Uh oh!
There was an error while loading. Please reload this page.
Adds glob-style pattern matching for files in tsconfig.json - #5980
Conversation
There was a problem hiding this comment.
tsconfig.json
There was a problem hiding this comment.
Add this file to the tsconfig.json files in src\**\
There was a problem hiding this comment.
There is no tsconfig.json in either src/harness or tests/cases/unittests
Ron Buckton (rbuckton)
commented
Dec 16, 2015
Paul van Brenk (@paulvanbrenk), Daniel Rosenwasser (@DanielRosenwasser), Vladimir Matveev (@vladima), Anders Hejlsberg (@ahejlsberg) Any comments on this approach? |
There was a problem hiding this comment.
Can you add comments to all these regular expressions.. they are impossible to parse.
There was a problem hiding this comment.
doesn't this make more sense in sys.ts ?
There was a problem hiding this comment.
Most of our other path logic exists in core.ts.
Ryan Smith (ryasmi)
commented
Dec 25, 2015
Need this so badly |
Ron Buckton (rbuckton)
commented
Jan 5, 2016
Odd. All I did was merge from master. I'll check into this shortly. |
Glen (glen-84)
commented
Feb 5, 2016
What still needs to be done before this can be merged? (other than resolving the conflicts) |
| const keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; | ||
| // Literal file names (provided via the "files" array in tsconfig.json) are stored in a | ||
| // file map with a possibly case insensitive key. We use this map later when when including |
There was a problem hiding this comment.
We use this map later when including
Glen (glen-84)
commented
Feb 15, 2016
Ron Buckton (@rbuckton) Is there any way that TypeScript could expose the globbing logic so that other libraries could easily get the list of files, without having to re-implement all of the rules? I was trying to implement the include/exclude stuff using globby, but it seems that an exclude entry like Edit: The use case is getting a list of files for Edit 2: Actually getting a list of files isn't really useful, as it won't match files created later. 😞 |
Ian MacLeod (nevir)
commented
Apr 22, 2016
Curious what the status on this one is |
Lucien Greathouse (LPGhatguy)
commented
May 25, 2016
Why isn't TypeScript using a community-vetted library like minimatch that WILL run in all environments? Implementing glob and not doing it fully is not as helpful as supporting the standard glob syntax used throughout the JS ecosystem. |
Mohamed Hegazy (mhegazy)
commented
May 25, 2016
The typescript compiler runs in other environments other than node, e.g. web (monaco web editor), VSCode, (uses its own require implementation), VS (chakra), etc.. so dependencies can be tricky. We are working on getting this done soon. so please bear with us for a bit longer. |
ik0r
commented
Jun 21, 2016
Exciting 😀 |
Supersedes #3232.
Adds support for expanding glob-like patterns in "include" and "exclude" properties of tsconfig.json. The following patterns are supported:
*- Matches zero or more characters, excluding directory separators.?- Matches any one character, excluding directory separators.**/- Recursively matches any subdirectory.*or.*, only supported extensions are considered (e.g. ".ts", ".tsx", and ".d.ts" by default, and also ".js" and ".jsx" ifallowJsistrue).At this time, character escape sequences are not supported, as there is no standard cross-platform convention. The standard escape sequence in a Unix shell is prefixed with
\, which is reserved as a directory separator on Windows, and is normalized to/by TypeScript. Character ranges are also not included at this time.This does not use the glob module, as TypeScript runs in more host environments than just NodeJS, and this would need to interoperate with the language service host.
{ "compilerOptions": { "out": "test.js" }, "files": [ "literal.ts" ], "include": [ "**/*.ts" ], "exclude": [ "node_modules", "tests/**/*.spec.ts", "utils/t2.ts" ] }Notes:
"files"list are always added to the list of files."exclude"list only applies to files matched via"include". If the leading directory of a path is excluded, it will not be traversed. You cannot re-include an excluded file, other than through providing it as a literal path in the"files"list."files"nor"include"are present,"include"defaults to"**/*"but only includes files with supported extensions. This preserves the existing behavior.