index.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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.0.0-0 || ^8.0.0-0");
  12. var {
  13. legacy
  14. } = options;
  15. const {
  16. version
  17. } = options;
  18. if (legacy || version === "legacy") {
  19. return {
  20. name: "proposal-decorators",
  21. inherits: _pluginSyntaxDecorators.default,
  22. visitor: _transformerLegacy.default
  23. };
  24. } else if (!version || version === "2018-09" || version === "2021-12" || version === "2022-03" || version === "2023-01" || version === "2023-05" || version === "2023-11") {
  25. api.assertVersion("^7.0.2 || ^8.0.0-0");
  26. return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
  27. name: "proposal-decorators",
  28. api,
  29. feature: _helperCreateClassFeaturesPlugin.FEATURES.decorators,
  30. inherits: _pluginSyntaxDecorators.default,
  31. decoratorVersion: version
  32. });
  33. } else {
  34. throw new Error("The '.version' option must be one of 'legacy', '2023-11', '2023-05', '2023-01', '2022-03', or '2021-12'.");
  35. }
  36. });
  37. //# sourceMappingURL=index.js.map