Closed aleclarson closed 2 years ago
The register.js file is just a shortcut into the compiled version of register.ts. So I think it would be confusing to put extra code within it. It has the same function as the new exports directive in package.json where you can export as /register.js from within /lib/register.js.
So I think it might be better to keep the register.js->register.ts mirroring and add a new programmatic api to avoid any extra parsing.
I don't see what's so confusing, but we can do it your way. What should the new function be called?
I looked a bit more into it now. An alternative to a new function might be to have register() disregard command line options when it receives the ExplicitParams as parameter. If you pass ExplicitParams they are the only params used, and the command line is disregarded. So it will only parse the command line if no parameter is passed. Would that work for what you need?
Sounds good to me! I'll update this PR
@aleclarson I merged #205. This PR now has some conflicts, could you take a look at those and then add an entry to the CHANGELOG? I guess this could be considered breaking since before you could pass explicit params and get the path from the commandline which is no longer possible?
Would you put this under Added
or Fixed
or smth else?
Do you think this change will be breaking? In that case it should go under "Changed" according to the changelog format. If we're doing a major release there might be some more PRs we could merge.
LGTM
⚠️ Please merge #205 before this one!
See https://github.com/dividab/tsconfig-paths/commit/3bc36fbfd00770faeabd4eea38cd86994744fa4c for the changes that aren't inherited from #205.
This is a follow-up to https://github.com/dividab/tsconfig-paths/pull/53#issuecomment-1099996457. The benefit is avoiding unintentional CLI parsing when
tsconfig-paths
is embedded into other CLIs, like Vite.The idea is to avoid parsing
--project
and-P
flags whenregister
is being called programmatically. But whennode -r tsconfig-paths/register
is used, those flags will still be supported. WDYT?