How to use the @babel/helper-create-class-features-plugin.FEATURES.decorators function in @babel/helper-create-class-features-plugin

To help you get started, we’ve selected a few @babel/helper-create-class-features-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github babel / babel / packages / babel-plugin-proposal-decorators / src / index.js View on Github external
if (legacy) {
    return {
      name: "proposal-decorators",
      inherits: syntaxDecorators,
      manipulateOptions({ generatorOpts }) {
        generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport;
      },
      visitor: legacyVisitor,
    };
  }

  return createClassFeaturePlugin({
    name: "proposal-decorators",

    feature: FEATURES.decorators,
    // loose: options.loose, Not supported

    manipulateOptions({ generatorOpts, parserOpts }) {
      parserOpts.plugins.push(["decorators", { decoratorsBeforeExport }]);
      generatorOpts.decoratorsBeforeExport = decoratorsBeforeExport;
    },
  });
});

@babel/helper-create-class-features-plugin

Compile class public and private fields, private methods and decorators to ES6

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis