Philip Pfaffe | ead3f10 | 2023-07-28 08:05:17 | [diff] [blame] | 1 | |
| 2 | // no idea what these regular expressions do, |
| 3 | // but i extracted it from https://github.com/yahoo/js-module-formats/blob/master/index.js#L18 |
| 4 | var ES6ImportExportRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(import\s+['"]|(import|module)\s+[^"'\(\)\n;]+\s+from\s+['"]|export\s+(\*|\{|default|function|var|const|let|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*))/; |
| 5 | |
| 6 | var ES6AliasRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(export\s*\*\s*from\s*(?:'([^']+)'|"([^"]+)"))/; |
| 7 | |
| 8 | module.exports = function (sauce) { |
| 9 | return ES6ImportExportRegExp.test(sauce) |
| 10 | || ES6AliasRegExp.test(sauce); |
| 11 | }; |