5f8ac90f7d14424506c7d1a5dbdaffcbdb9dfa4ebff034a4235116c414488f09241c8243b8396e75e24d243099e91d7cf2351c216de9ab4e4abd69ec65799c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _helperPluginUtils = require("@babel/helper-plugin-utils");
  7. var _pluginSyntaxDecorators = require("@babel/plugin-syntax-decorators");
  8. var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
  9. var _transformerLegacy = require("./transformer-legacy.js");
  10. var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
  11. api.assertVersion(7);
  12. {
  13. var {
  14. legacy
  15. } = options;
  16. }
  17. const {
  18. version
  19. } = options;
  20. if (legacy || version === "legacy") {
  21. return {
  22. name: "proposal-decorators",
  23. inherits: _pluginSyntaxDecorators.default,
  24. visitor: _transformerLegacy.default
  25. };
  26. } else if (!version || version === "2018-09" || version === "2021-12" || version === "2022-03" || version === "2023-01" || version === "2023-05" || version === "2023-11") {
  27. api.assertVersion("^7.0.2");
  28. return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
  29. name: "proposal-decorators",
  30. api,
  31. feature: _helperCreateClassFeaturesPlugin.FEATURES.decorators,
  32. inherits: _pluginSyntaxDecorators.default,
  33. decoratorVersion: version
  34. });
  35. } else {
  36. throw new Error("The '.version' option must be one of 'legacy', '2023-11', '2023-05', '2023-01', '2022-03', or '2021-12'.");
  37. }
  38. });
  39. //# sourceMappingURL=index.js.map