@babel/helper-annotate-as-pure
Advanced tools
Comparing version 7.0.0-beta.49 to 7.0.0-beta.50
{ | ||
"name": "@babel/helper-annotate-as-pure", | ||
"version": "7.0.0-beta.49", | ||
"version": "7.0.0-beta.50", | ||
"description": "Helper function to annotate paths and nodes with #__PURE__ comment", | ||
@@ -9,4 +9,4 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-helper-annotate-as-pure", | ||
"dependencies": { | ||
"@babel/types": "7.0.0-beta.49" | ||
"@babel/types": "7.0.0-beta.50" | ||
} | ||
} |
# @babel/helper-annotate-as-pure | ||
## API | ||
> Helper function to annotate paths and nodes with #__PURE__ comment | ||
```js | ||
declare export default annotateAsPure(nodeOrPath: Node | NodePath); | ||
``` | ||
See our website [@babel/helper-annotate-as-pure](https://new.babeljs.io/docs/en/next/babel-helper-annotate-as-pure.html) for more information. | ||
## Usage | ||
## Install | ||
```js | ||
import traverse from "@babel/traverse"; | ||
import annotateAsPure from "@babel/helper-annotate-as-pure"; | ||
Using npm: | ||
// ... | ||
traverse(file, { | ||
CallExpression(path) { | ||
annotateAsPure(path); | ||
}, | ||
}); | ||
```sh | ||
npm install --save @babel/helper-annotate-as-pure | ||
``` | ||
## Caveat with UglifyJS pre v3.1.0 | ||
or using yarn: | ||
`@babel/helper-annotate-as-pure` will append any existing leading comments to the `#__PURE__` annotation. Versions of UglifyJS prior to v3.1.0 will **ignore** these annotations, as they only check the _last_ leading comment for the annotation. | ||
For example, using the `Usage` snippet above: | ||
**In** | ||
```js | ||
const four = /* foo */ add(2, 2); | ||
```sh | ||
yarn add --save @babel/helper-annotate-as-pure | ||
``` | ||
**Out** | ||
```js | ||
const four = /* #__PURE__ */ /* foo */ add(2, 2); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1875
3
20
+ Added@babel/types@7.0.0-beta.50(transitive)
- Removed@babel/types@7.0.0-beta.49(transitive)
Updated@babel/types@7.0.0-beta.50