index.js 568 B

1234567891011
  1. // no idea what these regular expressions do,
  2. // but i extracted it from https://github.com/yahoo/js-module-formats/blob/master/index.js#L18
  3. 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]*))/;
  4. var ES6AliasRegExp = /(?:^\s*|[}{\(\);,\n]\s*)(export\s*\*\s*from\s*(?:'([^']+)'|"([^"]+)"))/;
  5. module.exports = function (sauce) {
  6. return ES6ImportExportRegExp.test(sauce)
  7. || ES6AliasRegExp.test(sauce);
  8. };