v0.3.2 - Location information!
The transformer now adds location information to all named values that it processes. This information includes:
- A trimmed
filePath, based on options mentioned below. - The starting line for the node.
- The ending line for the node.
By default, the transformer uses whatever filePath it finds when resolving a file with the typescript resolver. This ends up being an absolute path, which is great for uniqueness, but hard to do anything meaningful with.
You can now specify a basePath when configuring the loader, which will strip that content from the beginning of every path when generating IDs. For example, with a basePath of /users/myname/sites/project1/, a file at /users/myname/sites/project1/path/to/file would end up with using just /path/to/file in the location information.
This is great for generating GitHub links from generated documentation. You can also query the current commit SHA in your build process to be able to generate a permalink that's always accurate, no matter when someone looks at the build!