edgeone 1.0.11 → 1.0.13

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.
Files changed (2) hide show
  1. package/edgeone-dist/cli.js +65 -133
  2. package/package.json +1 -1
@@ -85016,96 +85016,6 @@ var require_async2 = __commonJS({
85016
85016
  }
85017
85017
  });
85018
85018
 
85019
- // node_modules/mkdirp/index.js
85020
- var require_mkdirp = __commonJS({
85021
- "node_modules/mkdirp/index.js"(exports2, module2) {
85022
- var path9 = require("path");
85023
- var fs9 = require("fs");
85024
- var _0777 = parseInt("0777", 8);
85025
- module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
85026
- function mkdirP(p, opts, f3, made) {
85027
- if (typeof opts === "function") {
85028
- f3 = opts;
85029
- opts = {};
85030
- } else if (!opts || typeof opts !== "object") {
85031
- opts = { mode: opts };
85032
- }
85033
- var mode = opts.mode;
85034
- var xfs = opts.fs || fs9;
85035
- if (mode === void 0) {
85036
- mode = _0777;
85037
- }
85038
- if (!made)
85039
- made = null;
85040
- var cb2 = f3 || /* istanbul ignore next */
85041
- function() {
85042
- };
85043
- p = path9.resolve(p);
85044
- xfs.mkdir(p, mode, function(er) {
85045
- if (!er) {
85046
- made = made || p;
85047
- return cb2(null, made);
85048
- }
85049
- switch (er.code) {
85050
- case "ENOENT":
85051
- if (path9.dirname(p) === p)
85052
- return cb2(er);
85053
- mkdirP(path9.dirname(p), opts, function(er2, made2) {
85054
- if (er2)
85055
- cb2(er2, made2);
85056
- else
85057
- mkdirP(p, opts, cb2, made2);
85058
- });
85059
- break;
85060
- default:
85061
- xfs.stat(p, function(er2, stat2) {
85062
- if (er2 || !stat2.isDirectory())
85063
- cb2(er, made);
85064
- else
85065
- cb2(null, made);
85066
- });
85067
- break;
85068
- }
85069
- });
85070
- }
85071
- mkdirP.sync = function sync(p, opts, made) {
85072
- if (!opts || typeof opts !== "object") {
85073
- opts = { mode: opts };
85074
- }
85075
- var mode = opts.mode;
85076
- var xfs = opts.fs || fs9;
85077
- if (mode === void 0) {
85078
- mode = _0777;
85079
- }
85080
- if (!made)
85081
- made = null;
85082
- p = path9.resolve(p);
85083
- try {
85084
- xfs.mkdirSync(p, mode);
85085
- made = made || p;
85086
- } catch (err0) {
85087
- switch (err0.code) {
85088
- case "ENOENT":
85089
- made = sync(path9.dirname(p), opts, made);
85090
- sync(p, opts, made);
85091
- break;
85092
- default:
85093
- var stat2;
85094
- try {
85095
- stat2 = xfs.statSync(p);
85096
- } catch (err1) {
85097
- throw err0;
85098
- }
85099
- if (!stat2.isDirectory())
85100
- throw err0;
85101
- break;
85102
- }
85103
- }
85104
- return made;
85105
- };
85106
- }
85107
- });
85108
-
85109
85019
  // node_modules/portfinder/lib/portfinder.js
85110
85020
  var require_portfinder = __commonJS({
85111
85021
  "node_modules/portfinder/lib/portfinder.js"(exports2) {
@@ -85116,7 +85026,6 @@ var require_portfinder = __commonJS({
85116
85026
  var path9 = require("path");
85117
85027
  var _async = require_async2();
85118
85028
  var debug = require_src();
85119
- var mkdirp = require_mkdirp().mkdirp;
85120
85029
  var debugTestPort = debug("portfinder:testPort");
85121
85030
  var debugGetPort = debug("portfinder:getPort");
85122
85031
  var debugDefaultHosts = debug("portfinder:defaultHosts");
@@ -85173,11 +85082,7 @@ var require_portfinder = __commonJS({
85173
85082
  exports2.setBasePath = function(path10) {
85174
85083
  exports2.basePath = path10;
85175
85084
  };
85176
- exports2.getPort = function(options, callback) {
85177
- if (!callback) {
85178
- callback = options;
85179
- options = {};
85180
- }
85085
+ internals.getPort = function(options, callback) {
85181
85086
  options.port = Number(options.port) || Number(exports2.basePort);
85182
85087
  options.host = options.host || null;
85183
85088
  options.stopPort = Number(options.stopPort) || Number(exports2.highestPort);
@@ -85187,7 +85092,7 @@ var require_portfinder = __commonJS({
85187
85092
  throw Error("Provided options.startPort(" + options.startPort + ") is less than 0, which are cannot be bound.");
85188
85093
  }
85189
85094
  if (options.stopPort < options.startPort) {
85190
- throw Error("Provided options.stopPort(" + options.stopPort + "is less than options.startPort (" + options.startPort + ")");
85095
+ throw Error("Provided options.stopPort(" + options.stopPort + ") is less than options.startPort (" + options.startPort + ")");
85191
85096
  }
85192
85097
  }
85193
85098
  if (options.host && exports2._defaultHosts.indexOf(options.host) === -1) {
@@ -85222,7 +85127,7 @@ var require_portfinder = __commonJS({
85222
85127
  } else {
85223
85128
  const idx = exports2._defaultHosts.indexOf(currentHost);
85224
85129
  exports2._defaultHosts.splice(idx, 1);
85225
- return exports2.getPort(options, callback);
85130
+ return internals.getPort(options, callback);
85226
85131
  }
85227
85132
  } else {
85228
85133
  return callback(err2);
@@ -85240,34 +85145,37 @@ var require_portfinder = __commonJS({
85240
85145
  return callback(Error(msg));
85241
85146
  }
85242
85147
  } else {
85243
- return exports2.getPort({ port: openPorts.pop(), host: options.host, startPort: options.startPort, stopPort: options.stopPort }, callback);
85148
+ return internals.getPort({ port: openPorts.pop(), host: options.host, startPort: options.startPort, stopPort: options.stopPort }, callback);
85244
85149
  }
85245
85150
  });
85246
85151
  };
85247
- exports2.getPortPromise = function(options) {
85248
- if (!options) {
85152
+ exports2.getPort = function(options, callback) {
85153
+ if (typeof options === "function") {
85154
+ callback = options;
85249
85155
  options = {};
85250
85156
  }
85251
- return new Promise(function(resolve5, reject) {
85252
- exports2.getPort(options, function(err2, port) {
85253
- if (err2) {
85254
- return reject(err2);
85255
- }
85256
- resolve5(port);
85257
- });
85258
- });
85259
- };
85260
- exports2.getPorts = function(count, options, callback) {
85157
+ options = options || {};
85261
85158
  if (!callback) {
85262
- callback = options;
85263
- options = {};
85159
+ return new Promise(function(resolve5, reject) {
85160
+ internals.getPort(options, function(err2, port) {
85161
+ if (err2) {
85162
+ return reject(err2);
85163
+ }
85164
+ resolve5(port);
85165
+ });
85166
+ });
85167
+ } else {
85168
+ return internals.getPort(options, callback);
85264
85169
  }
85170
+ };
85171
+ exports2.getPortPromise = exports2.getPort;
85172
+ internals.getPorts = function(count, options, callback) {
85265
85173
  let lastPort = null;
85266
85174
  _async.timesSeries(count, function(index, asyncCallback) {
85267
85175
  if (lastPort) {
85268
85176
  options.port = exports2.nextPort(lastPort);
85269
85177
  }
85270
- exports2.getPort(options, function(err2, port) {
85178
+ internals.getPort(options, function(err2, port) {
85271
85179
  if (err2) {
85272
85180
  asyncCallback(err2);
85273
85181
  } else {
@@ -85277,19 +85185,26 @@ var require_portfinder = __commonJS({
85277
85185
  });
85278
85186
  }, callback);
85279
85187
  };
85280
- exports2.getPortsPromise = function(count, options) {
85281
- if (!options) {
85188
+ exports2.getPorts = function(count, options, callback) {
85189
+ if (typeof options === "function") {
85190
+ callback = options;
85282
85191
  options = {};
85283
85192
  }
85284
- return new Promise(function(resolve5, reject) {
85285
- exports2.getPorts(count, options, function(err2, ports) {
85286
- if (err2) {
85287
- return reject(err2);
85288
- }
85289
- resolve5(ports);
85193
+ options = options || {};
85194
+ if (!callback) {
85195
+ return new Promise(function(resolve5, reject) {
85196
+ internals.getPorts(count, options, function(err2, ports) {
85197
+ if (err2) {
85198
+ return reject(err2);
85199
+ }
85200
+ resolve5(ports);
85201
+ });
85290
85202
  });
85291
- });
85203
+ } else {
85204
+ return internals.getPorts(count, options, callback);
85205
+ }
85292
85206
  };
85207
+ exports2.getPortsPromise = exports2.getPorts;
85293
85208
  exports2.getSocket = function(options, callback) {
85294
85209
  if (!callback) {
85295
85210
  callback = options;
@@ -85312,7 +85227,7 @@ var require_portfinder = __commonJS({
85312
85227
  });
85313
85228
  }
85314
85229
  function createAndTestSocket(dir) {
85315
- mkdirp(dir, options.mod, function(err2) {
85230
+ fs9.mkdir(dir, { mode: options.mod, recursive: true }, function(err2) {
85316
85231
  if (err2) {
85317
85232
  return callback(err2);
85318
85233
  }
@@ -102624,7 +102539,7 @@ var yargs_default = Yargs;
102624
102539
  // package.json
102625
102540
  var package_default = {
102626
102541
  name: "edgeone",
102627
- version: "1.0.11",
102542
+ version: "1.0.13",
102628
102543
  description: "Command-line interface for TencentCloud Pages Functions",
102629
102544
  bin: {
102630
102545
  edgeone: "./edgeone-bin/edgeone.js"
@@ -104142,7 +104057,7 @@ function combineURLs(baseURL, relativeURL) {
104142
104057
  // node_modules/axios/lib/core/buildFullPath.js
104143
104058
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
104144
104059
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
104145
- if (baseURL && isRelativeUrl || allowAbsoluteUrls == false) {
104060
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
104146
104061
  return combineURLs(baseURL, requestedURL);
104147
104062
  }
104148
104063
  return requestedURL;
@@ -104157,7 +104072,7 @@ var import_follow_redirects = __toESM(require_follow_redirects(), 1);
104157
104072
  var import_zlib = __toESM(require("zlib"), 1);
104158
104073
 
104159
104074
  // node_modules/axios/lib/env/data.js
104160
- var VERSION = "1.8.3";
104075
+ var VERSION = "1.8.4";
104161
104076
 
104162
104077
  // node_modules/axios/lib/helpers/parseProtocol.js
104163
104078
  function parseProtocol(url2) {
@@ -106240,7 +106155,6 @@ async function capi(action, params, options, callback) {
106240
106155
  }
106241
106156
  }
106242
106157
  );
106243
- console.log("res1", JSON.stringify(res1.data, null, 2));
106244
106158
  if ((_b2 = (_a6 = res1.data) == null ? void 0 : _a6.data) == null ? void 0 : _b2.Response) {
106245
106159
  if ((_e = (_d2 = (_c2 = res1.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.Response) == null ? void 0 : _e.Error) {
106246
106160
  throw res1.data.data.Response.Error;
@@ -113578,6 +113492,22 @@ async function PagesCI(_) {
113578
113492
  // src/pages/common/env.tsx
113579
113493
  var pullEnvVars = async (projectId) => {
113580
113494
  const envDestination = getCwdFullPath("./.env");
113495
+ let localEnv = {};
113496
+ try {
113497
+ localEnv = readEnvFileSync(envDestination);
113498
+ } catch (error3) {
113499
+ writeFileSync(envDestination, "");
113500
+ normalLog("Created new .env file");
113501
+ }
113502
+ const localEnvVars = [];
113503
+ Object.keys(localEnv).forEach((key2) => {
113504
+ if (key2.endsWith("DEV")) {
113505
+ localEnvVars.push({
113506
+ Key: key2,
113507
+ Value: localEnv[key2]
113508
+ });
113509
+ }
113510
+ });
113581
113511
  normalLog("Pulling environment variables...");
113582
113512
  const res = await pagesCapi("DescribePagesProjectEnvs", {
113583
113513
  ProjectId: projectId
@@ -113586,8 +113516,9 @@ var pullEnvVars = async (projectId) => {
113586
113516
  });
113587
113517
  const envvars = JSON.parse(res.Result || []);
113588
113518
  const { EnvVars } = envvars;
113519
+ const vars = EnvVars.concat(localEnvVars);
113589
113520
  let envFileContent = "";
113590
- EnvVars.forEach((item) => {
113521
+ vars.forEach((item) => {
113591
113522
  envFileContent += `${item.Key}=${item.Value}
113592
113523
  `;
113593
113524
  });
@@ -113870,10 +113801,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
113870
113801
  return 1;
113871
113802
  }
113872
113803
  if ("CI" in env2) {
113873
- if ("GITHUB_ACTIONS" in env2 || "GITEA_ACTIONS" in env2) {
113804
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key2) => key2 in env2)) {
113874
113805
  return 3;
113875
113806
  }
113876
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
113807
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env2) || env2.CI_NAME === "codeship") {
113877
113808
  return 1;
113878
113809
  }
113879
113810
  return min;
@@ -114252,8 +114183,7 @@ async function handleLog(url2) {
114252
114183
  okLog("Function log connected.");
114253
114184
  });
114254
114185
  ws.on("close", function close() {
114255
- normalLog("Function log server disconnected, exiting...Please restart the dev server.");
114256
- process.exit(0);
114186
+ normalLog("Function log server disconnected");
114257
114187
  });
114258
114188
  ws.on("message", function message(data) {
114259
114189
  const { logs, event_info, exceptions } = JSON.parse(data.toString());
@@ -114326,6 +114256,7 @@ async function PagesDevServer(devConfig) {
114326
114256
  return res.end();
114327
114257
  }
114328
114258
  if (localStaticPath) {
114259
+ console.log("this is localStaticPath");
114329
114260
  const localPath = path6.join(localStaticPath, req.url);
114330
114261
  if (localStaticPath && sirver && fs6.existsSync(localPath)) {
114331
114262
  if (req.url !== "/") {
@@ -114334,6 +114265,7 @@ async function PagesDevServer(devConfig) {
114334
114265
  }
114335
114266
  }
114336
114267
  }
114268
+ console.log("proxy");
114337
114269
  proxy.web(req, res, {
114338
114270
  target: `${DebugUrl}`,
114339
114271
  changeOrigin: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edgeone",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Command-line interface for TencentCloud Pages Functions",
5
5
  "bin": {
6
6
  "edgeone": "./edgeone-bin/edgeone.js"