Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/jitiPublic

feat: support custom user conditions#384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ernestostifano wants to merge5 commits intounjs:main
base:main
Choose a base branch
Loading
fromernestostifano:feat/user-custom-conditions

Conversation

@ernestostifano
Copy link

@ernestostifanoernestostifano commentedJun 13, 2025
edited
Loading

Resolves:#383,#369

Main Changes:

  • Added support forcustom user conditions:
    • ViaJitiOptions andJitiResolveOptions, so, consistently across all programmatic APIs.
    • ViaJITI_CONDITIONS environment variable.
    • Via package.json'sconditions field.
  • Added support forsynchronous hooks.

Added Capabilities Examples:

constjiti=createJiti(import.meta.url,{conditions:true});
constjiti=createJiti(import.meta.url,{conditions:['development']});
constjiti=createJiti(import.meta.url,{conditions:{'@scope/**/*':['development']}});
constjiti=createJiti(import.meta.url,{conditions:[{match:['@scope/**/*'],ignore:['@scope/some-specific-package'],values:['development']}]});
  • There is fullminimatch support.
  • Ifconditions is set totrue, configuration will be read from the nearestpackage.json, relative tocwd.
  • Ifconditions is set tofalse, or no configuration is found, then everything should behave like this PR never existed.

Details:

  • Createdutils.mjs to group common code for both synchronous and asynchronous hooks.
  • Replacedexists withaccess according to most recentrecommended approach.
  • Enabledpnpm workspaces for testing with packages.
  • Added tests for custom user conditions implementation.
  • Updated documentation.

Notes:

  • There should not be any breaking changes.
  • There should not be any relevant performance changes.
  • Madeconditions ->true by default according to thisNode.JS Proposal (see point5 at "The Problem - TL;DR").
  • I noticed some differences between outputs fromjiti andnative methods:
    • import() !==jiti.import().
    • createRequire() ->require() !==jiti.import().
    • Staticimport (when using--import jiti/register) !==jiti.import().
  • The above happens without this PR and I would be happy to investigate and fix it, if needed, after merging this PR.

FalCodistica and AnielloFalcone reacted with eyes emoji
@ernestostifano
Copy link
Author

@pi0 happy to make any changes if needed.

@ernestostifano
Copy link
Author

ernestostifano commentedJun 23, 2025
edited
Loading

@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)

@AnielloFalcone
Copy link

This seems a good idea!

@pigulla
Copy link

Shamelessly pinging@pi0 - I'd love to see this merged!

@pi0
Copy link
Member

pi0 commentedAug 10, 2025
edited
Loading

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.

@ernestostifano
Copy link
Author

@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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@ernestostifano@AnielloFalcone@pigulla@pi0

[8]ページ先頭

©2009-2025 Movatter.jp