repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/typescript-legacy.ts | packages/babel-types/scripts/generators/typescript-legacy.ts | // @ts-expect-error: Could not find type declarations for babel-types
import * as t from "../../lib/index.js";
import formatBuilderName from "../utils/formatBuilderName.ts";
import stringifyValidator from "../utils/stringifyValidator.ts";
import {
areAllRemainingFieldsNullable,
isNullable,
hasDefault,
sortField... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/builders.ts | packages/babel-types/scripts/generators/builders.ts | // @ts-expect-error: Could not find type declarations for babel-types
import * as _t from "../../lib/index.js";
import formatBuilderName from "../utils/formatBuilderName.ts";
import stringifyValidator from "../utils/stringifyValidator.ts";
import {
areAllRemainingFieldsNullable,
isNullable,
hasDefault,
sortFiel... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/ast-types.ts | packages/babel-types/scripts/generators/ast-types.ts | // @ts-expect-error: Could not find type declarations for babel-types
import * as _t from "../../lib/index.js";
import {
isNullable,
hasDefault,
sortFieldNames,
} from "../utils/fieldHelpers.ts";
import stringifyValidator, {
isValueType,
} from "../utils/stringifyValidator.ts";
import type { FieldOptions, Valid... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/constants.ts | packages/babel-types/scripts/generators/constants.ts | // @ts-expect-error: Could not find type declarations for babel-types
import { DEPRECATED_ALIASES, FLIPPED_ALIAS_KEYS } from "../../lib/index.js";
export default function generateConstants() {
let output = `/*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
import { ... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/validators.ts | packages/babel-types/scripts/generators/validators.ts | import {
DEPRECATED_ALIASES,
DEPRECATED_KEYS,
FLIPPED_ALIAS_KEYS,
NODE_FIELDS,
PLACEHOLDERS,
PLACEHOLDERS_FLIPPED_ALIAS,
VISITOR_KEYS,
// @ts-expect-error: Could not find type declarations for babel-types
} from "../../lib/index.js";
function buildCases(arr: string[]) {
return arr.map(key => `case ${... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/flow.ts | packages/babel-types/scripts/generators/flow.ts | // @ts-expect-error: Could not find type declarations for babel-types
import * as t from "../../lib/index.js";
import formatBuilderName from "../utils/formatBuilderName.ts";
import stringifyValidator from "../utils/stringifyValidator.ts";
import type { FieldOptions } from "../../src/definitions/utils.ts";
const NODE_P... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/docs.ts | packages/babel-types/scripts/generators/docs.ts | import util from "node:util";
import formatBuilderName from "../utils/formatBuilderName.ts";
import stringifyValidator from "../utils/stringifyValidator.ts";
// @ts-expect-error: Could not find type declarations for babel-types
import * as t from "../../lib/index.js";
import type { FieldOptions } from "../../src/defini... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/generators/asserts.ts | packages/babel-types/scripts/generators/asserts.ts | import {
DEPRECATED_KEYS,
DEPRECATED_ALIASES,
FLIPPED_ALIAS_KEYS,
NODE_FIELDS,
VISITOR_KEYS,
// @ts-expect-error: Could not find type declarations for babel-types
} from "../../lib/index.js";
/**
* Generate an assert helper for a given type.
* @param type Node type or alias type
*/
function addAssertHel... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/utils/fieldHelpers.ts | packages/babel-types/scripts/utils/fieldHelpers.ts | // @ts-expect-error: Could not find type declarations for babel-types
import { BUILDER_KEYS } from "../../lib/index.js";
import type { FieldOptions } from "../../src/index.ts";
/**
* Check if all fields after the given field name are nullable.
* @param {string} fieldName
* @param {string[]} fieldNames
* @param {Re... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/utils/formatBuilderName.ts | packages/babel-types/scripts/utils/formatBuilderName.ts | /**
* Format a node type to its corresponding builder name.
* @param {string} type
* @returns {string}
*/
export default function formatBuilderName(type: string): string {
// FunctionExpression -> functionExpression
// JSXIdentifier -> jsxIdentifier
// V8IntrinsicIdentifier -> v8IntrinsicIdentifier
return t... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/scripts/utils/stringifyValidator.ts | packages/babel-types/scripts/utils/stringifyValidator.ts | import type { Validator } from "../../src/definitions/utils.ts";
/**
* Stringify a validator to its corresponding TypeScript type.
* @param {Validator | undefined} validator
* @param {string} nodePrefix
* @returns {string}
*/
export default function stringifyValidator(
validator: Validator | undefined,
nodePre... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/index.ts | packages/babel-types/src/index.ts | import isReactComponent from "./validators/react/isReactComponent.ts";
import isCompatTag from "./validators/react/isCompatTag.ts";
import buildChildren from "./builders/react/buildChildren.ts";
// asserts
export { default as assertNode } from "./asserts/assertNode.ts";
export * from "./asserts/generated/index.ts";
/... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/toKeyAlias.ts | packages/babel-types/src/converters/toKeyAlias.ts | import {
isIdentifier,
isStringLiteral,
} from "../validators/generated/index.ts";
import cloneNode from "../clone/cloneNode.ts";
import removePropertiesDeep from "../modifications/removePropertiesDeep.ts";
import type * as t from "../index.ts";
export default function toKeyAlias(
node: t.Method | t.Property,
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/toComputedKey.ts | packages/babel-types/src/converters/toComputedKey.ts | import { isIdentifier } from "../validators/generated/index.ts";
import { stringLiteral } from "../builders/generated/index.ts";
import type * as t from "../index.ts";
export default function toComputedKey(
node:
| t.ObjectMember
| t.ObjectProperty
| t.ClassMethod
| t.ClassProperty
| t.ClassAcces... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/toExpression.ts | packages/babel-types/src/converters/toExpression.ts | import {
isExpression,
isFunction,
isClass,
isExpressionStatement,
} from "../validators/generated/index.ts";
import type * as t from "../index.ts";
export default toExpression as {
(node: t.Function): t.FunctionExpression;
(node: t.Class): t.ClassExpression;
(
node: t.ExpressionStatement | t.Express... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/toIdentifier.ts | packages/babel-types/src/converters/toIdentifier.ts | import isValidIdentifier from "../validators/isValidIdentifier.ts";
import { isIdentifierChar } from "@babel/helper-validator-identifier";
export default function toIdentifier(input: string): string {
input = input + "";
// replace all non-valid identifiers with dashes
let name = "";
for (const c of input) {
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/toStatement.ts | packages/babel-types/src/converters/toStatement.ts | import {
isStatement,
isFunction,
isClass,
isAssignmentExpression,
} from "../validators/generated/index.ts";
import { expressionStatement } from "../builders/generated/index.ts";
import type * as t from "../index.ts";
export default toStatement as {
(node: t.AssignmentExpression, ignore?: boolean): t.Expres... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/toBindingIdentifierName.ts | packages/babel-types/src/converters/toBindingIdentifierName.ts | import toIdentifier from "./toIdentifier.ts";
export default function toBindingIdentifierName(name: string): string {
name = toIdentifier(name);
if (name === "eval" || name === "arguments") name = "_" + name;
return name;
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/toBlock.ts | packages/babel-types/src/converters/toBlock.ts | import {
isBlockStatement,
isFunction,
isEmptyStatement,
isStatement,
} from "../validators/generated/index.ts";
import {
returnStatement,
expressionStatement,
blockStatement,
} from "../builders/generated/index.ts";
import type * as t from "../index.ts";
export default function toBlock(
node: t.Statem... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/valueToNode.ts | packages/babel-types/src/converters/valueToNode.ts | import isValidIdentifier from "../validators/isValidIdentifier.ts";
import {
identifier,
booleanLiteral,
nullLiteral,
stringLiteral,
numericLiteral,
bigIntLiteral,
regExpLiteral,
arrayExpression,
objectProperty,
objectExpression,
unaryExpression,
binaryExpression,
} from "../builders/generated/i... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/converters/ensureBlock.ts | packages/babel-types/src/converters/ensureBlock.ts | import toBlock from "./toBlock.ts";
import type * as t from "../index.ts";
/**
* Ensure the `key` (defaults to "body") of a `node` is a block.
* Casting it to a block if it is not.
*
* Returns the BlockStatement
*/
export default function ensureBlock(
node: t.Node,
key: string = "body",
): t.BlockStatement {
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/traverse/traverseFast.ts | packages/babel-types/src/traverse/traverseFast.ts | import { VISITOR_KEYS } from "../definitions/index.ts";
import type * as t from "../index.ts";
const _skip = Symbol();
const _stop = Symbol();
/**
* A prefix AST traversal implementation meant for simple searching and processing.
* @param enter The callback can return `traverseFast.skip` to skip the subtree of the ... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/traverse/traverse.ts | packages/babel-types/src/traverse/traverse.ts | import { VISITOR_KEYS } from "../definitions/index.ts";
import type * as t from "../index.ts";
export type TraversalAncestors = {
node: t.Node;
key: string;
index?: number;
}[];
export type TraversalHandler<T> = (
this: undefined,
node: t.Node,
parent: TraversalAncestors,
state: T,
) => void;
export ty... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/experimental.ts | packages/babel-types/src/definitions/experimental.ts | import defineType, { assertNodeType, assertValueType } from "./utils.ts";
defineType("ArgumentPlaceholder", {});
defineType("BindExpression", {
visitor: ["object", "callee"],
aliases: ["Expression"],
fields: {
object: {
validate: assertNodeType("Expression"),
},
callee: {
validate: asser... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/jsx.ts | packages/babel-types/src/definitions/jsx.ts | import {
defineAliasedType,
assertNodeType,
assertValueType,
validateArrayOfType,
} from "./utils.ts";
const defineType = defineAliasedType("JSX");
defineType("JSXAttribute", {
visitor: ["name", "value"],
aliases: ["Immutable"],
fields: {
name: {
validate: assertNodeType("JSXIdentifier", "JSXN... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/placeholders.ts | packages/babel-types/src/definitions/placeholders.ts | import { ALIAS_KEYS } from "./utils.ts";
export const PLACEHOLDERS = [
"Identifier",
"StringLiteral",
"Expression",
"Statement",
"Declaration",
"BlockStatement",
"ClassBody",
"Pattern",
] as const;
export const PLACEHOLDERS_ALIAS: Record<string, string[]> = {
Declaration: ["Statement"],
Pattern: [... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/utils.ts | packages/babel-types/src/definitions/utils.ts | import is from "../validators/is.ts";
import { validateField, validateChild } from "../validators/validate.ts";
import type * as t from "../index.ts";
export const VISITOR_KEYS: Record<string, string[]> = {};
export const ALIAS_KEYS: Partial<Record<NodeTypesWithoutComment, string[]>> =
{};
export const FLIPPED_ALIAS... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/typescript.ts | packages/babel-types/src/definitions/typescript.ts | import type * as t from "../index.ts";
import {
defineAliasedType,
arrayOfType,
assertEach,
assertNodeType,
assertOneOf,
assertValueType,
chain,
validateArrayOfType,
validateOptional,
validateOptionalType,
validateType,
type ValidatorImpl,
type ValidatorOneOfNodeTypes,
} from "./utils.ts";
imp... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/flow.ts | packages/babel-types/src/definitions/flow.ts | import { importAttributes } from "./core.ts";
import {
defineAliasedType,
arrayOfType,
assertOneOf,
assertValueType,
validate,
validateArrayOfType,
validateOptional,
validateOptionalType,
validateType,
} from "./utils.ts";
const defineType = defineAliasedType("Flow");
const defineInterfaceishType = ... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/misc.ts | packages/babel-types/src/definitions/misc.ts | import {
defineAliasedType,
assertNodeType,
assertOneOf,
assertValueType,
} from "./utils.ts";
import { PLACEHOLDERS } from "./placeholders.ts";
import { patternLikeCommon } from "./core.ts";
const defineType = defineAliasedType("Miscellaneous");
defineType("Placeholder", {
visitor: [],
builder: ["expecte... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/index.ts | packages/babel-types/src/definitions/index.ts | import "./core.ts";
import "./flow.ts";
import "./jsx.ts";
import "./misc.ts";
import "./experimental.ts";
import "./typescript.ts";
import {
VISITOR_KEYS,
ALIAS_KEYS,
FLIPPED_ALIAS_KEYS,
NODE_FIELDS,
BUILDER_KEYS,
DEPRECATED_KEYS,
NODE_PARENT_VALIDATIONS,
NODE_UNION_SHAPES__PRIVATE,
allExpandedTypes,... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/core.ts | packages/babel-types/src/definitions/core.ts | import is from "../validators/is.ts";
import isValidIdentifier from "../validators/isValidIdentifier.ts";
import { isKeyword, isReservedWord } from "@babel/helper-validator-identifier";
import type * as t from "../index.ts";
import { readStringContents } from "@babel/helper-string-parser";
import {
BINARY_OPERATORS,... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | true |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/definitions/deprecated-aliases.ts | packages/babel-types/src/definitions/deprecated-aliases.ts | export const DEPRECATED_ALIASES = {
ModuleDeclaration: "ImportOrExportDeclaration",
};
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isType.ts | packages/babel-types/src/validators/isType.ts | import { FLIPPED_ALIAS_KEYS, ALIAS_KEYS } from "../definitions/index.ts";
import type * as t from "../index.ts";
export default function isType<T extends t.Node["type"]>(
nodeType: string,
targetType: T,
): nodeType is T;
export default function isType(
nodeType: string | null | undefined,
targetType: string,... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/is.ts | packages/babel-types/src/validators/is.ts | import shallowEqual from "../utils/shallowEqual.ts";
import isType from "./isType.ts";
import isPlaceholderType from "./isPlaceholderType.ts";
import { FLIPPED_ALIAS_KEYS } from "../definitions/index.ts";
import type * as t from "../index.ts";
export default function is<T extends t.Node["type"]>(
type: T,
node: t.... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isScope.ts | packages/babel-types/src/validators/isScope.ts | import {
isFunction,
isCatchClause,
isBlockStatement,
isScopable,
isPattern,
} from "./generated/index.ts";
import type * as t from "../index.ts";
/**
* Check if the input `node` is a scope.
*/
export default function isScope(
node: t.Node | null | undefined,
parent: t.Node,
): boolean {
// If a Bloc... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isPlaceholderType.ts | packages/babel-types/src/validators/isPlaceholderType.ts | import { PLACEHOLDERS_ALIAS } from "../definitions/index.ts";
/**
* Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`.
*/
export default function isPlaceholderType(
placeholderType: string,
targetType: string,
): boolean {
if (placeholderType === targetType) retu... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/matchesPattern.ts | packages/babel-types/src/validators/matchesPattern.ts | import {
isIdentifier,
isMetaProperty,
isMemberExpression,
isPrivateName,
isStringLiteral,
isSuper,
isThisExpression,
} from "./generated/index.ts";
import type * as t from "../index.ts";
function isMemberExpressionLike(
node: t.Node,
): node is t.MemberExpression | t.MetaProperty {
return isMemberEx... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isVar.ts | packages/babel-types/src/validators/isVar.ts | import { isVariableDeclaration } from "./generated/index.ts";
import type * as t from "../index.ts";
/**
* Check if the input `node` is a variable declaration.
*/
export default function isVar(node: t.Node | null | undefined): boolean {
return isVariableDeclaration(node) && node.kind === "var";
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isSpecifierDefault.ts | packages/babel-types/src/validators/isSpecifierDefault.ts | import { isIdentifier, isImportDefaultSpecifier } from "./generated/index.ts";
import type * as t from "../index.ts";
/**
* Check if the input `specifier` is a `default` import or export.
*/
export default function isSpecifierDefault(
specifier: t.ModuleSpecifier,
): boolean {
return (
isImportDefaultSpecifi... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isNodesEquivalent.ts | packages/babel-types/src/validators/isNodesEquivalent.ts | import { NODE_FIELDS, VISITOR_KEYS } from "../definitions/index.ts";
import type * as t from "../index.ts";
/**
* Check if two nodes are equivalent
*/
export default function isNodesEquivalent<T extends Partial<t.Node>>(
a: T,
b: any,
): b is T {
if (
typeof a !== "object" ||
typeof b !== "object" ||
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isValidES3Identifier.ts | packages/babel-types/src/validators/isValidES3Identifier.ts | import isValidIdentifier from "./isValidIdentifier.ts";
const RESERVED_WORDS_ES3_ONLY = new Set<string>([
"abstract",
"boolean",
"byte",
"char",
"double",
"enum",
"final",
"float",
"goto",
"implements",
"int",
"interface",
"long",
"native",
"package",
"private",
"protected",
"public... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isLet.ts | packages/babel-types/src/validators/isLet.ts | import { isVariableDeclaration } from "./generated/index.ts";
import type * as t from "../index.ts";
/**
* Check if the input `node` is a `let` variable declaration.
*/
export default function isLet(node: t.Node): boolean {
return isVariableDeclaration(node) && node.kind !== "var";
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isReferenced.ts | packages/babel-types/src/validators/isReferenced.ts | import type * as t from "../index.ts";
/**
* Check if the input `node` is a reference to a bound variable.
*/
export default function isReferenced(
node: t.Node | null | undefined,
parent: t.Node,
grandparent?: t.Node,
): boolean {
switch (parent.type) {
// yes: PARENT[NODE]
// yes: NODE.child
//... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isBinding.ts | packages/babel-types/src/validators/isBinding.ts | import getBindingIdentifiers from "../retrievers/getBindingIdentifiers.ts";
import type * as t from "../index.ts";
/**
* Check if the input `node` is a binding identifier.
*/
export default function isBinding(
node: t.Node,
parent: t.Node,
grandparent?: t.Node,
): boolean {
if (
grandparent &&
node.ty... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isValidIdentifier.ts | packages/babel-types/src/validators/isValidIdentifier.ts | import {
isIdentifierName,
isStrictReservedWord,
isKeyword,
} from "@babel/helper-validator-identifier";
/**
* Check if the input `name` is a valid identifier name
* and isn't a reserved word.
*/
export default function isValidIdentifier(
name: string,
reserved: boolean = true,
): boolean {
if (typeof n... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isBlockScoped.ts | packages/babel-types/src/validators/isBlockScoped.ts | import {
isClassDeclaration,
isFunctionDeclaration,
} from "./generated/index.ts";
import isLet from "./isLet.ts";
import type * as t from "../index.ts";
/**
* Check if the input `node` is block scoped.
*/
export default function isBlockScoped(
node: t.Node | null | undefined,
): boolean {
return isFunctionD... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isImmutable.ts | packages/babel-types/src/validators/isImmutable.ts | import isType from "./isType.ts";
import { isIdentifier } from "./generated/index.ts";
import type * as t from "../index.ts";
/**
* Check if the input `node` is definitely immutable.
*/
export default function isImmutable(node: t.Node): boolean {
if (isType(node.type, "Immutable")) return true;
if (isIdentifier... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/validate.ts | packages/babel-types/src/validators/validate.ts | import {
NODE_FIELDS,
NODE_PARENT_VALIDATIONS,
type FieldOptions,
} from "../definitions/index.ts";
import type * as t from "../index.ts";
export default function validate(
node: t.Node | undefined | null,
key: string,
val: unknown,
): void {
if (!node) return;
const fields = NODE_FIELDS[node.type];
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/buildMatchMemberExpression.ts | packages/babel-types/src/validators/buildMatchMemberExpression.ts | import matchesPattern from "./matchesPattern.ts";
import type * as t from "../index.ts";
/**
* Build a function that when called will return whether or not the
* input `node` `MemberExpression` matches the input `match`.
*
* For example, given the match `React.createClass` it would match the
* parsed nodes of `Re... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/isNode.ts | packages/babel-types/src/validators/isNode.ts | import { VISITOR_KEYS } from "../definitions/index.ts";
import type * as t from "../index.ts";
export default function isNode(node: any): node is t.Node {
return !!(node && VISITOR_KEYS[node.type]);
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/generated/index.ts | packages/babel-types/src/validators/generated/index.ts | /*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
/* eslint-disable no-fallthrough */
import shallowEqual from "../../utils/shallowEqual.ts";
import type * as t from "../../index.ts";
import deprecationWarning from "../../utils/deprecationWarning.ts";
type Options<O... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | true |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/react/isReactComponent.ts | packages/babel-types/src/validators/react/isReactComponent.ts | import buildMatchMemberExpression from "../buildMatchMemberExpression.ts";
const isReactComponent = buildMatchMemberExpression("React.Component");
export default isReactComponent;
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/validators/react/isCompatTag.ts | packages/babel-types/src/validators/react/isCompatTag.ts | export default function isCompatTag(tagName?: string): boolean {
// Must start with a lowercase ASCII letter
return !!tagName && /^[a-z]/.test(tagName);
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/asserts/assertNode.ts | packages/babel-types/src/asserts/assertNode.ts | import isNode from "../validators/isNode.ts";
import type * as t from "../index.ts";
export default function assertNode(node?: any): asserts node is t.Node {
if (!isNode(node)) {
const type = node?.type ?? JSON.stringify(node);
throw new TypeError(`Not a valid node of type "${type}"`);
}
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/asserts/generated/index.ts | packages/babel-types/src/asserts/generated/index.ts | /*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
import is from "../../validators/is.ts";
import type * as t from "../../index.ts";
import deprecationWarning from "../../utils/deprecationWarning.ts";
function assert(type: string, node: any, opts?: any): void {
if (... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | true |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/utils/shallowEqual.ts | packages/babel-types/src/utils/shallowEqual.ts | export default function shallowEqual<T extends object>(
actual: object,
expected: T,
): actual is T {
const keys = Object.keys(expected) as (keyof T)[];
for (const key of keys) {
if (
// @ts-expect-error maybe we should check whether key exists first
actual[key] !== expected[key]
) {
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/utils/deprecationWarning.ts | packages/babel-types/src/utils/deprecationWarning.ts | const warnings = new Set();
export default function deprecationWarning(
oldName: string,
newName: string,
prefix: string = "",
cacheKey: string = oldName,
) {
if (warnings.has(cacheKey)) return;
warnings.add(cacheKey);
const { internal, trace } = captureShortStackTrace(1, 2);
if (internal) {
// If... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/utils/inherit.ts | packages/babel-types/src/utils/inherit.ts | import type * as t from "../index.ts";
export default function inherit<
C extends t.Node | undefined,
P extends t.Node | undefined,
>(key: keyof C & keyof P, child: C, parent: P): void {
if (child && parent) {
// @ts-expect-error Could further refine key definitions
child[key] = Array.from(
new Set... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts | packages/babel-types/src/utils/react/cleanJSXElementLiteralChild.ts | import { stringLiteral } from "../../builders/generated/index.ts";
import type * as t from "../../index.ts";
import { inherits } from "../../index.ts";
export default function cleanJSXElementLiteralChild(
child: t.JSXText,
args: t.Node[],
) {
const lines = child.value.split(/\r\n|\n|\r/);
let lastNonEmptyLine... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/modifications/removeProperties.ts | packages/babel-types/src/modifications/removeProperties.ts | import { COMMENT_KEYS } from "../constants/index.ts";
import type * as t from "../index.ts";
const CLEAR_KEYS = [
"tokens", // only exist in t.File
"start",
"end",
"loc",
// Fixme: should be extra.raw / extra.rawValue?
"raw",
"rawValue",
] as const;
const CLEAR_KEYS_PLUS_COMMENTS = [
...COMMENT_KEYS,
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/modifications/prependToMemberExpression.ts | packages/babel-types/src/modifications/prependToMemberExpression.ts | import { memberExpression } from "../builders/generated/index.ts";
import { isSuper } from "../index.ts";
import type * as t from "../index.ts";
/**
* Prepend a node to a member expression.
*/
export default function prependToMemberExpression<
T extends Pick<t.MemberExpression, "object" | "property">,
>(member: T,... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/modifications/appendToMemberExpression.ts | packages/babel-types/src/modifications/appendToMemberExpression.ts | import { memberExpression } from "../builders/generated/index.ts";
import type * as t from "../index.ts";
/**
* Append a node to a member expression.
*/
export default function appendToMemberExpression(
member: t.MemberExpression,
append: t.MemberExpression["property"],
computed: boolean = false,
): t.MemberEx... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/modifications/inherits.ts | packages/babel-types/src/modifications/inherits.ts | import { INHERIT_KEYS } from "../constants/index.ts";
import inheritsComments from "../comments/inheritsComments.ts";
import type * as t from "../index.ts";
/**
* Inherit all contextual properties from `parent` node to `child` node.
*/
export default function inherits<T extends t.Node | null | undefined>(
child: T... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/modifications/removePropertiesDeep.ts | packages/babel-types/src/modifications/removePropertiesDeep.ts | import traverseFast from "../traverse/traverseFast.ts";
import removeProperties from "./removeProperties.ts";
import type * as t from "../index.ts";
export default function removePropertiesDeep<T extends t.Node>(
tree: T,
opts?: { preserveComments: boolean } | null,
): T {
traverseFast(tree, removeProperties, op... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/modifications/flow/removeTypeDuplicates.ts | packages/babel-types/src/modifications/flow/removeTypeDuplicates.ts | import {
isAnyTypeAnnotation,
isGenericTypeAnnotation,
isUnionTypeAnnotation,
isFlowBaseAnnotation,
isIdentifier,
} from "../../validators/generated/index.ts";
import type * as t from "../../index.ts";
function getQualifiedName(node: t.GenericTypeAnnotation["id"]): string {
return isIdentifier(node)
? ... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/modifications/typescript/removeTypeDuplicates.ts | packages/babel-types/src/modifications/typescript/removeTypeDuplicates.ts | import {
isIdentifier,
isThisExpression,
isTSAnyKeyword,
isTSTypeReference,
isTSUnionType,
isTSBaseType,
} from "../../validators/generated/index.ts";
import type * as t from "../../index.ts";
function getQualifiedName(node: t.TSTypeReference["typeName"]): string {
return isIdentifier(node)
? node.na... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/validateNode.ts | packages/babel-types/src/builders/validateNode.ts | import { validateInternal } from "../validators/validate.ts";
import type * as t from "../index.ts";
import { BUILDER_KEYS, NODE_FIELDS } from "../index.ts";
export default function validateNode<N extends t.Node>(node: N) {
if (node == null || typeof node !== "object") return;
const fields = NODE_FIELDS[node.type]... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/productions.ts | packages/babel-types/src/builders/productions.ts | import { numericLiteral, unaryExpression } from "./generated/index.ts";
export function buildUndefinedNode() {
return unaryExpression("void", numericLiteral(0), true);
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts | packages/babel-types/src/builders/flow/createTypeAnnotationBasedOnTypeof.ts | import {
anyTypeAnnotation,
stringTypeAnnotation,
numberTypeAnnotation,
voidTypeAnnotation,
booleanTypeAnnotation,
genericTypeAnnotation,
identifier,
} from "../generated/index.ts";
import type * as t from "../../index.ts";
export default createTypeAnnotationBasedOnTypeof as {
(type: "string"): t.Strin... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/flow/createFlowUnionType.ts | packages/babel-types/src/builders/flow/createFlowUnionType.ts | import { unionTypeAnnotation } from "../generated/index.ts";
import removeTypeDuplicates from "../../modifications/flow/removeTypeDuplicates.ts";
import type * as t from "../../index.ts";
/**
* Takes an array of `types` and flattens them, removing duplicates and
* returns a `UnionTypeAnnotation` node containing them... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/generated/lowercase.ts | packages/babel-types/src/builders/generated/lowercase.ts | /*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
import * as _validate from "../../validators/validate.ts";
import type * as t from "../../ast-types/generated/index.ts";
import deprecationWarning from "../../utils/deprecationWarning.ts";
import * as utils from "../../... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | true |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/generated/uppercase.ts | packages/babel-types/src/builders/generated/uppercase.ts | /*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
import * as b from "./lowercase.ts";
import deprecationWarning from "../../utils/deprecationWarning.ts";
function alias<const N extends keyof typeof b>(lowercase: N): (typeof b)[N] {
return function () {
depreca... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/generated/index.ts | packages/babel-types/src/builders/generated/index.ts | /*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
export * from "./lowercase.ts";
export * from "./uppercase.ts";
// Uppercase builders and AST types conflict with each other, which is
// not allowed by TypeScript when using `export * from ...`
// We instead explicit... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/typescript/createTSUnionType.ts | packages/babel-types/src/builders/typescript/createTSUnionType.ts | import { tsUnionType } from "../generated/index.ts";
import removeTypeDuplicates from "../../modifications/typescript/removeTypeDuplicates.ts";
import { isTSTypeAnnotation } from "../../validators/generated/index.ts";
import type * as t from "../../index.ts";
/**
* Takes an array of `types` and flattens them, removin... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/builders/react/buildChildren.ts | packages/babel-types/src/builders/react/buildChildren.ts | import {
isJSXText,
isJSXExpressionContainer,
isJSXEmptyExpression,
} from "../../validators/generated/index.ts";
import cleanJSXElementLiteralChild from "../../utils/react/cleanJSXElementLiteralChild.ts";
import type * as t from "../../index.ts";
type ReturnedChild =
| t.JSXSpreadChild
| t.JSXElement
| t.... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/comments/addComment.ts | packages/babel-types/src/comments/addComment.ts | import addComments from "./addComments.ts";
import type * as t from "../index.ts";
/**
* Add comment of certain type to a node.
*/
export default function addComment<T extends t.Node>(
node: T,
type: t.CommentTypeShorthand,
content: string,
line?: boolean,
): T {
return addComments(node, type, [
{
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/comments/inheritTrailingComments.ts | packages/babel-types/src/comments/inheritTrailingComments.ts | import inherit from "../utils/inherit.ts";
import type * as t from "../index.ts";
export default function inheritTrailingComments(
child: t.Node,
parent: t.Node,
): void {
inherit("trailingComments", child, parent);
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/comments/removeComments.ts | packages/babel-types/src/comments/removeComments.ts | import { COMMENT_KEYS } from "../constants/index.ts";
import type * as t from "../index.ts";
/**
* Remove comment properties from a node.
*/
export default function removeComments<T extends t.Node>(node: T): T {
COMMENT_KEYS.forEach(key => {
node[key] = null;
});
return node;
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/comments/inheritInnerComments.ts | packages/babel-types/src/comments/inheritInnerComments.ts | import inherit from "../utils/inherit.ts";
import type * as t from "../index.ts";
export default function inheritInnerComments(
child: t.Node,
parent: t.Node,
): void {
inherit("innerComments", child, parent);
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/comments/inheritsComments.ts | packages/babel-types/src/comments/inheritsComments.ts | import inheritTrailingComments from "./inheritTrailingComments.ts";
import inheritLeadingComments from "./inheritLeadingComments.ts";
import inheritInnerComments from "./inheritInnerComments.ts";
import type * as t from "../index.ts";
/**
* Inherit all unique comments from `parent` node to `child` node.
*/
export de... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/comments/inheritLeadingComments.ts | packages/babel-types/src/comments/inheritLeadingComments.ts | import inherit from "../utils/inherit.ts";
import type * as t from "../index.ts";
export default function inheritLeadingComments(
child: t.Node,
parent: t.Node,
): void {
inherit("leadingComments", child, parent);
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/comments/addComments.ts | packages/babel-types/src/comments/addComments.ts | import type * as t from "../index.ts";
/**
* Add comments of certain type to a node.
*/
export default function addComments<T extends t.Node>(
node: T,
type: t.CommentTypeShorthand,
comments: t.Comment[],
): T {
if (!comments || !node) return node;
const key = `${type}Comments` as const;
if (node[key])... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/retrievers/getBindingIdentifiers.ts | packages/babel-types/src/retrievers/getBindingIdentifiers.ts | import {
isExportDeclaration,
isIdentifier,
isClassExpression,
isDeclaration,
isFunctionDeclaration,
isFunctionExpression,
isExportAllDeclaration,
isAssignmentExpression,
isUnaryExpression,
isUpdateExpression,
} from "../validators/generated/index.ts";
import type * as t from "../index.ts";
export ... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/retrievers/getFunctionName.ts | packages/babel-types/src/retrievers/getFunctionName.ts | import type * as t from "../index.ts";
import {
isAssignmentExpression,
isClassMethod,
isIdentifier,
isLiteral,
isNullLiteral,
isObjectMethod,
isObjectProperty,
isPrivateName,
isRegExpLiteral,
isTemplateLiteral,
isVariableDeclarator,
} from "../validators/generated/index.ts";
function getNameFro... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts | packages/babel-types/src/retrievers/getOuterBindingIdentifiers.ts | import getBindingIdentifiers from "./getBindingIdentifiers.ts";
import type * as t from "../index.ts";
export default getOuterBindingIdentifiers as {
(node: t.Node, duplicates: true): Record<string, t.Identifier[]>;
(node: t.Node, duplicates?: false): Record<string, t.Identifier>;
(
node: t.Node,
duplica... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/retrievers/getAssignmentIdentifiers.ts | packages/babel-types/src/retrievers/getAssignmentIdentifiers.ts | import type * as t from "../index.ts";
/**
* For the given node, generate a map from assignment id names to the identifier node.
* Unlike getBindingIdentifiers, this function does not handle declarations and imports.
* @param node the assignment expression or forXstatement
* @returns an object map
* @see getBindi... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/ast-types/generated/index.ts | packages/babel-types/src/ast-types/generated/index.ts | // NOTE: This file is autogenerated. Do not modify.
// See packages/babel-types/scripts/generators/ast-types.ts for script used.
interface BaseComment {
value: string;
start?: number;
end?: number;
loc?: SourceLocation;
// generator will skip the comment if ignore is true
ignore?: boolean;
type: "Comment... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | true |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/clone/cloneDeep.ts | packages/babel-types/src/clone/cloneDeep.ts | import cloneNode from "./cloneNode.ts";
import type * as t from "../index.ts";
/**
* Create a deep clone of a `node` and all of it's child nodes
* including only properties belonging to the node.
* @deprecated Use t.cloneNode instead.
*/
export default function cloneDeep<T extends t.Node>(node: T): T {
return cl... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/clone/cloneWithoutLoc.ts | packages/babel-types/src/clone/cloneWithoutLoc.ts | import cloneNode from "./cloneNode.ts";
import type * as t from "../index.ts";
/**
* Create a shallow clone of a `node` excluding `_private` and location properties.
*/
export default function cloneWithoutLoc<T extends t.Node>(node: T): T {
return cloneNode(node, /* deep */ false, /* withoutLoc */ true);
}
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/clone/clone.ts | packages/babel-types/src/clone/clone.ts | import cloneNode from "./cloneNode.ts";
import type * as t from "../index.ts";
/**
* Create a shallow clone of a `node`, including only
* properties belonging to the node.
* @deprecated Use t.cloneNode instead.
*/
export default function clone<T extends t.Node>(node: T): T {
return cloneNode(node, /* deep */ fal... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/clone/cloneNode.ts | packages/babel-types/src/clone/cloneNode.ts | import { NODE_FIELDS } from "../definitions/index.ts";
import type * as t from "../index.ts";
import { isFile, isIdentifier } from "../validators/generated/index.ts";
const { hasOwn } = Object;
type CommentCache = Map<t.Comment, t.Comment>;
// This function will never be called for comments, only for real nodes.
func... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/clone/cloneDeepWithoutLoc.ts | packages/babel-types/src/clone/cloneDeepWithoutLoc.ts | import cloneNode from "./cloneNode.ts";
import type * as t from "../index.ts";
/**
* Create a deep clone of a `node` and all of it's child nodes
* including only properties belonging to the node.
* excluding `_private` and location properties.
*/
export default function cloneDeepWithoutLoc<T extends t.Node>(node: T... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/constants/index.ts | packages/babel-types/src/constants/index.ts | export const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
export const FLATTENABLE_KEYS = ["body", "expressions"];
export const FOR_INIT_KEYS = ["left", "init"];
export const COMMENT_KEYS = [
"leadingComments",
"trailingComments",
"innerComments",
] as const;
export const LOGICAL_OPERATORS = ["... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-types/src/constants/generated/index.ts | packages/babel-types/src/constants/generated/index.ts | /*
* This file is auto-generated! Do not modify it directly.
* To re-generate run 'make build'
*/
import { FLIPPED_ALIAS_KEYS } from "../../definitions/index.ts";
export const STANDARDIZED_TYPES = FLIPPED_ALIAS_KEYS["Standardized"];
export const EXPRESSION_TYPES = FLIPPED_ALIAS_KEYS["Expression"];
export const BINA... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-plugin-syntax-do-expressions/src/index.ts | packages/babel-plugin-syntax-do-expressions/src/index.ts | import { declare } from "@babel/helper-plugin-utils";
export default declare(api => {
api.assertVersion(REQUIRED_VERSION("^7.0.0-0 || ^8.0.0-0"));
return {
name: "syntax-do-expressions",
manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("doExpressions");
},
};
});
| typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-plugin-syntax-decorators/src/index.ts | packages/babel-plugin-syntax-decorators/src/index.ts | import { declare } from "@babel/helper-plugin-utils";
export interface Options {
version?: "legacy" | "2023-11";
}
export default declare((api, options: Options) => {
api.assertVersion(REQUIRED_VERSION("^7.0.0-0 || ^8.0.0-0"));
const { version } = options;
if (version === undefined) {
throw new Error(
... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-plugin-syntax-explicit-resource-management/src/index.ts | packages/babel-plugin-syntax-explicit-resource-management/src/index.ts | import { declare } from "@babel/helper-plugin-utils";
export default declare(api => {
api.assertVersion(REQUIRED_VERSION("^7.0.0-0 || ^8.0.0-0"));
return {
name: "syntax-explicit-resource-management",
manipulateOptions(opts, parserOpts) {
parserOpts.plugins.push("explicitResourceManagement");
}... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-plugin-external-helpers/src/index.ts | packages/babel-plugin-external-helpers/src/index.ts | import { declare } from "@babel/helper-plugin-utils";
import { types as t } from "@babel/core";
export interface Options {
helperVersion?: string;
whitelist?: false | string[];
}
export default declare((api, options: Options) => {
api.assertVersion(REQUIRED_VERSION(7));
const { helperVersion = "7.0.0-beta.0"... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
babel/babel | https://github.com/babel/babel/blob/30af57a25649635268e0a9ecdfae99bdd5dda5b4/packages/babel-plugin-bugfix-safari-class-field-initializer-scope/src/index.ts | packages/babel-plugin-bugfix-safari-class-field-initializer-scope/src/index.ts | import { declare } from "@babel/helper-plugin-utils";
import { types as t } from "@babel/core";
import type { NodePath } from "@babel/core";
function needsWrapping(node: t.Node): boolean {
if (t.isLiteral(node) && !t.isTemplateLiteral(node)) {
return false;
}
if (
t.isCallExpression(node) ||
t.isOpt... | typescript | MIT | 30af57a25649635268e0a9ecdfae99bdd5dda5b4 | 2026-01-04T15:46:08.418221Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.