Socket
Socket
Sign inDemoInstall

babel-types

Package Overview
Dependencies
Maintainers
6
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-types - npm Package Compare versions

Comparing version 7.0.0-beta.1 to 7.0.0-beta.2

9

lib/definitions/core.js

@@ -248,3 +248,3 @@ "use strict";

returnType: {
validate: (0, _index2.assertNodeType)("TypeAnnotation", "Noop"),
validate: (0, _index2.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true

@@ -294,3 +294,3 @@ },

typeAnnotation: {
validate: (0, _index2.assertNodeType)("TypeAnnotation", "Noop"),
validate: (0, _index2.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true

@@ -439,3 +439,3 @@ },

visitor: ["directives", "body"],
builder: ["body", "directives"],
builder: ["body", "directives", "sourceType"],
fields: {

@@ -446,3 +446,4 @@ sourceFile: {

sourceType: {
validate: (0, _index2.assertOneOf)("script", "module")
validate: (0, _index2.assertOneOf)("script", "module"),
default: "script"
},

@@ -449,0 +450,0 @@ directives: {

"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _index = require("./index");

@@ -7,2 +9,4 @@

var _es = require("./es2015");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -25,2 +29,25 @@

});
(0, _index2.default)("ClassProperty", {
visitor: ["key", "value", "typeAnnotation", "decorators"],
builder: ["key", "value", "typeAnnotation", "decorators", "computed"],
aliases: ["Property"],
fields: _extends({}, _es.classMethodOrPropertyCommon, {
value: {
validate: (0, _index.assertNodeType)("Expression"),
optional: true
},
typeAnnotation: {
validate: (0, _index.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
decorators: {
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator"))),
optional: true
},
readonly: {
validate: (0, _index.assertValueType)("boolean"),
optional: true
}
})
});
(0, _index2.default)("Import", {

@@ -27,0 +54,0 @@ aliases: ["Expression"]

@@ -146,2 +146,37 @@ "use strict";

});
(0, _index2.default)("ObjectTypeAnnotation", {
visitor: ["properties", "indexers", "callProperties"],
aliases: ["Flow"],
fields: {}
});
(0, _index2.default)("ObjectTypeCallProperty", {
visitor: ["value"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
});
(0, _index2.default)("ObjectTypeIndexer", {
visitor: ["id", "key", "value"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
});
(0, _index2.default)("ObjectTypeProperty", {
visitor: ["key", "value"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
});
(0, _index2.default)("ObjectTypeSpreadProperty", {
visitor: ["argument"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
});
(0, _index2.default)("OpaqueType", {
visitor: ["id", "typeParameters", "supertype", "impltype"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {}
});
(0, _index2.default)("QualifiedTypeIdentifier", {
visitor: ["id", "qualification"],
aliases: ["Flow"],
fields: {}
});
(0, _index2.default)("StringLiteralTypeAnnotation", {

@@ -174,6 +209,10 @@ aliases: ["Flow"],

});
(0, _index2.default)("OpaqueType", {
visitor: ["id", "typeParameters", "supertype", "impltype"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {}
(0, _index2.default)("TypeAnnotation", {
aliases: ["Flow"],
visitor: ["typeAnnotation"],
fields: {
typeAnnotation: {
validate: (0, _index.assertNodeType)("Flow")
}
}
});

@@ -185,31 +224,36 @@ (0, _index2.default)("TypeCastExpression", {

});
(0, _index2.default)("ObjectTypeAnnotation", {
visitor: ["properties", "indexers", "callProperties"],
(0, _index2.default)("TypeParameter", {
aliases: ["Flow"],
fields: {}
visitor: ["bound", "default"],
fields: {
name: {
validate: (0, _index.assertValueType)("string")
},
bound: {
validate: (0, _index.assertNodeType)("TypeAnnotation"),
optional: true
},
default: {
validate: (0, _index.assertNodeType)("Flow"),
optional: true
}
}
});
(0, _index2.default)("ObjectTypeCallProperty", {
visitor: ["value"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
(0, _index2.default)("TypeParameterDeclaration", {
aliases: ["Flow"],
visitor: ["params"],
fields: {
params: {
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TypeParameter")))
}
}
});
(0, _index2.default)("ObjectTypeIndexer", {
visitor: ["id", "key", "value"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
});
(0, _index2.default)("ObjectTypeProperty", {
visitor: ["key", "value"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
});
(0, _index2.default)("ObjectTypeSpreadProperty", {
visitor: ["argument"],
aliases: ["Flow", "UserWhitespacable"],
fields: {}
});
(0, _index2.default)("QualifiedTypeIdentifier", {
visitor: ["id", "qualification"],
(0, _index2.default)("TypeParameterInstantiation", {
aliases: ["Flow"],
fields: {}
visitor: ["params"],
fields: {
params: {
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Flow")))
}
}
});

@@ -216,0 +260,0 @@ (0, _index2.default)("UnionTypeAnnotation", {

@@ -17,4 +17,2 @@ "use strict";

require("./tsFlowCommon");
require("./typescript");

@@ -94,3 +94,3 @@ "use strict";

parameters: validateArrayOfType(["Identifier", "RestElement"]),
typeAnnotation: validateOptionalType("TypeAnnotation")
typeAnnotation: validateOptionalType("TSTypeAnnotation")
};

@@ -114,3 +114,3 @@ var callConstructSignatureDeclaration = {

readonly: validateOptional(bool),
typeAnnotation: validateOptionalType("TypeAnnotation"),
typeAnnotation: validateOptionalType("TSTypeAnnotation"),
initializer: validateOptionalType("Expression")

@@ -130,3 +130,3 @@ })

parameters: validateArrayOfType("Identifier"),
typeAnnotation: validateOptionalType("TypeAnnotation")
typeAnnotation: validateOptionalType("TSTypeAnnotation")
}

@@ -170,3 +170,3 @@ });

parameterName: validateType(["Identifier", "TSThisType"]),
typeAnnotation: validateType("TypeAnnotation")
typeAnnotation: validateType("TSTypeAnnotation")
}

@@ -371,2 +371,42 @@ });

}
});
(0, _index2.default)("TSTypeAnnotation", {
visitor: ["typeAnnotation"],
fields: {
typeAnnotation: {
validate: (0, _index.assertNodeType)("TSType")
}
}
});
(0, _index2.default)("TSTypeParameterInstantiation", {
visitor: ["params"],
fields: {
params: {
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TSType")))
}
}
});
(0, _index2.default)("TSTypeParameterDeclaration", {
visitor: ["params"],
fields: {
params: {
validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TSTypeParameter")))
}
}
});
(0, _index2.default)("TSTypeParameter", {
visitor: ["constraint", "default"],
fields: {
name: {
validate: (0, _index.assertValueType)("string")
},
constraint: {
validate: (0, _index.assertNodeType)("TSType"),
optional: true
},
default: {
validate: (0, _index.assertNodeType)("TSType"),
optional: true
}
}
});

@@ -136,2 +136,4 @@ "use strict";

exports.buildMatchMemberExpression = buildMatchMemberExpression;
exports.addComment = addComment;
exports.addComments = addComments;
exports.removeComments = removeComments;

@@ -596,2 +598,26 @@ exports.inheritsComments = inheritsComments;

function addComment(node, type, content, line) {
addComments(node, type, [{
type: line ? "CommentLine" : "CommentBlock",
value: content
}]);
}
function addComments(node, type, comments) {
if (!comments || !node) return;
var key = type + "Comments";
if (node[key]) {
if (type === "leading") {
node[key] = comments.concat(node[key]);
} else {
node[key] = node[key].concat(comments);
}
} else {
node[key] = comments;
}
return node;
}
function removeComments(node) {

@@ -598,0 +624,0 @@ for (var _iterator2 = t.COMMENT_KEYS, _isArray2 = Array.isArray(_iterator2), _i4 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {

{
"name": "babel-types",
"version": "7.0.0-beta.1",
"version": "7.0.0-beta.2",
"description": "Babel Types is a Lodash-esque utility library for AST nodes",

@@ -16,5 +16,5 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"devDependencies": {
"babel-generator": "7.0.0-beta.1",
"babylon": "^7.0.0-beta.22"
"babel-generator": "7.0.0-beta.2",
"babylon": "^7.0.0-beta.25"
}
}

@@ -51,3 +51,3 @@ # babel-types

- `decorators`: `Array<Decorator>` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | Noop` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)

@@ -83,3 +83,3 @@ ---

- `generator`: `boolean` (default: `false`)
- `returnType`: `TypeAnnotation | Noop` (default: `null`)
- `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | Noop` (default: `null`)

@@ -116,3 +116,3 @@

- `decorators`: `Array<Decorator>` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | Noop` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)

@@ -346,3 +346,3 @@ ---

- `optional`: `boolean` (default: `null`)
- `returnType`: `TypeAnnotation | Noop` (default: `null`)
- `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | Noop` (default: `null`)

@@ -363,3 +363,3 @@

- `value`: `Expression` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | Noop` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `decorators`: `Array<Decorator>` (default: `null`)

@@ -836,3 +836,3 @@ - `computed`: `boolean` (default: `false`)

- `declare`: `boolean` (default: `null`)
- `returnType`: `TypeAnnotation | Noop` (default: `null`)
- `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | Noop` (default: `null`)

@@ -856,3 +856,3 @@

- `async`: `boolean` (default: `false`)
- `returnType`: `TypeAnnotation | Noop` (default: `null`)
- `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | Noop` (default: `null`)

@@ -918,3 +918,3 @@

- `optional`: `boolean` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | Noop` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)

@@ -1424,3 +1424,3 @@ ---

- `generator`: `boolean` (default: `false`)
- `returnType`: `TypeAnnotation | Noop` (default: `null`)
- `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | Noop` (default: `null`)

@@ -1441,3 +1441,3 @@

- `decorators`: `Array<Decorator>` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | Noop` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)

@@ -1564,3 +1564,3 @@ ---

```javascript
t.program(body, directives)
t.program(body, directives, sourceType)
```

@@ -1574,4 +1574,4 @@

- `directives`: `Array<Directive>` (default: `[]`)
- `sourceType`: `'script' | 'module'` (default: `'script'`)
- `sourceFile`: `string` (default: `null`)
- `sourceType`: `'script' | 'module'` (default: `null`)

@@ -1619,3 +1619,3 @@ ---

- `decorators`: `Array<Decorator>` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | Noop` (default: `null`)
- `typeAnnotation`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)

@@ -1800,3 +1800,3 @@ ---

- `parameters`: `Array<Identifier | RestElement>` (default: `null`)
- `typeAnnotation`: `TypeAnnotation` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)

@@ -1816,3 +1816,3 @@ ---

- `parameters`: `Array<Identifier | RestElement>` (default: `null`)
- `typeAnnotation`: `TypeAnnotation` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)

@@ -1831,3 +1831,3 @@ ---

- `typeParameters`: `TypeParameterDeclaration` (default: `null`)
- `typeAnnotation`: `TypeAnnotation` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)
- `parameters`: `Array<Identifier | RestElement>` (default: `null`)

@@ -1849,3 +1849,3 @@

- `params`: `Array<LVal>` (required)
- `returnType`: `TypeAnnotation | Noop` (default: `null`)
- `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `async`: `boolean` (default: `false`)

@@ -1868,3 +1868,3 @@ - `declare`: `boolean` (default: `null`)

- `params`: `Array<LVal>` (required)
- `returnType`: `TypeAnnotation | Noop` (default: `null`)
- `returnType`: `TypeAnnotation | TSTypeAnnotation | Noop` (default: `null`)
- `abstract`: `boolean` (default: `null`)

@@ -1959,3 +1959,3 @@ - `access`: `"public" | "private" | "protected"` (default: `null`)

- `typeParameters`: `TypeParameterDeclaration` (default: `null`)
- `typeAnnotation`: `TypeAnnotation` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)
- `parameters`: `Array<Identifier | RestElement>` (default: `null`)

@@ -1990,3 +1990,3 @@

- `parameters`: `Array<Identifier>` (required)
- `typeAnnotation`: `TypeAnnotation` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)
- `readonly`: `boolean` (default: `null`)

@@ -2092,3 +2092,3 @@

- `parameters`: `Array<Identifier | RestElement>` (default: `null`)
- `typeAnnotation`: `TypeAnnotation` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)
- `computed`: `boolean` (default: `null`)

@@ -2238,3 +2238,3 @@ - `optional`: `boolean` (default: `null`)

- `key`: `Expression` (required)
- `typeAnnotation`: `TypeAnnotation` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)
- `initializer`: `Expression` (default: `null`)

@@ -2326,2 +2326,13 @@ - `computed`: `boolean` (default: `null`)

### tSTypeAnnotation
```javascript
t.tSTypeAnnotation(typeAnnotation)
```
See also `t.isTSTypeAnnotation(node, opts)` and `t.assertTSTypeAnnotation(node, opts)`.
- `typeAnnotation`: `TSType` (required)
---
### tSTypeAssertion

@@ -2368,2 +2379,37 @@ ```javascript

### tSTypeParameter
```javascript
t.tSTypeParameter(constraint, default)
```
See also `t.isTSTypeParameter(node, opts)` and `t.assertTSTypeParameter(node, opts)`.
- `constraint`: `TSType` (default: `null`)
- `default`: `TSType` (default: `null`)
- `name`: `string` (default: `null`)
---
### tSTypeParameterDeclaration
```javascript
t.tSTypeParameterDeclaration(params)
```
See also `t.isTSTypeParameterDeclaration(node, opts)` and `t.assertTSTypeParameterDeclaration(node, opts)`.
- `params`: `Array<TSTypeParameter>` (required)
---
### tSTypeParameterInstantiation
```javascript
t.tSTypeParameterInstantiation(params)
```
See also `t.isTSTypeParameterInstantiation(node, opts)` and `t.assertTSTypeParameterInstantiation(node, opts)`.
- `params`: `Array<TSType>` (required)
---
### tSTypePredicate

@@ -2379,3 +2425,3 @@ ```javascript

- `parameterName`: `Identifier | TSThisType` (required)
- `typeAnnotation`: `TypeAnnotation` (required)
- `typeAnnotation`: `TSTypeAnnotation` (required)

@@ -2577,3 +2623,3 @@ ---

- `typeAnnotation`: `TSType | Flow` (required)
- `typeAnnotation`: `Flow` (required)

@@ -2598,3 +2644,3 @@ ---

```javascript
t.typeParameter(bound, constraint, default)
t.typeParameter(bound, default)
```

@@ -2607,4 +2653,3 @@

- `bound`: `TypeAnnotation` (default: `null`)
- `constraint`: `TSType` (default: `null`)
- `default`: `TSType | Flow` (default: `null`)
- `default`: `Flow` (default: `null`)
- `name`: `string` (default: `null`)

@@ -2636,3 +2681,3 @@

- `params`: `Array<TSType | Flow>` (required)
- `params`: `Array<Flow>` (required)

@@ -2639,0 +2684,0 @@ ---

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