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

flow-parser

Package Overview
Dependencies
Maintainers
4
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.32.0 to 0.33.0

2

package.json
{
"name": "flow-parser",
"version": "0.32.0",
"version": "0.33.0",
"license": "BSD-3-Clause",

@@ -5,0 +5,0 @@ "description": "JavaScript parser written in OCaml. Produces SpiderMonkey AST",

@@ -72,1 +72,7 @@ var types = require("ast-types/lib/types");

.field("exact", Boolean)
def("MetaProperty")
.bases("Expression")
.build("meta", "property")
.field("meta", def("Identifier"))
.field("property", def("Identifier"));

@@ -89,7 +89,2 @@ /**

switch (esprima.type) {
case "SwitchStatement":
// Esprima doesn't support let statements so it doesn't include the
// lexical field
delete flow.lexical;
break;
case 'TryStatement':

@@ -101,10 +96,5 @@ // The Mozilla spec changed over time. There used to be a "handlers"

flow.handlers = flow.handler ? [ flow.handler ] : [];
flow.guardedHandlers = [];
delete flow.handler;
break;
case 'CatchClause':
// Esprima doesn't support the guard property for catch clauses
if (!esprima.hasOwnProperty("guard")) {
esprima.guard = null;
}
break;
case 'Identifier':

@@ -259,12 +249,72 @@ if (esprima.optional === undefined) {

case 'ArrowFunctionExpression':
if (Array.isArray(esprima.defaults)) {
// esprima-fb uses a "defaults" array that is parallel to the "params"
// array. Flow and modern esprima use AssignmentPatterns within the
// params array.
if (Array.isArray(esprima.defaults) && Array.isArray(esprima.params)) {
for (var i = 0; i < esprima.defaults.length; i++) {
if (esprima.defaults[i] === undefined) {
esprima.defaults[i] = null;
var left = esprima.params[i];
var right = esprima.defaults[i];
if (right !== undefined && right !== null) {
var newParam = {
type: 'AssignmentPattern',
left: left,
right: right,
};
if (left.loc && right.loc) {
newParam.loc = {
start: {
line: left.loc.start.line,
column: left.loc.start.column,
},
end: {
line: right.loc.end.line,
column: right.loc.end.column,
},
};
if (left.loc.source) {
newParam.loc.source = left.loc.source;
}
}
if (left.range && right.range) {
newParam.range = [left.range[0], right.range[1]];
}
esprima.params[i] = newParam;
}
}
delete esprima.defaults;
}
// esprima-fb uses a "rest" property. Flow and modern esprima use
// RestElement within the params array.
if ('rest' in esprima) {
if (esprima.rest !== undefined && esprima.rest !== null) {
var arg = esprima.rest;
var rest = {
type: 'RestElement',
argument: arg,
};
if (arg.loc) {
rest.loc = {
start: {
line: arg.loc.start.line,
column: arg.loc.start.column - 3, // HACKY!
},
end: arg.loc.end,
};
if (arg.loc.source) {
rest.loc.source = arg.loc.source;
}
}
if (arg.range) {
rest.range = [arg.range[0] - 3, arg.range[1]]; // HACKY!
}
esprima.params.push(rest);
}
delete esprima.rest;
}
if (esprima.async === undefined) {
esprima.async = false;
}
delete flow.predicate;

@@ -271,0 +321,0 @@ }

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

Sorry, the diff of this file is not supported yet

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