ts.js 504 B

123456789101112131415161718192021222324
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. 'use strict';
  8. const babylon = require('@babel/parser');
  9. const options = require('./tsOptions');
  10. /**
  11. * Doesn't accept custom options because babylon should be used directly in
  12. * that case.
  13. */
  14. module.exports = function() {
  15. return {
  16. parse(code) {
  17. return babylon.parse(code, options);
  18. },
  19. };
  20. };