edgeone 1.0.8 → 1.0.9

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.
@@ -1827,6 +1827,115 @@ var require_browser = __commonJS({
1827
1827
  }
1828
1828
  });
1829
1829
 
1830
+ // ../../node_modules/has-flag/index.js
1831
+ var require_has_flag = __commonJS({
1832
+ "../../node_modules/has-flag/index.js"(exports2, module2) {
1833
+ "use strict";
1834
+ module2.exports = (flag, argv) => {
1835
+ argv = argv || process.argv;
1836
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
1837
+ const pos = argv.indexOf(prefix + flag);
1838
+ const terminatorPos = argv.indexOf("--");
1839
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
1840
+ };
1841
+ }
1842
+ });
1843
+
1844
+ // ../../node_modules/supports-color/index.js
1845
+ var require_supports_color = __commonJS({
1846
+ "../../node_modules/supports-color/index.js"(exports2, module2) {
1847
+ "use strict";
1848
+ var os = require("os");
1849
+ var hasFlag = require_has_flag();
1850
+ var env = process.env;
1851
+ var forceColor;
1852
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
1853
+ forceColor = false;
1854
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
1855
+ forceColor = true;
1856
+ }
1857
+ if ("FORCE_COLOR" in env) {
1858
+ forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
1859
+ }
1860
+ function translateLevel(level) {
1861
+ if (level === 0) {
1862
+ return false;
1863
+ }
1864
+ return {
1865
+ level,
1866
+ hasBasic: true,
1867
+ has256: level >= 2,
1868
+ has16m: level >= 3
1869
+ };
1870
+ }
1871
+ function supportsColor(stream) {
1872
+ if (forceColor === false) {
1873
+ return 0;
1874
+ }
1875
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
1876
+ return 3;
1877
+ }
1878
+ if (hasFlag("color=256")) {
1879
+ return 2;
1880
+ }
1881
+ if (stream && !stream.isTTY && forceColor !== true) {
1882
+ return 0;
1883
+ }
1884
+ const min = forceColor ? 1 : 0;
1885
+ if (process.platform === "win32") {
1886
+ const osRelease = os.release().split(".");
1887
+ if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1888
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
1889
+ }
1890
+ return 1;
1891
+ }
1892
+ if ("CI" in env) {
1893
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
1894
+ return 1;
1895
+ }
1896
+ return min;
1897
+ }
1898
+ if ("TEAMCITY_VERSION" in env) {
1899
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
1900
+ }
1901
+ if (env.COLORTERM === "truecolor") {
1902
+ return 3;
1903
+ }
1904
+ if ("TERM_PROGRAM" in env) {
1905
+ const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
1906
+ switch (env.TERM_PROGRAM) {
1907
+ case "iTerm.app":
1908
+ return version >= 3 ? 3 : 2;
1909
+ case "Apple_Terminal":
1910
+ return 2;
1911
+ }
1912
+ }
1913
+ if (/-256(color)?$/i.test(env.TERM)) {
1914
+ return 2;
1915
+ }
1916
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
1917
+ return 1;
1918
+ }
1919
+ if ("COLORTERM" in env) {
1920
+ return 1;
1921
+ }
1922
+ if (env.TERM === "dumb") {
1923
+ return min;
1924
+ }
1925
+ return min;
1926
+ }
1927
+ function getSupportLevel(stream) {
1928
+ const level = supportsColor(stream);
1929
+ return translateLevel(level);
1930
+ }
1931
+ module2.exports = {
1932
+ supportsColor: getSupportLevel,
1933
+ stdout: getSupportLevel(process.stdout),
1934
+ stderr: getSupportLevel(process.stderr)
1935
+ };
1936
+ }
1937
+ });
1938
+
1830
1939
  // ../../node_modules/debug/src/node.js
1831
1940
  var require_node = __commonJS({
1832
1941
  "../../node_modules/debug/src/node.js"(exports2, module2) {
@@ -1845,7 +1954,7 @@ var require_node = __commonJS({
1845
1954
  );
1846
1955
  exports2.colors = [6, 2, 3, 4, 5, 1];
1847
1956
  try {
1848
- const supportsColor = require("supports-color");
1957
+ const supportsColor = require_supports_color();
1849
1958
  if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
1850
1959
  exports2.colors = [
1851
1960
  20,
@@ -78179,6 +78179,115 @@ var require_browser = __commonJS({
78179
78179
  }
78180
78180
  });
78181
78181
 
78182
+ // ../../node_modules/has-flag/index.js
78183
+ var require_has_flag2 = __commonJS({
78184
+ "../../node_modules/has-flag/index.js"(exports2, module2) {
78185
+ "use strict";
78186
+ module2.exports = (flag, argv) => {
78187
+ argv = argv || process.argv;
78188
+ const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
78189
+ const pos = argv.indexOf(prefix2 + flag);
78190
+ const terminatorPos = argv.indexOf("--");
78191
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
78192
+ };
78193
+ }
78194
+ });
78195
+
78196
+ // ../../node_modules/supports-color/index.js
78197
+ var require_supports_color2 = __commonJS({
78198
+ "../../node_modules/supports-color/index.js"(exports2, module2) {
78199
+ "use strict";
78200
+ var os2 = require("os");
78201
+ var hasFlag2 = require_has_flag2();
78202
+ var env3 = process.env;
78203
+ var forceColor;
78204
+ if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false")) {
78205
+ forceColor = false;
78206
+ } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
78207
+ forceColor = true;
78208
+ }
78209
+ if ("FORCE_COLOR" in env3) {
78210
+ forceColor = env3.FORCE_COLOR.length === 0 || parseInt(env3.FORCE_COLOR, 10) !== 0;
78211
+ }
78212
+ function translateLevel2(level) {
78213
+ if (level === 0) {
78214
+ return false;
78215
+ }
78216
+ return {
78217
+ level,
78218
+ hasBasic: true,
78219
+ has256: level >= 2,
78220
+ has16m: level >= 3
78221
+ };
78222
+ }
78223
+ function supportsColor2(stream4) {
78224
+ if (forceColor === false) {
78225
+ return 0;
78226
+ }
78227
+ if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
78228
+ return 3;
78229
+ }
78230
+ if (hasFlag2("color=256")) {
78231
+ return 2;
78232
+ }
78233
+ if (stream4 && !stream4.isTTY && forceColor !== true) {
78234
+ return 0;
78235
+ }
78236
+ const min = forceColor ? 1 : 0;
78237
+ if (process.platform === "win32") {
78238
+ const osRelease = os2.release().split(".");
78239
+ if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
78240
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
78241
+ }
78242
+ return 1;
78243
+ }
78244
+ if ("CI" in env3) {
78245
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env3) || env3.CI_NAME === "codeship") {
78246
+ return 1;
78247
+ }
78248
+ return min;
78249
+ }
78250
+ if ("TEAMCITY_VERSION" in env3) {
78251
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env3.TEAMCITY_VERSION) ? 1 : 0;
78252
+ }
78253
+ if (env3.COLORTERM === "truecolor") {
78254
+ return 3;
78255
+ }
78256
+ if ("TERM_PROGRAM" in env3) {
78257
+ const version = parseInt((env3.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
78258
+ switch (env3.TERM_PROGRAM) {
78259
+ case "iTerm.app":
78260
+ return version >= 3 ? 3 : 2;
78261
+ case "Apple_Terminal":
78262
+ return 2;
78263
+ }
78264
+ }
78265
+ if (/-256(color)?$/i.test(env3.TERM)) {
78266
+ return 2;
78267
+ }
78268
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env3.TERM)) {
78269
+ return 1;
78270
+ }
78271
+ if ("COLORTERM" in env3) {
78272
+ return 1;
78273
+ }
78274
+ if (env3.TERM === "dumb") {
78275
+ return min;
78276
+ }
78277
+ return min;
78278
+ }
78279
+ function getSupportLevel(stream4) {
78280
+ const level = supportsColor2(stream4);
78281
+ return translateLevel2(level);
78282
+ }
78283
+ module2.exports = {
78284
+ supportsColor: getSupportLevel,
78285
+ stdout: getSupportLevel(process.stdout),
78286
+ stderr: getSupportLevel(process.stderr)
78287
+ };
78288
+ }
78289
+ });
78290
+
78182
78291
  // ../../node_modules/debug/src/node.js
78183
78292
  var require_node = __commonJS({
78184
78293
  "../../node_modules/debug/src/node.js"(exports2, module2) {
@@ -78197,7 +78306,7 @@ var require_node = __commonJS({
78197
78306
  );
78198
78307
  exports2.colors = [6, 2, 3, 4, 5, 1];
78199
78308
  try {
78200
- const supportsColor2 = require("supports-color");
78309
+ const supportsColor2 = require_supports_color2();
78201
78310
  if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
78202
78311
  exports2.colors = [
78203
78312
  20,
@@ -86295,7 +86404,7 @@ var require_node2 = __commonJS({
86295
86404
  exports2.useColors = useColors;
86296
86405
  exports2.colors = [6, 2, 3, 4, 5, 1];
86297
86406
  try {
86298
- supportsColor2 = require("supports-color");
86407
+ supportsColor2 = require_supports_color2();
86299
86408
  if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
86300
86409
  exports2.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
86301
86410
  }
@@ -103190,7 +103299,7 @@ var yargs_default = Yargs;
103190
103299
  // package.json
103191
103300
  var package_default = {
103192
103301
  name: "edgeone",
103193
- version: "1.0.8",
103302
+ version: "1.0.9",
103194
103303
  description: "Command-line interface for TencentCloud Pages Functions",
103195
103304
  bin: {
103196
103305
  edgeone: "./edgeone-bin/edgeone.js"
@@ -111201,6 +111310,11 @@ var tefConfRewritesSchema = querySchema.merge(
111201
111310
  destination: z.string().superRefine(pathMatch)
111202
111311
  })
111203
111312
  ).array();
111313
+ var tefConfCachesSchema = querySchema.merge(
111314
+ z.object({
111315
+ cacheTtl: z.number()
111316
+ })
111317
+ ).array();
111204
111318
  var tefConfigSchema = z.object({
111205
111319
  // name: z.string(),
111206
111320
  // main: z.string(),
@@ -111216,7 +111330,8 @@ var tefConfigSchema = z.object({
111216
111330
  nodeVersion: z.string().optional().describe("the node version to use."),
111217
111331
  headers: tefConfHeadersSchema.optional(),
111218
111332
  redirects: tefConfRedirectsSchema.optional(),
111219
- rewrites: tefConfRewritesSchema.optional()
111333
+ rewrites: tefConfRewritesSchema.optional(),
111334
+ caches: tefConfCachesSchema.optional()
111220
111335
  });
111221
111336
  var filteredTefConfigSchema = toFilteredSchema(tefConfigSchema);
111222
111337
  var symFilteredSchema = Symbol("filteredSchema");
@@ -112945,8 +113060,12 @@ function isSource(v) {
112945
113060
  }
112946
113061
  if (v.length) {
112947
113062
  const arr = v.split("/");
112948
- const ret = arr.some((v2) => v2.includes(":") && (v2.includes("*") || v2.includes(".")));
112949
- if (ret) {
113063
+ const ret1 = arr.some((v2) => v2.includes(":") && (v2.includes("*") || v2.includes(".")));
113064
+ if (ret1) {
113065
+ return Error_Message.char_match;
113066
+ }
113067
+ const ret2 = arr.some((v2) => v2.split(":").length > 2);
113068
+ if (ret2) {
112950
113069
  return Error_Message.char_match;
112951
113070
  }
112952
113071
  }
@@ -112964,19 +113083,12 @@ function isDestination(v) {
112964
113083
  if (illegal.test(v)) {
112965
113084
  return Error_Message.char_match;
112966
113085
  }
112967
- if (((_a6 = v.match(/\*/g)) == null ? void 0 : _a6.length) > 1) {
113086
+ if (((_a6 = v.match(/\*/g)) == null ? void 0 : _a6.length) >= 1) {
112968
113087
  return Error_Message.char_match;
112969
113088
  }
112970
113089
  if (/(?<![a-zA-Z0-9_\-/:*.~=?#!$&+,;%@ ]):/.test(v) || /:(?![a-zA-Z0-9]+)/.test(v)) {
112971
113090
  return Error_Message.char_match;
112972
113091
  }
112973
- if (v.length) {
112974
- const arr = v.split("/");
112975
- const ret = arr.some((v2) => v2.includes(":") && (v2.includes("*") || v2.includes(".")));
112976
- if (ret) {
112977
- return Error_Message.char_match;
112978
- }
112979
- }
112980
113092
  }
112981
113093
  function isKey(v) {
112982
113094
  if (v.length === 0) {
@@ -113005,6 +113117,17 @@ function isStatusCode(v) {
113005
113117
  return Error_Message.value_match;
113006
113118
  }
113007
113119
  }
113120
+ function isCacheTtl(v) {
113121
+ if (typeof v !== "number") {
113122
+ return Error_Message.value_match;
113123
+ }
113124
+ if (!Number.isInteger(v)) {
113125
+ return Error_Message.value_match;
113126
+ }
113127
+ if (v < 0) {
113128
+ return Error_Message.value_match;
113129
+ }
113130
+ }
113008
113131
  function parseSubHeaders(config, path9) {
113009
113132
  const result = [];
113010
113133
  const message = [];
@@ -113272,8 +113395,72 @@ function parseRewrites(config, path9) {
113272
113395
  }
113273
113396
  return [result, message];
113274
113397
  }
113398
+ function parseCaches(config, path9) {
113399
+ let result = [];
113400
+ const message = [];
113401
+ if (!isArray2(config)) {
113402
+ message.push({
113403
+ path: [...path9],
113404
+ message: Error_Message.invalid_type
113405
+ });
113406
+ return [result, message];
113407
+ }
113408
+ for (const index in config) {
113409
+ const cache = config[index];
113410
+ if (!isObject2(cache)) {
113411
+ message.push({
113412
+ path: [...path9, `[${index}]`],
113413
+ message: Error_Message.invalid_type
113414
+ });
113415
+ continue;
113416
+ }
113417
+ const { source, cacheTtl } = cache;
113418
+ if (!isString2(source)) {
113419
+ message.push({
113420
+ path: [...path9, `[${index}]`, "source"],
113421
+ message: Error_Message.invalid_type
113422
+ });
113423
+ continue;
113424
+ }
113425
+ const source_e = isSource(source);
113426
+ if (source_e) {
113427
+ message.push({
113428
+ path: [...path9, `[${index}]`, "source"],
113429
+ message: source_e
113430
+ });
113431
+ continue;
113432
+ }
113433
+ if (!isNumber2(cacheTtl)) {
113434
+ message.push({
113435
+ path: [...path9, `[${index}]`, "cacheTtl"],
113436
+ message: Error_Message.invalid_type
113437
+ });
113438
+ continue;
113439
+ }
113440
+ const cacheTtl_e = isCacheTtl(cacheTtl);
113441
+ if (cacheTtl_e) {
113442
+ message.push({
113443
+ path: [...path9, `[${index}]`, "cacheTtl"],
113444
+ message: cacheTtl_e
113445
+ });
113446
+ continue;
113447
+ }
113448
+ result.push({
113449
+ source,
113450
+ cacheTtl
113451
+ });
113452
+ }
113453
+ if (result.length > Max_Len) {
113454
+ message.push({
113455
+ path: [...path9],
113456
+ message: Error_Message.max_length
113457
+ });
113458
+ result = result.slice(0, Max_Len);
113459
+ }
113460
+ return [result, message];
113461
+ }
113275
113462
  function parse2(config, path9) {
113276
- const result = { headers: [], redirects: [], rewrites: [] };
113463
+ const result = { headers: [], redirects: [], rewrites: [], caches: [] };
113277
113464
  const message = [];
113278
113465
  if (!isObject2(config)) {
113279
113466
  message.push({
@@ -113282,20 +113469,22 @@ function parse2(config, path9) {
113282
113469
  });
113283
113470
  return [result, message];
113284
113471
  }
113285
- const { headers = [], redirects = [], rewrites = [] } = config;
113472
+ const { headers = [], redirects = [], rewrites = [], caches = [] } = config;
113286
113473
  const [result_h, message_h] = parseHeaders(headers, [...path9, "headers"]);
113287
113474
  const [result_r, message_r] = parseRedirects(redirects, [...path9, "redirects"]);
113288
113475
  const [result_w, message_w] = parseRewrites(rewrites, [...path9, "rewrites"]);
113476
+ const [result_c, message_c] = parseCaches(caches, [...path9, "caches"]);
113289
113477
  result.headers = result_h;
113290
113478
  result.redirects = result_r;
113291
113479
  result.rewrites = result_w;
113480
+ result.caches = result_c;
113292
113481
  const rest_arg = ["outputDirectory", "installCommand", "buildCommand", "nodeVersion"];
113293
113482
  for (const key2 in config) {
113294
113483
  if (rest_arg.includes(key2) && config[key2]) {
113295
113484
  result[key2] = config[key2];
113296
113485
  }
113297
113486
  }
113298
- message.push(...message_h, ...message_r, ...message_w);
113487
+ message.push(...message_h, ...message_r, ...message_w, ...message_c);
113299
113488
  return [result, message];
113300
113489
  }
113301
113490
 
@@ -113399,7 +113588,8 @@ async function safeParseTefConfig() {
113399
113588
  return {
113400
113589
  headers: [],
113401
113590
  redirects: [],
113402
- rewrites: []
113591
+ rewrites: [],
113592
+ caches: []
113403
113593
  };
113404
113594
  if (showError()) {
113405
113595
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edgeone",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Command-line interface for TencentCloud Pages Functions",
5
5
  "bin": {
6
6
  "edgeone": "./edgeone-bin/edgeone.js"