Fix Flow.
Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow. Closes #3064
This commit is contained in:
parent
1d34d19ce9
commit
0076204f80
@ -9,6 +9,7 @@ lib/types.js
|
|||||||
|
|
||||||
[options]
|
[options]
|
||||||
strip_root=true
|
strip_root=true
|
||||||
|
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
|
||||||
|
|
||||||
[version]
|
[version]
|
||||||
0.16.0
|
0.18.1
|
||||||
|
|||||||
2
Makefile
2
Makefile
@ -20,7 +20,7 @@ watch: clean
|
|||||||
|
|
||||||
lint:
|
lint:
|
||||||
node node_modules/.bin/eslint packages/*/src
|
node node_modules/.bin/eslint packages/*/src
|
||||||
#flow check
|
flow
|
||||||
|
|
||||||
clean: test-clean
|
clean: test-clean
|
||||||
rm -rf packages/babel-polyfill/browser*
|
rm -rf packages/babel-polyfill/browser*
|
||||||
|
|||||||
69
lib/types.js
69
lib/types.js
@ -51,7 +51,7 @@ declare class BabelNodeAssignmentExpression extends BabelNode {
|
|||||||
|
|
||||||
declare class BabelNodeBinaryExpression extends BabelNode {
|
declare class BabelNodeBinaryExpression extends BabelNode {
|
||||||
type: "BinaryExpression";
|
type: "BinaryExpression";
|
||||||
operator: string;
|
operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=";
|
||||||
left: BabelNodeExpression;
|
left: BabelNodeExpression;
|
||||||
right: BabelNodeExpression;
|
right: BabelNodeExpression;
|
||||||
}
|
}
|
||||||
@ -136,9 +136,9 @@ declare class BabelNodeForInStatement extends BabelNode {
|
|||||||
|
|
||||||
declare class BabelNodeForStatement extends BabelNode {
|
declare class BabelNodeForStatement extends BabelNode {
|
||||||
type: "ForStatement";
|
type: "ForStatement";
|
||||||
init: BabelNodeVariableDeclaration | BabelNodeExpression;
|
init?: ?BabelNodeVariableDeclaration | BabelNodeExpression;
|
||||||
test: BabelNodeExpression;
|
test?: ?BabelNodeExpression;
|
||||||
update: BabelNodeExpression;
|
update?: ?BabelNodeExpression;
|
||||||
body: BabelNodeStatement;
|
body: BabelNodeStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ declare class BabelNodeIdentifier extends BabelNode {
|
|||||||
declare class BabelNodeIfStatement extends BabelNode {
|
declare class BabelNodeIfStatement extends BabelNode {
|
||||||
type: "IfStatement";
|
type: "IfStatement";
|
||||||
test: BabelNodeExpression;
|
test: BabelNodeExpression;
|
||||||
consequent?: ?BabelNodeStatement;
|
consequent: BabelNodeStatement;
|
||||||
alternate?: ?BabelNodeStatement;
|
alternate?: ?BabelNodeStatement;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ declare class BabelNodeRegExpLiteral extends BabelNode {
|
|||||||
|
|
||||||
declare class BabelNodeLogicalExpression extends BabelNode {
|
declare class BabelNodeLogicalExpression extends BabelNode {
|
||||||
type: "LogicalExpression";
|
type: "LogicalExpression";
|
||||||
operator: any;
|
operator: "||" | "&&";
|
||||||
left: BabelNodeExpression;
|
left: BabelNodeExpression;
|
||||||
right: BabelNodeExpression;
|
right: BabelNodeExpression;
|
||||||
}
|
}
|
||||||
@ -280,13 +280,13 @@ declare class BabelNodeSequenceExpression extends BabelNode {
|
|||||||
|
|
||||||
declare class BabelNodeSwitchCase extends BabelNode {
|
declare class BabelNodeSwitchCase extends BabelNode {
|
||||||
type: "SwitchCase";
|
type: "SwitchCase";
|
||||||
test: any;
|
test?: ?BabelNodeExpression;
|
||||||
consequent: any;
|
consequent: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class BabelNodeSwitchStatement extends BabelNode {
|
declare class BabelNodeSwitchStatement extends BabelNode {
|
||||||
type: "SwitchStatement";
|
type: "SwitchStatement";
|
||||||
discriminant: any;
|
discriminant: BabelNodeExpression;
|
||||||
cases: any;
|
cases: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,14 +311,14 @@ declare class BabelNodeUnaryExpression extends BabelNode {
|
|||||||
type: "UnaryExpression";
|
type: "UnaryExpression";
|
||||||
prefix?: boolean;
|
prefix?: boolean;
|
||||||
argument: BabelNodeExpression;
|
argument: BabelNodeExpression;
|
||||||
operator: any;
|
operator: "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof";
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class BabelNodeUpdateExpression extends BabelNode {
|
declare class BabelNodeUpdateExpression extends BabelNode {
|
||||||
type: "UpdateExpression";
|
type: "UpdateExpression";
|
||||||
prefix?: boolean;
|
prefix?: boolean;
|
||||||
argument: BabelNodeExpression;
|
argument: BabelNodeExpression;
|
||||||
operator: any;
|
operator: "++" | "--";
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class BabelNodeVariableDeclaration extends BabelNode {
|
declare class BabelNodeVariableDeclaration extends BabelNode {
|
||||||
@ -392,19 +392,19 @@ declare class BabelNodeClassExpression extends BabelNode {
|
|||||||
|
|
||||||
declare class BabelNodeExportAllDeclaration extends BabelNode {
|
declare class BabelNodeExportAllDeclaration extends BabelNode {
|
||||||
type: "ExportAllDeclaration";
|
type: "ExportAllDeclaration";
|
||||||
source: any;
|
source: BabelNodeStringLiteral;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class BabelNodeExportDefaultDeclaration extends BabelNode {
|
declare class BabelNodeExportDefaultDeclaration extends BabelNode {
|
||||||
type: "ExportDefaultDeclaration";
|
type: "ExportDefaultDeclaration";
|
||||||
declaration: any;
|
declaration: BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class BabelNodeExportNamedDeclaration extends BabelNode {
|
declare class BabelNodeExportNamedDeclaration extends BabelNode {
|
||||||
type: "ExportNamedDeclaration";
|
type: "ExportNamedDeclaration";
|
||||||
declaration: any;
|
declaration?: ?BabelNodeDeclaration;
|
||||||
specifiers: any;
|
specifiers: any;
|
||||||
source: any;
|
source?: ?BabelNodeStringLiteral;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class BabelNodeExportSpecifier extends BabelNode {
|
declare class BabelNodeExportSpecifier extends BabelNode {
|
||||||
@ -556,6 +556,10 @@ declare class BabelNodeDeclareVariable extends BabelNode {
|
|||||||
id: any;
|
id: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare class BabelNodeExistentialTypeParam extends BabelNode {
|
||||||
|
type: "ExistentialTypeParam";
|
||||||
|
}
|
||||||
|
|
||||||
declare class BabelNodeFunctionTypeAnnotation extends BabelNode {
|
declare class BabelNodeFunctionTypeAnnotation extends BabelNode {
|
||||||
type: "FunctionTypeAnnotation";
|
type: "FunctionTypeAnnotation";
|
||||||
typeParameters: any;
|
typeParameters: any;
|
||||||
@ -809,7 +813,7 @@ declare class BabelNodeSpreadProperty extends BabelNode {
|
|||||||
argument: BabelNodeExpression;
|
argument: BabelNodeExpression;
|
||||||
}
|
}
|
||||||
|
|
||||||
type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeParenthesizedExpression | BabelNodeAwaitExpression | BabelNodeDoExpression;
|
type BabelNodeExpression = BabelNodeArrayExpression | BabelNodeAssignmentExpression | BabelNodeBinaryExpression | BabelNodeCallExpression | BabelNodeConditionalExpression | BabelNodeFunctionExpression | BabelNodeIdentifier | BabelNodeStringLiteral | BabelNodeNumericLiteral | BabelNodeNullLiteral | BabelNodeBooleanLiteral | BabelNodeRegExpLiteral | BabelNodeLogicalExpression | BabelNodeMemberExpression | BabelNodeNewExpression | BabelNodeObjectExpression | BabelNodeSequenceExpression | BabelNodeThisExpression | BabelNodeUnaryExpression | BabelNodeUpdateExpression | BabelNodeArrowFunctionExpression | BabelNodeClassExpression | BabelNodeMetaProperty | BabelNodeSuper | BabelNodeTaggedTemplateExpression | BabelNodeTemplateLiteral | BabelNodeYieldExpression | BabelNodeTypeCastExpression | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeParenthesizedExpression | BabelNodeAwaitExpression | BabelNodeDoExpression;
|
||||||
type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression;
|
type BabelNodeBinary = BabelNodeBinaryExpression | BabelNodeLogicalExpression;
|
||||||
type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
|
type BabelNodeScopable = BabelNodeBlockStatement | BabelNodeCatchClause | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeClassDeclaration | BabelNodeClassExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
|
||||||
type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
|
type BabelNodeBlockParent = BabelNodeBlockStatement | BabelNodeDoWhileStatement | BabelNodeForInStatement | BabelNodeForStatement | BabelNodeFunctionDeclaration | BabelNodeFunctionExpression | BabelNodeProgram | BabelNodeObjectMethod | BabelNodeSwitchStatement | BabelNodeWhileStatement | BabelNodeArrowFunctionExpression | BabelNodeForOfStatement | BabelNodeClassMethod;
|
||||||
@ -839,7 +843,7 @@ type BabelNodeClass = BabelNodeClassDeclaration | BabelNodeClassExpression;
|
|||||||
type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration;
|
type BabelNodeModuleDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration | BabelNodeImportDeclaration;
|
||||||
type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration;
|
type BabelNodeExportDeclaration = BabelNodeExportAllDeclaration | BabelNodeExportDefaultDeclaration | BabelNodeExportNamedDeclaration;
|
||||||
type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier;
|
type BabelNodeModuleSpecifier = BabelNodeExportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier | BabelNodeImportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier;
|
||||||
type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumericLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation;
|
type BabelNodeFlow = BabelNodeAnyTypeAnnotation | BabelNodeArrayTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeBooleanLiteralTypeAnnotation | BabelNodeClassImplements | BabelNodeClassProperty | BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeExistentialTypeParam | BabelNodeFunctionTypeAnnotation | BabelNodeFunctionTypeParam | BabelNodeGenericTypeAnnotation | BabelNodeInterfaceExtends | BabelNodeInterfaceDeclaration | BabelNodeIntersectionTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNullableTypeAnnotation | BabelNodeNumericLiteralTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringLiteralTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeTupleTypeAnnotation | BabelNodeTypeofTypeAnnotation | BabelNodeTypeAlias | BabelNodeTypeAnnotation | BabelNodeTypeCastExpression | BabelNodeTypeParameterDeclaration | BabelNodeTypeParameterInstantiation | BabelNodeObjectTypeAnnotation | BabelNodeObjectTypeCallProperty | BabelNodeObjectTypeIndexer | BabelNodeObjectTypeProperty | BabelNodeQualifiedTypeIdentifier | BabelNodeUnionTypeAnnotation | BabelNodeVoidTypeAnnotation;
|
||||||
type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeVoidTypeAnnotation;
|
type BabelNodeFlowBaseAnnotation = BabelNodeAnyTypeAnnotation | BabelNodeBooleanTypeAnnotation | BabelNodeMixedTypeAnnotation | BabelNodeNumberTypeAnnotation | BabelNodeStringTypeAnnotation | BabelNodeVoidTypeAnnotation;
|
||||||
type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias;
|
type BabelNodeFlowDeclaration = BabelNodeDeclareClass | BabelNodeDeclareFunction | BabelNodeDeclareModule | BabelNodeDeclareVariable | BabelNodeInterfaceDeclaration | BabelNodeTypeAlias;
|
||||||
type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText;
|
type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNodeJSXElement | BabelNodeJSXEmptyExpression | BabelNodeJSXExpressionContainer | BabelNodeJSXIdentifier | BabelNodeJSXMemberExpression | BabelNodeJSXNamespacedName | BabelNodeJSXOpeningElement | BabelNodeJSXSpreadAttribute | BabelNodeJSXText;
|
||||||
@ -847,7 +851,7 @@ type BabelNodeJSX = BabelNodeJSXAttribute | BabelNodeJSXClosingElement | BabelNo
|
|||||||
declare module "babel-types" {
|
declare module "babel-types" {
|
||||||
declare function arrayExpression(elements: Array<any>): BabelNodeArrayExpression;
|
declare function arrayExpression(elements: Array<any>): BabelNodeArrayExpression;
|
||||||
declare function assignmentExpression(operator: string, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
|
declare function assignmentExpression(operator: string, left: BabelNodeLVal, right: BabelNodeExpression): BabelNodeAssignmentExpression;
|
||||||
declare function binaryExpression(operator: string, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
|
declare function binaryExpression(operator: "+" | "-" | "/" | "%" | "*" | "**" | "&" | "|" | ">>" | ">>>" | "<<" | "^" | "==" | "===" | "!=" | "!==" | "in" | "instanceof" | ">" | "<" | ">=" | "<=", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeBinaryExpression;
|
||||||
declare function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective;
|
declare function directive(value: BabelNodeDirectiveLiteral): BabelNodeDirective;
|
||||||
declare function directiveLiteral(value: string): BabelNodeDirectiveLiteral;
|
declare function directiveLiteral(value: string): BabelNodeDirectiveLiteral;
|
||||||
declare function blockStatement(directives?: any, body: any): BabelNodeBlockStatement;
|
declare function blockStatement(directives?: any, body: any): BabelNodeBlockStatement;
|
||||||
@ -862,18 +866,18 @@ declare module "babel-types" {
|
|||||||
declare function expressionStatement(expression: BabelNodeExpression): BabelNodeExpressionStatement;
|
declare function expressionStatement(expression: BabelNodeExpression): BabelNodeExpressionStatement;
|
||||||
declare function file(program: BabelNodeProgram, comments: any, tokens: any): BabelNodeFile;
|
declare function file(program: BabelNodeProgram, comments: any, tokens: any): BabelNodeFile;
|
||||||
declare function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement;
|
declare function forInStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForInStatement;
|
||||||
declare function forStatement(init: BabelNodeVariableDeclaration | BabelNodeExpression, test: BabelNodeExpression, update: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement;
|
declare function forStatement(init?: ?BabelNodeVariableDeclaration | BabelNodeExpression, test?: ?BabelNodeExpression, update?: ?BabelNodeExpression, body: BabelNodeStatement): BabelNodeForStatement;
|
||||||
declare function functionDeclaration(id: BabelNodeIdentifier, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, returnType: any, typeParameters: any): BabelNodeFunctionDeclaration;
|
declare function functionDeclaration(id: BabelNodeIdentifier, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, returnType: any, typeParameters: any): BabelNodeFunctionDeclaration;
|
||||||
declare function functionExpression(id?: ?BabelNodeIdentifier, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, returnType: any, typeParameters: any): BabelNodeFunctionExpression;
|
declare function functionExpression(id?: ?BabelNodeIdentifier, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, returnType: any, typeParameters: any): BabelNodeFunctionExpression;
|
||||||
declare function identifier(name: any, typeAnnotation: any): BabelNodeIdentifier;
|
declare function identifier(name: any, typeAnnotation: any): BabelNodeIdentifier;
|
||||||
declare function ifStatement(test: BabelNodeExpression, consequent?: ?BabelNodeStatement, alternate?: ?BabelNodeStatement): BabelNodeIfStatement;
|
declare function ifStatement(test: BabelNodeExpression, consequent: BabelNodeStatement, alternate?: ?BabelNodeStatement): BabelNodeIfStatement;
|
||||||
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
|
declare function labeledStatement(label: BabelNodeIdentifier, body: BabelNodeStatement): BabelNodeLabeledStatement;
|
||||||
declare function stringLiteral(value: string): BabelNodeStringLiteral;
|
declare function stringLiteral(value: string): BabelNodeStringLiteral;
|
||||||
declare function NumericLiteral(value: number): BabelNodeNumericLiteral;
|
declare function numericLiteral(value: number): BabelNodeNumericLiteral;
|
||||||
declare function nullLiteral(): BabelNodeNullLiteral;
|
declare function nullLiteral(): BabelNodeNullLiteral;
|
||||||
declare function booleanLiteral(value: boolean): BabelNodeBooleanLiteral;
|
declare function booleanLiteral(value: boolean): BabelNodeBooleanLiteral;
|
||||||
declare function RegExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral;
|
declare function regExpLiteral(pattern: string, flags?: string): BabelNodeRegExpLiteral;
|
||||||
declare function logicalExpression(operator: any, left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
|
declare function logicalExpression(operator: "||" | "&&", left: BabelNodeExpression, right: BabelNodeExpression): BabelNodeLogicalExpression;
|
||||||
declare function memberExpression(object: BabelNodeExpression, property: any, computed?: boolean): BabelNodeMemberExpression;
|
declare function memberExpression(object: BabelNodeExpression, property: any, computed?: boolean): BabelNodeMemberExpression;
|
||||||
declare function newExpression(callee: BabelNodeExpression, _arguments: any): BabelNodeNewExpression;
|
declare function newExpression(callee: BabelNodeExpression, _arguments: any): BabelNodeNewExpression;
|
||||||
declare function program(directives?: any, body: any): BabelNodeProgram;
|
declare function program(directives?: any, body: any): BabelNodeProgram;
|
||||||
@ -883,13 +887,13 @@ declare module "babel-types" {
|
|||||||
declare function restElement(argument: BabelNodeLVal, typeAnnotation: any): BabelNodeRestElement;
|
declare function restElement(argument: BabelNodeLVal, typeAnnotation: any): BabelNodeRestElement;
|
||||||
declare function returnStatement(argument?: ?BabelNodeExpression): BabelNodeReturnStatement;
|
declare function returnStatement(argument?: ?BabelNodeExpression): BabelNodeReturnStatement;
|
||||||
declare function sequenceExpression(expressions: Array<any>): BabelNodeSequenceExpression;
|
declare function sequenceExpression(expressions: Array<any>): BabelNodeSequenceExpression;
|
||||||
declare function switchCase(test: any, consequent: any): BabelNodeSwitchCase;
|
declare function switchCase(test?: ?BabelNodeExpression, consequent: any): BabelNodeSwitchCase;
|
||||||
declare function switchStatement(discriminant: any, cases: any): BabelNodeSwitchStatement;
|
declare function switchStatement(discriminant: BabelNodeExpression, cases: any): BabelNodeSwitchStatement;
|
||||||
declare function thisExpression(): BabelNodeThisExpression;
|
declare function thisExpression(): BabelNodeThisExpression;
|
||||||
declare function throwStatement(argument: BabelNodeExpression): BabelNodeThrowStatement;
|
declare function throwStatement(argument: BabelNodeExpression): BabelNodeThrowStatement;
|
||||||
declare function tryStatement(body: BabelNodeBlockStatement, handler?: any, finalizer?: ?BabelNodeBlockStatement, block: any): BabelNodeTryStatement;
|
declare function tryStatement(body: BabelNodeBlockStatement, handler?: any, finalizer?: ?BabelNodeBlockStatement, block: any): BabelNodeTryStatement;
|
||||||
declare function unaryExpression(prefix?: boolean, argument: BabelNodeExpression, operator: any): BabelNodeUnaryExpression;
|
declare function unaryExpression(prefix?: boolean, argument: BabelNodeExpression, operator: "void" | "delete" | "!" | "+" | "-" | "++" | "--" | "~" | "typeof"): BabelNodeUnaryExpression;
|
||||||
declare function updateExpression(prefix?: boolean, argument: BabelNodeExpression, operator: any): BabelNodeUpdateExpression;
|
declare function updateExpression(prefix?: boolean, argument: BabelNodeExpression, operator: "++" | "--"): BabelNodeUpdateExpression;
|
||||||
declare function variableDeclaration(kind: any, declarations: any): BabelNodeVariableDeclaration;
|
declare function variableDeclaration(kind: any, declarations: any): BabelNodeVariableDeclaration;
|
||||||
declare function variableDeclarator(id: BabelNodeLVal, init?: ?BabelNodeExpression): BabelNodeVariableDeclarator;
|
declare function variableDeclarator(id: BabelNodeLVal, init?: ?BabelNodeExpression): BabelNodeVariableDeclarator;
|
||||||
declare function whileStatement(test: BabelNodeExpression, body: BabelNodeBlockStatement | BabelNodeStatement): BabelNodeWhileStatement;
|
declare function whileStatement(test: BabelNodeExpression, body: BabelNodeBlockStatement | BabelNodeStatement): BabelNodeWhileStatement;
|
||||||
@ -900,9 +904,9 @@ declare module "babel-types" {
|
|||||||
declare function classBody(body: any): BabelNodeClassBody;
|
declare function classBody(body: any): BabelNodeClassBody;
|
||||||
declare function classDeclaration(id: BabelNodeIdentifier, body: BabelNodeClassBody, superClass?: ?BabelNodeExpression, decorators: any, typeParameters: any, superTypeParameters: any, _implements: any): BabelNodeClassDeclaration;
|
declare function classDeclaration(id: BabelNodeIdentifier, body: BabelNodeClassBody, superClass?: ?BabelNodeExpression, decorators: any, typeParameters: any, superTypeParameters: any, _implements: any): BabelNodeClassDeclaration;
|
||||||
declare function classExpression(id?: ?BabelNodeIdentifier, body: BabelNodeClassBody, superClass?: ?BabelNodeExpression, decorators: any, typeParameters: any, superTypeParameters: any, _implements: any): BabelNodeClassExpression;
|
declare function classExpression(id?: ?BabelNodeIdentifier, body: BabelNodeClassBody, superClass?: ?BabelNodeExpression, decorators: any, typeParameters: any, superTypeParameters: any, _implements: any): BabelNodeClassExpression;
|
||||||
declare function exportAllDeclaration(source: any): BabelNodeExportAllDeclaration;
|
declare function exportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeExportAllDeclaration;
|
||||||
declare function exportDefaultDeclaration(declaration: any): BabelNodeExportDefaultDeclaration;
|
declare function exportDefaultDeclaration(declaration: BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration;
|
||||||
declare function exportNamedDeclaration(declaration: any, specifiers: any, source: any): BabelNodeExportNamedDeclaration;
|
declare function exportNamedDeclaration(declaration?: ?BabelNodeDeclaration, specifiers: any, source?: ?BabelNodeStringLiteral): BabelNodeExportNamedDeclaration;
|
||||||
declare function exportSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier, exported: any): BabelNodeExportSpecifier;
|
declare function exportSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier, exported: any): BabelNodeExportSpecifier;
|
||||||
declare function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForOfStatement;
|
declare function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement): BabelNodeForOfStatement;
|
||||||
declare function importDeclaration(specifiers: any, source: BabelNodeStringLiteral): BabelNodeImportDeclaration;
|
declare function importDeclaration(specifiers: any, source: BabelNodeStringLiteral): BabelNodeImportDeclaration;
|
||||||
@ -913,7 +917,6 @@ declare module "babel-types" {
|
|||||||
declare function classMethod(kind?: any, computed?: boolean, _static?: boolean, key: any, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, decorators: any, returnType: any, typeParameters: any): BabelNodeClassMethod;
|
declare function classMethod(kind?: any, computed?: boolean, _static?: boolean, key: any, params: any, body: BabelNodeBlockStatement, generator?: boolean, async?: boolean, decorators: any, returnType: any, typeParameters: any): BabelNodeClassMethod;
|
||||||
declare function objectPattern(properties: any, typeAnnotation: any): BabelNodeObjectPattern;
|
declare function objectPattern(properties: any, typeAnnotation: any): BabelNodeObjectPattern;
|
||||||
declare function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement;
|
declare function spreadElement(argument: BabelNodeExpression): BabelNodeSpreadElement;
|
||||||
declare function super(): BabelNodeSuper;
|
|
||||||
declare function taggedTemplateExpression(tag: BabelNodeExpression, quasi: BabelNodeTemplateLiteral): BabelNodeTaggedTemplateExpression;
|
declare function taggedTemplateExpression(tag: BabelNodeExpression, quasi: BabelNodeTemplateLiteral): BabelNodeTaggedTemplateExpression;
|
||||||
declare function templateElement(value: any, tail?: boolean): BabelNodeTemplateElement;
|
declare function templateElement(value: any, tail?: boolean): BabelNodeTemplateElement;
|
||||||
declare function templateLiteral(quasis: any, expressions: any): BabelNodeTemplateLiteral;
|
declare function templateLiteral(quasis: any, expressions: any): BabelNodeTemplateLiteral;
|
||||||
@ -928,6 +931,7 @@ declare module "babel-types" {
|
|||||||
declare function declareFunction(id: any): BabelNodeDeclareFunction;
|
declare function declareFunction(id: any): BabelNodeDeclareFunction;
|
||||||
declare function declareModule(id: any, body: any): BabelNodeDeclareModule;
|
declare function declareModule(id: any, body: any): BabelNodeDeclareModule;
|
||||||
declare function declareVariable(id: any): BabelNodeDeclareVariable;
|
declare function declareVariable(id: any): BabelNodeDeclareVariable;
|
||||||
|
declare function existentialTypeParam(): BabelNodeExistentialTypeParam;
|
||||||
declare function functionTypeAnnotation(typeParameters: any, params: any, rest: any, returnType: any): BabelNodeFunctionTypeAnnotation;
|
declare function functionTypeAnnotation(typeParameters: any, params: any, rest: any, returnType: any): BabelNodeFunctionTypeAnnotation;
|
||||||
declare function functionTypeParam(name: any, typeAnnotation: any): BabelNodeFunctionTypeParam;
|
declare function functionTypeParam(name: any, typeAnnotation: any): BabelNodeFunctionTypeParam;
|
||||||
declare function genericTypeAnnotation(id: any, typeParameters: any): BabelNodeGenericTypeAnnotation;
|
declare function genericTypeAnnotation(id: any, typeParameters: any): BabelNodeGenericTypeAnnotation;
|
||||||
@ -936,7 +940,7 @@ declare module "babel-types" {
|
|||||||
declare function intersectionTypeAnnotation(types: any): BabelNodeIntersectionTypeAnnotation;
|
declare function intersectionTypeAnnotation(types: any): BabelNodeIntersectionTypeAnnotation;
|
||||||
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
|
declare function mixedTypeAnnotation(): BabelNodeMixedTypeAnnotation;
|
||||||
declare function nullableTypeAnnotation(typeAnnotation: any): BabelNodeNullableTypeAnnotation;
|
declare function nullableTypeAnnotation(typeAnnotation: any): BabelNodeNullableTypeAnnotation;
|
||||||
declare function NumericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
|
declare function numericLiteralTypeAnnotation(): BabelNodeNumericLiteralTypeAnnotation;
|
||||||
declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation;
|
declare function numberTypeAnnotation(): BabelNodeNumberTypeAnnotation;
|
||||||
declare function stringLiteralTypeAnnotation(): BabelNodeStringLiteralTypeAnnotation;
|
declare function stringLiteralTypeAnnotation(): BabelNodeStringLiteralTypeAnnotation;
|
||||||
declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation;
|
declare function stringTypeAnnotation(): BabelNodeStringTypeAnnotation;
|
||||||
@ -1058,6 +1062,7 @@ declare module "babel-types" {
|
|||||||
declare function isDeclareFunction(node: Object, opts?: Object): boolean;
|
declare function isDeclareFunction(node: Object, opts?: Object): boolean;
|
||||||
declare function isDeclareModule(node: Object, opts?: Object): boolean;
|
declare function isDeclareModule(node: Object, opts?: Object): boolean;
|
||||||
declare function isDeclareVariable(node: Object, opts?: Object): boolean;
|
declare function isDeclareVariable(node: Object, opts?: Object): boolean;
|
||||||
|
declare function isExistentialTypeParam(node: Object, opts?: Object): boolean;
|
||||||
declare function isFunctionTypeAnnotation(node: Object, opts?: Object): boolean;
|
declare function isFunctionTypeAnnotation(node: Object, opts?: Object): boolean;
|
||||||
declare function isFunctionTypeParam(node: Object, opts?: Object): boolean;
|
declare function isFunctionTypeParam(node: Object, opts?: Object): boolean;
|
||||||
declare function isGenericTypeAnnotation(node: Object, opts?: Object): boolean;
|
declare function isGenericTypeAnnotation(node: Object, opts?: Object): boolean;
|
||||||
@ -1139,6 +1144,8 @@ declare module "babel-types" {
|
|||||||
declare function isFlowBaseAnnotation(node: Object, opts?: Object): boolean;
|
declare function isFlowBaseAnnotation(node: Object, opts?: Object): boolean;
|
||||||
declare function isFlowDeclaration(node: Object, opts?: Object): boolean;
|
declare function isFlowDeclaration(node: Object, opts?: Object): boolean;
|
||||||
declare function isJSX(node: Object, opts?: Object): boolean;
|
declare function isJSX(node: Object, opts?: Object): boolean;
|
||||||
|
declare function isNumberLiteral(node: Object, opts?: Object): boolean;
|
||||||
|
declare function isRegexLiteral(node: Object, opts?: Object): boolean;
|
||||||
declare function isReferencedIdentifier(node: Object, opts?: Object): boolean;
|
declare function isReferencedIdentifier(node: Object, opts?: Object): boolean;
|
||||||
declare function isReferencedMemberExpression(node: Object, opts?: Object): boolean;
|
declare function isReferencedMemberExpression(node: Object, opts?: Object): boolean;
|
||||||
declare function isBindingIdentifier(node: Object, opts?: Object): boolean;
|
declare function isBindingIdentifier(node: Object, opts?: Object): boolean;
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
/* eslint no-new-func: 0 */
|
/* eslint no-new-func: 0 */
|
||||||
|
|
||||||
import { transform } from "./node";
|
import { transform } from "./node";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import isFunction from "lodash/lang/isFunction";
|
import isFunction from "lodash/lang/isFunction";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import Module from "module";
|
import Module from "module";
|
||||||
|
|
||||||
let relativeModules = {};
|
let relativeModules = {};
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
export default class Store extends Map {
|
export default class Store extends Map {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as helpers from "babel-helpers";
|
import * as helpers from "babel-helpers";
|
||||||
import generator from "babel-generator";
|
import generator from "babel-generator";
|
||||||
import * as messages from "babel-messages";
|
import * as messages from "babel-messages";
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
/* global BabelParserOptions */
|
/* global BabelParserOptions */
|
||||||
/* global BabelFileMetadata */
|
/* global BabelFileMetadata */
|
||||||
/* global BabelFileResult */
|
/* global BabelFileResult */
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type File from "./index";
|
import type File from "./index";
|
||||||
import buildDebug from "debug/node";
|
import buildDebug from "debug/node";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
export let ModuleDeclaration = {
|
export let ModuleDeclaration = {
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as context from "../../../api/node";
|
import * as context from "../../../api/node";
|
||||||
import type Logger from "../logger";
|
import type Logger from "../logger";
|
||||||
import Plugin from "../../plugin";
|
import Plugin from "../../plugin";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import Plugin from "../plugin";
|
import Plugin from "../plugin";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type Plugin from "./plugin";
|
import type Plugin from "./plugin";
|
||||||
import Store from "../store";
|
import Store from "../store";
|
||||||
import traverse from "babel-traverse";
|
import traverse from "babel-traverse";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import OptionManager from "./file/options/option-manager"
|
import OptionManager from "./file/options/option-manager"
|
||||||
import * as messages from "babel-messages";
|
import * as messages from "babel-messages";
|
||||||
import Store from "../store";
|
import Store from "../store";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import escapeRegExp from "lodash/string/escapeRegExp";
|
import escapeRegExp from "lodash/string/escapeRegExp";
|
||||||
import startsWith from "lodash/string/startsWith";
|
import startsWith from "lodash/string/startsWith";
|
||||||
import isBoolean from "lodash/lang/isBoolean";
|
import isBoolean from "lodash/lang/isBoolean";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type Position from "./position";
|
import type Position from "./position";
|
||||||
import repeating from "repeating";
|
import repeating from "repeating";
|
||||||
import trimRight from "trim-right";
|
import trimRight from "trim-right";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
export function JSXAttribute(node: Object) {
|
export function JSXAttribute(node: Object) {
|
||||||
this.print(node.name, node);
|
this.print(node.name, node);
|
||||||
if (node.value) {
|
if (node.value) {
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import repeating from "repeating";
|
import repeating from "repeating";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import detectIndent from "detect-indent";
|
import detectIndent from "detect-indent";
|
||||||
import Whitespace from "./whitespace";
|
import Whitespace from "./whitespace";
|
||||||
import SourceMap from "./source-map";
|
import SourceMap from "./source-map";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import whitespace from "./whitespace";
|
import whitespace from "./whitespace";
|
||||||
import * as parens from "./parentheses";
|
import * as parens from "./parentheses";
|
||||||
import each from "lodash/collection/each";
|
import each from "lodash/collection/each";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import isBoolean from "lodash/lang/isBoolean";
|
import isBoolean from "lodash/lang/isBoolean";
|
||||||
import each from "lodash/collection/each";
|
import each from "lodash/collection/each";
|
||||||
import map from "lodash/collection/map";
|
import map from "lodash/collection/map";
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default class Position {
|
export default class Position {
|
||||||
|
column: number;
|
||||||
|
line: number;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.line = 1;
|
this.line = 1;
|
||||||
this.column = 0;
|
this.column = 0;
|
||||||
@ -14,7 +17,7 @@ export default class Position {
|
|||||||
* Push a string to the current position, mantaining the current line and column.
|
* Push a string to the current position, mantaining the current line and column.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
push(str) {
|
push(str: string): void {
|
||||||
for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
if (str[i] === "\n") {
|
if (str[i] === "\n") {
|
||||||
this.line++;
|
this.line++;
|
||||||
@ -29,7 +32,7 @@ export default class Position {
|
|||||||
* Unshift a string from the current position, mantaining the current line and column.
|
* Unshift a string from the current position, mantaining the current line and column.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unshift(str) {
|
unshift(str: string): void {
|
||||||
for (let i = 0; i < str.length; i++) {
|
for (let i = 0; i < str.length; i++) {
|
||||||
if (str[i] === "\n") {
|
if (str[i] === "\n") {
|
||||||
this.line--;
|
this.line--;
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import repeating from "repeating";
|
import repeating from "repeating";
|
||||||
import Buffer from "./buffer";
|
import Buffer from "./buffer";
|
||||||
import n from "./node";
|
import n from "./node";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import sourceMap from "source-map";
|
import sourceMap from "source-map";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns `i`th number from `base`, continuing from 0 when `max` is reached.
|
* Returns `i`th number from `base`, continuing from 0 when `max` is reached.
|
||||||
* Useful for shifting `for` loop by a fixed number but going over all items.
|
* Useful for shifting `for` loop by a fixed number but going over all items.
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import esutils from "esutils";
|
import esutils from "esutils";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import hoistVariables from "babel-helper-hoist-variables";
|
import hoistVariables from "babel-helper-hoist-variables";
|
||||||
import type { NodePath } from "babel-traverse";
|
import type { NodePath } from "babel-traverse";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import nameFunction from "babel-helper-function-name";
|
import nameFunction from "babel-helper-function-name";
|
||||||
import each from "lodash/collection/each";
|
import each from "lodash/collection/each";
|
||||||
import has from "lodash/object/has";
|
import has from "lodash/object/has";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type { Scope } from "babel-traverse";
|
import type { Scope } from "babel-traverse";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import getFunctionArity from "babel-helper-get-function-arity";
|
import getFunctionArity from "babel-helper-get-function-arity";
|
||||||
import template from "babel-template";
|
import template from "babel-template";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
export default function (node): number {
|
export default function (node): number {
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type { NodePath, Scope } from "babel-traverse";
|
import type { NodePath, Scope } from "babel-traverse";
|
||||||
import optimiseCall from "babel-helper-optimise-call-expression";
|
import optimiseCall from "babel-helper-optimise-call-expression";
|
||||||
import * as messages from "babel-messages";
|
import * as messages from "babel-messages";
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export const MESSAGES = {
|
|||||||
* Get a message with $0 placeholders replaced by arguments.
|
* Get a message with $0 placeholders replaced by arguments.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function get(key: string, ...args): string {
|
export function get(key: string, ...args: Array<any>): string {
|
||||||
let msg = MESSAGES[key];
|
let msg = MESSAGES[key];
|
||||||
if (!msg) throw new ReferenceError(`Unknown message ${JSON.stringify(key)}`);
|
if (!msg) throw new ReferenceError(`Unknown message ${JSON.stringify(key)}`);
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type { Scope } from "babel-traverse";
|
import type { Scope } from "babel-traverse";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import homeOrTmp from "home-or-tmp";
|
import homeOrTmp from "home-or-tmp";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import cloneDeep from "lodash/lang/cloneDeep";
|
import cloneDeep from "lodash/lang/cloneDeep";
|
||||||
import has from "lodash/object/has";
|
import has from "lodash/object/has";
|
||||||
import traverse from "babel-traverse";
|
import traverse from "babel-traverse";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import NodePath from "./path";
|
import NodePath from "./path";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
export default class Hub {
|
export default class Hub {
|
||||||
constructor(file, options) {
|
constructor(file, options) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import TraversalContext from "./context";
|
import TraversalContext from "./context";
|
||||||
import * as visitors from "./visitors";
|
import * as visitors from "./visitors";
|
||||||
import * as messages from "babel-messages";
|
import * as messages from "babel-messages";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains that retrieve or validate anything related to the current paths ancestry.
|
// This file contains that retrieve or validate anything related to the current paths ancestry.
|
||||||
|
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods responsible for dealing with comments.
|
// This file contains methods responsible for dealing with comments.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods responsible for maintaining a TraversalContext.
|
// This file contains methods responsible for maintaining a TraversalContext.
|
||||||
|
|
||||||
import traverse from "../index";
|
import traverse from "../index";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods that convert the path node into another node or some other type of data.
|
// This file contains methods that convert the path node into another node or some other type of data.
|
||||||
|
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type NodePath from "./index";
|
import type NodePath from "./index";
|
||||||
|
|
||||||
// This file contains Babels metainterpreter that can evaluate static code.
|
// This file contains Babels metainterpreter that can evaluate static code.
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods responsible for dealing with/retrieving children or siblings.
|
// This file contains methods responsible for dealing with/retrieving children or siblings.
|
||||||
|
|
||||||
import type TraversalContext from "../index";
|
import type TraversalContext from "../index";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type Hub from "../hub";
|
import type Hub from "../hub";
|
||||||
import type TraversalContext from "../context";
|
import type TraversalContext from "../context";
|
||||||
import * as virtualTypes from "./lib/virtual-types";
|
import * as virtualTypes from "./lib/virtual-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type NodePath from "./index";
|
import type NodePath from "./index";
|
||||||
import * as inferers from "./inferers";
|
import * as inferers from "./inferers";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type NodePath from "../index";
|
import type NodePath from "../index";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
export { default as Identifier } from "./inferer-reference";
|
export { default as Identifier } from "./inferer-reference";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods responsible for introspecting the current path for certain values.
|
// This file contains methods responsible for introspecting the current path for certain values.
|
||||||
|
|
||||||
import type NodePath from "./index";
|
import type NodePath from "./index";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { react } from "babel-types";
|
import { react } from "babel-types";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// this file contains hooks that handle ancestry cleanup of parent nodes when removing children
|
// this file contains hooks that handle ancestry cleanup of parent nodes when removing children
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type NodePath from "../index";
|
import type NodePath from "../index";
|
||||||
import { react } from "babel-types";
|
import { react } from "babel-types";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods that modify the path/node in some ways.
|
// This file contains methods that modify the path/node in some ways.
|
||||||
|
|
||||||
import { PATH_CACHE_KEY } from "./constants";
|
import { PATH_CACHE_KEY } from "./constants";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods responsible for removing a node.
|
// This file contains methods responsible for removing a node.
|
||||||
|
|
||||||
import { hooks } from "./lib/removal-hooks";
|
import { hooks } from "./lib/removal-hooks";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This file contains methods responsible for replacing a node with another.
|
// This file contains methods responsible for replacing a node with another.
|
||||||
|
|
||||||
import codeFrame from "babel-code-frame";
|
import codeFrame from "babel-code-frame";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type NodePath from "../path";
|
import type NodePath from "../path";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import includes from "lodash/collection/includes";
|
import includes from "lodash/collection/includes";
|
||||||
import repeating from "repeating";
|
import repeating from "repeating";
|
||||||
import Renamer from "./lib/renamer";
|
import Renamer from "./lib/renamer";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import Binding from "../binding";
|
import Binding from "../binding";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as virtualTypes from "./path/lib/virtual-types";
|
import * as virtualTypes from "./path/lib/virtual-types";
|
||||||
import * as messages from "babel-messages";
|
import * as messages from "babel-messages";
|
||||||
import * as t from "babel-types";
|
import * as t from "babel-types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import isPlainObject from "lodash/lang/isPlainObject";
|
import isPlainObject from "lodash/lang/isPlainObject";
|
||||||
import isNumber from "lodash/lang/isNumber";
|
import isNumber from "lodash/lang/isNumber";
|
||||||
import isRegExp from "lodash/lang/isRegExp";
|
import isRegExp from "lodash/lang/isRegExp";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as t from "../index";
|
import * as t from "../index";
|
||||||
|
|
||||||
export let VISITOR_KEYS = {};
|
export let VISITOR_KEYS = {};
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as t from "./index";
|
import * as t from "./index";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import toFastProperties from "to-fast-properties";
|
import toFastProperties from "to-fast-properties";
|
||||||
import compact from "lodash/array/compact";
|
import compact from "lodash/array/compact";
|
||||||
import loClone from "lodash/lang/clone";
|
import loClone from "lodash/lang/clone";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { getBindingIdentifiers } from "./retrievers";
|
import { getBindingIdentifiers } from "./retrievers";
|
||||||
import esutils from "esutils";
|
import esutils from "esutils";
|
||||||
import * as t from "./index";
|
import * as t from "./index";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import Parser, { plugins } from "./parser";
|
import Parser, { plugins } from "./parser";
|
||||||
import "./parser/util";
|
import "./parser/util";
|
||||||
import "./parser/statement";
|
import "./parser/statement";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// A second optional argument can be given to further configure
|
// A second optional argument can be given to further configure
|
||||||
// the parser process. These options are recognized:
|
// the parser process. These options are recognized:
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// A recursive descent parser operates by defining functions for all
|
// A recursive descent parser operates by defining functions for all
|
||||||
// syntactic elements, and recursively calling those, each function
|
// syntactic elements, and recursively calling those, each function
|
||||||
// advancing the input stream and returning an AST node. Precedence
|
// advancing the input stream and returning an AST node. Precedence
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { reservedWords } from "../util/identifier";
|
import { reservedWords } from "../util/identifier";
|
||||||
import { getOptions } from "../options";
|
import { getOptions } from "../options";
|
||||||
import Tokenizer from "../tokenizer";
|
import Tokenizer from "../tokenizer";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { getLineInfo } from "../util/location";
|
import { getLineInfo } from "../util/location";
|
||||||
import Parser from "./index";
|
import Parser from "./index";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { types as tt } from "../tokenizer/types";
|
import { types as tt } from "../tokenizer/types";
|
||||||
import Parser from "./index";
|
import Parser from "./index";
|
||||||
import { reservedWords } from "../util/identifier";
|
import { reservedWords } from "../util/identifier";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import Parser from "./index";
|
import Parser from "./index";
|
||||||
import { SourceLocation } from "../util/location";
|
import { SourceLocation } from "../util/location";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { types as tt } from "../tokenizer/types";
|
import { types as tt } from "../tokenizer/types";
|
||||||
import Parser from "./index";
|
import Parser from "./index";
|
||||||
import { lineBreak } from "../util/whitespace";
|
import { lineBreak } from "../util/whitespace";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { types as tt } from "../tokenizer/types";
|
import { types as tt } from "../tokenizer/types";
|
||||||
import Parser from "../parser";
|
import Parser from "../parser";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import XHTMLEntities from "./xhtml";
|
import XHTMLEntities from "./xhtml";
|
||||||
import { TokenType, types as tt } from "../../tokenizer/types";
|
import { TokenType, types as tt } from "../../tokenizer/types";
|
||||||
import { TokContext, types as tc } from "../../tokenizer/context";
|
import { TokContext, types as tc } from "../../tokenizer/context";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type { TokenType } from "./types";
|
import type { TokenType } from "./types";
|
||||||
import { isIdentifierStart, isIdentifierChar, isKeyword } from "../util/identifier";
|
import { isIdentifierStart, isIdentifierChar, isKeyword } from "../util/identifier";
|
||||||
import { types as tt, keywords as keywordTypes } from "./types";
|
import { types as tt, keywords as keywordTypes } from "./types";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import type { TokContext } from "./context";
|
import type { TokContext } from "./context";
|
||||||
import type { Token } from "./index";
|
import type { Token } from "./index";
|
||||||
import { Position } from "../util/location";
|
import { Position } from "../util/location";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// ## Token types
|
// ## Token types
|
||||||
|
|
||||||
// The assignment of fine-grained, information-carrying type objects
|
// The assignment of fine-grained, information-carrying type objects
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
// This is a trick taken from Esprima. It turns out that, on
|
// This is a trick taken from Esprima. It turns out that, on
|
||||||
// non-Chrome browsers, to check whether a string is in a set, a
|
// non-Chrome browsers, to check whether a string is in a set, a
|
||||||
// predicate containing a big ugly `switch` statement is faster than
|
// predicate containing a big ugly `switch` statement is faster than
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import { lineBreakG } from "./whitespace";
|
import { lineBreakG } from "./whitespace";
|
||||||
|
|
||||||
// These are used when `options.locations` is on, for the
|
// These are used when `options.locations` is on, for the
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
export const lineBreak = /\r\n?|\n|\u2028|\u2029/;
|
export const lineBreak = /\r\n?|\n|\u2028|\u2029/;
|
||||||
export const lineBreakG = new RegExp(lineBreak.source, "g");
|
export const lineBreakG = new RegExp(lineBreak.source, "g");
|
||||||
|
|
||||||
export function isNewLine(code) {
|
export function isNewLine(code: number): boolean {
|
||||||
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
|
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,10 @@ for (var type in t.NODE_FIELDS) {
|
|||||||
${struct.join("\n ").trim()}
|
${struct.join("\n ").trim()}
|
||||||
}\n\n`;
|
}\n\n`;
|
||||||
|
|
||||||
|
// Flow chokes on super() :/
|
||||||
|
if (type !== 'Super') {
|
||||||
lines.push(`declare function ${type[0].toLowerCase() + type.slice(1)}(${args.join(", ")}): ${NODE_PREFIX}${type};`);
|
lines.push(`declare function ${type[0].toLowerCase() + type.slice(1)}(${args.join(", ")}): ${NODE_PREFIX}${type};`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < t.TYPES.length; i++) {
|
for (var i = 0; i < t.TYPES.length; i++) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user