jestPreprocessor.js 831 B

12345678910111213141516171819202122
  1. /**
  2. * Copyright 2013-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. var jstransform = require('./src/jstransform');
  10. var arrowFuncVisitors = require('./visitors/es6-arrow-function-visitors');
  11. var restParamVisitors = require('./visitors/es6-rest-param-visitors');
  12. var es7SpreadPropertyVisitors = require('./visitors/es7-spread-property-visitors');
  13. exports.process = function(sourceText, sourcePath) {
  14. return jstransform.transform(
  15. arrowFuncVisitors.visitorList
  16. .concat(restParamVisitors.visitorList)
  17. .concat(es7SpreadPropertyVisitors.visitorList),
  18. sourceText
  19. ).code;
  20. };