aboutsummaryrefslogtreecommitdiff
path: root/test/sandbox.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-27 06:05:36 +0000
committerGitHub <noreply@github.com>2021-02-27 14:05:36 +0800
commit13ad10a6b532bc7d31c72e2cb9a8a39999824466 (patch)
treec46ba2f367a4abd3aed46388eba51cb5839c9201 /test/sandbox.js
parente6ebf827ce8eaf75b0ad137aa19d09da2c03df46 (diff)
downloadtracifyjs-13ad10a6b532bc7d31c72e2cb9a8a39999824466.tar.gz
tracifyjs-13ad10a6b532bc7d31c72e2cb9a8a39999824466.zip
improve `export` compatibility mode (#4703)
Diffstat (limited to 'test/sandbox.js')
-rw-r--r--test/sandbox.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/sandbox.js b/test/sandbox.js
index ceaf0088..b369ba81 100644
--- a/test/sandbox.js
+++ b/test/sandbox.js
@@ -51,7 +51,7 @@ exports.same_stdout = semver.satisfies(process.version, "0.12") ? function(expec
};
exports.strip_exports = function(code) {
var count = 0;
- return code.replace(/\bexport(?:\s*\{[^}]*};|\s+default\b(?:\s*(\(|\{|class\s*\{|class\s+(?=extends\b)|(?:async\s+)?function\s*(?:\*\s*)?\())?|\b)/g, function(match, header) {
+ return code.replace(/\bexport(?:\s*\{[^}]*}\s*?(?:$|\n|;)|\s+default\b(?:\s*(\(|\{|class\s*\{|class\s+(?=extends\b)|(?:async\s+)?function\s*(?:\*\s*)?\())?|\b)/g, function(match, header) {
if (!header) return "";
if (header.length == 1) return "!!" + header;
return header.slice(0, -1) + " _" + ++count + header.slice(-1);