Skip to content

Commit 989c0fc

Browse files
committed
1 parent 30b3b86 commit 989c0fc

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

index.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,27 @@ function replaceExtensions(extensionsRegex, name) {
2727
function parseOptions(tsconfigPath) {
2828
try {
2929
var configFile = fs.readFileSync(tsconfigPath, 'utf8');
30-
var rawConfig = ts.parseConfigFileText(tsconfigPath, configFile);
30+
var rawConfig;
31+
32+
if (typeof ts.parseConfigFileText === 'function') {
33+
rawConfig = ts.parseConfigFileText(tsconfigPath, configFile);
34+
} else {
35+
// >= 1.8
36+
rawConfig = ts.parseConfigFileTextToJson(tsconfigPath, configFile);
37+
}
3138

3239
if (rawConfig.error) {
3340
throw new Error(rawConfig.error.messageText);
3441
}
3542

36-
var parsedConfig = ts.parseConfigFile(rawConfig.config, ts.sys, path.dirname(tsconfigPath));
43+
var parsedConfig;
44+
45+
if (typeof ts.parseConfigFile === 'function') {
46+
parsedConfig = ts.parseConfigFile(rawConfig.config, ts.sys, path.dirname(tsconfigPath));
47+
} else {
48+
// >= 1.8
49+
parsedConfig = ts.convertCompilerOptionsFromJson(rawConfig.config.compilerOptions, path.dirname(tsconfigPath));
50+
}
3751

3852
if (parsedConfig.errors && parsedConfig.errors.length) {
3953
throw new Error(parsedConfig.errors.join(', '));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"json-stable-stringify": "^1.0.0"
3333
},
3434
"peerDependencies": {
35-
"typescript": "^1.6.2 || ^1.7.0-dev"
35+
"typescript": "^1.6.2 || ^1.7.0-dev || ^1.8.0-dev"
3636
},
3737
"devDependencies": {
3838
"broccoli": "^0.16.3",

0 commit comments

Comments
 (0)