@@ -56,7 +56,10 @@ exports.patch_module_statements = function(code) {
|
||||
code = 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 "0, " + header;
|
||||
return header.slice(0, -1) + " _" + ++count + header.slice(-1);
|
||||
do {
|
||||
var name = "_export_default_" + ++count;
|
||||
} while (code.indexOf(name) >= 0);
|
||||
return header.slice(0, -1) + " " + name + header.slice(-1);
|
||||
}).replace(/\bimport\.meta\b/g, function() {
|
||||
return '({ url: "https://example.com/path/index.html" })';
|
||||
}).replace(/\bimport\b(?:\s*([^\s('"][^('"]*)\bfrom\b)?\s*(['"]).*?\2(?:$|\n|;)/g, function(match, symbols) {
|
||||
|
||||
Reference in New Issue
Block a user