flow-remove-types
Advanced tools
Comparing version 2.220.1 to 2.221.0
25
index.js
@@ -10,3 +10,3 @@ /** | ||
var parse = require('flow-parser').parse; | ||
var parse = require('hermes-parser').parse; | ||
var vlq = require('vlq'); | ||
@@ -61,12 +61,3 @@ | ||
// This parse configuration is intended to be as permissive as possible. | ||
var ast = parse(source, { | ||
esproposal_decorators: true, | ||
esproposal_class_instance_fields: true, | ||
esproposal_class_static_fields: true, | ||
esproposal_export_star_as: true, | ||
esproposal_optional_chaining: true, | ||
esproposal_nullish_coalescing: true, | ||
types: true, | ||
tokens: true, | ||
}); | ||
var ast = parse(source, {types: true, tokens: true}); | ||
@@ -170,3 +161,3 @@ var removedNodes = []; | ||
TypeParameterInstantiation: removeNode, | ||
InferredPredicate: removeNode, | ||
InferredPredicate: removeInferredPredicateNode, | ||
OpaqueType: removeNode, | ||
@@ -375,2 +366,12 @@ DeclareOpaqueType: removeNode, | ||
function removeInferredPredicateNode(context, node) { | ||
var tokens = context.ast.tokens; | ||
var priorTokenIdx = findTokenIndexAtStartOfNode(tokens, node) - 1; | ||
var token = tokens[priorTokenIdx]; | ||
if (token && token.type === 'Punctuator' && token.value === ':') { | ||
removeNode(context, token); | ||
} | ||
return removeNode(context, node); | ||
} | ||
function removeTrailingCommaNode(context, node) { | ||
@@ -377,0 +378,0 @@ var ast = context.ast; |
{ | ||
"name": "flow-remove-types", | ||
"version": "2.220.1", | ||
"version": "2.221.0", | ||
"description": "Removes Flow type annotations from JavaScript files with speed and simplicity.", | ||
@@ -47,3 +47,3 @@ "author": { | ||
"dependencies": { | ||
"flow-parser": "^0.220.0", | ||
"hermes-parser": "0.17.1", | ||
"pirates": "^3.0.2", | ||
@@ -50,0 +50,0 @@ "vlq": "^0.2.1" |
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
43298
+ Addedhermes-parser@0.17.1
+ Addedhermes-estree@0.17.1(transitive)
+ Addedhermes-parser@0.17.1(transitive)
- Removedflow-parser@^0.220.0
- Removedflow-parser@0.220.1(transitive)