mirror of https://github.com/status-im/metro.git
Rename `Ast` to a more appropriate `BabelNode` in the babel flow type
Summary: An Ast consists of `Node` elements and the one Babel uses is specific to Babel (incompatible with Astree spec by default) so `BabelNode` seems more appropriate. Keeping the other `ast` names for now to reduce the footprint of this diff. Also makes sure `babel-core` properly exports the same node type as what the api returns making fixes to this type in the future easier to implement. Reviewed By: davidaurelio Differential Revision: D6834291 fbshipit-source-id: 4cb0eb2ee280a4988071b8412539edfad12cf56f
This commit is contained in:
parent
7fcff0a976
commit
d23c3ca10b
|
@ -102,10 +102,10 @@ type _TransformOptions = __TransformOptions & {
|
||||||
env?: {[key: string]: __TransformOptions},
|
env?: {[key: string]: __TransformOptions},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Ast = {};
|
type BabelNode = {};
|
||||||
|
|
||||||
type TransformResult = {
|
type TransformResult = {
|
||||||
ast: Ast,
|
ast: BabelNode,
|
||||||
code: ?string,
|
code: ?string,
|
||||||
ignored: boolean,
|
ignored: boolean,
|
||||||
map: ?_BabelSourceMap,
|
map: ?_BabelSourceMap,
|
||||||
|
@ -123,14 +123,13 @@ type BabelTypes = {[key: string]: Function};
|
||||||
declare module 'babel-core' {
|
declare module 'babel-core' {
|
||||||
declare type Plugins = _Plugins;
|
declare type Plugins = _Plugins;
|
||||||
declare type BabelSourceMap = _BabelSourceMap;
|
declare type BabelSourceMap = _BabelSourceMap;
|
||||||
declare type Ast = {};
|
declare type Ast = BabelNode;
|
||||||
declare type TransformOptions = _TransformOptions;
|
declare type TransformOptions = _TransformOptions;
|
||||||
declare var transform: TransformSync /*(
|
declare var transform: TransformSync /*(
|
||||||
code: string,
|
code: string,
|
||||||
options?: _TransformOptions,
|
options?: _TransformOptions,
|
||||||
): TransformResult*/;
|
): TransformResult*/;
|
||||||
declare function traverse<State>(
|
declare function traverse<State>(
|
||||||
ast: Ast,
|
|
||||||
ast: BabelNode,
|
ast: BabelNode,
|
||||||
visitor: BabelVisitor,
|
visitor: BabelVisitor,
|
||||||
scope?: ?Object,
|
scope?: ?Object,
|
||||||
|
@ -140,7 +139,7 @@ declare module 'babel-core' {
|
||||||
declare var types: BabelTypes;
|
declare var types: BabelTypes;
|
||||||
declare var transformFile: TransformFile;
|
declare var transformFile: TransformFile;
|
||||||
declare var transformFromAst: TransformFromAst /*(
|
declare var transformFromAst: TransformFromAst /*(
|
||||||
ast: Ast,
|
ast: BabelNode,
|
||||||
code?: ?string,
|
code?: ?string,
|
||||||
babelOptions?: _TransformOptions,
|
babelOptions?: _TransformOptions,
|
||||||
): TransformResult*/;
|
): TransformResult*/;
|
||||||
|
@ -157,7 +156,7 @@ type _BabelSourceMapSegment = {
|
||||||
declare module 'babel-generator' {
|
declare module 'babel-generator' {
|
||||||
declare export type BabelSourceMapSegment = _BabelSourceMapSegment;
|
declare export type BabelSourceMapSegment = _BabelSourceMapSegment;
|
||||||
declare export default (
|
declare export default (
|
||||||
ast: Ast,
|
ast: BabelNode,
|
||||||
options?: GeneratorOptions,
|
options?: GeneratorOptions,
|
||||||
code?: string | {[string]: string},
|
code?: string | {[string]: string},
|
||||||
) => GeneratorResult
|
) => GeneratorResult
|
||||||
|
|
|
@ -17,6 +17,7 @@ const {babelTypes} = require('../babel-bridge');
|
||||||
|
|
||||||
import type {AssetDataWithoutFiles} from '../Assets';
|
import type {AssetDataWithoutFiles} from '../Assets';
|
||||||
import type {ModuleTransportLike} from '../shared/types.flow';
|
import type {ModuleTransportLike} from '../shared/types.flow';
|
||||||
|
import type {Ast} from '@babel/core';
|
||||||
|
|
||||||
// Structure of the object: dir.name.scale = asset
|
// Structure of the object: dir.name.scale = asset
|
||||||
export type RemoteFileMap = {
|
export type RemoteFileMap = {
|
||||||
|
|
Loading…
Reference in New Issue