feat: support custom user conditions#384
Conversation
|
@pi0 happy to make any changes if needed. |
|
@pi0 friendly ping. I'd love to receive some feedback. Maybe I could help maintaining this package in the future. If you think this cannot be merged right now I could publish a forked version. (If you prefer we review it together, I can schedule a meeting) |
|
This seems a good idea! |
|
Shamelessly pinging @pi0 - I'd love to see this merged! |
|
It is a risky changest with possible regressions and lots of changes. Ideally if someone can help making another PR with minimum enough (few lines of diff) to add custom resolve conditions it can speedup adding this feature. |
|
@pi0 I understand your concerns, but all these features are tightly related and I think they all add value considering how Node.Js is evolving. I tried to separate changes logically into multiple commits, all automatic tests are passing and I added new ones covering the new changes. I also performed many manual tests installing the library locally. I have a good level of confidence that no regressions were introduced. If you want, I would be available to review together. |
Resolves: #383, #369
Main Changes:
JitiOptionsandJitiResolveOptions, so, consistently across all programmatic APIs.JITI_CONDITIONSenvironment variable.conditionsfield.Added Capabilities Examples:
conditionsis set totrue, configuration will be read from the nearestpackage.json, relative tocwd.conditionsis set tofalse, or no configuration is found, then everything should behave like this PR never existed.Details:
utils.mjsto group common code for both synchronous and asynchronous hooks.existswithaccessaccording to most recent recommended approach.pnpmworkspaces for testing with packages.Notes:
conditions->trueby default according to this Node.JS Proposal (see point5at "The Problem - TL;DR").jitiandnativemethods:import()!==jiti.import().createRequire()->require()!==jiti.import().import(when using--import jiti/register) !==jiti.import().