Restructuring

master
Paul Loyd 2017-12-01 22:39:03 +03:00
parent f2aadffd95
commit e706f57684
11 changed files with 22 additions and 21 deletions

View File

@ -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 {

View File

@ -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';

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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 {

View File

@ -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;

View File

@ -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

View File

@ -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 {

View File

@ -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);