Skip to content

[Bug?]: slugifyIdent in getPackageMetadata can cause a name collision for caching metadata #6761

@MLoughry

Description

@MLoughry

Self-service

  • I'd be willing to implement a fix

Describe the bug

For some reason in our corporate project, we have in our dependency tree both @xxxx/types-yyyy and @xxxx-types/yyyy. They are distinct packages with distinct versions and dependencies. However, slugifyIdent formats both as @xxxx-types-yyyy, causing a collision in the metadata cache.

To reproduce

Create and install from npm two packages, one @name1/types-name2 and the other @name1-types/name2

Environment

System:
    OS: Linux 6.8 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (32) x64 AMD EPYC 7763 64-Core Processor
  Binaries:
    Node: 22.11.0 - /tmp/xfs-8fa8cddc/node
    Yarn: 4.9.0-git.20250409.hash-5bea831 - /tmp/xfs-8fa8cddc/yarn
    npm: 10.9.0 - /usr/local/share/nvm/versions/node/v22.11.0/bin/npm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions