Skip to content

Commit 295ccdd

Browse files
committed
fix!: Rename external modules to modules
Closes #109 BREAKING CHANGE: Any plugins which referenced ReflectionKind.ExternalModule or ReflectionKind.Module need to be updated to reference ReflectionKind.Module and ReflectionKind.Namespace respectively.
1 parent 5d41a2e commit 295ccdd

File tree

71 files changed

+1163
-1984
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1163
-1984
lines changed

src/lib/converter/factories/declaration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { createReferenceType } from './reference';
1212
const nonStaticKinds = [
1313
ReflectionKind.Class,
1414
ReflectionKind.Interface,
15-
ReflectionKind.Module
15+
ReflectionKind.Namespace
1616
];
1717

1818
/**
@@ -73,13 +73,13 @@ export function createDeclaration(context: Context, node: ts.Declaration, kind:
7373
let hasComment: boolean = Boolean(getRawComment(node));
7474
// Test whether the node is exported
7575
let isExported: boolean;
76-
if (kind === ReflectionKind.ExternalModule || kind === ReflectionKind.Global) {
76+
if (kind === ReflectionKind.Module || kind === ReflectionKind.Global) {
7777
isExported = true;
7878
hasComment = true;
7979
} else if (container.kind === ReflectionKind.Global) {
8080
// In file mode, everything is exported.
8181
isExported = true;
82-
} else if (container.kindOf([ReflectionKind.Module, ReflectionKind.ExternalModule])) {
82+
} else if (container.kindOf([ReflectionKind.Namespace, ReflectionKind.Module])) {
8383
const symbol = context.getSymbolAtLocation(node);
8484
if (!symbol) {
8585
isExported = false;
@@ -220,7 +220,7 @@ function canMergeReflectionsByKind(kind1: ReflectionKind, kind2: ReflectionKind)
220220
*/
221221
function mergeDeclarations(context: Context, reflection: DeclarationReflection, node: ts.Node, kind: ReflectionKind) {
222222
if (reflection.kind !== kind) {
223-
const weights = [ReflectionKind.Module, ReflectionKind.Enum, ReflectionKind.Class];
223+
const weights = [ReflectionKind.Namespace, ReflectionKind.Enum, ReflectionKind.Class];
224224
const kindWeight = weights.indexOf(kind);
225225
const childKindWeight = weights.indexOf(reflection.kind);
226226
if (kindWeight > childKindWeight) {

src/lib/converter/nodes/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class BlockConverter extends ConverterNodeComponent<ts.SourceFile|ts.Bloc
5555

5656
context.withSourceFile(node, () => {
5757
if (this.mode === SourceFileMode.Modules) {
58-
result = createDeclaration(context, node, ReflectionKind.ExternalModule, node.fileName);
58+
result = createDeclaration(context, node, ReflectionKind.Module, node.fileName);
5959
context.withScope(result, () => {
6060
this.convertStatements(context, node);
6161
result!.setFlag(ReflectionFlag.Exported);

src/lib/converter/nodes/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class ModuleConverter extends ConverterNodeComponent<ts.ModuleDeclaration
2424
convert(context: Context, node: ts.ModuleDeclaration): Reflection | undefined {
2525
const reflection = context.isInherit && context.inheritParent === node
2626
? <DeclarationReflection> context.scope
27-
: createDeclaration(context, node, ReflectionKind.Module);
27+
: createDeclaration(context, node, ReflectionKind.Namespace);
2828
context.withScope(reflection, () => {
2929
if (node.body) {
3030
this.owner.convertNode(context, node.body);

src/lib/converter/plugins/CommentPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export class CommentPlugin extends ConverterComponent {
137137
comment.removeTags('event');
138138
}
139139

140-
if (reflection.kindOf(ReflectionKind.ExternalModule)) {
140+
if (reflection.kindOf(ReflectionKind.Module)) {
141141
comment.removeTags('packagedocumentation');
142142
}
143143
}
@@ -199,7 +199,7 @@ export class CommentPlugin extends ConverterComponent {
199199
const comment = parseComment(rawComment, reflection.comment);
200200
this.applyModifiers(reflection, comment);
201201
this.removeExcludedTags(comment);
202-
} else if (reflection.kindOf(ReflectionKind.Module)) {
202+
} else if (reflection.kindOf(ReflectionKind.Namespace)) {
203203
this.storeModuleComment(rawComment, reflection);
204204
} else {
205205
const comment = parseComment(rawComment, reflection.comment);

src/lib/converter/plugins/DynamicModulePlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class DynamicModulePlugin extends ConverterComponent {
5252
* @param node The node that is currently processed if available.
5353
*/
5454
private onDeclaration(context: Context, reflection: Reflection, node?: ts.Node) {
55-
if (reflection.kindOf(ReflectionKind.ExternalModule)) {
55+
if (reflection.kindOf(ReflectionKind.Module)) {
5656
let name = reflection.name;
5757
if (!name.includes('/')) {
5858
return;

src/lib/converter/plugins/GroupPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export class GroupPlugin extends ConverterComponent {
1717
*/
1818
static WEIGHTS = [
1919
ReflectionKind.Global,
20-
ReflectionKind.ExternalModule,
2120
ReflectionKind.Module,
21+
ReflectionKind.Namespace,
2222
ReflectionKind.Enum,
2323
ReflectionKind.EnumMember,
2424
ReflectionKind.Class,

src/lib/models/reflections/abstract.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ export function resetReflectionID() {
3636
*/
3737
export enum ReflectionKind {
3838
Global = 0,
39-
ExternalModule = 1 << 0,
40-
Module = 1 << 1,
39+
Module = 1 << 0,
40+
Namespace = 1 << 1,
4141
Enum = 1 << 2,
4242
EnumMember = 1 << 4,
4343
Variable = 1 << 5,
@@ -66,7 +66,7 @@ export enum ReflectionKind {
6666
FunctionOrMethod = ReflectionKind.Function | Method,
6767
ClassMember = Accessor | Constructor | Method | Property | Event,
6868
SomeSignature = CallSignature | IndexSignature | ConstructorSignature | GetSignature | SetSignature,
69-
SomeModule = Module | ExternalModule,
69+
SomeModule = Namespace | Module,
7070
SomeType = Interface | TypeLiteral | TypeParameter | TypeAlias,
7171
SomeValue = Variable | Function | ObjectLiteral
7272
}

src/lib/output/themes/DefaultTheme.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class DefaultTheme extends Theme {
6161
directory: 'enums',
6262
template: 'reflection.hbs'
6363
}, {
64-
kind: [ReflectionKind.Module, ReflectionKind.ExternalModule],
64+
kind: [ReflectionKind.Namespace, ReflectionKind.Module],
6565
isLeaf: false,
6666
directory: 'modules',
6767
template: 'reflection.hbs'
@@ -375,7 +375,7 @@ export class NavigationBuilder {
375375
let target = someModule.parent;
376376
let inScope = (someModule === this.entryPoint);
377377
while (target) {
378-
if (target.kindOf(ReflectionKind.ExternalModule)) {
378+
if (target.kindOf(ReflectionKind.Module)) {
379379
return;
380380
}
381381
if (this.entryPoint === target) {

src/test/converter/alias/specs.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"id": 1,
99
"name": "\"alias\"",
1010
"kind": 1,
11-
"kindString": "External module",
11+
"kindString": "Module",
1212
"flags": {
1313
"isExported": true
1414
},
@@ -629,7 +629,7 @@
629629
],
630630
"groups": [
631631
{
632-
"title": "External modules",
632+
"title": "Modules",
633633
"kind": 1,
634634
"children": [
635635
1

src/test/converter/class/specs-with-lump-categories.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"id": 1,
99
"name": "\"access\"",
1010
"kind": 1,
11-
"kindString": "External module",
11+
"kindString": "Module",
1212
"flags": {
1313
"isExported": true
1414
},
@@ -336,7 +336,7 @@
336336
"id": 15,
337337
"name": "\"class\"",
338338
"kind": 1,
339-
"kindString": "External module",
339+
"kindString": "Module",
340340
"flags": {
341341
"isExported": true
342342
},
@@ -1794,7 +1794,7 @@
17941794
"id": 77,
17951795
"name": "\"clodule-with-subclass\"",
17961796
"kind": 1,
1797-
"kindString": "External module",
1797+
"kindString": "Module",
17981798
"flags": {
17991799
"isExported": true
18001800
},
@@ -1940,7 +1940,7 @@
19401940
"id": 82,
19411941
"name": "\"constructor-properties\"",
19421942
"kind": 1,
1943-
"kindString": "External module",
1943+
"kindString": "Module",
19441944
"flags": {
19451945
"isExported": true
19461946
},
@@ -2411,7 +2411,7 @@
24112411
"id": 103,
24122412
"name": "\"decorators\"",
24132413
"kind": 1,
2414-
"kindString": "External module",
2414+
"kindString": "Module",
24152415
"flags": {
24162416
"isExported": true
24172417
},
@@ -2778,7 +2778,7 @@
27782778
"id": 147,
27792779
"name": "\"events\"",
27802780
"kind": 1,
2781-
"kindString": "External module",
2781+
"kindString": "Module",
27822782
"flags": {
27832783
"isExported": true
27842784
},
@@ -2855,7 +2855,7 @@
28552855
"id": 120,
28562856
"name": "\"events-overloads\"",
28572857
"kind": 1,
2858-
"kindString": "External module",
2858+
"kindString": "Module",
28592859
"flags": {
28602860
"isExported": true
28612861
},
@@ -3280,7 +3280,7 @@
32803280
"id": 150,
32813281
"name": "\"generic-class\"",
32823282
"kind": 1,
3283-
"kindString": "External module",
3283+
"kindString": "Module",
32843284
"flags": {
32853285
"isExported": true
32863286
},
@@ -3717,7 +3717,7 @@
37173717
"id": 168,
37183718
"name": "\"getter-setter\"",
37193719
"kind": 1,
3720-
"kindString": "External module",
3720+
"kindString": "Module",
37213721
"flags": {
37223722
"isExported": true
37233723
},
@@ -3924,7 +3924,7 @@
39243924
"id": 180,
39253925
"name": "\"this\"",
39263926
"kind": 1,
3927-
"kindString": "External module",
3927+
"kindString": "Module",
39283928
"flags": {
39293929
"isExported": true
39303930
},
@@ -4018,7 +4018,7 @@
40184018
"id": 184,
40194019
"name": "\"type-operator\"",
40204020
"kind": 1,
4021-
"kindString": "External module",
4021+
"kindString": "Module",
40224022
"flags": {
40234023
"isExported": true
40244024
},
@@ -4200,7 +4200,7 @@
42004200
],
42014201
"groups": [
42024202
{
4203-
"title": "External modules",
4203+
"title": "Modules",
42044204
"kind": 1,
42054205
"children": [
42064206
1,

src/test/converter/class/specs-without-exported.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"id": 1,
99
"name": "\"access\"",
1010
"kind": 1,
11-
"kindString": "External module",
11+
"kindString": "Module",
1212
"flags": {
1313
"isExported": true
1414
},
@@ -336,7 +336,7 @@
336336
"id": 15,
337337
"name": "\"class\"",
338338
"kind": 1,
339-
"kindString": "External module",
339+
"kindString": "Module",
340340
"flags": {
341341
"isExported": true
342342
},
@@ -1677,7 +1677,7 @@
16771677
"id": 71,
16781678
"name": "\"clodule-with-subclass\"",
16791679
"kind": 1,
1680-
"kindString": "External module",
1680+
"kindString": "Module",
16811681
"flags": {
16821682
"isExported": true
16831683
},
@@ -1823,7 +1823,7 @@
18231823
"id": 76,
18241824
"name": "\"constructor-properties\"",
18251825
"kind": 1,
1826-
"kindString": "External module",
1826+
"kindString": "Module",
18271827
"flags": {
18281828
"isExported": true
18291829
},
@@ -1840,7 +1840,7 @@
18401840
"id": 77,
18411841
"name": "\"decorators\"",
18421842
"kind": 1,
1843-
"kindString": "External module",
1843+
"kindString": "Module",
18441844
"flags": {
18451845
"isExported": true
18461846
},
@@ -1857,7 +1857,7 @@
18571857
"id": 79,
18581858
"name": "\"events\"",
18591859
"kind": 1,
1860-
"kindString": "External module",
1860+
"kindString": "Module",
18611861
"flags": {
18621862
"isExported": true
18631863
},
@@ -1874,7 +1874,7 @@
18741874
"id": 78,
18751875
"name": "\"events-overloads\"",
18761876
"kind": 1,
1877-
"kindString": "External module",
1877+
"kindString": "Module",
18781878
"flags": {
18791879
"isExported": true
18801880
},
@@ -1891,7 +1891,7 @@
18911891
"id": 80,
18921892
"name": "\"generic-class\"",
18931893
"kind": 1,
1894-
"kindString": "External module",
1894+
"kindString": "Module",
18951895
"flags": {
18961896
"isExported": true
18971897
},
@@ -1908,7 +1908,7 @@
19081908
"id": 81,
19091909
"name": "\"getter-setter\"",
19101910
"kind": 1,
1911-
"kindString": "External module",
1911+
"kindString": "Module",
19121912
"flags": {
19131913
"isExported": true
19141914
},
@@ -1925,7 +1925,7 @@
19251925
"id": 82,
19261926
"name": "\"this\"",
19271927
"kind": 1,
1928-
"kindString": "External module",
1928+
"kindString": "Module",
19291929
"flags": {
19301930
"isExported": true
19311931
},
@@ -2019,7 +2019,7 @@
20192019
"id": 86,
20202020
"name": "\"type-operator\"",
20212021
"kind": 1,
2022-
"kindString": "External module",
2022+
"kindString": "Module",
20232023
"flags": {
20242024
"isExported": true
20252025
},
@@ -2201,7 +2201,7 @@
22012201
],
22022202
"groups": [
22032203
{
2204-
"title": "External modules",
2204+
"title": "Modules",
22052205
"kind": 1,
22062206
"children": [
22072207
1,

0 commit comments

Comments
 (0)