Skip to content

Commit

Permalink
deps: replace builtins dependency with Node.js `module.builtinModul…
Browse files Browse the repository at this point in the history
…es` (#104)
  • Loading branch information
thecodrr authored Dec 13, 2023
1 parent 2a17a08 commit f12f849
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
10 changes: 4 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'
const { builtinModules: builtins } = require('module')

var scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$')
var builtins = require('builtins')
var blacklist = [
'node_modules',
'favicon.ico',
Expand Down Expand Up @@ -52,11 +52,9 @@ function validate (name) {
// Generate warnings for stuff that used to be allowed

// core module names like http, events, util, etc
builtins({ version: '*' }).forEach(function (builtin) {
if (name.toLowerCase() === builtin) {
warnings.push(builtin + ' is a core module name')
}
})
if (builtins.includes(name.toLowerCase())) {
warnings.push(name + ' is a core module name')
}

if (name.length > 214) {
warnings.push('name can no longer contain more than 214 characters')
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
"directories": {
"test": "test"
},
"dependencies": {
"builtins": "^5.0.0"
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",
"@npmcli/template-oss": "4.21.3",
Expand Down

0 comments on commit f12f849

Please sign in to comment.