Skip to content

[Bug?]: Catalog resolution when running publish/pack strips special protocols #7314

Open

Description

@xenobytezero

Self-service

  • I'd be willing to implement a fix

Describe the bug

When upgrading packages to TS7, Typescript recommends using the following in package.json until the full TS API is available

"@typescript/native": "npm:[email protected]",
"typescript": "npm:@typescript/[email protected]",

When running yarn pack the output preserves the npm: protocol correctly.

When I moved the above into a catalog in .yarnrc.yaml as below

catalog:
  typescript: "npm:@typescript/typescript6@^6.0.2"
  "@typescript/native": "npm:typescript@^7.0.2"

and then use that catalog in the package.json

"@typescript/native": "catalog:",
"typescript": "catalog:"

and then run yarn pack, the resolved package.json in the output has the following

"typescript": "@typescript/typescript6@^6.0.2",
 "@typescript/native": "typescript@^7.0.2",

which then causes the following error when using that package

➤ YN0000: · Yarn 4.18.0
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: @typescript/native@typescript@^7.0.2 isn't supported by any available resolver
    at Dy.getResolverByDescriptor (C:\Users\user\AppData\Local\node\corepack\v1\yarn\4.18.0\yarn.js:143:1698)
    at Dy.bindDescriptor (C:\Users\user\AppData\Local\node\corepack\v1\yarn\4.18.0\yarn.js:143:1083)
    at t.preparePackage (C:\Users\user\AppData\Local\node\corepack\v1\yarn\4.18.0\yarn.js:211:6182)
    at async $ (C:\Users\user\AppData\Local\node\corepack\v1\yarn\4.18.0\yarn.js:211:7596)

To reproduce

https://github.com/xenobytezero/bugrepo-yarn-protocol-strip

  • yarn install
  • yarn run pack

Check the package.json of both package outputs (package.tgz) which should be different and look like the following.

Image

Environment

System:
    OS: Windows 11 10.0.26200
    CPU: (16) x64 Intel(R) Xeon(R) W-11955M CPU @ 2.60GHz
  Binaries:
    Node: 24.14.1 - C:\Users\user\AppData\Local\Temp\xfs-cf41ddd3\node.CMD
    Yarn: 4.18.0 - C:\Users\user\AppData\Local\Temp\xfs-cf41ddd3\yarn.CMD
    npm: 11.11.0 - C:\nvm4w\nodejs\npm.CMD

Additional context

No response

Activity

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

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