From 13ad10a6b532bc7d31c72e2cb9a8a39999824466 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 27 Feb 2021 06:05:36 +0000 Subject: improve `export` compatibility mode (#4703) --- test/sandbox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3