@lark-apaas/devtool-kits 1.1.0-alpha.0 → 1.1.1-alpha.0
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/error.html +23 -194
- package/dist/index.cjs +5 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -12
- package/dist/index.js.map +1 -1
- package/dist/template/types.ts +4 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -689,17 +689,10 @@ function checkForErrors(logs) {
|
|
|
689
689
|
return false;
|
|
690
690
|
}
|
|
691
691
|
__name(checkForErrors, "checkForErrors");
|
|
692
|
-
function
|
|
693
|
-
|
|
694
|
-
if (errorLogs.length > 0) {
|
|
695
|
-
logsText = errorLogs.join("\n");
|
|
696
|
-
} else {
|
|
697
|
-
logsText = "\u672A\u627E\u5230\u76F8\u5173\u9519\u8BEF\u65E5\u5FD7";
|
|
698
|
-
}
|
|
699
|
-
return template.replace("{{.errorData.message}}", `\u670D\u52A1\u542F\u52A8\u5F02\u5E38\uFF0C\u8BF7\u6839\u636E\u65E5\u5FD7\u4FEE\u590D\u76F8\u5173\u95EE\u9898
|
|
700
|
-
${JSON.stringify(logsText)}`).replace("{{.clientBasePath}}", clientBasePath);
|
|
692
|
+
function injectTemplateData(template, clientBasePath) {
|
|
693
|
+
return template.replace("{{.clientBasePath}}", clientBasePath);
|
|
701
694
|
}
|
|
702
|
-
__name(
|
|
695
|
+
__name(injectTemplateData, "injectTemplateData");
|
|
703
696
|
function handleDevProxyError(err, req, res, options) {
|
|
704
697
|
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 || {};
|
|
705
698
|
const clientBasePathWithoutSlash = normalizeBasePath(clientBasePath);
|
|
@@ -711,7 +704,7 @@ function handleDevProxyError(err, req, res, options) {
|
|
|
711
704
|
(async () => {
|
|
712
705
|
try {
|
|
713
706
|
const isConnError = isConnectionError(err);
|
|
714
|
-
const {
|
|
707
|
+
const { hasCompileError } = await readRecentErrorLogs(logDir, maxErrorLogs, logFileName);
|
|
715
708
|
if (isConnError && !hasCompileError) {
|
|
716
709
|
console.log("[Proxy Error]: Connection error without compile errors, possibly server restarting...");
|
|
717
710
|
try {
|
|
@@ -735,7 +728,7 @@ function handleDevProxyError(err, req, res, options) {
|
|
|
735
728
|
console.log("[Proxy Error]: Compile error or non-connection error, showing error page");
|
|
736
729
|
}
|
|
737
730
|
const template = getErrorHtmlTemplate();
|
|
738
|
-
const html =
|
|
731
|
+
const html = injectTemplateData(template, clientBasePathWithoutSlash);
|
|
739
732
|
res.writeHead(200, {
|
|
740
733
|
"Content-Type": "text/html; charset=utf-8",
|
|
741
734
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|