edgeone 1.0.14-beta.1 → 1.0.14-beta.2

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.
@@ -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.14",
102542
+ version: "1.0.14-beta.1",
102543
102543
  description: "Command-line interface for TencentCloud Pages Functions",
102544
102544
  bin: {
102545
102545
  edgeone: "./edgeone-bin/edgeone.js"
@@ -113116,7 +113116,7 @@ var esbuild = require("esbuild");
113116
113116
  var FUNCTIONPATH = "./functions";
113117
113117
  var OUTPUTPATH = "./.edgeone/functions/index.js";
113118
113118
  var OUTPUTMETA = "./.edgeone/meta.json";
113119
- var regex1 = /^\/(?:[^/]+\/)*\[(.+?)\]$/;
113119
+ var regex1 = /^\/(?:[^/]+\/)*\[(.+?)\]/;
113120
113120
  var regex2 = /^\/(?:[^/]+\/)*\[\[(.+?)\]\]$/;
113121
113121
  var methodList = [
113122
113122
  // {
@@ -113429,7 +113429,7 @@ var BuildFunctionGenerator = class {
113429
113429
  this.functionIndex = this.functionIndex + 1;
113430
113430
  }
113431
113431
  getMountPath(fullPath) {
113432
- const p = fullPath.replace(/\/([^/]+)$/, "");
113432
+ const p = fullPath.replace(/\/([^/]+)$/g, "");
113433
113433
  if (!p) {
113434
113434
  return "/";
113435
113435
  }
@@ -113437,7 +113437,7 @@ var BuildFunctionGenerator = class {
113437
113437
  }
113438
113438
  recordFunc(obj, method) {
113439
113439
  try {
113440
- const key2 = obj.path.replace("functions/", "").replace(/\/\[\[(.+)\]\]$/, "/:$1").replace(/\/\[(.+)\]$/, "/:$1");
113440
+ const key2 = obj.path.replace("functions/", "").replace(/\/\[\[([^/]+)\]\]$/, "/:$1*").replace(/\/\[([^/]+)\]/g, "/:$1");
113441
113441
  this.functionList.push({
113442
113442
  routePath: key2,
113443
113443
  mountPath: this.getMountPath(key2),
@@ -113452,6 +113452,10 @@ var BuildFunctionGenerator = class {
113452
113452
  }
113453
113453
  }
113454
113454
  bundleAndGetString(filePath) {
113455
+ const define2 = {};
113456
+ for (const k in this.env) {
113457
+ define2[`env.${k}`] = JSON.stringify(process.env[k]);
113458
+ }
113455
113459
  const result = esbuild.buildSync({
113456
113460
  entryPoints: [filePath],
113457
113461
  bundle: true,
@@ -113460,7 +113464,9 @@ var BuildFunctionGenerator = class {
113460
113464
  // outdir: './.tef_dist/assets',
113461
113465
  write: false,
113462
113466
  // 禁止写入文件
113463
- outfile: "./.tef_dist/assets.js"
113467
+ outfile: "./.tef_dist/assets.js",
113468
+ // envs
113469
+ define: define2
113464
113470
  });
113465
113471
  const { outputFiles } = result;
113466
113472
  let currentFileInfo;
@@ -113503,7 +113509,13 @@ async function PagesCI(_) {
113503
113509
  // src/pages/common/env.tsx
113504
113510
  var pullEnvVars = async (projectId) => {
113505
113511
  const envDestination = getCwdFullPath("./.env");
113506
- const localEnv = readEnvFileSync(envDestination);
113512
+ let localEnv = {};
113513
+ try {
113514
+ localEnv = readEnvFileSync(envDestination);
113515
+ } catch (error3) {
113516
+ writeFileSync(envDestination, "");
113517
+ normalLog("Created new .env file");
113518
+ }
113507
113519
  const localEnvVars = [];
113508
113520
  Object.keys(localEnv).forEach((key2) => {
113509
113521
  if (key2.endsWith("DEV")) {
@@ -114188,8 +114200,7 @@ async function handleLog(url2) {
114188
114200
  okLog("Function log connected.");
114189
114201
  });
114190
114202
  ws.on("close", function close() {
114191
- normalLog("Function log server disconnected, exiting...Please restart the dev server.");
114192
- process.exit(0);
114203
+ normalLog("Function log server disconnected");
114193
114204
  });
114194
114205
  ws.on("message", function message(data) {
114195
114206
  const { logs, event_info, exceptions } = JSON.parse(data.toString());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edgeone",
3
- "version": "1.0.14-beta.1",
3
+ "version": "1.0.14-beta.2",
4
4
  "description": "Command-line interface for TencentCloud Pages Functions",
5
5
  "bin": {
6
6
  "edgeone": "./edgeone-bin/edgeone.js"