Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flow-parser

Package Overview
Dependencies
Maintainers
3
Versions
332
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flow-parser - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

8

package.json
{
"name": "flow-parser",
"version": "0.1.1",
"version": "0.2.0",
"description": "JavaScript parser written in OCaml. Produces SpiderMonkey AST",

@@ -18,6 +18,6 @@ "author": {

"devDependencies": {
"esprima-fb": "12001.1.0-dev-harmony-fb"
"esprima-fb": "13001.1001.0-dev-harmony-fb"
},
"dependencies": {
"ast-types": ">=0.6.11",
"ast-types": "0.7.0",
"colors": ">=0.6.2",

@@ -27,3 +27,3 @@ "minimist": ">=0.2.0"

"engines": {
"node": ">=0.4.0"
"node": ">=0.4.0"
},

@@ -30,0 +30,0 @@ "scripts": {

@@ -126,4 +126,4 @@ /**

break;
case 'XJSEmptyExpression':
// The location for the empty XJS expression doesn't really matter. I'm
case 'JSXEmptyExpression':
// The location for the empty JSX expression doesn't really matter. I'm
// arbitrarily using the location of the {}, and esprima is arbitrarily

@@ -223,4 +223,4 @@ // using the single column location immediately after the {}

switch (flow.type) {
case "XJSText":
// Esprima represents XJS children string literals as Literal nodes
case "JSXText":
// Esprima represents JSX children string literals as Literal nodes
flow.type = "Literal";

@@ -227,0 +227,0 @@ break;

@@ -1392,7 +1392,7 @@ module.exports = {

},
'Invalid XJS Syntax': {
'Invalid JSX Syntax': {
'(<div />) < x;': {
'errors': {
'0': {
'message': 'Unexpected token <. Remember, adjacent XJS elements '+
'message': 'Unexpected token <. Remember, adjacent JSX elements '+
'must be wrapped in an enclosing parent tag',

@@ -1409,3 +1409,3 @@ 'loc': {

'0': {
'message': 'Unexpected token <. Remember, adjacent XJS elements '+
'message': 'Unexpected token <. Remember, adjacent JSX elements '+
'must be wrapped in an enclosing parent tag',

@@ -1422,3 +1422,3 @@ 'loc': {

'0': {
'message': 'Unexpected token <. Remember, adjacent XJS elements '+
'message': 'Unexpected token <. Remember, adjacent JSX elements '+
'must be wrapped in an enclosing parent tag',

@@ -1720,2 +1720,210 @@ 'loc': {

},
'Type Annotations In Comments': {
'function foo(numVal/*: number*/, x/* : number*/){}': {
'body.0.params': [
{
'name': 'numVal',
'typeAnnotation.typeAnnotation.type': 'NumberTypeAnnotation',
},
{
'name': 'x',
'typeAnnotation.typeAnnotation.type': 'NumberTypeAnnotation',
},
]
},
'function foo(a/* :function*/, b/* : switch*/){}': {
'body.0.params.0.typeAnnotation.typeAnnotation.id.name': 'function',
'body.0.params.1.typeAnnotation.typeAnnotation.id.name': 'switch',
},
'function foo(numVal/*::: number*/, strVal/*:: :string*/){}': {
'body.0': {
'params': {
'0.typeAnnotation.typeAnnotation.type': 'NumberTypeAnnotation',
'1.typeAnnotation.typeAnnotation.type': 'StringTypeAnnotation'
},
'returnType': null,
'typeParameters': null,
}
},
'function foo(numVal/* :: : number*/, untypedVal){}': {
'body.0.params.0.typeAnnotation.typeAnnotation.type': 'NumberTypeAnnotation',
'body.0.params.1.typeAnnotation': null
},
'function foo(untypedVal, numVal/*flow-include: number*/){}': {
'body.0.params.0.typeAnnotation': null,
'body.0.params.1.typeAnnotation.typeAnnotation.type': 'NumberTypeAnnotation'
},
'function foo(nullableNum/*flow-include : ?number*/){}': {
'body.0.params.0.typeAnnotation.typeAnnotation': {
'type': 'NullableTypeAnnotation',
'typeAnnotation.type': 'NumberTypeAnnotation'
}
},
'function foo(callback/* flow-include : () => void*/){}': {
'body.0.params.0.typeAnnotation.typeAnnotation': {
'type': 'FunctionTypeAnnotation',
'params': [],
'returnType.type': 'VoidTypeAnnotation',
}
},
'function foo(callback/*: () => number*/){}': {
'body.0.params.0.typeAnnotation.typeAnnotation': {
'type': 'FunctionTypeAnnotation',
'params': [],
'returnType.type': 'NumberTypeAnnotation',
}
},
'function foo(callback/*: (_:bool) => number*/){}': {
'body.0.params.0.typeAnnotation.typeAnnotation': {
'type': 'FunctionTypeAnnotation',
'params.0': {
'type': 'FunctionTypeParam',
'name.name': '_',
'typeAnnotation.type': 'BooleanTypeAnnotation'
},
'returnType.type': 'NumberTypeAnnotation'
}
},
'function foo(callback/*: (_1:bool, _2:string) => number*/){}': {
'body.0.params.0.typeAnnotation.typeAnnotation': {
'type': 'FunctionTypeAnnotation',
'params': [
{
'name.name': '_1',
'typeAnnotation.type': 'BooleanTypeAnnotation'
},
{
'name.name': '_2',
'typeAnnotation.type': 'StringTypeAnnotation'
},
],
'returnType.type': 'NumberTypeAnnotation'
}
},
'function foo()/*:number*/{}': {
'body.0.returnType.typeAnnotation.type': 'NumberTypeAnnotation',
},
'function foo()/*:() => void*/{}': {
'body.0.returnType.typeAnnotation': {
'type': "FunctionTypeAnnotation",
'params': [],
'returnType.type': 'VoidTypeAnnotation',
}
},
"/*::\ntype duck = {\n quack(): string;\n};\n*/": {
'body': [
{
'type': 'TypeAlias',
'id.name': 'duck',
'typeParameters': null,
'right': {
'type': 'ObjectTypeAnnotation',
},
},
],
},
"/*flow-include\ntype duck = {\n quack(): string;\n};\n*/": {
'body': [
{
'type': 'TypeAlias',
'id.name': 'duck',
'typeParameters': null,
'right': {
'type': 'ObjectTypeAnnotation',
},
},
],
},
'/*:: */': {
'body': [],
},
'/*flow-include */': {
'body': [],
},
'function foo/*:: <T> */(x /*: T */)/*: T */ { return x; }': {
'body.0.typeParameters.params': [
{
'type': 'Identifier',
'name': 'T',
}
]
}
},
'Invalid Type Annotations In Comments': {
'/*: */': {
'errors': {
'0.message': 'Unexpected token /*:',
}
},
'/*:: /* */': {
'errors': {
'0.message': 'Unexpected token /*',
}
},
'/*:: /*: */': {
'errors': {
'0.message': 'Unexpected token /*:',
}
},
'/*:: /* : */': {
'errors': {
'0.message': 'Unexpected token /* :',
}
},
'/*:: /*:: */': {
'errors': {
'0.message': 'Unexpected token /*::',
}
},
'/*:: /*flow-include */': {
'errors': {
'0.message': 'Unexpected token /*flow-include',
}
},
'*/': {
'errors': {
'0.message': 'Unexpected token */',
}
},
'/*::': {
'errors': {
'0.message': 'Unexpected end of input',
}
}
},
'Trailing commas': {
'Math.max(a, b, c,)': {},
'var exp = function(a, b,) { return a + b; };': {},
'function dec(a, b,) { return a + b; }': {},
'class Test { constructor(x, y,) {} }': {},
'(x,) => x * x': {},
'(x,y,) => Math.pow(x,y,)': {},
'(function foo(x = 5,) {})': {},
'foo(a, ...b,)': {},
'var x = [1, 2, 3,];': {},
'var x = [1, 2, ...y,];': {},
'var x = [1, 2, ...y, 4,];': {},
},
'Invalid trailing commas': {
'foo(a, (b,))': {
'errors': {
'0.message': 'Unexpected token )',
}
},
'function foo(a, ...b,) { return b.concat(a); }': {
'errors': {
'0.message': 'Rest parameter must be final parameter of an argument list',
}
},
'var f = function(a, ...b,) { return b.concat(a); }': {
'errors': {
'0.message': 'Rest parameter must be final parameter of an argument list',
}
},
'var f = (a, ...b,) => b.concat(a);': {
'errors': {
'0.message': 'Rest parameter must be final parameter of an argument list',
}
},
},
};

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc