@@ -56,7 +56,8 @@ async function runGlobs(options: Options, pluginsDefaultOptions: PluginsOptions,
5656
5757 const rootPath = process . cwd ( ) ;
5858 const projectPath = getProjectPath ( rootPath ) ;
59- const [ filesPaths , filesNames , filesNamesToPaths , filesFoundPaths , foldersFoundPaths ] = await getTargetsPaths ( rootPath , options . globs , options . withNodeModules ) ; // prettier-ignore
59+ const [ filesPaths , filesNames , filesNamesToPaths , filesExplicitPaths , filesFoundPaths , foldersFoundPaths ] = await getTargetsPaths ( rootPath , options . globs , options . withNodeModules ) ; // prettier-ignore
60+ const filesExplicitPathsSet = new Set ( filesExplicitPaths ) ;
6061 const filesPathsTargets = filesPaths . filter ( negate ( isBinaryPath ) ) . sort ( ) ;
6162 const [ foldersPathsTargets , foldersExtraPaths ] = getExpandedFoldersPaths ( foldersFoundPaths , projectPath ) ;
6263 const filesExtraPaths = await getFoldersChildrenPaths ( [ rootPath , ...foldersExtraPaths ] ) ;
@@ -103,7 +104,7 @@ async function runGlobs(options: Options, pluginsDefaultOptions: PluginsOptions,
103104 const cliFormatConfig = options . formatOptions ;
104105 const cacheVersion = stringify ( { prettierVersion, cliVersion, pluginsNames, pluginsVersions, editorConfigs, ignoreContents, prettierConfigs, ignoreManualFilesPaths, ignoreManualFilesContents, prettierManualFilesPaths, prettierManualFilesContents, cliContextConfig, cliFormatConfig, pluginsDefaultOptions, pluginsCustomOptions } ) ; // prettier-ignore
105106
106- const shouldCache = options . cache && ! pluginsVersionsMissing . length && isUndefined ( cliContextConfig . cursorOffset ) ;
107+ const shouldCache = options . cache && ! options . dump && ! pluginsVersionsMissing . length && isUndefined ( cliContextConfig . cursorOffset ) ;
107108 const cache = shouldCache ? new Cache ( cacheVersion , projectPath , options , stdout ) : undefined ;
108109 const prettier = await makePrettier ( options , cache ) ;
109110
@@ -112,8 +113,10 @@ async function runGlobs(options: Options, pluginsDefaultOptions: PluginsOptions,
112113 filesPathsTargets . map ( async ( filePath ) => {
113114 const isIgnored = ( ) => ( ignoreManual ? ignoreManual ( filePath ) : getIgnoreResolved ( filePath , ignoreNames ) ) ;
114115 const isCacheable = ( ) => cache ?. has ( filePath , isIgnored ) ;
115- const ignored = cache ? ! ( await isCacheable ( ) ) : await isIgnored ( ) ;
116- if ( ignored ) return ;
116+ const isExplicitlyIncluded = ( ) => filesExplicitPathsSet . has ( filePath ) ;
117+ const isForceIncluded = options . dump && isExplicitlyIncluded ( ) ;
118+ const isExcluded = cache ? ! ( await isCacheable ( ) ) : await isIgnored ( ) ;
119+ if ( ! isForceIncluded && isExcluded ) return ;
117120 const getFormatOptions = async ( ) : Promise < FormatOptions > => {
118121 const editorConfig = options . editorConfig ? getEditorConfigFormatOptions ( await getEditorConfigResolved ( filePath , editorConfigNames ) ) : { } ;
119122 const prettierConfig = prettierManualConfig || ( options . config ? await getPrettierConfigResolved ( filePath , prettierConfigNames ) : { } ) ;
0 commit comments