isExportFrom.js 742 B

123456789101112131415161718
  1. "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _keywords = require('../parser/tokenizer/keywords');
  2. var _types = require('../parser/tokenizer/types');
  3. /**
  4. * Starting at `export {`, look ahead and return `true` if this is an
  5. * `export {...} from` statement and `false` if this is a plain multi-export.
  6. */
  7. function isExportFrom(tokens) {
  8. let closeBraceIndex = tokens.currentIndex();
  9. while (!tokens.matches1AtIndex(closeBraceIndex, _types.TokenType.braceR)) {
  10. closeBraceIndex++;
  11. }
  12. return (
  13. tokens.matchesContextualAtIndex(closeBraceIndex + 1, _keywords.ContextualKeyword._from) &&
  14. tokens.matches1AtIndex(closeBraceIndex + 2, _types.TokenType.string)
  15. );
  16. } exports.default = isExportFrom;