mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
ea8c2a6505
* feat: move build to packages * fix: remove build in eslint * refactor: rename nuxt-build to nuxt-pack
24 lines
592 B
JavaScript
24 lines
592 B
JavaScript
/*
|
|
** Core logic from https://github.com/sindresorhus/builtin-modules
|
|
** Many thanks to @sindresorhus
|
|
*/
|
|
const { builtinModules } = require('module')
|
|
|
|
const blacklist = [
|
|
'sys'
|
|
]
|
|
|
|
const builtins = (builtinModules || Object.keys(process.binding('natives')))
|
|
.filter(x => !/^_|^(internal|v8|node-inspect)\/|\//.test(x) && !blacklist.includes(x))
|
|
.sort()
|
|
|
|
let builtinsObj = null
|
|
|
|
const convertToObj = () => builtins.reduce((obj, builtin) => {
|
|
obj[builtin] = true
|
|
return obj
|
|
}, (builtinsObj = {}))
|
|
|
|
export const builtinsMap = () => builtinsObj || convertToObj()
|
|
export default builtins
|