Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confused by resolveVersion #168

Closed
jimisaacs opened this issue Sep 22, 2021 · 6 comments
Closed

Confused by resolveVersion #168

jimisaacs opened this issue Sep 22, 2021 · 6 comments

Comments

@jimisaacs
Copy link
Collaborator

jimisaacs commented Sep 22, 2021

@ije I'm really not understanding what resolveVersion does. It literally looks like it is removing semver constraint symbols from a version constraint, and calling that "resolved".

Example:
https://github.com/alephjs/esm.sh/blob/c8be4051019116a99a741545185985c0866226c0/server/nodejs.go#L335-L337

How is that logic right? If the package constraint is react@<17, how does that come to mean react@latest (which is 17). The rest of the function is also confusing, as it's just removing symbols rather than actually resolving from what I am attempting to understand.

If you have some time, can you please explain this function?

@ije
Copy link
Member

ije commented Sep 22, 2021

no, the logic from 335 to 337 is not right indeed! it should be fixed. the rest is to simplify the version expression, because when we fetch package info form npm we can get all the versions of the package, then we must decide to which version we should use.
check: https://github.com/alephjs/esm.sh/blob/c8be4051019116a99a741545185985c0866226c0/server/nodejs.go#L292-L308

@jimisaacs
Copy link
Collaborator Author

thanks, I'll look more there

@jimisaacs
Copy link
Collaborator Author

jimisaacs commented Sep 22, 2021

@ije would you be opposed to using something like or maybe even exactly this? https://github.com/Masterminds/semver

@jimisaacs jimisaacs reopened this Sep 22, 2021
@ije
Copy link
Member

ije commented Sep 23, 2021

this https://github.com/Masterminds/semver looks great, i like it~

@ije
Copy link
Member

ije commented Sep 23, 2021

would you create a pr on it? currently i am focusing on the new cjs lexer in rust instead of the cjs-module-lexer and evel for some safety reasons

@ije
Copy link
Member

ije commented Feb 5, 2022

switch to https://github.com/Masterminds/semver in v65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants