diff --git a/lib/fixer.js b/lib/fixer.js index 0a3b2d4..27682e9 100644 --- a/lib/fixer.js +++ b/lib/fixer.js @@ -1,7 +1,7 @@ var semver = require("semver") var validateLicense = require('validate-npm-package-license'); var hostedGitInfo = require("hosted-git-info") -var isBuiltinModule = require("is-builtin-module") +var isBuiltinModule = require("resolve").isCore var depTypes = ["dependencies","devDependencies","optionalDependencies"] var extractDescription = require("./extract_description") var url = require("url") diff --git a/package-lock.json b/package-lock.json index 8936980..237ef5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -128,11 +128,6 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=" - }, "capture-stack-trace": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", @@ -424,14 +419,6 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "requires": { - "builtin-modules": "^1.0.0" - } - }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -647,7 +634,6 @@ "version": "0.1.4", "bundled": true, "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -1830,8 +1816,7 @@ "longest": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "loose-envify": { "version": "1.3.1", @@ -3288,6 +3273,11 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" + }, "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -3369,6 +3359,14 @@ "uuid": "^3.3.2" } }, + "resolve": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", + "integrity": "sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==", + "requires": { + "path-parse": "^1.0.6" + } + }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", diff --git a/package.json b/package.json index b7200db..ba0e134 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "hosted-git-info": "^2.1.4", - "is-builtin-module": "^1.0.0", + "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" }, diff --git a/test/normalize.js b/test/normalize.js index d6ef2b5..2b3fa54 100644 --- a/test/normalize.js +++ b/test/normalize.js @@ -62,22 +62,26 @@ tap.test("core module name", function(t) { function warn(m) { warnings.push(m) } + var coreModules = ["http", "_stream_writable"] var a - normalize(a={ - name: "http", - readme: "read yourself how about", - homepage: 123, - bugs: "what is this i don't even", - repository: "Hello." - }, warn) + var expect = [] + for (var i = 0; i < coreModules.length; ++i) { + normalize(a={ + name: coreModules[i], + readme: "read yourself how about", + homepage: 123, + bugs: "what is this i don't even", + repository: "Hello." + }, warn) - var expect = [ - safeFormat(warningMessages.conflictingName, 'http'), + expect = expect.concat([ + safeFormat(warningMessages.conflictingName, coreModules[i]), warningMessages.nonEmailUrlBugsString, warningMessages.emptyNormalizedBugs, warningMessages.nonUrlHomepage, warningMessages.missingLicense - ] + ]) + } t.same(warnings, expect) t.end() })