diff --git a/index.js b/index.js index 738651e92..0b6cd3f3a 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const printDocToString = require("./src/doc-printer").printDocToString; const normalizeOptions = require("./src/options").normalize; const parser = require("./src/parser"); const printDocToDebug = require("./src/doc-debug").printDocToDebug; -const resolveConfig = require("./src/resolve-config").resolveConfig; +const config = require("./src/resolve-config"); function guessLineEnding(text) { const index = text.indexOf("\n"); @@ -338,7 +338,8 @@ module.exports = { } }, - resolveConfig, + resolveConfig: config.resolveConfig, + clearConfigCache: config.clearCache, version, diff --git a/src/resolve-config.js b/src/resolve-config.js index bf265cba1..10f66f5a8 100644 --- a/src/resolve-config.js +++ b/src/resolve-config.js @@ -25,6 +25,10 @@ function resolveConfig(filePath, opts) { ); } +function clearCache() { + withCache.clearCaches(); +} + function resolveConfigFile(filePath) { return noCache.load(filePath).then(result => { if (result) { @@ -64,5 +68,6 @@ function pathMatchesGlobs(filePath, patterns, excludedPatterns) { module.exports = { resolveConfig, - resolveConfigFile + resolveConfigFile, + clearCache };