Skip to content

Commit

Permalink
feat(ast-spec): extract ExportKind & ImportKind (#3564)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Jul 31, 2021
1 parent ce984e3 commit 120d566
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
Expand Up @@ -2,10 +2,11 @@ import type { AST_NODE_TYPES } from '../../ast-node-types';
import type { BaseNode } from '../../base/BaseNode';
import type { Identifier } from '../../expression/Identifier/spec';
import type { Expression } from '../../unions/Expression';
import type { ExportKind } from '../ExportAndImportKind';

export interface ExportAllDeclaration extends BaseNode {
type: AST_NODE_TYPES.ExportAllDeclaration;
source: Expression | null;
exportKind: 'type' | 'value';
exportKind: ExportKind;
exported: Identifier | null;
}
4 changes: 4 additions & 0 deletions packages/ast-spec/src/declaration/ExportAndImportKind.ts
@@ -0,0 +1,4 @@
type ExportAndImportKind = 'type' | 'value';

export type ExportKind = ExportAndImportKind;
export type ImportKind = ExportAndImportKind;
Expand Up @@ -2,9 +2,10 @@ import type { AST_NODE_TYPES } from '../../ast-node-types';
import type { BaseNode } from '../../base/BaseNode';
import type { ExportDeclaration } from '../../unions/ExportDeclaration';
import type { Expression } from '../../unions/Expression';
import type { ExportKind } from '../ExportAndImportKind';

export interface ExportDefaultDeclaration extends BaseNode {
type: AST_NODE_TYPES.ExportDefaultDeclaration;
declaration: ExportDeclaration | Expression;
exportKind: 'type' | 'value';
exportKind: ExportKind;
}
Expand Up @@ -3,11 +3,12 @@ import type { BaseNode } from '../../base/BaseNode';
import type { ExportSpecifier } from '../../special/ExportSpecifier/spec';
import type { ExportDeclaration } from '../../unions/ExportDeclaration';
import type { Expression } from '../../unions/Expression';
import type { ExportKind } from '../ExportAndImportKind';

export interface ExportNamedDeclaration extends BaseNode {
type: AST_NODE_TYPES.ExportNamedDeclaration;
declaration: ExportDeclaration | null;
specifiers: ExportSpecifier[];
source: Expression | null;
exportKind: 'type' | 'value';
exportKind: ExportKind;
}
3 changes: 2 additions & 1 deletion packages/ast-spec/src/declaration/ImportDeclaration/spec.ts
Expand Up @@ -2,10 +2,11 @@ import type { AST_NODE_TYPES } from '../../ast-node-types';
import type { BaseNode } from '../../base/BaseNode';
import type { ImportClause } from '../../unions/ImportClause';
import type { Literal } from '../../unions/Literal';
import type { ImportKind } from '../ExportAndImportKind';

export interface ImportDeclaration extends BaseNode {
type: AST_NODE_TYPES.ImportDeclaration;
source: Literal;
specifiers: ImportClause[];
importKind: 'type' | 'value';
importKind: ImportKind;
}
Expand Up @@ -3,11 +3,12 @@ import type { BaseNode } from '../../base/BaseNode';
import type { Identifier } from '../../expression/Identifier/spec';
import type { TSExternalModuleReference } from '../../special/TSExternalModuleReference/spec';
import type { EntityName } from '../../unions/EntityName';
import type { ImportKind } from '../ExportAndImportKind';

export interface TSImportEqualsDeclaration extends BaseNode {
type: AST_NODE_TYPES.TSImportEqualsDeclaration;
id: Identifier;
moduleReference: EntityName | TSExternalModuleReference;
importKind: 'type' | 'value';
importKind: ImportKind;
isExport: boolean;
}

0 comments on commit 120d566

Please sign in to comment.