Skip to content

remove exclusion of TS 2 options, add lib support #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/lib/utils/options/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ export class OptionDeclaration {
const map = this.map;
if (map !== 'object') {
const key = value ? (value + '').toLowerCase() : '';
const values = Object.keys(map).map(key => map[key]);

if (map instanceof Map && map.has(key)) {
value = map.get(key);
if (map instanceof Map) {
value = map.has(key) ? map.get(key) : key;
} else if (key in map) {
value = map[key];
} else if (errorCallback) {
} else if (values.indexOf(value) === -1 && errorCallback) {
if (this.mapError) {
errorCallback(this.mapError);
} else {
Expand Down
5 changes: 1 addition & 4 deletions src/lib/utils/options/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ export class Options extends ChildableComponent<Application, OptionsComponent> {
setValue(name: string|OptionDeclaration, value: any, errorCallback?: Function) {
const declaration = name instanceof OptionDeclaration ? name : this.getDeclaration(<string> name);
if (!declaration) {
if (errorCallback) {
errorCallback('Unknown option `%s`.', name.toString());
}
return;
}

Expand All @@ -152,7 +149,7 @@ export class Options extends ChildableComponent<Application, OptionsComponent> {
const value = obj[key];
const declaration = this.getDeclaration(key);
const shouldValueBeAnObject = declaration && declaration['map'] === 'object';
if (typeof value === 'object' && !shouldValueBeAnObject) {
if (!Array.isArray(value) && typeof value === 'object' && !shouldValueBeAnObject) {
this.setValues(value, prefix + key + '.', errorCallback);
} else {
this.setValue(prefix + key, value, errorCallback);
Expand Down
17 changes: 8 additions & 9 deletions src/lib/utils/options/readers/tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,30 @@ export class TSConfigReader extends OptionsComponent {
return;
}

let data = ts.readConfigFile(fileName, ts.sys.readFile).config;
if (data === undefined) {
const { config } = ts.readConfigFile(fileName, ts.sys.readFile);
if (config === undefined) {
event.addError('The tsconfig file %s does not contain valid JSON.', fileName);
return;
}
if (!_.isPlainObject(data)) {
if (!_.isPlainObject(config)) {
event.addError('The tsconfig file %s does not contain a JSON object.', fileName);
return;
}

data = ts.parseJsonConfigFileContent(
data,
const { fileNames, options, raw: { typedocOptions }} = ts.parseJsonConfigFileContent(
config,
ts.sys,
Path.resolve(Path.dirname(fileName)),
{},
Path.resolve(fileName));

event.inputFiles = data.fileNames;
event.inputFiles = fileNames;

const ignored = TypeScriptSource.IGNORED;
let compilerOptions = _.clone(data.raw.compilerOptions);
for (const key of ignored) {
delete compilerOptions[key];
delete options[key];
}

_.defaults(event.data, data.raw.typedocOptions, compilerOptions);
_.defaults(event.data, typedocOptions, options);
}
}
9 changes: 4 additions & 5 deletions src/lib/utils/options/sources/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ export class TypeScriptSource extends OptionsComponent {
static IGNORED: string[] = [
'out', 'version', 'help',
'watch', 'declaration', 'mapRoot',
'sourceMap', 'inlineSources', 'removeComments',
// Ignore new TypeScript 2.0 options until typedoc can't manage it.
'lib', 'noImplicitThis',
'traceResolution', 'noUnusedParameters', 'noUnusedLocals',
'skipLibCheck', 'declarationDir', 'types', 'typeRoots'
'sourceMap', 'inlineSources', 'removeComments'
];

initialize() {
Expand Down Expand Up @@ -59,6 +55,9 @@ export class TypeScriptSource extends OptionsComponent {
case 'string':
param.type = ParameterType.String;
break;
case 'list':
param.type = ParameterType.Array;
break;
default:
param.type = ParameterType.Map;
param.map = option.type;
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/classes/_access_.privateclass.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/classes/_classes_.baseclass.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/classes/_classes_.subclassa.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/classes/_classes_.subclassb.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/enums/_enumerations_.size.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/globals.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/interfaces/_generics_.a.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/interfaces/_generics_.ab.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/interfaces/_generics_.b.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_access_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_classes_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_default_export_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_enumerations_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_flattened_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_functions_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_generics_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_modules_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_modules_.mymodule.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_single_export_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_typescript_1_3_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
2 changes: 1 addition & 1 deletion src/test/renderer/specs/modules/_typescript_1_4_.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="default no-js">
<html class="default">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
Loading