Skip to content

|| versions not supported by runtime-core's semver #3803

@tringenbach

Description

@tringenbach

Describe the bug

The semver implementation in runtime-core does not support versions with a double pipe ||, which means OR.

You can see this style documented here: https://docs.npmjs.com/cli/v11/configuring-npm/package-json#dependencies

range1 || range2 Passes if either range1 or range2 are satisfied.

To reproduce, modify the unit test: https://github.com/module-federation/core/blob/main/packages/runtime-core/__tests__/semver.spec.ts

Ideally add a new test. But just to see the issue with minimal changes, change const tilde = '~1.2.3'; to const tilde = '1.2.3 || 1.2.4'; and observe the failing test.

Reproduction

I don't have a repo, but I describe a tiny unit test in the description

Used Package Manager

yarn

System Info

Sorry the output here isn't exact, I had to type this in manually.

System:
  OS: macOS 15.2
  CPU: (10) arm64 Apple M1 Pro
  Memory: 664.69 MB / 32.00 GB
  Shell 5.9 - /bin/zsh
Binaries:
  Node: 20.19.
  Yarn: 3.2.1
  npm: 10.8.2
  Watchman 2025.03.10.00
Browsers:
  Chrome: 136.0.7103.144

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions