index.js 891 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = _default;
  4. var _visit = require("./visit");
  5. /**
  6. * Copyright (c) 2014-present, Facebook, Inc.
  7. *
  8. * This source code is licensed under the MIT license found in the
  9. * LICENSE file in the root directory of this source tree.
  10. */
  11. function _default(context) {
  12. var plugin = {
  13. visitor: (0, _visit.getVisitor)(context)
  14. };
  15. // Some presets manually call child presets, but fail to pass along the
  16. // context object. Out of an abundance of caution, we verify that it
  17. // exists first to avoid causing unnecessary breaking changes.
  18. var version = context && context.version;
  19. // The "name" property is not allowed in older versions of Babel (6.x)
  20. // and will cause the plugin validator to throw an exception.
  21. if (version && parseInt(version, 10) >= 7) {
  22. plugin.name = "regenerator-transform";
  23. }
  24. return plugin;
  25. }