ms-vite-plugin 1.3.5 → 1.3.7
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/stopGuardPlugin.js +4 -2
- package/package.json +1 -1
package/dist/stopGuardPlugin.js
CHANGED
|
@@ -38,6 +38,7 @@ const acorn = __importStar(require("acorn"));
|
|
|
38
38
|
const MagicString = require("magic-string");
|
|
39
39
|
const STOP_GUARD_ERROR = "__kuaijs_stop_guard_error";
|
|
40
40
|
const STOP_EXCEPTION_NAME = "KuaiJSManualExitException";
|
|
41
|
+
const STOP_RELATED_FUNCTION_ERROR = "is not a function";
|
|
41
42
|
/**
|
|
42
43
|
* 为最终 JS chunk 的 catch 块补充停止异常转抛逻辑。
|
|
43
44
|
*
|
|
@@ -123,8 +124,9 @@ function addCatchStopExceptionGuard(edits, catchClause, code) {
|
|
|
123
124
|
text: `(${STOP_GUARD_ERROR})`,
|
|
124
125
|
});
|
|
125
126
|
}
|
|
126
|
-
const stopGuard = `if(String(${errorExpression}).includes("${STOP_EXCEPTION_NAME}")
|
|
127
|
-
`
|
|
127
|
+
const stopGuard = `if(String(${errorExpression}).includes("${STOP_EXCEPTION_NAME}")||` +
|
|
128
|
+
`String(${errorExpression}).includes("${STOP_RELATED_FUNCTION_ERROR}")){` +
|
|
129
|
+
`console.error(${errorExpression});throw ${errorExpression};` +
|
|
128
130
|
`}`;
|
|
129
131
|
edits.push({
|
|
130
132
|
start: catchClause.body.start + 1,
|