Skip to content

Commit 9d720f4

Browse files
nicknisiblakeembrey
authored andcommitted
Remove exclusion of TS 2 options, support lib (#449)
1 parent 4204c20 commit 9d720f4

Some content is hidden

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

49 files changed

+63
-66
lines changed

src/lib/utils/options/declaration.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,13 @@ export class OptionDeclaration {
9595
const map = this.map;
9696
if (map !== 'object') {
9797
const key = value ? (value + '').toLowerCase() : '';
98+
const values = Object.keys(map).map(key => map[key]);
9899

99-
if (map instanceof Map && map.has(key)) {
100-
value = map.get(key);
100+
if (map instanceof Map) {
101+
value = map.has(key) ? map.get(key) : key;
101102
} else if (key in map) {
102103
value = map[key];
103-
} else if (errorCallback) {
104+
} else if (values.indexOf(value) === -1 && errorCallback) {
104105
if (this.mapError) {
105106
errorCallback(this.mapError);
106107
} else {

src/lib/utils/options/options.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ export class Options extends ChildableComponent<Application, OptionsComponent> {
133133
setValue(name: string|OptionDeclaration, value: any, errorCallback?: Function) {
134134
const declaration = name instanceof OptionDeclaration ? name : this.getDeclaration(<string> name);
135135
if (!declaration) {
136-
if (errorCallback) {
137-
errorCallback('Unknown option `%s`.', name.toString());
138-
}
139136
return;
140137
}
141138

@@ -152,7 +149,7 @@ export class Options extends ChildableComponent<Application, OptionsComponent> {
152149
const value = obj[key];
153150
const declaration = this.getDeclaration(key);
154151
const shouldValueBeAnObject = declaration && declaration['map'] === 'object';
155-
if (typeof value === 'object' && !shouldValueBeAnObject) {
152+
if (!Array.isArray(value) && typeof value === 'object' && !shouldValueBeAnObject) {
156153
this.setValues(value, prefix + key + '.', errorCallback);
157154
} else {
158155
this.setValue(prefix + key, value, errorCallback);

src/lib/utils/options/readers/tsconfig.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,30 @@ export class TSConfigReader extends OptionsComponent {
5151
return;
5252
}
5353

54-
let data = ts.readConfigFile(fileName, ts.sys.readFile).config;
55-
if (data === undefined) {
54+
const { config } = ts.readConfigFile(fileName, ts.sys.readFile);
55+
if (config === undefined) {
5656
event.addError('The tsconfig file %s does not contain valid JSON.', fileName);
5757
return;
5858
}
59-
if (!_.isPlainObject(data)) {
59+
if (!_.isPlainObject(config)) {
6060
event.addError('The tsconfig file %s does not contain a JSON object.', fileName);
6161
return;
6262
}
6363

64-
data = ts.parseJsonConfigFileContent(
65-
data,
64+
const { fileNames, options, raw: { typedocOptions }} = ts.parseJsonConfigFileContent(
65+
config,
6666
ts.sys,
6767
Path.resolve(Path.dirname(fileName)),
6868
{},
6969
Path.resolve(fileName));
7070

71-
event.inputFiles = data.fileNames;
71+
event.inputFiles = fileNames;
7272

7373
const ignored = TypeScriptSource.IGNORED;
74-
let compilerOptions = _.clone(data.raw.compilerOptions);
7574
for (const key of ignored) {
76-
delete compilerOptions[key];
75+
delete options[key];
7776
}
7877

79-
_.defaults(event.data, data.raw.typedocOptions, compilerOptions);
78+
_.defaults(event.data, typedocOptions, options);
8079
}
8180
}

src/lib/utils/options/sources/typescript.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ export class TypeScriptSource extends OptionsComponent {
1515
static IGNORED: string[] = [
1616
'out', 'version', 'help',
1717
'watch', 'declaration', 'mapRoot',
18-
'sourceMap', 'inlineSources', 'removeComments',
19-
// Ignore new TypeScript 2.0 options until typedoc can't manage it.
20-
'lib', 'noImplicitThis',
21-
'traceResolution', 'noUnusedParameters', 'noUnusedLocals',
22-
'skipLibCheck', 'declarationDir', 'types', 'typeRoots'
18+
'sourceMap', 'inlineSources', 'removeComments'
2319
];
2420

2521
initialize() {
@@ -59,6 +55,9 @@ export class TypeScriptSource extends OptionsComponent {
5955
case 'string':
6056
param.type = ParameterType.String;
6157
break;
58+
case 'list':
59+
param.type = ParameterType.Array;
60+
break;
6261
default:
6362
param.type = ParameterType.Map;
6463
param.map = option.type;

src/test/renderer/specs/classes/_access_.privateclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_classes_.baseclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_classes_.genericclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_classes_.internalclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_classes_.nongenericclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_classes_.subclassa.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_classes_.subclassb.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_default_export_.defaultexportedclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_default_export_.notexportedclassname.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_flattened_.flattenedclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_single_export_.notexportedclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_single_export_.singleexportedclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_typescript_1_3_.classwithprotectedmembers.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_typescript_1_3_.subclasswithprotectedmembers.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/classes/_typescript_1_4_.simpleclass.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/enums/_enumerations_.directions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/enums/_enumerations_.size.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/globals.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_classes_.inameinterface.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_classes_.iprintinterface.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_classes_.iprintnameinterface.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_generics_.a.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_generics_.ab.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_generics_.abnumber.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_generics_.abstring.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_generics_.b.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/interfaces/_typescript_1_4_.runoptions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_access_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_access_.privatemodule.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_classes_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_default_export_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_enumerations_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_flattened_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_functions_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_functions_.modulefunction.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_generics_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_modules_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_modules_.mymodule.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_modules_.mymodule.mysubmodule.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_single_export_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_typescript_1_3_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

src/test/renderer/specs/modules/_typescript_1_4_.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html class="default no-js">
2+
<html class="default">
33
<head>
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">

0 commit comments

Comments
 (0)