index.js 889 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. }; // Some presets manually call child presets, but fail to pass along the
  15. // context object. Out of an abundance of caution, we verify that it
  16. // exists first to avoid causing unnecessary breaking changes.
  17. var version = context && context.version; // The "name" property is not allowed in older versions of Babel (6.x)
  18. // and will cause the plugin validator to throw an exception.
  19. if (version && parseInt(version, 10) >= 7) {
  20. plugin.name = "regenerator-transform";
  21. }
  22. return plugin;
  23. }