21f9fbf4c0395bd86bac0f52e5e27edfe0fa5992a38806a5299fb5e4f651b880f9a3ed57eb1a815db772f7cb5df4276cd3b0d898a3ce5b43fc5a03eef78c79 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.addProposalSyntaxPlugins = addProposalSyntaxPlugins;
  6. exports.removeUnnecessaryItems = removeUnnecessaryItems;
  7. exports.removeUnsupportedItems = removeUnsupportedItems;
  8. var _semver = require("semver");
  9. var _availablePlugins = require("./available-plugins.js");
  10. function addProposalSyntaxPlugins(items, proposalSyntaxPlugins) {
  11. proposalSyntaxPlugins.forEach(plugin => {
  12. items.add(plugin);
  13. });
  14. }
  15. function removeUnnecessaryItems(items, overlapping) {
  16. items.forEach(item => {
  17. var _overlapping$item;
  18. (_overlapping$item = overlapping[item]) == null || _overlapping$item.forEach(name => items.delete(name));
  19. });
  20. }
  21. function removeUnsupportedItems(items, babelVersion) {
  22. items.forEach(item => {
  23. if (hasOwnProperty.call(_availablePlugins.minVersions, item) && _semver.lt(babelVersion, _availablePlugins.minVersions[item])) {
  24. items.delete(item);
  25. } else if (babelVersion[0] === "8" && _availablePlugins.legacyBabel7SyntaxPlugins.has(item)) {
  26. items.delete(item);
  27. }
  28. });
  29. }
  30. //# sourceMappingURL=filter-items.js.map