13 stable releases (3 major)
|4.2.1||Feb 10, 2023|
|4.2.0||Feb 9, 2023|
|3.2.0||Feb 8, 2023|
|2.0.4||Jan 14, 2023|
|1.0.0||Nov 13, 2022|
#2252 in Command line utilities
58 downloads per month
tsconfig-includes enumerates files used in the TypeScript compilation
process for monorepo packages. While
tsc --listFilesOnly only lists input
files in the target package, tsconfig-includes lists input files in the
target package and all of its internal dependencies. You can use this list to
determine when inputs to a package has changed, to decide whether to rebuild
the package or used a cached version.
Enumerate source code files used by the TypeScript compiler during compilation. The return value is a list of relative paths from the monorepo root, sorted in alphabetical order.
There are two methods of calculating this list of files: the exact way, and using an estimation.
The exact method uses the TypeScript compiler's listFilesOnly flag as the
source of truth. We do not try to reimplement this algorithm independently
because this list requires following
TypeScript code. From the tsconfig exclude documentation:
excludeonly changes which files are included as a result of the
includesetting. A file specified by exclude can still become part of your codebase due to an import statement in your code, a types inclusion, a
/// <referencedirective, or being specified in the
The TypeScript compiler is a project where the implementation is the spec, so this method of enumeration trades the runtime penalty of invoking the TypeScript compiler for accuracy of output as defined by the "spec".
The estimation method uses the list of globs from the
property in a package's tsconfig.json file to calculate the list of source
This estimation is currently imprecise (and likely to stay that way) --
it makes a best attempt to follow the
exclude or file-type based rules:
If a glob pattern doesn’t include a file extension, then only files with supported extensions are included (e.g. .ts, .tsx, and .d.ts by default, with .js and .jsx if allowJs is set to true).
without any guarantee of exhaustive compatibility.
Additionally, this method performs no source-code analysis to follow imported files.
You might want to use the estimation method if speed is a concern, because it is several orders of magnitude faster than the exact method.