diff --git a/lib/resolve.js b/lib/resolve.js index 60621c4..d0ba8a5 100644 --- a/lib/resolve.js +++ b/lib/resolve.js @@ -24,15 +24,11 @@ import {Stats, statSync, realpathSync} from 'node:fs' import process from 'node:process' import {URL, fileURLToPath, pathToFileURL} from 'node:url' import path from 'node:path' -// @ts-expect-error: hush -import builtins from 'builtins' +import {builtinModules} from 'node:module' import packageJsonReader from './package-json-reader.js' import {defaultGetFormatWithoutErrors} from './get-format.js' import {codes} from './errors.js' -/** @type {Array} */ -const listOfBuiltins = builtins() - const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace] // To do: potentially enable? @@ -989,7 +985,7 @@ function parsePackageName(specifier, base) { * @returns {URL} */ function packageResolve(specifier, base, conditions) { - if (listOfBuiltins.includes(specifier)) { + if (builtinModules.includes(specifier)) { return new URL('node:' + specifier) } @@ -1162,7 +1158,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { return {url: parsed.href} } - if (listOfBuiltins.includes(specifier)) { + if (builtinModules.includes(specifier)) { throw new ERR_NETWORK_IMPORT_DISALLOWED( specifier, parsedParentURL, diff --git a/package.json b/package.json index 609ab70..1a406e2 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,7 @@ "index.d.ts", "index.js" ], - "dependencies": { - "builtins": "^5.0.0" - }, + "dependencies": {}, "devDependencies": { "@types/node": "^17.0.0", "@types/semver": "^7.0.0",