Skip to content

[BUG] bun is a core module name #126

@bodadotsh

Description

@bodadotsh

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using the node runtime, validating the string "bun" will output:

{
  validForNewPackages: true,
  validForOldPackages: true
}

But when using the Bun runtime, validating the same string will output:

{
  validForNewPackages: false,
  validForOldPackages: true,
  warnings: [ "bun is a core module name" ],
}

Because we are checking if the name is included in the builtinModules, and in Bun, the name itself is a core module.

if (builtins.includes(name.toLowerCase())) {
	warnings.push(name + ' is a core module name')
}

Expected Behavior

The expected behaviour are the following names should be valid NPM package names:

There could be more names but I didn't check them all.

Steps To Reproduce

import validate from 'validate-npm-package-name'

console.log(validate('bun'));
console.log(validate('ws'));

Run the above code with Bun.

Environment

  • Bun: 1.1.24

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions