Commit 762b95bc authored by Cholgrrr's avatar Cholgrrr
Browse files

Merge branch 'New_Structure' of https://gitlab.com/Cholgrrr/m4labplatform into New_Structure

parents 613a2f33 a2e8cafb
......@@ -39,6 +39,12 @@ Object.defineProperty(exports, "DEPRECATED_KEYS", {
return _utils.DEPRECATED_KEYS;
}
});
Object.defineProperty(exports, "NODE_PARENT_VALIDATIONS", {
enumerable: true,
get: function () {
return _utils.NODE_PARENT_VALIDATIONS;
}
});
Object.defineProperty(exports, "PLACEHOLDERS", {
enumerable: true,
get: function () {
......@@ -59,12 +65,10 @@ Object.defineProperty(exports, "PLACEHOLDERS_FLIPPED_ALIAS", {
});
exports.TYPES = void 0;
var _toFastProperties = _interopRequireDefault(require("to-fast-properties"));
var _toFastProperties = require("to-fast-properties");
require("./core");
require("./es2015");
require("./flow");
require("./jsx");
......@@ -79,15 +83,21 @@ var _utils = require("./utils");
var _placeholders = require("./placeholders");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_toFastProperties(_utils.VISITOR_KEYS);
_toFastProperties(_utils.ALIAS_KEYS);
_toFastProperties(_utils.FLIPPED_ALIAS_KEYS);
_toFastProperties(_utils.NODE_FIELDS);
_toFastProperties(_utils.BUILDER_KEYS);
_toFastProperties(_utils.DEPRECATED_KEYS);
_toFastProperties(_placeholders.PLACEHOLDERS_ALIAS);
_toFastProperties(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS);
(0, _toFastProperties.default)(_utils.VISITOR_KEYS);
(0, _toFastProperties.default)(_utils.ALIAS_KEYS);
(0, _toFastProperties.default)(_utils.FLIPPED_ALIAS_KEYS);
(0, _toFastProperties.default)(_utils.NODE_FIELDS);
(0, _toFastProperties.default)(_utils.BUILDER_KEYS);
(0, _toFastProperties.default)(_utils.DEPRECATED_KEYS);
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_ALIAS);
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS);
const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS));
exports.TYPES = TYPES;
\ No newline at end of file
"use strict";
var _utils = _interopRequireWildcard(require("./utils"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _utils = require("./utils");
(0, _utils.default)("JSXAttribute", {
visitor: ["name", "value"],
......@@ -42,6 +38,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
},
children: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
},
selfClosing: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}
}
});
......@@ -108,8 +108,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
},
selfClosing: {
default: false,
validate: (0, _utils.assertValueType)("boolean")
default: false
},
attributes: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXAttribute", "JSXSpreadAttribute")))
......
"use strict";
var _utils = _interopRequireWildcard(require("./utils"));
var _utils = require("./utils");
var _placeholders = require("./placeholders");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
(0, _utils.default)("Noop", {
visitor: []
});
{
(0, _utils.default)("Noop", {
visitor: []
});
}
(0, _utils.default)("Placeholder", {
visitor: [],
builder: ["expectedNode", "name"],
......
......@@ -17,7 +17,7 @@ exports.PLACEHOLDERS_ALIAS = PLACEHOLDERS_ALIAS;
for (const type of PLACEHOLDERS) {
const alias = _utils.ALIAS_KEYS[type];
if (alias && alias.length) PLACEHOLDERS_ALIAS[type] = alias;
if (alias != null && alias.length) PLACEHOLDERS_ALIAS[type] = alias;
}
const PLACEHOLDERS_FLIPPED_ALIAS = {};
......
"use strict";
var _utils = _interopRequireWildcard(require("./utils"));
var _utils = require("./utils");
var _core = require("./core");
var _es = require("./es2015");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const bool = (0, _utils.assertValueType)("boolean");
const tSFunctionTypeAnnotationCommon = {
returnType: {
......@@ -41,11 +35,11 @@ const tSFunctionTypeAnnotationCommon = {
(0, _utils.default)("TSDeclareFunction", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "typeParameters", "params", "returnType"],
fields: Object.assign({}, _core.functionDeclarationCommon, {}, tSFunctionTypeAnnotationCommon)
fields: Object.assign({}, _core.functionDeclarationCommon, tSFunctionTypeAnnotationCommon)
});
(0, _utils.default)("TSDeclareMethod", {
visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, {}, tSFunctionTypeAnnotationCommon)
fields: Object.assign({}, _core.classMethodOrDeclareMethodCommon, tSFunctionTypeAnnotationCommon)
});
(0, _utils.default)("TSQualifiedName", {
aliases: ["TSEntityName"],
......@@ -84,39 +78,49 @@ const namedTypeElementCommon = {
(0, _utils.default)("TSMethodSignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
fields: Object.assign({}, signatureDeclarationCommon, {}, namedTypeElementCommon)
fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon, {
kind: {
validate: (0, _utils.assertOneOf)("method", "get", "set")
}
})
});
(0, _utils.default)("TSIndexSignature", {
aliases: ["TSTypeElement"],
visitor: ["parameters", "typeAnnotation"],
fields: {
readonly: (0, _utils.validateOptional)(bool),
static: (0, _utils.validateOptional)(bool),
parameters: (0, _utils.validateArrayOfType)("Identifier"),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
}
});
const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"];
const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSIntrinsicKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"];
for (const type of tsKeywordTypes) {
(0, _utils.default)(type, {
aliases: ["TSType"],
aliases: ["TSType", "TSBaseType"],
visitor: [],
fields: {}
});
}
(0, _utils.default)("TSThisType", {
aliases: ["TSType"],
aliases: ["TSType", "TSBaseType"],
visitor: [],
fields: {}
});
const fnOrCtr = {
const fnOrCtrBase = {
aliases: ["TSType"],
visitor: ["typeParameters", "parameters", "typeAnnotation"],
fields: signatureDeclarationCommon
visitor: ["typeParameters", "parameters", "typeAnnotation"]
};
(0, _utils.default)("TSFunctionType", fnOrCtr);
(0, _utils.default)("TSConstructorType", fnOrCtr);
(0, _utils.default)("TSFunctionType", Object.assign({}, fnOrCtrBase, {
fields: signatureDeclarationCommon
}));
(0, _utils.default)("TSConstructorType", Object.assign({}, fnOrCtrBase, {
fields: Object.assign({}, signatureDeclarationCommon, {
abstract: (0, _utils.validateOptional)(bool)
})
}));
(0, _utils.default)("TSTypeReference", {
aliases: ["TSType"],
visitor: ["typeName", "typeParameters"],
......@@ -127,11 +131,12 @@ const fnOrCtr = {
});
(0, _utils.default)("TSTypePredicate", {
aliases: ["TSType"],
visitor: ["parameterName", "typeAnnotation", "asserts"],
visitor: ["parameterName", "typeAnnotation"],
builder: ["parameterName", "typeAnnotation", "asserts"],
fields: {
parameterName: (0, _utils.validateType)(["Identifier", "TSThisType"]),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
asserts: (0, _utils.validate)(bool)
asserts: (0, _utils.validateOptional)(bool)
}
});
(0, _utils.default)("TSTypeQuery", {
......@@ -159,7 +164,7 @@ const fnOrCtr = {
aliases: ["TSType"],
visitor: ["elementTypes"],
fields: {
elementTypes: (0, _utils.validateArrayOfType)("TSType")
elementTypes: (0, _utils.validateArrayOfType)(["TSType", "TSNamedTupleMember"])
}
});
(0, _utils.default)("TSOptionalType", {
......@@ -176,6 +181,18 @@ const fnOrCtr = {
typeAnnotation: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSNamedTupleMember", {
visitor: ["label", "elementType"],
builder: ["label", "elementType", "optional"],
fields: {
label: (0, _utils.validateType)("Identifier"),
optional: {
validate: bool,
default: false
},
elementType: (0, _utils.validateType)("TSType")
}
});
const unionOrIntersection = {
aliases: ["TSType"],
visitor: ["types"],
......@@ -227,19 +244,20 @@ const unionOrIntersection = {
});
(0, _utils.default)("TSMappedType", {
aliases: ["TSType"],
visitor: ["typeParameter", "typeAnnotation"],
visitor: ["typeParameter", "typeAnnotation", "nameType"],
fields: {
readonly: (0, _utils.validateOptional)(bool),
typeParameter: (0, _utils.validateType)("TSTypeParameter"),
optional: (0, _utils.validateOptional)(bool),
typeAnnotation: (0, _utils.validateOptionalType)("TSType")
typeAnnotation: (0, _utils.validateOptionalType)("TSType"),
nameType: (0, _utils.validateOptionalType)("TSType")
}
});
(0, _utils.default)("TSLiteralType", {
aliases: ["TSType"],
aliases: ["TSType", "TSBaseType"],
visitor: ["literal"],
fields: {
literal: (0, _utils.validateType)(["NumericLiteral", "StringLiteral", "BooleanLiteral"])
literal: (0, _utils.validateType)(["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral"])
}
});
(0, _utils.default)("TSExpressionWithTypeArguments", {
......
......@@ -17,16 +17,15 @@ exports.assertNodeType = assertNodeType;
exports.assertNodeOrValueType = assertNodeOrValueType;
exports.assertValueType = assertValueType;
exports.assertShape = assertShape;
exports.assertOptionalChainStart = assertOptionalChainStart;
exports.chain = chain;
exports.default = defineType;
exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = void 0;
exports.NODE_PARENT_VALIDATIONS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = void 0;
var _is = _interopRequireDefault(require("../validators/is"));
var _is = require("../validators/is");
var _validate = require("../validators/validate");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const VISITOR_KEYS = {};
exports.VISITOR_KEYS = VISITOR_KEYS;
const ALIAS_KEYS = {};
......@@ -39,14 +38,14 @@ const BUILDER_KEYS = {};
exports.BUILDER_KEYS = BUILDER_KEYS;
const DEPRECATED_KEYS = {};
exports.DEPRECATED_KEYS = DEPRECATED_KEYS;
const NODE_PARENT_VALIDATIONS = {};
exports.NODE_PARENT_VALIDATIONS = NODE_PARENT_VALIDATIONS;
function getType(val) {
if (Array.isArray(val)) {
return "array";
} else if (val === null) {
return "null";
} else if (val === undefined) {
return "undefined";
} else {
return typeof val;
}
......@@ -97,7 +96,10 @@ function assertEach(callback) {
if (!Array.isArray(val)) return;
for (let i = 0; i < val.length; i++) {
callback(node, `${key}[${i}]`, val[i]);
const subkey = `${key}[${i}]`;
const v = val[i];
callback(node, subkey, v);
if (process.env.BABEL_TYPES_8_BREAKING) (0, _validate.validateChild)(node, subkey, v);
}
}
......@@ -118,18 +120,14 @@ function assertOneOf(...values) {
function assertNodeType(...types) {
function validate(node, key, val) {
let valid = false;
for (const type of types) {
if ((0, _is.default)(type, val)) {
valid = true;
break;
(0, _validate.validateChild)(node, key, val);
return;
}
}
if (!valid) {
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`);
}
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`);
}
validate.oneOfNodeTypes = types;
......@@ -138,18 +136,14 @@ function assertNodeType(...types) {
function assertNodeOrValueType(...types) {
function validate(node, key, val) {
let valid = false;
for (const type of types) {
if (getType(val) === type || (0, _is.default)(type, val)) {
valid = true;
break;
(0, _validate.validateChild)(node, key, val);
return;
}
}
if (!valid) {
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} ` + `but instead got ${JSON.stringify(val && val.type)}`);
}
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`);
}
validate.oneOfNodeOrValueTypes = types;
......@@ -195,6 +189,38 @@ function assertShape(shape) {
return validate;
}
function assertOptionalChainStart() {
function validate(node) {
var _current;
let current = node;
while (node) {
const {
type
} = current;
if (type === "OptionalCallExpression") {
if (current.optional) return;
current = current.callee;
continue;
}
if (type === "OptionalMemberExpression") {
if (current.optional) return;
current = current.object;
continue;
}
break;
}
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${(_current = current) == null ? void 0 : _current.type}`);
}
return validate;
}
function chain(...fns) {
function validate(...args) {
for (const fn of fns) {
......@@ -203,16 +229,54 @@ function chain(...fns) {
}
validate.chainOf = fns;
if (fns.length >= 2 && "type" in fns[0] && fns[0].type === "array" && !("each" in fns[1])) {
throw new Error(`An assertValueType("array") validator can only be followed by an assertEach(...) validator.`);
}
return validate;
}
const validTypeOpts = ["aliases", "builder", "deprecatedAlias", "fields", "inherits", "visitor", "validate"];
const validFieldKeys = ["default", "optional", "validate"];
function defineType(type, opts = {}) {
const inherits = opts.inherits && store[opts.inherits] || {};
const fields = opts.fields || inherits.fields || {};
let fields = opts.fields;
if (!fields) {
fields = {};
if (inherits.fields) {
const keys = Object.getOwnPropertyNames(inherits.fields);
for (const key of keys) {
const field = inherits.fields[key];
const def = field.default;
if (Array.isArray(def) ? def.length > 0 : def && typeof def === "object") {
throw new Error("field defaults can only be primitives or empty arrays currently");
}
fields[key] = {
default: Array.isArray(def) ? [] : def,
optional: field.optional,
validate: field.validate
};
}
}
}
const visitor = opts.visitor || inherits.visitor || [];
const aliases = opts.aliases || inherits.aliases || [];
const builder = opts.builder || inherits.builder || opts.visitor || [];
for (const k of Object.keys(opts)) {
if (validTypeOpts.indexOf(k) === -1) {
throw new Error(`Unknown type option "${k}" on ${type}`);
}
}
if (opts.deprecatedAlias) {
DEPRECATED_KEYS[opts.deprecatedAlias] = type;
}
......@@ -224,15 +288,21 @@ function defineType(type, opts = {}) {
for (const key of Object.keys(fields)) {
const field = fields[key];
if (builder.indexOf(key) === -1) {
if (field.default !== undefined && builder.indexOf(key) === -1) {
field.optional = true;
}
if (field.default === undefined) {
field.default = null;
} else if (!field.validate) {
} else if (!field.validate && field.default != null) {
field.validate = assertValueType(getType(field.default));
}
for (const k of Object.keys(field)) {
if (validFieldKeys.indexOf(k) === -1) {
throw new Error(`Unknown field key "${k}" on ${type}.${key}`);
}
}
}
VISITOR_KEYS[type] = opts.visitor = visitor;
......@@ -243,6 +313,11 @@ function defineType(type, opts = {}) {
FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || [];
FLIPPED_ALIAS_KEYS[alias].push(type);
});
if (opts.validate) {
NODE_PARENT_VALIDATIONS[type] = opts.validate;
}
store[type] = opts;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,9 +8,12 @@ var _exportNames = {
assertNode: true,
createTypeAnnotationBasedOnTypeof: true,
createUnionTypeAnnotation: true,
createFlowUnionType: true,
createTSUnionType: true,
cloneNode: true,
clone: true,
cloneDeep: true,
cloneDeepWithoutLoc: true,
cloneWithoutLoc: true,
addComment: true,
addComments: true,
......@@ -74,7 +77,19 @@ Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", {
Object.defineProperty(exports, "createUnionTypeAnnotation", {
enumerable: true,
get: function () {
return _createUnionTypeAnnotation.default;
return _createFlowUnionType.default;
}
});
Object.defineProperty(exports, "createFlowUnionType", {
enumerable: true,
get: function () {
return _createFlowUnionType.default;
}
});
Object.defineProperty(exports, "createTSUnionType", {
enumerable: true,
get: function () {
return _createTSUnionType.default;
}
});
Object.defineProperty(exports, "cloneNode", {
......@@ -95,6 +110,12 @@ Object.defineProperty(exports, "cloneDeep", {
return _cloneDeep.default;
}
});
Object.defineProperty(exports, "cloneDeepWithoutLoc", {
enumerable: true,
get: function () {
return _cloneDeepWithoutLoc.default;
}
});
Object.defineProperty(exports, "cloneWithoutLoc", {
enumerable: true,
get: function () {
......@@ -379,19 +400,20 @@ Object.defineProperty(exports, "buildMatchMemberExpression", {
});
exports.react = void 0;
var _isReactComponent = _interopRequireDefault(require("./validators/react/isReactComponent"));
var _isReactComponent = require("./validators/react/isReactComponent");
var _isCompatTag = _interopRequireDefault(require("./validators/react/isCompatTag"));
var _isCompatTag = require("./validators/react/isCompatTag");
var _buildChildren = _interopRequireDefault(require("./builders/react/buildChildren"));
var _buildChildren = require("./builders/react/buildChildren");
var _assertNode = _interopRequireDefault(require("./asserts/assertNode"));
var _assertNode = require("./asserts/assertNode");
var _generated = require("./asserts/generated");
Object.keys(_generated).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _generated[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
......@@ -400,15 +422,18 @@ Object.keys(_generated).forEach(function (key) {
});
});
var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(require("./builders/flow/createTypeAnnotationBasedOnTypeof"));
var _createTypeAnnotationBasedOnTypeof = require("./builders/flow/createTypeAnnotationBasedOnTypeof");
var _createFlowUnionType = require("./builders/flow/createFlowUnionType");
var _createUnionTypeAnnotation = _interopRequireDefault(require("./builders/flow/createUnionTypeAnnotation"));
var _createTSUnionType = require("./builders/typescript/createTSUnionType");
var _generated2 = require("./builders/generated");
Object.keys(_generated2).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _generated2[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
......@@ -417,33 +442,50 @@ Object.keys(_generated2).forEach(function (key) {
});
});
var _cloneNode = _interopRequireDefault(require("./clone/cloneNode"));
var _uppercase = require("./builders/generated/uppercase");
var _clone = _interopRequireDefault(require("./clone/clone"));
Object.keys(_uppercase).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _uppercase[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _uppercase[key];
}
});
});
var _cloneDeep = _interopRequireDefault(require("./clone/cloneDeep"));
var _cloneNode = require("./clone/cloneNode");
var _cloneWithoutLoc = _interopRequireDefault(require("./clone/cloneWithoutLoc"));
var _clone = require("./clone/clone");
var _addComment = _interopRequireDefault(require("./comments/addComment"));
var _cloneDeep = require("./clone/cloneDeep");
var _addComments = _interopRequireDefault(require("./comments/addComments"));
var _cloneDeepWithoutLoc = require("./clone/cloneDeepWithoutLoc");
var _inheritInnerComments = _interopRequireDefault(require("./comments/inheritInnerComments"));
var _cloneWithoutLoc = require("./clone/cloneWithoutLoc");
var _inheritLeadingComments = _interopRequireDefault(require("./comments/inheritLeadingComments"));
var _addComment = require("./comments/addComment");
var _inheritsComments = _interopRequireDefault(require("./comments/inheritsComments"));
var _addComments = require("./comments/addComments");
var _inheritTrailingComments = _interopRequireDefault(require("./comments/inheritTrailingComments"));
var _inheritInnerComments = require("./comments/inheritInnerComments");
var _removeComments = _interopRequireDefault(require("./comments/removeComments"));
var _inheritLeadingComments = require("./comments/inheritLeadingComments");
var _inheritsComments = require("./comments/inheritsComments");
var _inheritTrailingComments = require("./comments/inheritTrailingComments");
var _removeComments = require("./comments/removeComments");
var _generated3 = require("./constants/generated");
Object.keys(_generated3).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _generated3[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
......@@ -457,6 +499,7 @@ var _constants = require("./constants");
Object.keys(_constants).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _constants[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
......@@ -465,31 +508,32 @@ Object.keys(_constants).forEach(function (key) {
});
});
var _ensureBlock = _interopRequireDefault(require("./converters/ensureBlock"));
var _ensureBlock = require("./converters/ensureBlock");
var _toBindingIdentifierName = _interopRequireDefault(require("./converters/toBindingIdentifierName"));
var _toBindingIdentifierName = require("./converters/toBindingIdentifierName");
var _toBlock = _interopRequireDefault(require("./converters/toBlock"));
var _toBlock = require("./converters/toBlock");
var _toComputedKey = _interopRequireDefault(require("./converters/toComputedKey"));
var _toComputedKey = require("./converters/toComputedKey");
var _toExpression = _interopRequireDefault(require("./converters/toExpression"));
var _toExpression = require("./converters/toExpression");
var _toIdentifier = _interopRequireDefault(require("./converters/toIdentifier"));
var _toIdentifier = require("./converters/toIdentifier");
var _toKeyAlias = _interopRequireDefault(require("./converters/toKeyAlias"));
var _toKeyAlias = require("./converters/toKeyAlias");
var _toSequenceExpression = _interopRequireDefault(require("./converters/toSequenceExpression"));
var _toSequenceExpression = require("./converters/toSequenceExpression");
var _toStatement = _interopRequireDefault(require("./converters/toStatement"));
var _toStatement = require("./converters/toStatement");
var _valueToNode = _interopRequireDefault(require("./converters/valueToNode"));
var _valueToNode = require("./converters/valueToNode");
var _definitions = require("./definitions");
Object.keys(_definitions).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _definitions[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
......@@ -498,69 +542,82 @@ Object.keys(_definitions).forEach(function (key) {
});
});
var _appendToMemberExpression = _interopRequireDefault(require("./modifications/appendToMemberExpression"));
var _appendToMemberExpression = require("./modifications/appendToMemberExpression");
var _inherits = _interopRequireDefault(require("./modifications/inherits"));
var _inherits = require("./modifications/inherits");
var _prependToMemberExpression = _interopRequireDefault(require("./modifications/prependToMemberExpression"));
var _prependToMemberExpression = require("./modifications/prependToMemberExpression");
var _removeProperties = _interopRequireDefault(require("./modifications/removeProperties"));
var _removeProperties = require("./modifications/removeProperties");
var _removePropertiesDeep = _interopRequireDefault(require("./modifications/removePropertiesDeep"));
var _removePropertiesDeep = require("./modifications/removePropertiesDeep");
var _removeTypeDuplicates = _interopRequireDefault(require("./modifications/flow/removeTypeDuplicates"));
var _removeTypeDuplicates = require("./modifications/flow/removeTypeDuplicates");
var _getBindingIdentifiers = _interopRequireDefault(require("./retrievers/getBindingIdentifiers"));
var _getBindingIdentifiers = require("./retrievers/getBindingIdentifiers");
var _getOuterBindingIdentifiers = _interopRequireDefault(require("./retrievers/getOuterBindingIdentifiers"));
var _getOuterBindingIdentifiers = require("./retrievers/getOuterBindingIdentifiers");
var _traverse = _interopRequireDefault(require("./traverse/traverse"));
var _traverse = require("./traverse/traverse");
Object.keys(_traverse).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _traverse[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _traverse[key];
}
});
});
var _traverseFast = _interopRequireDefault(require("./traverse/traverseFast"));
var _traverseFast = require("./traverse/traverseFast");
var _shallowEqual = _interopRequireDefault(require("./utils/shallowEqual"));
var _shallowEqual = require("./utils/shallowEqual");
var _is = _interopRequireDefault(require("./validators/is"));
var _is = require("./validators/is");
var _isBinding = _interopRequireDefault(require("./validators/isBinding"));
var _isBinding = require("./validators/isBinding");
var _isBlockScoped = _interopRequireDefault(require("./validators/isBlockScoped"));
var _isBlockScoped = require("./validators/isBlockScoped");
var _isImmutable = _interopRequireDefault(require("./validators/isImmutable"));
var _isImmutable = require("./validators/isImmutable");
var _isLet = _interopRequireDefault(require("./validators/isLet"));
var _isLet = require("./validators/isLet");
var _isNode = _interopRequireDefault(require("./validators/isNode"));
var _isNode = require("./validators/isNode");
var _isNodesEquivalent = _interopRequireDefault(require("./validators/isNodesEquivalent"));
var _isNodesEquivalent = require("./validators/isNodesEquivalent");
var _isPlaceholderType = _interopRequireDefault(require("./validators/isPlaceholderType"));
var _isPlaceholderType = require("./validators/isPlaceholderType");
var _isReferenced = _interopRequireDefault(require("./validators/isReferenced"));
var _isReferenced = require("./validators/isReferenced");
var _isScope = _interopRequireDefault(require("./validators/isScope"));
var _isScope = require("./validators/isScope");
var _isSpecifierDefault = _interopRequireDefault(require("./validators/isSpecifierDefault"));
var _isSpecifierDefault = require("./validators/isSpecifierDefault");
var _isType = _interopRequireDefault(require("./validators/isType"));
var _isType = require("./validators/isType");
var _isValidES3Identifier = _interopRequireDefault(require("./validators/isValidES3Identifier"));
var _isValidES3Identifier = require("./validators/isValidES3Identifier");
var _isValidIdentifier = _interopRequireDefault(require("./validators/isValidIdentifier"));
var _isValidIdentifier = require("./validators/isValidIdentifier");
var _isVar = _interopRequireDefault(require("./validators/isVar"));
var _isVar = require("./validators/isVar");
var _matchesPattern = _interopRequireDefault(require("./validators/matchesPattern"));
var _matchesPattern = require("./validators/matchesPattern");
var _validate = _interopRequireDefault(require("./validators/validate"));
var _validate = require("./validators/validate");
var _buildMatchMemberExpression = _interopRequireDefault(require("./validators/buildMatchMemberExpression"));
var _buildMatchMemberExpression = require("./validators/buildMatchMemberExpression");
var _generated4 = require("./validators/generated");
Object.keys(_generated4).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _generated4[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
......@@ -569,8 +626,19 @@ Object.keys(_generated4).forEach(function (key) {
});
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _generated5 = require("./ast-types/generated");
Object.keys(_generated5).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _generated5[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated5[key];
}
});
});
const react = {
isReactComponent: _isReactComponent.default,
isCompatTag: _isCompatTag.default,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,6 +7,10 @@ exports.default = removeTypeDuplicates;
var _generated = require("../../validators/generated");
function getQualifiedName(node) {
return (0, _generated.isIdentifier)(node) ? node.name : `${node.id.name}.${getQualifiedName(node.qualification)}`;
}
function removeTypeDuplicates(nodes) {
const generics = {};
const bases = {};
......@@ -40,7 +44,7 @@ function removeTypeDuplicates(nodes) {
}
if ((0, _generated.isGenericTypeAnnotation)(node)) {
const name = node.id.name;
const name = getQualifiedName(node.id);
if (generics[name]) {
let existing = generics[name];
......
......@@ -7,9 +7,7 @@ exports.default = inherits;
var _constants = require("../constants");
var _inheritsComments = _interopRequireDefault(require("../comments/inheritsComments"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _inheritsComments = require("../comments/inheritsComments");
function inherits(child, parent) {
if (!child || !parent) return child;
......
......@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = removePropertiesDeep;
var _traverseFast = _interopRequireDefault(require("../traverse/traverseFast"));
var _traverseFast = require("../traverse/traverseFast");
var _removeProperties = _interopRequireDefault(require("./removeProperties"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _removeProperties = require("./removeProperties");
function removePropertiesDeep(tree, opts) {
(0, _traverseFast.default)(tree, _removeProperties.default, opts);
......
......@@ -28,7 +28,7 @@ function getBindingIdentifiers(node, duplicates, outerOnly) {
continue;
}
if ((0, _generated.isExportDeclaration)(id)) {
if ((0, _generated.isExportDeclaration)(id) && !(0, _generated.isExportAllDeclaration)(id)) {
if ((0, _generated.isDeclaration)(id.declaration)) {
search.push(id.declaration);
}
......
......@@ -3,11 +3,12 @@
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getOuterBindingIdentifiers;
exports.default = void 0;
var _getBindingIdentifiers = _interopRequireDefault(require("./getBindingIdentifiers"));
var _getBindingIdentifiers = require("./getBindingIdentifiers");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = getOuterBindingIdentifiers;
exports.default = _default;
function getOuterBindingIdentifiers(node, duplicates) {
return (0, _getBindingIdentifiers.default)(node, duplicates, true);
......
......@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = inherit;
var _uniq = _interopRequireDefault(require("lodash/uniq"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function inherit(key, child, parent) {
if (child && parent) {
child[key] = (0, _uniq.default)([].concat(child[key], parent[key]).filter(Boolean));
child[key] = Array.from(new Set([].concat(child[key], parent[key]).filter(Boolean)));
}
}
\ No newline at end of file
......@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = buildMatchMemberExpression;
var _matchesPattern = _interopRequireDefault(require("./matchesPattern"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _matchesPattern = require("./matchesPattern");
function buildMatchMemberExpression(match, allowPartial) {
const parts = match.split(".");
......
......@@ -58,8 +58,8 @@ exports.isAssignmentPattern = isAssignmentPattern;
exports.isArrayPattern = isArrayPattern;
exports.isArrowFunctionExpression = isArrowFunctionExpression;
exports.isClassBody = isClassBody;
exports.isClassDeclaration = isClassDeclaration;
exports.isClassExpression = isClassExpression;
exports.isClassDeclaration = isClassDeclaration;
exports.isExportAllDeclaration = isExportAllDeclaration;
exports.isExportDefaultDeclaration = isExportDefaultDeclaration;
exports.isExportNamedDeclaration = isExportNamedDeclaration;
......@@ -78,6 +78,12 @@ exports.isTaggedTemplateExpression = isTaggedTemplateExpression;
exports.isTemplateElement = isTemplateElement;
exports.isTemplateLiteral = isTemplateLiteral;
exports.isYieldExpression = isYieldExpression;
exports.isAwaitExpression = isAwaitExpression;
exports.isImport = isImport;
exports.isBigIntLiteral = isBigIntLiteral;
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier;
exports.isOptionalMemberExpression = isOptionalMemberExpression;
exports.isOptionalCallExpression = isOptionalCallExpression;
exports.isAnyTypeAnnotation = isAnyTypeAnnotation;
exports.isArrayTypeAnnotation = isArrayTypeAnnotation;
exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation;
......@@ -119,6 +125,7 @@ exports.isOpaqueType = isOpaqueType;
exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier;
exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation;
exports.isStringTypeAnnotation = isStringTypeAnnotation;
exports.isSymbolTypeAnnotation = isSymbolTypeAnnotation;
exports.isThisTypeAnnotation = isThisTypeAnnotation;
exports.isTupleTypeAnnotation = isTupleTypeAnnotation;
exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation;
......@@ -140,6 +147,8 @@ exports.isEnumBooleanMember = isEnumBooleanMember;
exports.isEnumNumberMember = isEnumNumberMember;
exports.isEnumStringMember = isEnumStringMember;
exports.isEnumDefaultedMember = isEnumDefaultedMember;
exports.isIndexedAccessType = isIndexedAccessType;
exports.isOptionalIndexedAccessType = isOptionalIndexedAccessType;
exports.isJSXAttribute = isJSXAttribute;
exports.isJSXClosingElement = isJSXClosingElement;
exports.isJSXElement = isJSXElement;
......@@ -159,23 +168,23 @@ exports.isNoop = isNoop;
exports.isPlaceholder = isPlaceholder;
exports.isV8IntrinsicIdentifier = isV8IntrinsicIdentifier;
exports.isArgumentPlaceholder = isArgumentPlaceholder;
exports.isAwaitExpression = isAwaitExpression;
exports.isBindExpression = isBindExpression;
exports.isClassProperty = isClassProperty;
exports.isOptionalMemberExpression = isOptionalMemberExpression;
exports.isPipelineTopicExpression = isPipelineTopicExpression;
exports.isPipelineBareFunction = isPipelineBareFunction;
exports.isPipelinePrimaryTopicReference = isPipelinePrimaryTopicReference;
exports.isOptionalCallExpression = isOptionalCallExpression;
exports.isClassPrivateProperty = isClassPrivateProperty;
exports.isClassPrivateMethod = isClassPrivateMethod;
exports.isImport = isImport;
exports.isImportAttribute = isImportAttribute;
exports.isDecorator = isDecorator;
exports.isDoExpression = isDoExpression;
exports.isExportDefaultSpecifier = isExportDefaultSpecifier;
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier;
exports.isPrivateName = isPrivateName;
exports.isBigIntLiteral = isBigIntLiteral;
exports.isRecordExpression = isRecordExpression;
exports.isTupleExpression = isTupleExpression;
exports.isDecimalLiteral = isDecimalLiteral;
exports.isStaticBlock = isStaticBlock;
exports.isModuleExpression = isModuleExpression;
exports.isTSParameterProperty = isTSParameterProperty;
exports.isTSDeclareFunction = isTSDeclareFunction;
exports.isTSDeclareMethod = isTSDeclareMethod;
......@@ -188,6 +197,7 @@ exports.isTSIndexSignature = isTSIndexSignature;
exports.isTSAnyKeyword = isTSAnyKeyword;
exports.isTSBooleanKeyword = isTSBooleanKeyword;
exports.isTSBigIntKeyword = isTSBigIntKeyword;
exports.isTSIntrinsicKeyword = isTSIntrinsicKeyword;
exports.isTSNeverKeyword = isTSNeverKeyword;
exports.isTSNullKeyword = isTSNullKeyword;
exports.isTSNumberKeyword = isTSNumberKeyword;
......@@ -208,6 +218,7 @@ exports.isTSArrayType = isTSArrayType;
exports.isTSTupleType = isTSTupleType;
exports.isTSOptionalType = isTSOptionalType;
exports.isTSRestType = isTSRestType;
exports.isTSNamedTupleMember = isTSNamedTupleMember;
exports.isTSUnionType = isTSUnionType;
exports.isTSIntersectionType = isTSIntersectionType;
exports.isTSConditionalType = isTSConditionalType;
......@@ -281,14 +292,13 @@ exports.isJSX = isJSX;
exports.isPrivate = isPrivate;
exports.isTSTypeElement = isTSTypeElement;
exports.isTSType = isTSType;
exports.isTSBaseType = isTSBaseType;
exports.isNumberLiteral = isNumberLiteral;
exports.isRegexLiteral = isRegexLiteral;
exports.isRestProperty = isRestProperty;
exports.isSpreadProperty = isSpreadProperty;
var _shallowEqual = _interopRequireDefault(require("../../utils/shallowEqual"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _shallowEqual = require("../../utils/shallowEqual");
function isArrayExpression(node, opts) {
if (!node) return false;
......@@ -1115,11 +1125,11 @@ function isClassBody(node, opts) {
return false;
}
function isClassDeclaration(node, opts) {
function isClassExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassDeclaration") {
if (nodeType === "ClassExpression") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -1130,11 +1140,11 @@ function isClassDeclaration(node, opts) {
return false;
}
function isClassExpression(node, opts) {
function isClassDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassExpression") {
if (nodeType === "ClassDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -1415,6 +1425,96 @@ function isYieldExpression(node, opts) {
return false;
}
function isAwaitExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "AwaitExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImport(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Import") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBigIntLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BigIntLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportNamespaceSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportNamespaceSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isOptionalMemberExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalMemberExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isOptionalCallExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalCallExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isAnyTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
......@@ -2030,6 +2130,21 @@ function isStringTypeAnnotation(node, opts) {
return false;
}
function isSymbolTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "SymbolTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isThisTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
......@@ -2345,6 +2460,36 @@ function isEnumDefaultedMember(node, opts) {
return false;
}
function isIndexedAccessType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "IndexedAccessType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isOptionalIndexedAccessType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalIndexedAccessType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXAttribute(node, opts) {
if (!node) return false;
const nodeType = node.type;
......@@ -2630,11 +2775,11 @@ function isArgumentPlaceholder(node, opts) {
return false;
}
function isAwaitExpression(node, opts) {
function isBindExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "AwaitExpression") {
if (nodeType === "BindExpression") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2645,11 +2790,11 @@ function isAwaitExpression(node, opts) {
return false;
}
function isBindExpression(node, opts) {
function isClassProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BindExpression") {
if (nodeType === "ClassProperty") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2660,11 +2805,11 @@ function isBindExpression(node, opts) {
return false;
}
function isClassProperty(node, opts) {
function isPipelineTopicExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassProperty") {
if (nodeType === "PipelineTopicExpression") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2675,11 +2820,11 @@ function isClassProperty(node, opts) {
return false;
}
function isOptionalMemberExpression(node, opts) {
function isPipelineBareFunction(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalMemberExpression") {
if (nodeType === "PipelineBareFunction") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2690,11 +2835,11 @@ function isOptionalMemberExpression(node, opts) {
return false;
}
function isPipelineTopicExpression(node, opts) {
function isPipelinePrimaryTopicReference(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PipelineTopicExpression") {
if (nodeType === "PipelinePrimaryTopicReference") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2705,11 +2850,11 @@ function isPipelineTopicExpression(node, opts) {
return false;
}
function isPipelineBareFunction(node, opts) {
function isClassPrivateProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PipelineBareFunction") {
if (nodeType === "ClassPrivateProperty") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2720,11 +2865,11 @@ function isPipelineBareFunction(node, opts) {
return false;
}
function isPipelinePrimaryTopicReference(node, opts) {
function isClassPrivateMethod(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PipelinePrimaryTopicReference") {
if (nodeType === "ClassPrivateMethod") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2735,11 +2880,11 @@ function isPipelinePrimaryTopicReference(node, opts) {
return false;
}
function isOptionalCallExpression(node, opts) {
function isImportAttribute(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalCallExpression") {
if (nodeType === "ImportAttribute") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2750,11 +2895,11 @@ function isOptionalCallExpression(node, opts) {
return false;
}
function isClassPrivateProperty(node, opts) {
function isDecorator(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassPrivateProperty") {
if (nodeType === "Decorator") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2765,11 +2910,11 @@ function isClassPrivateProperty(node, opts) {
return false;
}
function isClassPrivateMethod(node, opts) {
function isDoExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassPrivateMethod") {
if (nodeType === "DoExpression") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2780,11 +2925,11 @@ function isClassPrivateMethod(node, opts) {
return false;
}
function isImport(node, opts) {
function isExportDefaultSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Import") {
if (nodeType === "ExportDefaultSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2795,11 +2940,11 @@ function isImport(node, opts) {
return false;
}
function isDecorator(node, opts) {
function isPrivateName(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Decorator") {
if (nodeType === "PrivateName") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2810,11 +2955,11 @@ function isDecorator(node, opts) {
return false;
}
function isDoExpression(node, opts) {
function isRecordExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DoExpression") {
if (nodeType === "RecordExpression") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2825,11 +2970,11 @@ function isDoExpression(node, opts) {
return false;
}
function isExportDefaultSpecifier(node, opts) {
function isTupleExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportDefaultSpecifier") {
if (nodeType === "TupleExpression") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2840,11 +2985,11 @@ function isExportDefaultSpecifier(node, opts) {
return false;
}
function isExportNamespaceSpecifier(node, opts) {
function isDecimalLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportNamespaceSpecifier") {
if (nodeType === "DecimalLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2855,11 +3000,11 @@ function isExportNamespaceSpecifier(node, opts) {
return false;
}
function isPrivateName(node, opts) {
function isStaticBlock(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PrivateName") {
if (nodeType === "StaticBlock") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -2870,11 +3015,11 @@ function isPrivateName(node, opts) {
return false;
}
function isBigIntLiteral(node, opts) {
function isModuleExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BigIntLiteral") {
if (nodeType === "ModuleExpression") {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3065,6 +3210,21 @@ function isTSBigIntKeyword(node, opts) {
return false;
}
function isTSIntrinsicKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSIntrinsicKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSNeverKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
......@@ -3365,6 +3525,21 @@ function isTSRestType(node, opts) {
return false;
}
function isTSNamedTupleMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSNamedTupleMember") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSUnionType(node, opts) {
if (!node) return false;
const nodeType = node.type;
......@@ -3804,7 +3979,7 @@ function isExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ParenthesizedExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || nodeType === "Placeholder" && ("Expression" === node.expectedNode || "Identifier" === node.expectedNode || "StringLiteral" === node.expectedNode)) {
if ("ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ParenthesizedExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType || "Import" === nodeType || "BigIntLiteral" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "BindExpression" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "DoExpression" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType || "DecimalLiteral" === nodeType || "ModuleExpression" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || nodeType === "Placeholder" && ("Expression" === node.expectedNode || "Identifier" === node.expectedNode || "StringLiteral" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3819,7 +3994,7 @@ function isBinary(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) {
if ("BinaryExpression" === nodeType || "LogicalExpression" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3834,7 +4009,7 @@ function isScopable(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if ("BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "ClassDeclaration" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3849,7 +4024,7 @@ function isBlockParent(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if ("BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "StaticBlock" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3864,7 +4039,7 @@ function isBlock(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if ("BlockStatement" === nodeType || "Program" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3879,7 +4054,7 @@ function isStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType || nodeType === "Placeholder" && ("Statement" === node.expectedNode || "Declaration" === node.expectedNode || "BlockStatement" === node.expectedNode)) {
if ("BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType || nodeType === "Placeholder" && ("Statement" === node.expectedNode || "Declaration" === node.expectedNode || "BlockStatement" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3894,7 +4069,7 @@ function isTerminatorless(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) {
if ("BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3909,7 +4084,7 @@ function isCompletionStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) {
if ("BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3924,7 +4099,7 @@ function isConditional(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) {
if ("ConditionalExpression" === nodeType || "IfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3939,7 +4114,7 @@ function isLoop(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) {
if ("DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3954,7 +4129,7 @@ function isWhile(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) {
if ("DoWhileStatement" === nodeType || "WhileStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3969,7 +4144,7 @@ function isExpressionWrapper(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "ParenthesizedExpression" === nodeType || "TypeCastExpression" === nodeType) {
if ("ExpressionStatement" === nodeType || "ParenthesizedExpression" === nodeType || "TypeCastExpression" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3984,7 +4159,7 @@ function isFor(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) {
if ("ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -3999,7 +4174,7 @@ function isForXStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) {
if ("ForInStatement" === nodeType || "ForOfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4014,7 +4189,7 @@ function isFunction(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4029,7 +4204,7 @@ function isFunctionParent(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4044,7 +4219,7 @@ function isPureish(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType || "BigIntLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4059,7 +4234,7 @@ function isDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || nodeType === "Placeholder" && "Declaration" === node.expectedNode) {
if ("FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || nodeType === "Placeholder" && "Declaration" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4074,7 +4249,7 @@ function isPatternLike(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
if ("Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4089,7 +4264,7 @@ function isLVal(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
if ("Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4104,7 +4279,7 @@ function isTSEntityName(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType || nodeType === "Placeholder" && "Identifier" === node.expectedNode) {
if ("Identifier" === nodeType || "TSQualifiedName" === nodeType || nodeType === "Placeholder" && "Identifier" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4119,7 +4294,7 @@ function isLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4134,7 +4309,7 @@ function isImmutable(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "BigIntLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "DecimalLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4149,7 +4324,7 @@ function isUserWhitespacable(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) {
if ("ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4164,7 +4339,7 @@ function isMethod(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if ("ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4179,7 +4354,7 @@ function isObjectMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) {
if ("ObjectMethod" === nodeType || "ObjectProperty" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4194,7 +4369,7 @@ function isProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) {
if ("ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4209,7 +4384,7 @@ function isUnaryLike(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) {
if ("UnaryExpression" === nodeType || "SpreadElement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4224,7 +4399,7 @@ function isPattern(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && "Pattern" === node.expectedNode) {
if ("AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && "Pattern" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4239,7 +4414,7 @@ function isClass(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Class" || "ClassDeclaration" === nodeType || "ClassExpression" === nodeType) {
if ("ClassExpression" === nodeType || "ClassDeclaration" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4254,7 +4429,7 @@ function isModuleDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) {
if ("ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4269,7 +4444,7 @@ function isExportDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) {
if ("ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4284,7 +4459,7 @@ function isModuleSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) {
if ("ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4299,7 +4474,7 @@ function isFlow(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) {
if ("AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType || "IndexedAccessType" === nodeType || "OptionalIndexedAccessType" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4314,7 +4489,7 @@ function isFlowType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
if ("AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType || "IndexedAccessType" === nodeType || "OptionalIndexedAccessType" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4329,7 +4504,7 @@ function isFlowBaseAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
if ("AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4344,7 +4519,7 @@ function isFlowDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) {
if ("DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4359,7 +4534,7 @@ function isFlowPredicate(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) {
if ("DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4374,7 +4549,7 @@ function isEnumBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumBody" || "EnumBooleanBody" === nodeType || "EnumNumberBody" === nodeType || "EnumStringBody" === nodeType || "EnumSymbolBody" === nodeType) {
if ("EnumBooleanBody" === nodeType || "EnumNumberBody" === nodeType || "EnumStringBody" === nodeType || "EnumSymbolBody" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4389,7 +4564,7 @@ function isEnumMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumMember" || "EnumBooleanMember" === nodeType || "EnumNumberMember" === nodeType || "EnumStringMember" === nodeType || "EnumDefaultedMember" === nodeType) {
if ("EnumBooleanMember" === nodeType || "EnumNumberMember" === nodeType || "EnumStringMember" === nodeType || "EnumDefaultedMember" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4404,7 +4579,7 @@ function isJSX(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) {
if ("JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4419,7 +4594,7 @@ function isPrivate(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) {
if ("ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4434,7 +4609,7 @@ function isTSTypeElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) {
if ("TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......@@ -4449,7 +4624,22 @@ function isTSType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType || "TSImportType" === nodeType) {
if ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType || "TSImportType" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSBaseType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSLiteralType" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
......
......@@ -5,16 +5,14 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = is;
var _shallowEqual = _interopRequireDefault(require("../utils/shallowEqual"));
var _shallowEqual = require("../utils/shallowEqual");
var _isType = _interopRequireDefault(require("./isType"));
var _isType = require("./isType");
var _isPlaceholderType = _interopRequireDefault(require("./isPlaceholderType"));
var _isPlaceholderType = require("./isPlaceholderType");
var _definitions = require("../definitions");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function is(type, node, opts) {
if (!node) return false;
const matches = (0, _isType.default)(node.type, type);
......
......@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = isBinding;
var _getBindingIdentifiers = _interopRequireDefault(require("../retrievers/getBindingIdentifiers"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _getBindingIdentifiers = require("../retrievers/getBindingIdentifiers");
function isBinding(node, parent, grandparent) {
if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") {
......
......@@ -7,9 +7,7 @@ exports.default = isBlockScoped;
var _generated = require("./generated");
var _isLet = _interopRequireDefault(require("./isLet"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _isLet = require("./isLet");
function isBlockScoped(node) {
return (0, _generated.isFunctionDeclaration)(node) || (0, _generated.isClassDeclaration)(node) || (0, _isLet.default)(node);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment