[heft] Add typings options#2305
Conversation
| ); | ||
| const generatedTsFilePath: string = this._getTypingsFilePath(locFilePath); | ||
|
|
||
| if (typingsData === undefined) { |
There was a problem hiding this comment.
Comment what cases this would return undefined and expected behaviour
|
|
||
| /** | ||
| * Files with these extensions will pass through the Sass transpiler for typings generation. | ||
| * Defaults to ["sass", "scss", "css"] |
There was a problem hiding this comment.
For consistency with this, let's require that these start with a .
There was a problem hiding this comment.
Can you also make sure that works with typings-generator. Maybe we even require that in typings-generator?
There was a problem hiding this comment.
The TypingsGenerator class appears to have logic to test for the . and add it if it's missing.
Everything seems to work fine after adding the .
| "description": "Files with these extensions will pass through the Sass transpiler for typings generation.", | ||
| "items": { | ||
| "type": "string", | ||
| "pattern": "[^\\\\]" |
There was a problem hiding this comment.
Let's update this pattern to something like
| "pattern": "[^\\\\]" | |
| "pattern": "^\\.[A-z0-9-._]*[A-z0-9-]+$" |
This says:
- Must start with a
. - Other characters must be alphanumeric,
-,_, or.(except for the last character)
That doesn't cover 100% of legal file extensions, but it should be pretty close.
It'd also be good to update this expression. Might be a good idea to extract this to a resource in a shared schema file.
| // "sass", | ||
| // "scss", | ||
| // "css |
There was a problem hiding this comment.
| // "sass", | |
| // "scss", | |
| // "css | |
| // ".sass", | |
| // ".scss", | |
| // ".css |
| "description": "Files with these extensions will pass through the Sass transpiler for typings generation.", | ||
| "items": { | ||
| "type": "string", | ||
| "pattern": "^\\.[A-z0-9-._]*[A-z0-9-]+$" |
There was a problem hiding this comment.
| "pattern": "^\\.[A-z0-9-._]*[A-z0-9-]+$" | |
| "pattern": "^\\.[A-z0-9-_.]*[A-z0-9-_]+$" |
| "items": { | ||
| "type": "string", | ||
| "pattern": "\\..+" | ||
| "pattern": "^\\.[A-z0-9-._]*[A-z0-9-]+$" |
There was a problem hiding this comment.
| "pattern": "^\\.[A-z0-9-._]*[A-z0-9-]+$" | |
| "pattern": "^\\.[A-z0-9-_.]*[A-z0-9-_]+$" |
This PR makes 2 changes.
undefinedas a value returned byparseFileAndGenerateTypingsAsync. Whenundefinedis returned, no typings file is generated."fileExtensions"configuration option to the SassTypingsGenerator. This is so repos that only want to process Sass Modules may do so (e.g. by configuring extensions as["module.sass", "module.scss"]