![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@babel/helper-annotate-as-pure
Advanced tools
Helper function to annotate paths and nodes with #__PURE__ comment
The @babel/helper-annotate-as-pure npm package is a utility within the Babel ecosystem designed to annotate call expressions with a /*#__PURE__*/ comment. This comment hints to JavaScript bundlers and minifiers, such as Terser, that the function call is pure. A pure function call's result can be safely removed if its result is not used, enabling more efficient final bundles by removing unused code.
Annotating a call expression as pure
This feature allows developers to mark specific call expressions as pure, enabling potential removal during the minification process if the result of the call is unused. This is particularly useful for library authors who want to ensure their library's unused parts can be tree-shaken in consumer applications.
import * as t from '@babel/types';
import annotateAsPure from '@babel/helper-annotate-as-pure';
const callExpression = t.callExpression(t.identifier('myFunction'), []);
annotateAsPure(callExpression);
// The callExpression node is now annotated with a /*#__PURE__*/ comment.
Similar to @babel/helper-annotate-as-pure, this package provides a Babel plugin to automatically annotate call expressions and new expressions with /*#__PURE__*/ comments. The key difference is that it operates at the plugin level, automatically applying the annotations across your codebase, rather than requiring manual annotation of each call.
While not a direct alternative, uglifyjs-webpack-plugin interfaces with UglifyJS to minify JavaScript bundles in Webpack projects. It can take advantage of the pure annotations added by @babel/helper-annotate-as-pure to perform tree shaking and dead code elimination, showcasing how such annotations can be utilized in the minification process.
Helper function to annotate paths and nodes with #PURE comment
See our website @babel/helper-annotate-as-pure for more information.
Using npm:
npm install --save @babel/helper-annotate-as-pure
or using yarn:
yarn add @babel/helper-annotate-as-pure
v7.25.9 (2024-10-22)
babel-parser
, babel-template
, babel-types
syntacticPlaceholders
mode (@liuxingbaoyu)babel-helper-compilation-targets
, babel-preset-env
ClassAccessorProperty
to prevent the no-undef
rule (@victorenator)babel-parser
, babel-types
VISITOR_KEYS
etc. faster to access (@liuxingbaoyu)FAQs
Helper function to annotate paths and nodes with #__PURE__ comment
The npm package @babel/helper-annotate-as-pure receives a total of 23,186,440 weekly downloads. As such, @babel/helper-annotate-as-pure popularity was classified as popular.
We found that @babel/helper-annotate-as-pure demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.