Restructuring
parent
f2aadffd95
commit
e706f57684
|
@ -2,9 +2,9 @@ import wu from 'wu';
|
|||
import type {Node} from '@babel/types';
|
||||
|
||||
import Scope from './scope';
|
||||
import Collector from './collector';
|
||||
import {invariant} from './utils';
|
||||
import type {Type} from './types';
|
||||
import Collector from '.';
|
||||
import {invariant} from '../utils';
|
||||
import type {Type} from '../types';
|
||||
import type {TemplateParam, ExternalInfo} from './query';
|
||||
|
||||
export default class Context {
|
|
@ -14,7 +14,7 @@ import {
|
|||
isStringLiteral, isTypeAlias, isVariableDeclaration,
|
||||
} from '@babel/types';
|
||||
|
||||
import {invariant} from './utils';
|
||||
import {invariant} from '../utils';
|
||||
import Context from './context';
|
||||
import type {ExternalInfo, TemplateParam} from './query';
|
||||
|
|
@ -18,13 +18,13 @@ import Context from './context';
|
|||
import type {
|
||||
Type, RecordType, Field, ArrayType, TupleType, MapType, UnionType, IntersectionType,
|
||||
MaybeType, NumberType, StringType, BooleanType, LiteralType, ReferenceType,
|
||||
} from './types';
|
||||
} from '../types';
|
||||
|
||||
import * as t from './types';
|
||||
import * as t from '../types';
|
||||
|
||||
import {extractPragmas} from './pragmas';
|
||||
|
||||
import {invariant} from './utils';
|
||||
import {invariant} from '../utils';
|
||||
|
||||
function processTypeAlias(ctx: Context, node: TypeAlias) {
|
||||
const {name} = node.id;
|
|
@ -1,8 +1,8 @@
|
|||
import wu from 'wu';
|
||||
|
||||
import {invariant} from './utils';
|
||||
import type {Type, TypeId} from './types';
|
||||
import * as t from './types';
|
||||
import {invariant} from '../utils';
|
||||
import type {Type, TypeId} from '../types';
|
||||
import * as t from '../types';
|
||||
|
||||
function object(params: (?Type)[]): ?Type {
|
||||
invariant(params.length === 0);
|
|
@ -11,9 +11,9 @@ import declarationGroup from './declarations';
|
|||
import Module from './module';
|
||||
import Scope from './scope';
|
||||
import Context from './context';
|
||||
import {invariant} from './utils';
|
||||
import type Parser from './parser';
|
||||
import type {Type, TypeId} from './types';
|
||||
import {invariant} from '../utils';
|
||||
import type Parser from '../parser';
|
||||
import type {Type, TypeId} from '../types';
|
||||
import type {TemplateParam} from './query';
|
||||
|
||||
const VISITOR = Object.assign({}, definitionGroup, declarationGroup);
|
|
@ -2,7 +2,7 @@ import * as pathlib from 'path';
|
|||
import * as resolve from 'resolve';
|
||||
|
||||
import type Scope from './scope';
|
||||
import type {Type, TypeId} from './types';
|
||||
import type {Type, TypeId} from '../types';
|
||||
import type {Query} from './query';
|
||||
|
||||
export default class Module {
|
|
@ -1,7 +1,7 @@
|
|||
import {invariant} from './utils';
|
||||
import {invariant} from '../utils';
|
||||
|
||||
import type {Type} from './types';
|
||||
import * as t from './types';
|
||||
import type {Type} from '../types';
|
||||
import * as t from '../types';
|
||||
|
||||
export type Pragma =
|
||||
| TypePragma;
|
|
@ -1,7 +1,7 @@
|
|||
import type {Node} from '@babel/types';
|
||||
|
||||
import type Scope from './scope';
|
||||
import type {Type, TypeId} from './types';
|
||||
import type {Type, TypeId} from '../types';
|
||||
|
||||
export type Query =
|
||||
| Unknown
|
|
@ -1,9 +1,9 @@
|
|||
import wu from 'wu';
|
||||
import type {Node} from '@babel/types';
|
||||
|
||||
import {invariant, last} from './utils';
|
||||
import {invariant, last} from '../utils';
|
||||
import type Module from './module';
|
||||
import type {Type, TypeId} from './types';
|
||||
import type {Type, TypeId} from '../types';
|
||||
import type {Query, Template, TemplateParam, ExternalInfo, SpecialFn} from './query';
|
||||
|
||||
export default class Scope {
|
|
@ -1,10 +1,11 @@
|
|||
import Parser from './parser';
|
||||
import Collector from './collector';
|
||||
import type {Type} from './types';
|
||||
|
||||
// @see babel#6805.
|
||||
//export {Parser, Collector};
|
||||
|
||||
export default function collect(path: string): Collector {
|
||||
export default function (path: string): {+types: Type[]} {
|
||||
const parser = new Parser;
|
||||
const collector = new Collector(parser);
|
||||
|
||||
|
|
Loading…
Reference in New Issue