@lark-apaas/devtool-kits 1.2.0-alpha.0 → 1.2.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/dist/index.js CHANGED
@@ -1356,17 +1356,10 @@ function checkForErrors(logs) {
1356
1356
  return false;
1357
1357
  }
1358
1358
  __name(checkForErrors, "checkForErrors");
1359
- function injectErrorData(template, errorLogs, clientBasePath) {
1360
- let logsText = "";
1361
- if (errorLogs.length > 0) {
1362
- logsText = errorLogs.join("\n");
1363
- } else {
1364
- logsText = "\u672A\u627E\u5230\u76F8\u5173\u9519\u8BEF\u65E5\u5FD7";
1365
- }
1366
- return template.replace("{{.errorData.message}}", `\u670D\u52A1\u542F\u52A8\u5F02\u5E38\uFF0C\u8BF7\u6839\u636E\u65E5\u5FD7\u4FEE\u590D\u76F8\u5173\u95EE\u9898
1367
- ${JSON.stringify(logsText)}`).replace("{{.clientBasePath}}", clientBasePath);
1359
+ function injectTemplateData(template, clientBasePath) {
1360
+ return template.replace("{{.clientBasePath}}", clientBasePath);
1368
1361
  }
1369
- __name(injectErrorData, "injectErrorData");
1362
+ __name(injectTemplateData, "injectTemplateData");
1370
1363
  function handleDevProxyError(err, req, res, options) {
1371
1364
  const { logDir = path3.join(process.cwd(), "logs"), maxErrorLogs = 100, logFileName = "server.log", retryTimeout = 5e3, retryInterval = 500, target = `http://localhost:${process.env.SERVER_PORT || 3e3}`, clientBasePath = process.env.CLIENT_BASE_PATH || "/" } = options || {};
1372
1365
  const clientBasePathWithoutSlash = normalizeBasePath(clientBasePath);
@@ -1378,7 +1371,7 @@ function handleDevProxyError(err, req, res, options) {
1378
1371
  (async () => {
1379
1372
  try {
1380
1373
  const isConnError = isConnectionError(err);
1381
- const { logs: errorLogs, hasCompileError } = await readRecentErrorLogs(logDir, maxErrorLogs, logFileName);
1374
+ const { hasCompileError } = await readRecentErrorLogs(logDir, maxErrorLogs, logFileName);
1382
1375
  if (isConnError && !hasCompileError) {
1383
1376
  console.log("[Proxy Error]: Connection error without compile errors, possibly server restarting...");
1384
1377
  try {
@@ -1402,7 +1395,7 @@ function handleDevProxyError(err, req, res, options) {
1402
1395
  console.log("[Proxy Error]: Compile error or non-connection error, showing error page");
1403
1396
  }
1404
1397
  const template = getErrorHtmlTemplate();
1405
- const html = injectErrorData(template, errorLogs, clientBasePathWithoutSlash);
1398
+ const html = injectTemplateData(template, clientBasePathWithoutSlash);
1406
1399
  res.writeHead(200, {
1407
1400
  "Content-Type": "text/html; charset=utf-8",
1408
1401
  "Cache-Control": "no-cache, no-store, must-revalidate",