Socket
Socket
Sign inDemoInstall

estraverse-fb

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

estraverse-fb - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

40

keys.js

@@ -12,3 +12,39 @@ module.exports = {

XJSText: null,
XJSSpreadAttribute: ['argument']
};
XJSSpreadAttribute: ['argument'],
/* Flow Type Annotations */
Type: [],
AnyTypeAnnotation: [],
VoidTypeAnnotation: [],
NumberTypeAnnotation: [],
StringTypeAnnotation: [],
StringLiteralTypeAnnotation: ["value", "raw"],
BooleanTypeAnnotation: [],
TypeAnnotation: ["typeAnnotation"],
NullableTypeAnnotation: ["typeAnnotation"],
FunctionTypeAnnotation: ["params", "returnType", "rest", "typeParameters"],
FunctionTypeParam: ["name", "typeAnnotation", "optional"],
ObjectTypeAnnotation: ["properties"],
ObjectTypeProperty: ["key", "value", "optional"],
ObjectTypeIndexer: ["id", "key", "value"],
ObjectTypeCallProperty: ["value"],
QualifiedTypeIdentifier: ["qualification", "id"],
GenericTypeAnnotation: ["id", "typeParameters"],
MemberTypeAnnotation: ["object", "property"],
UnionTypeAnnotation: ["types"],
IntersectionTypeAnnotation: ["types"],
TypeofTypeAnnotation: ["argument"],
TypeParameterDeclaration: ["params"],
TypeParameterInstantiation: ["params"],
ClassProperty: ["key", "typeAnnotation"],
ClassImplements: [],
InterfaceDeclaration: ["id", "body", "extends"],
InterfaceExtends: ["id"],
TypeAlias: ["id", "typeParameters", "right"],
TupleTypeAnnotation: ["types"],
DeclareVariable: ["id"],
DeclareFunction: ["id"],
DeclareClass: ["id"],
DeclareModule: ["id", "body"]
/* End: Flow Type Annotations */
};

2

package.json
{
"name": "estraverse-fb",
"version": "1.1.1",
"version": "1.2.0",
"description": "Drop-in for estraverse that enables traversal over React's JSX nodes.",

@@ -5,0 +5,0 @@ "main": "estraverse-fb.js",

@@ -5,3 +5,3 @@ estraverse-fb

Drop-in for estraverse that enables traversal over React's JSX using monkey-patching technique.
Drop-in for estraverse that enables traversal over React's JSX and Flow nodes using monkey-patching technique.

@@ -8,0 +8,0 @@ You can use estraverse-fb in two possible ways:

var assert = require('chai').assert;
var parse = require('esprima-fb').parse;
var originalKeys = require('./keys');
describe('works', function () {
var code = '<namespace:tag textAttr="value" exprAttr={expr} {...spreadAttr}><object.prop>!</object.prop>{}</namespace:tag>';
var code = ['class MyClass{',
'x: number;',
'y: number;',
'constructor(x: number, y: number){',
'this.x = x;',
'this.y = y;',
'}',
'render(){',
'return <namespace:tag textAttr="value" exprAttr={expr} {...spreadAttr}><object.prop>!</object.prop>{}</namespace:tag>',
'}',
'}'].join('\n');
var ast = parse(code);
var expectedKeys = [
'ClassProperty',
'TypeAnnotation',
'NumberTypeAnnotation',
'ClassProperty',
'TypeAnnotation',
'NumberTypeAnnotation',
'XJSElement',

@@ -46,6 +64,7 @@ 'XJSOpeningElement',

var actualKeys = [];
var actualTypeKeys = [];
traverse(ast, {
enter: function (node) {
if (node.type.slice(0, 3) === 'XJS') {
if (originalKeys[node.type] != null) {
actualKeys.push(node.type);

@@ -66,3 +85,3 @@ }

enter: function (node) {
if (node.type.slice(0, 3) === 'XJS') {
if (originalKeys[node.type] != null) {
actualKeys.push(node.type);

@@ -84,3 +103,3 @@ }

enter: function (node) {
if (node.type.slice(0, 3) === 'XJS') {
if (originalKeys[node.type] != null) {
actualKeys.push(node.type);

@@ -100,2 +119,2 @@ }

});
});
});
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