11import { orderBy } from "natural-orderby" ;
2- import {
3- Node ,
4- type ExportedDeclarations ,
5- type ModuleDeclaration ,
6- type Project ,
7- type SourceFile ,
8- } from "ts-morph" ;
2+ import { Node , type ExportedDeclarations } from "ts-morph" ;
93import { ambientModulesDeclarations } from "./ambient-modules-declarations" ;
104import { exportEqualsDeclarations } from "./export-equals-declarations" ;
115import { exportedDeclarations } from "./exported-declarations" ;
12- import { extractClass , type ExtractedClass } from "./extract-class" ;
13- import { extractEnum , type ExtractedEnum } from "./extract-enum" ;
6+ import { extractClass } from "./extract-class" ;
7+ import { extractEnum } from "./extract-enum" ;
148import { extractExpression } from "./extract-expression" ;
159import { extractFileModule } from "./extract-file-module" ;
16- import { extractFunction , type ExtractedFunction } from "./extract-function" ;
10+ import { extractFunction } from "./extract-function" ;
1711import { extractFunctionExpression } from "./extract-function-expression" ;
18- import { extractInterface , type ExtractedInterface } from "./extract-interface" ;
19- import { extractNamespace , type ExtractedNamespace } from "./extract-namespace" ;
20- import { extractTypeAlias , type ExtractedTypeAlias } from "./extract-type-alias" ;
21- import { extractVariable , type ExtractedVariable } from "./extract-variable" ;
12+ import { extractInterface } from "./extract-interface" ;
13+ import { extractNamespace } from "./extract-namespace" ;
14+ import { extractTypeAlias } from "./extract-type-alias" ;
15+ import { extractVariable } from "./extract-variable" ;
2216import { extractVariableAssignmentExpression } from "./extract-variable-assignment-expression" ;
2317import { globalAmbientDeclarations } from "./global-ambient-declarations" ;
2418import { id } from "./id" ;
@@ -33,55 +27,7 @@ import { isNamespace } from "./is-namespace";
3327import { isTypeAlias } from "./is-type-alias" ;
3428import { isVariable } from "./is-variable" ;
3529import { isVariableAssignmentExpression } from "./is-variable-assignment-expression" ;
36-
37- /**
38- `ExtractDeclarationsOptions` contains all the options
39- for calling {@link extractDeclarations}.
40-
41- @internal
42- */
43- export type ExtractDeclarationsOptions = {
44- /**
45- Name of the container that contains the top-level declarations
46- (e.g., a namespace's name). This is used to generate declaration IDs.
47- */
48- containerName : string ;
49-
50- /** Container that contains the top-level declarations. */
51- container : SourceFile | ModuleDeclaration ;
52-
53- /** Maximum extraction depth for nested namespaces. */
54- maxDepth : number ;
55-
56- /**
57- Instance of a `ts-morph` `Project`. This is used to find ambient modules.
58- */
59- project ?: Project ;
60-
61- /**
62- Name of the package being analyzed. This is used to filter ambient modules.
63- */
64- pkgName ?: string ;
65- } ;
66-
67- /**
68- `ExtractedDeclaration` is the union of all possible top-level declarations
69- that can be extracted from a package, module or namespace.
70- */
71- export type ExtractedDeclaration =
72- | ExtractedVariable
73- | ExtractedFunction
74- | ExtractedClass
75- | ExtractedInterface
76- | ExtractedEnum
77- | ExtractedTypeAlias
78- | ExtractedNamespace ;
79-
80- /**
81- `ExtractedDeclarationKind` is the union of all discriminators
82- used to detect the kind of top-level declaration.
83- */
84- export type ExtractedDeclarationKind = ExtractedDeclaration [ "kind" ] ;
30+ import type { ExtractDeclarationsOptions , ExtractedDeclaration } from "./types" ;
8531
8632/**
8733`extractDeclarations` extracts the top-level declarations found in a container
0 commit comments