From 9da61e29026480c1447a34bd21736452ffaae148 Mon Sep 17 00:00:00 2001 From: Justin Ridgewell Date: Mon, 16 Aug 2021 15:34:15 -0400 Subject: [PATCH] Remove Proposal alias --- .../src/path/generated/asserts.ts | 4 - .../src/path/generated/validators.ts | 4 - .../babel-types/scripts/generators/docs.js | 4 - .../src/asserts/generated/index.ts | 12 -- .../src/ast-types/generated/index.ts | 119 ------------- .../src/constants/generated/index.ts | 3 - packages/babel-types/src/definitions/core.ts | 2 +- .../src/definitions/experimental.ts | 5 +- .../src/validators/generated/index.ts | 156 ------------------ 9 files changed, 2 insertions(+), 307 deletions(-) diff --git a/packages/babel-traverse/src/path/generated/asserts.ts b/packages/babel-traverse/src/path/generated/asserts.ts index 871f209663cb..a0f0c50093b6 100755 --- a/packages/babel-traverse/src/path/generated/asserts.ts +++ b/packages/babel-traverse/src/path/generated/asserts.ts @@ -416,7 +416,6 @@ export interface NodePathAssetions { assertPrivateName(opts?: object): asserts this is NodePath; assertProgram(opts?: object): asserts this is NodePath; assertProperty(opts?: object): asserts this is NodePath; - assertProposal(opts?: object): asserts this is NodePath; assertPureish(opts?: object): asserts this is NodePath; assertQualifiedTypeIdentifier( opts?: object, @@ -440,9 +439,6 @@ export interface NodePathAssetions { opts?: object, ): asserts this is NodePath; assertStandardized(opts?: object): asserts this is NodePath; - assertStandardizedOrProposal( - opts?: object, - ): asserts this is NodePath; assertStatement(opts?: object): asserts this is NodePath; assertStaticBlock(opts?: object): asserts this is NodePath; assertStringLiteral(opts?: object): asserts this is NodePath; diff --git a/packages/babel-traverse/src/path/generated/validators.ts b/packages/babel-traverse/src/path/generated/validators.ts index 9e7781917e94..ab7b614d4454 100755 --- a/packages/babel-traverse/src/path/generated/validators.ts +++ b/packages/babel-traverse/src/path/generated/validators.ts @@ -261,7 +261,6 @@ export interface NodePathValidators { isPrivateName(opts?: object): this is NodePath; isProgram(opts?: object): this is NodePath; isProperty(opts?: object): this is NodePath; - isProposal(opts?: object): this is NodePath; isPureish(opts?: object): this is NodePath; isQualifiedTypeIdentifier( opts?: object, @@ -277,9 +276,6 @@ export interface NodePathValidators { isSpreadElement(opts?: object): this is NodePath; isSpreadProperty(opts?: object): this is NodePath; isStandardized(opts?: object): this is NodePath; - isStandardizedOrProposal( - opts?: object, - ): this is NodePath; isStatement(opts?: object): this is NodePath; isStaticBlock(opts?: object): this is NodePath; isStringLiteral(opts?: object): this is NodePath; diff --git a/packages/babel-types/scripts/generators/docs.js b/packages/babel-types/scripts/generators/docs.js index 1ce0a79897d8..e64bb275e98d 100644 --- a/packages/babel-types/scripts/generators/docs.js +++ b/packages/babel-types/scripts/generators/docs.js @@ -231,16 +231,12 @@ const aliasDescriptions = { "A cover of [BindingPattern](https://tc39.es/ecma262/#prod-BindingPattern)s. ", Private: "A cover of private class elements and private identifiers.", Property: "A cover of object properties and class properties.", - Proposal: - "A cover of AST nodes which are proprosed for inclusion in ECMAScript.", Pureish: "A cover of AST nodes which do not have side-effects. In other words, there is no observable behaviour changes if they are evaluated more than once.", Scopable: "A cover of [FunctionParent](#functionparent) and [BlockParent](#blockparent).", Standardized: "A cover of AST nodes which are part of an official ECMAScript specification.", - StandardizedOrProposal: - "A cover of AST nodes which are part of an official ECMAScript specification or a proposed for inclusion.", Statement: "A cover of any [Statement](https://tc39.es/ecma262/#prod-Statement)s.", TSBaseType: "A cover of primary TypeScript type annotations.", diff --git a/packages/babel-types/src/asserts/generated/index.ts b/packages/babel-types/src/asserts/generated/index.ts index b4d8e3747faa..5b784c6171e1 100755 --- a/packages/babel-types/src/asserts/generated/index.ts +++ b/packages/babel-types/src/asserts/generated/index.ts @@ -1496,12 +1496,6 @@ export function assertStandardized( ): asserts node is t.Standardized { assert("Standardized", node, opts); } -export function assertStandardizedOrProposal( - node: object | null | undefined, - opts?: object | null, -): asserts node is t.StandardizedOrProposal { - assert("StandardizedOrProposal", node, opts); -} export function assertExpression( node: object | null | undefined, opts?: object | null, @@ -1760,12 +1754,6 @@ export function assertMiscellaneous( ): asserts node is t.Miscellaneous { assert("Miscellaneous", node, opts); } -export function assertProposal( - node: object | null | undefined, - opts?: object | null, -): asserts node is t.Proposal { - assert("Proposal", node, opts); -} export function assertTypeScript( node: object | null | undefined, opts?: object | null, diff --git a/packages/babel-types/src/ast-types/generated/index.ts b/packages/babel-types/src/ast-types/generated/index.ts index 10257b1985d4..cb5483b949bd 100755 --- a/packages/babel-types/src/ast-types/generated/index.ts +++ b/packages/babel-types/src/ast-types/generated/index.ts @@ -2096,107 +2096,6 @@ export type Standardized = | ClassPrivateProperty | ClassPrivateMethod | PrivateName; -export type StandardizedOrProposal = - | ArrayExpression - | AssignmentExpression - | BinaryExpression - | InterpreterDirective - | Directive - | DirectiveLiteral - | BlockStatement - | BreakStatement - | CallExpression - | CatchClause - | ConditionalExpression - | ContinueStatement - | DebuggerStatement - | DoWhileStatement - | EmptyStatement - | ExpressionStatement - | File - | ForInStatement - | ForStatement - | FunctionDeclaration - | FunctionExpression - | Identifier - | IfStatement - | LabeledStatement - | StringLiteral - | NumericLiteral - | NullLiteral - | BooleanLiteral - | RegExpLiteral - | LogicalExpression - | MemberExpression - | NewExpression - | Program - | ObjectExpression - | ObjectMethod - | ObjectProperty - | RestElement - | ReturnStatement - | SequenceExpression - | ParenthesizedExpression - | SwitchCase - | SwitchStatement - | ThisExpression - | ThrowStatement - | TryStatement - | UnaryExpression - | UpdateExpression - | VariableDeclaration - | VariableDeclarator - | WhileStatement - | WithStatement - | AssignmentPattern - | ArrayPattern - | ArrowFunctionExpression - | ClassBody - | ClassExpression - | ClassDeclaration - | ExportAllDeclaration - | ExportDefaultDeclaration - | ExportNamedDeclaration - | ExportSpecifier - | ForOfStatement - | ImportDeclaration - | ImportDefaultSpecifier - | ImportNamespaceSpecifier - | ImportSpecifier - | MetaProperty - | ClassMethod - | ObjectPattern - | SpreadElement - | Super - | TaggedTemplateExpression - | TemplateElement - | TemplateLiteral - | YieldExpression - | AwaitExpression - | Import - | BigIntLiteral - | ExportNamespaceSpecifier - | OptionalMemberExpression - | OptionalCallExpression - | ClassProperty - | ClassPrivateProperty - | ClassPrivateMethod - | PrivateName - | ArgumentPlaceholder - | BindExpression - | ImportAttribute - | Decorator - | DoExpression - | ExportDefaultSpecifier - | RecordExpression - | TupleExpression - | DecimalLiteral - | StaticBlock - | ModuleExpression - | TopicReference - | PipelineTopicExpression - | PipelineBareFunction - | PipelinePrimaryTopicReference; export type Expression = | ArrayExpression | AssignmentExpression @@ -2631,22 +2530,6 @@ export type JSX = | JSXOpeningFragment | JSXClosingFragment; export type Miscellaneous = Noop | Placeholder | V8IntrinsicIdentifier; -export type Proposal = - | ArgumentPlaceholder - | BindExpression - | ImportAttribute - | Decorator - | DoExpression - | ExportDefaultSpecifier - | RecordExpression - | TupleExpression - | DecimalLiteral - | StaticBlock - | ModuleExpression - | TopicReference - | PipelineTopicExpression - | PipelineBareFunction - | PipelinePrimaryTopicReference; export type TypeScript = | TSParameterProperty | TSDeclareFunction @@ -2772,7 +2655,6 @@ export type TSBaseType = export interface Aliases { Standardized: Standardized; - StandardizedOrProposal: StandardizedOrProposal; Expression: Expression; Binary: Binary; Scopable: Scopable; @@ -2816,7 +2698,6 @@ export interface Aliases { EnumMember: EnumMember; JSX: JSX; Miscellaneous: Miscellaneous; - Proposal: Proposal; TypeScript: TypeScript; TSTypeElement: TSTypeElement; TSType: TSType; diff --git a/packages/babel-types/src/constants/generated/index.ts b/packages/babel-types/src/constants/generated/index.ts index effa226acc51..774d7a8fb4cd 100755 --- a/packages/babel-types/src/constants/generated/index.ts +++ b/packages/babel-types/src/constants/generated/index.ts @@ -5,8 +5,6 @@ import { FLIPPED_ALIAS_KEYS } from "../../definitions"; export const STANDARDIZED_TYPES = FLIPPED_ALIAS_KEYS["Standardized"]; -export const STANDARDIZEDORPROPOSAL_TYPES = - FLIPPED_ALIAS_KEYS["StandardizedOrProposal"]; export const EXPRESSION_TYPES = FLIPPED_ALIAS_KEYS["Expression"]; export const BINARY_TYPES = FLIPPED_ALIAS_KEYS["Binary"]; export const SCOPABLE_TYPES = FLIPPED_ALIAS_KEYS["Scopable"]; @@ -52,7 +50,6 @@ export const ENUMBODY_TYPES = FLIPPED_ALIAS_KEYS["EnumBody"]; export const ENUMMEMBER_TYPES = FLIPPED_ALIAS_KEYS["EnumMember"]; export const JSX_TYPES = FLIPPED_ALIAS_KEYS["JSX"]; export const MISCELLANEOUS_TYPES = FLIPPED_ALIAS_KEYS["Miscellaneous"]; -export const PROPOSAL_TYPES = FLIPPED_ALIAS_KEYS["Proposal"]; export const TYPESCRIPT_TYPES = FLIPPED_ALIAS_KEYS["TypeScript"]; export const TSTYPEELEMENT_TYPES = FLIPPED_ALIAS_KEYS["TSTypeElement"]; export const TSTYPE_TYPES = FLIPPED_ALIAS_KEYS["TSType"]; diff --git a/packages/babel-types/src/definitions/core.ts b/packages/babel-types/src/definitions/core.ts index 55052ee6d676..4b619edca893 100644 --- a/packages/babel-types/src/definitions/core.ts +++ b/packages/babel-types/src/definitions/core.ts @@ -23,7 +23,7 @@ import { validateOptional, } from "./utils"; -const defineType = defineAliasedType("Standardized", "StandardizedOrProposal"); +const defineType = defineAliasedType("Standardized"); defineType("ArrayExpression", { fields: { diff --git a/packages/babel-types/src/definitions/experimental.ts b/packages/babel-types/src/definitions/experimental.ts index f478ec80b086..064f25e47f26 100644 --- a/packages/babel-types/src/definitions/experimental.ts +++ b/packages/babel-types/src/definitions/experimental.ts @@ -1,13 +1,10 @@ -import { - defineAliasedType, +import defineType, { assertEach, assertNodeType, assertValueType, chain, } from "./utils"; -const defineType = defineAliasedType("Proposal", "StandardizedOrProposal"); - defineType("ArgumentPlaceholder", {}); defineType("BindExpression", { diff --git a/packages/babel-types/src/validators/generated/index.ts b/packages/babel-types/src/validators/generated/index.ts index 1bdef6bb60a2..c65613f85ef6 100755 --- a/packages/babel-types/src/validators/generated/index.ts +++ b/packages/babel-types/src/validators/generated/index.ts @@ -4295,129 +4295,6 @@ export function isStandardized( return false; } -export function isStandardizedOrProposal( - node: object | null | undefined, - opts?: object | null, -): node is t.StandardizedOrProposal { - if (!node) return false; - - const nodeType = (node as t.Node).type; - if ( - "ArrayExpression" === nodeType || - "AssignmentExpression" === nodeType || - "BinaryExpression" === nodeType || - "InterpreterDirective" === nodeType || - "Directive" === nodeType || - "DirectiveLiteral" === nodeType || - "BlockStatement" === nodeType || - "BreakStatement" === nodeType || - "CallExpression" === nodeType || - "CatchClause" === nodeType || - "ConditionalExpression" === nodeType || - "ContinueStatement" === nodeType || - "DebuggerStatement" === nodeType || - "DoWhileStatement" === nodeType || - "EmptyStatement" === nodeType || - "ExpressionStatement" === nodeType || - "File" === nodeType || - "ForInStatement" === nodeType || - "ForStatement" === nodeType || - "FunctionDeclaration" === nodeType || - "FunctionExpression" === nodeType || - "Identifier" === nodeType || - "IfStatement" === nodeType || - "LabeledStatement" === nodeType || - "StringLiteral" === nodeType || - "NumericLiteral" === nodeType || - "NullLiteral" === nodeType || - "BooleanLiteral" === nodeType || - "RegExpLiteral" === nodeType || - "LogicalExpression" === nodeType || - "MemberExpression" === nodeType || - "NewExpression" === nodeType || - "Program" === nodeType || - "ObjectExpression" === nodeType || - "ObjectMethod" === nodeType || - "ObjectProperty" === nodeType || - "RestElement" === nodeType || - "ReturnStatement" === nodeType || - "SequenceExpression" === nodeType || - "ParenthesizedExpression" === nodeType || - "SwitchCase" === nodeType || - "SwitchStatement" === nodeType || - "ThisExpression" === nodeType || - "ThrowStatement" === nodeType || - "TryStatement" === nodeType || - "UnaryExpression" === nodeType || - "UpdateExpression" === nodeType || - "VariableDeclaration" === nodeType || - "VariableDeclarator" === nodeType || - "WhileStatement" === nodeType || - "WithStatement" === nodeType || - "AssignmentPattern" === nodeType || - "ArrayPattern" === nodeType || - "ArrowFunctionExpression" === nodeType || - "ClassBody" === nodeType || - "ClassExpression" === nodeType || - "ClassDeclaration" === nodeType || - "ExportAllDeclaration" === nodeType || - "ExportDefaultDeclaration" === nodeType || - "ExportNamedDeclaration" === nodeType || - "ExportSpecifier" === nodeType || - "ForOfStatement" === nodeType || - "ImportDeclaration" === nodeType || - "ImportDefaultSpecifier" === nodeType || - "ImportNamespaceSpecifier" === nodeType || - "ImportSpecifier" === nodeType || - "MetaProperty" === nodeType || - "ClassMethod" === nodeType || - "ObjectPattern" === nodeType || - "SpreadElement" === nodeType || - "Super" === nodeType || - "TaggedTemplateExpression" === nodeType || - "TemplateElement" === nodeType || - "TemplateLiteral" === nodeType || - "YieldExpression" === nodeType || - "AwaitExpression" === nodeType || - "Import" === nodeType || - "BigIntLiteral" === nodeType || - "ExportNamespaceSpecifier" === nodeType || - "OptionalMemberExpression" === nodeType || - "OptionalCallExpression" === nodeType || - "ClassProperty" === nodeType || - "ClassPrivateProperty" === nodeType || - "ClassPrivateMethod" === nodeType || - "PrivateName" === nodeType || - "ArgumentPlaceholder" === nodeType || - "BindExpression" === nodeType || - "ImportAttribute" === nodeType || - "Decorator" === nodeType || - "DoExpression" === nodeType || - "ExportDefaultSpecifier" === nodeType || - "RecordExpression" === nodeType || - "TupleExpression" === nodeType || - "DecimalLiteral" === nodeType || - "StaticBlock" === nodeType || - "ModuleExpression" === nodeType || - "TopicReference" === nodeType || - "PipelineTopicExpression" === nodeType || - "PipelineBareFunction" === nodeType || - "PipelinePrimaryTopicReference" === nodeType || - (nodeType === "Placeholder" && - ("Identifier" === (node as t.Placeholder).expectedNode || - "StringLiteral" === (node as t.Placeholder).expectedNode || - "BlockStatement" === (node as t.Placeholder).expectedNode || - "ClassBody" === (node as t.Placeholder).expectedNode)) - ) { - if (typeof opts === "undefined") { - return true; - } else { - return shallowEqual(node, opts); - } - } - - return false; -} export function isExpression( node: object | null | undefined, opts?: object | null, @@ -5630,39 +5507,6 @@ export function isMiscellaneous( return false; } -export function isProposal( - node: object | null | undefined, - opts?: object | null, -): node is t.Proposal { - if (!node) return false; - - const nodeType = (node as t.Node).type; - if ( - "ArgumentPlaceholder" === nodeType || - "BindExpression" === nodeType || - "ImportAttribute" === nodeType || - "Decorator" === nodeType || - "DoExpression" === nodeType || - "ExportDefaultSpecifier" === nodeType || - "RecordExpression" === nodeType || - "TupleExpression" === nodeType || - "DecimalLiteral" === nodeType || - "StaticBlock" === nodeType || - "ModuleExpression" === nodeType || - "TopicReference" === nodeType || - "PipelineTopicExpression" === nodeType || - "PipelineBareFunction" === nodeType || - "PipelinePrimaryTopicReference" === nodeType - ) { - if (typeof opts === "undefined") { - return true; - } else { - return shallowEqual(node, opts); - } - } - - return false; -} export function isTypeScript( node: object | null | undefined, opts?: object | null,