estree-to-babel
Advanced tools
Comparing version 3.1.1 to 3.2.0
@@ -8,3 +8,2 @@ 'use strict'; | ||
const setClassMethod = require('./set-class-method'); | ||
const setClassPrivateMethod = require('./set-class-private-method'); | ||
const setClassPrivateProperty = require('./set-class-private-property'); | ||
@@ -36,5 +35,2 @@ const setClassPrivateName = require('./set-class-private-name'); | ||
if (type === 'ClassPrivateMethod') | ||
return setClassPrivateMethod(path); | ||
if (type === 'FieldDefinition') | ||
@@ -41,0 +37,0 @@ return setClassPrivateProperty(path); |
'use strict'; | ||
const {classMethod} = require('@babel/types'); | ||
const { | ||
isPrivateName, | ||
classPrivateMethod, | ||
classMethod, | ||
} = require('@babel/types'); | ||
@@ -23,3 +27,3 @@ const {assign} = Object; | ||
path.replaceWith(classMethod( | ||
const method = getClassMethod({ | ||
kind, | ||
@@ -30,5 +34,6 @@ key, | ||
computed, | ||
node.static, | ||
)); | ||
nodeStatic: node.static, | ||
}); | ||
path.replaceWith(method); | ||
assign(path.node, { | ||
@@ -41,1 +46,20 @@ loc, | ||
function getClassMethod({kind, key, params, body, computed, nodeStatic}) { | ||
if (isPrivateName(key)) | ||
return classPrivateMethod( | ||
kind, | ||
key, | ||
params, | ||
body, | ||
computed, | ||
); | ||
return classMethod( | ||
kind, | ||
key, | ||
params, | ||
body, | ||
computed, | ||
nodeStatic, | ||
); | ||
} |
{ | ||
"name": "estree-to-babel", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -45,4 +45,4 @@ "description": "convert estree ast to babel", | ||
"nyc": "^15.0.0", | ||
"putout": "^14.0.1", | ||
"supertape": "^4.8.1" | ||
"putout": "^15.4.3", | ||
"supertape": "^5.0.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "license": "MIT", |
# Estree-to-babel [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL] | ||
[NPMIMGURL]: https://img.shields.io/npm/v/estree-to-babel.svg?style=flat&longCache=true | ||
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/estree-to-babel/master.svg?style=flat&longCache=true | ||
[BuildStatusURL]: https://github.com/coderaiser/estree-to-babel/actions?query=workflow%3A%22Node+CI%22 "Build Status" | ||
[BuildStatusIMGURL]: https://github.com/coderaiser/estree-to-babel/workflows/Node%20CI/badge.svg | ||
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/estree-to-babel.svg?style=flat&longCache=true | ||
@@ -34,3 +35,3 @@ [NPMURL]: https://npmjs.org/package/estree-to-babel "npm" | ||
- `ClassMethod` instead of `MethodDefinition`; | ||
- `ClassPrivateMethod` | ||
- `ClassPrivateMethod`; | ||
- `ClassPrivateName` stores name as `Identifier` in `id` field; | ||
@@ -37,0 +38,0 @@ - `ClassPrivateProperty` instead of `FieldDefinition`; |
Sorry, the diff of this file is not supported yet
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
71
14866
12
239