[go: nahoru, domu]

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

fix(npm): support non-all lowercase package names #16669

Merged

Conversation

dsherret
Copy link
Member

Supports package names that aren't all lowercase.

This stores the package with a leading underscore (since that's not allowed in npm's registry and no package exists with a leading underscore) then base32 encoded (A-Z0-9) so it can be lowercased and avoid collisions.

Global cache dir:

$DENO_DIR/npm/registry.npmjs.org/_{base32_encode(package_name).to_lowercase()}/{version}

node_modules dir .deno folder:

node_modules/.deno/_{base32_encode(package_name).to_lowercase()}@{version}/node_modules/<package-name>

Within node_modules folder:

node_modules/<package-name>

So, direct childs of the node_modules folder can have collisions between packages like JSON vs json, but this is already something npm itself doesn't handle well. Plus, Deno doesn't actually ever resolve to the node_modules/<package-name> folder, but just has that for compatibility. Additionally, packages in the .deno dir could have collissions if they have multiple dependencies that only differ in casing or a dependency that has different casing, but if someone is doing that then they're already going to have trouble with npm and they are asking for trouble in general.

@dsherret dsherret changed the title fix(npm): support non-lowercase package names fix(npm): support non-all lowercase package names Nov 16, 2022
Copy link
Member
@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, elegantly solved 👍

@dsherret dsherret enabled auto-merge (squash) November 16, 2022 18:42
@dsherret dsherret merged commit 40a72f3 into denoland:main Nov 16, 2022
@dsherret dsherret deleted the fix_support_mixed_casing_package_names branch November 16, 2022 19:00
@dsherret dsherret mentioned this pull request Nov 16, 2022
25 tasks
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

Successfully merging this pull request may close these issues.

None yet

2 participants