From 3f9d2e8c4ede0723539815a8fd4d5e42a16dc96d Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Wed, 22 Feb 2017 10:57:20 -0600 Subject: [PATCH] fix excludeNotExported with default exports Fix issue where default exports are separated across two statements such as ``` const foo = {}; export default foo; ``` * remove the short-circuit in the declaration factory so all reflections exist after converter#convert is run * in converter#resolve, add check for excludeNotExported and then prune the references list and children in the project structure whose isExported flag is false fixes #393 --- src/lib/converter/converter.ts | 33 +++++++++++++++++++++- src/lib/converter/factories/declaration.ts | 4 --- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/lib/converter/converter.ts b/src/lib/converter/converter.ts index 847a6ce0d..1f14c56f2 100644 --- a/src/lib/converter/converter.ts +++ b/src/lib/converter/converter.ts @@ -4,7 +4,7 @@ import * as _ from 'lodash'; import {Application} from '../application'; import {ParameterType} from '../utils/options/declaration'; -import {Reflection, Type, ProjectReflection} from '../models/index'; +import {Reflection, Type, ProjectReflection, DeclarationReflection} from '../models/index'; import {Context} from './context'; import {ConverterComponent, ConverterNodeComponent, ConverterTypeComponent, TypeTypeConverter, TypeNodeConverter} from './components'; import {CompilerHost} from './utils/compiler-host'; @@ -374,6 +374,33 @@ export class Converter extends ChildableComponent= 0; --i) { + const node = reflections[i]; + if (!node.flags.isExported) { + reflections.splice(i, 1); + delete project.reflections[node.id]; + } + + if (Array.isArray(node.children)) { + checkNodes(node.children); + } + } + } + + if (Array.isArray(project.children)) { + checkNodes(project.children); + } + } + /** * Resolve the project within the given context. * @@ -384,6 +411,10 @@ export class Converter extends ChildableComponent