How to use the @babel/helper-annotate-as-pure.default function in @babel/helper-annotate-as-pure

To help you get started, we’ve selected a few @babel/helper-annotate-as-pure 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 instructure / instructure-ui / packages / console / macro.js View on Github external
references[referenceKey].reverse().forEach(reference => {
      const path = reference.parentPath

      reference.replaceWith(t.cloneDeep(runtimeNode))

      // add pure function annotation
      // so that consumers can remove console statements from prod bundles
      if (process.env.NODE_ENV === 'production') {
        path.traverse({
          Function: annotateAsPure
        })
        annotateAsPure(reference)
        annotateAsPure(path)
      }
    })
  })
github instructure / instructure-ui / packages / console / macro.js View on Github external
references[referenceKey].reverse().forEach(reference => {
      const path = reference.parentPath

      reference.replaceWith(t.cloneDeep(runtimeNode))

      // add pure function annotation
      // so that consumers can remove console statements from prod bundles
      if (process.env.NODE_ENV === 'production') {
        path.traverse({
          Function: annotateAsPure
        })
        annotateAsPure(reference)
        annotateAsPure(path)
      }
    })
  })
github jacobp100 / cssta / babel-plugin / visitors / csstaCall.js View on Github external
state.singleSourceOfVariables[variableName] || fallback
    );
  }

  transformCsstaTypes[csstaType](
    babel,
    path,
    state,
    component,
    cssText,
    substitutionMap
  );
  const binding = path.scope.getBinding(callee.name);
  binding.dereference();

  annotateAsPure(path);
};

@babel/helper-annotate-as-pure

Helper function to annotate paths and nodes with #__PURE__ comment

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis

Popular @babel/helper-annotate-as-pure functions

Similar packages