filing-cabinet
Advanced tools
Comparing version 2.3.3 to 2.4.1
21
index.js
@@ -5,3 +5,2 @@ 'use strict'; | ||
const debug = require('debug')('cabinet'); | ||
const fs = require('fs'); | ||
@@ -185,5 +184,3 @@ /* | ||
const defaultTsConfig = { | ||
compilerOptions: {} | ||
}; | ||
let compilerOptions = {}; | ||
@@ -197,3 +194,2 @@ if (!ts) { | ||
if (!tsConfig) { | ||
tsConfig = defaultTsConfig; | ||
debug('no tsconfig given, defaulting'); | ||
@@ -205,3 +201,4 @@ | ||
try { | ||
tsConfig = JSON.parse(fs.readFileSync(tsConfig, 'utf8')); | ||
const tsParsedConfig = ts.readJsonConfigFile(tsConfig, ts.sys.readFile); | ||
compilerOptions = ts.parseJsonSourceFileConfigFileContent(tsParsedConfig, ts.sys, path.dirname(tsConfig)).options; | ||
debug('successfully parsed tsconfig'); | ||
@@ -212,2 +209,4 @@ } catch (e) { | ||
} | ||
} else { | ||
compilerOptions = ts.convertCompilerOptionsFromJson(tsConfig.compilerOptions).options; | ||
} | ||
@@ -218,13 +217,11 @@ | ||
const {options} = ts.convertCompilerOptionsFromJson(tsConfig.compilerOptions); | ||
// Preserve for backcompat. Consider removing this as a breaking change. | ||
if (!options.module) { | ||
options.module = ts.ModuleKind.AMD; | ||
if (!compilerOptions.module) { | ||
compilerOptions.module = ts.ModuleKind.AMD; | ||
} | ||
const host = ts.createCompilerHost({}); | ||
debug('with options: ', options); | ||
debug('with options: ', compilerOptions); | ||
const namedModule = ts.resolveModuleName(dependency, filename, options, host); | ||
const namedModule = ts.resolveModuleName(dependency, filename, compilerOptions, host); | ||
let result = ''; | ||
@@ -231,0 +228,0 @@ |
{ | ||
"name": "filing-cabinet", | ||
"version": "2.3.3", | ||
"version": "2.4.1", | ||
"description": "Find files based on partial paths", | ||
@@ -50,2 +50,3 @@ "main": "index.js", | ||
"debug": "^4.1.1", | ||
"decomment": "^0.9.2", | ||
"enhanced-resolve": "^4.1.0", | ||
@@ -52,0 +53,0 @@ "is-relative-path": "^1.0.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
15916
3
13
322
+ Addeddecomment@^0.9.2
+ Addeddecomment@0.9.5(transitive)