Socket
Socket
Sign inDemoInstall

@babel/types

Package Overview
Dependencies
3
Maintainers
4
Versions
160
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0-beta.34 to 7.0.0-beta.35

scripts/utils/formatBuilderName.js

2

lib/asserts/generated/index.js

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

if (!(0, _is.default)(type, node, opts)) {
throw new Error("Expected type \"" + type + "\" with option " + JSON.stringify(opts));
throw new Error("Expected type \"" + type + "\" with option " + JSON.stringify(opts) + ", but instead got \"" + node.type + "\".");
}

@@ -260,0 +260,0 @@ }

"use strict";
exports.__esModule = true;
exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionCommon = void 0;
exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionTypeAnnotationCommon = exports.functionCommon = void 0;

@@ -114,3 +114,3 @@ var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier"));

typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
optional: true

@@ -241,3 +241,6 @@ }

default: false
},
}
};
exports.functionCommon = functionCommon;
var functionTypeAnnotationCommon = {
returnType: {

@@ -248,7 +251,7 @@ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),

typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "Noop"),
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true
}
};
exports.functionCommon = functionCommon;
exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon;
var functionDeclarationCommon = Object.assign({}, functionCommon, {

@@ -268,3 +271,3 @@ declare: {

visitor: ["id", "params", "body", "returnType", "typeParameters"],
fields: Object.assign({}, functionDeclarationCommon, {
fields: Object.assign({}, functionDeclarationCommon, functionTypeAnnotationCommon, {
body: {

@@ -279,3 +282,3 @@ validate: (0, _utils.assertNodeType)("BlockStatement")

aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, functionCommon, {
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
id: {

@@ -467,3 +470,3 @@ validate: (0, _utils.assertNodeType)("Identifier"),

builder: ["kind", "key", "params", "body", "computed"],
fields: Object.assign({}, functionCommon, {
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
kind: {

@@ -470,0 +473,0 @@ validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("method", "get", "set")),

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

aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, _core.functionCommon, {
fields: Object.assign({}, _core.functionCommon, _core.functionTypeAnnotationCommon, {
expression: {

@@ -65,3 +65,3 @@ validate: (0, _utils.assertValueType)("boolean")

typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "Noop"),
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true

@@ -77,3 +77,3 @@ },

superTypeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
optional: true

@@ -305,3 +305,3 @@ },

visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
fields: Object.assign({}, classMethodOrDeclareMethodCommon, {
fields: Object.assign({}, classMethodOrDeclareMethodCommon, _core.functionTypeAnnotationCommon, {
body: {

@@ -308,0 +308,0 @@ validate: (0, _utils.assertNodeType)("BlockStatement")

@@ -53,2 +53,12 @@ "use strict";

var tSFunctionTypeAnnotationCommon = {
returnType: {
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
optional: true
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
optional: true
}
};
(0, _utils.default)("TSParameterProperty", {

@@ -74,7 +84,7 @@ aliases: ["LVal"],

visitor: ["id", "typeParameters", "params", "returnType"],
fields: _core.functionDeclarationCommon
fields: Object.assign({}, _core.functionDeclarationCommon, tSFunctionTypeAnnotationCommon)
});
(0, _utils.default)("TSDeclareMethod", {
visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
fields: _es.classMethodOrDeclareMethodCommon
fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, tSFunctionTypeAnnotationCommon)
});

@@ -90,3 +100,3 @@ (0, _utils.default)("TSQualifiedName", {

var signatureDeclarationCommon = {
typeParameters: validateOptionalType("TypeParameterDeclaration"),
typeParameters: validateOptionalType("TSTypeParameterDeclaration"),
parameters: validateArrayOfType(["Identifier", "RestElement"]),

@@ -158,3 +168,3 @@ typeAnnotation: validateOptionalType("TSTypeAnnotation")

typeName: validateType("TSEntityName"),
typeParameters: validateOptionalType("TypeParameterInstantiation")
typeParameters: validateOptionalType("TSTypeParameterInstantiation")
}

@@ -235,3 +245,3 @@ });

readonly: validateOptional(bool),
typeParameter: validateType("TypeParameter"),
typeParameter: validateType("TSTypeParameter"),
optional: validateOptional(bool),

@@ -253,3 +263,3 @@ typeAnnotation: validateOptionalType("TSType")

expression: validateType("TSEntityName"),
typeParameters: validateOptionalType("TypeParameterInstantiation")
typeParameters: validateOptionalType("TSTypeParameterInstantiation")
}

@@ -263,3 +273,3 @@ });

id: validateType("Identifier"),
typeParameters: validateOptionalType("TypeParameterDeclaration"),
typeParameters: validateOptionalType("TSTypeParameterDeclaration"),
extends: validateOptional(arrayOfType("TSExpressionWithTypeArguments")),

@@ -281,3 +291,3 @@ body: validateType("TSInterfaceBody")

id: validateType("Identifier"),
typeParameters: validateOptionalType("TypeParameterDeclaration"),
typeParameters: validateOptionalType("TSTypeParameterDeclaration"),
typeAnnotation: validateType("TSType")

@@ -284,0 +294,0 @@ }

{
"name": "@babel/types",
"version": "7.0.0-beta.34",
"version": "7.0.0-beta.35",
"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.34",
"babylon": "7.0.0-beta.34"
"@babel/generator": "7.0.0-beta.35",
"babylon": "7.0.0-beta.35"
}
}

@@ -83,3 +83,3 @@ # @babel/types

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

@@ -237,3 +237,3 @@ ---

- `optional`: `true | false` (default: `null`)
- `typeParameters`: `TypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`)

@@ -284,4 +284,4 @@ ---

- `mixins` (default: `null`)
- `superTypeParameters`: `TypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | Noop` (default: `null`)
- `superTypeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`)

@@ -305,4 +305,4 @@ ---

- `mixins` (default: `null`)
- `superTypeParameters`: `TypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | Noop` (default: `null`)
- `superTypeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TypeParameterDeclaration | TSTypeParameterDeclaration | Noop` (default: `null`)

@@ -348,3 +348,3 @@ ---

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

@@ -837,3 +837,3 @@ ---

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

@@ -857,3 +857,3 @@ ---

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

@@ -1344,3 +1344,3 @@ ---

- `optional`: `true | false` (default: `null`)
- `typeParameters`: `TypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TypeParameterInstantiation | TSTypeParameterInstantiation` (default: `null`)

@@ -1464,3 +1464,3 @@ ---

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

@@ -1833,3 +1833,3 @@ ---

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

@@ -1849,3 +1849,3 @@ - `typeAnnotation`: `TSTypeAnnotation` (default: `null`)

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

@@ -1865,3 +1865,3 @@ - `typeAnnotation`: `TSTypeAnnotation` (default: `null`)

- `typeParameters`: `TypeParameterDeclaration` (default: `null`)
- `typeParameters`: `TSTypeParameterDeclaration` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)

@@ -1882,5 +1882,5 @@ - `parameters`: `Array<Identifier | RestElement>` (default: `null`)

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

@@ -1901,5 +1901,5 @@ - `declare`: `boolean` (default: `null`)

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

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

- `expression`: `TSEntityName` (required)
- `typeParameters`: `TypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TSTypeParameterInstantiation` (default: `null`)

@@ -1994,3 +1994,3 @@ ---

- `typeParameters`: `TypeParameterDeclaration` (default: `null`)
- `typeParameters`: `TSTypeParameterDeclaration` (default: `null`)
- `typeAnnotation`: `TSTypeAnnotation` (default: `null`)

@@ -2066,3 +2066,3 @@ - `parameters`: `Array<Identifier | RestElement>` (default: `null`)

- `id`: `Identifier` (required)
- `typeParameters`: `TypeParameterDeclaration` (default: `null`)
- `typeParameters`: `TSTypeParameterDeclaration` (default: `null`)
- `extends`: `Array<TSExpressionWithTypeArguments>` (default: `null`)

@@ -2109,3 +2109,3 @@ - `body`: `TSInterfaceBody` (required)

- `typeParameter`: `TypeParameter` (required)
- `typeParameter`: `TSTypeParameter` (required)
- `typeAnnotation`: `TSType` (default: `null`)

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

- `key`: `Expression` (required)
- `typeParameters`: `TypeParameterDeclaration` (default: `null`)
- `typeParameters`: `TSTypeParameterDeclaration` (default: `null`)
- `parameters`: `Array<Identifier | RestElement>` (default: `null`)

@@ -2356,3 +2356,3 @@ - `typeAnnotation`: `TSTypeAnnotation` (default: `null`)

- `id`: `Identifier` (required)
- `typeParameters`: `TypeParameterDeclaration` (default: `null`)
- `typeParameters`: `TSTypeParameterDeclaration` (default: `null`)
- `typeAnnotation`: `TSType` (required)

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

- `typeName`: `TSEntityName` (required)
- `typeParameters`: `TypeParameterInstantiation` (default: `null`)
- `typeParameters`: `TSTypeParameterInstantiation` (default: `null`)

@@ -2490,0 +2490,0 @@ ---

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

throw new Error(
\`Expected type "\${type}" with option \${JSON.stringify(opts)}\`,
\`Expected type "\${type}" with option \${JSON.stringify(opts)}, but instead got "\${node.type}".\`,
);

@@ -24,0 +24,0 @@ }

"use strict";
const definitions = require("../../lib/definitions");
const formatBuilderName = require("../utils/formatBuilderName");
const lowerFirst = require("../utils/lowerFirst");

@@ -15,3 +16,10 @@

output += `export function ${type}(...args: Array<any>): Object { return builder("${type}", ...args); }
export { ${type} as ${lowerFirst(type)} };\n`;
export { ${type} as ${formatBuilderName(type)} };\n`;
// This is needed for backwards compatibility.
// It should be removed in the next major version.
// JSXIdentifier -> jSXIdentifier
if (/^[A-Z]{2}/.test(type)) {
output += `export { ${type} as ${lowerFirst(type)} }\n`;
}
});

@@ -25,3 +33,10 @@

}
export { ${type} as ${lowerFirst(type)} };\n`;
export { ${type} as ${formatBuilderName(type)} };\n`;
// This is needed for backwards compatibility.
// It should be removed in the next major version.
// JSXIdentifier -> jSXIdentifier
if (/^[A-Z]{2}/.test(type)) {
output += `export { ${type} as ${lowerFirst(type)} }\n`;
}
});

@@ -28,0 +43,0 @@

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc