Skip to content

Commit

Permalink
[New] extract isCore implementation to is-core-module
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Sep 28, 2020
1 parent cdd0b35 commit 205b660
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/async.js
Expand Up @@ -3,7 +3,7 @@ var path = require('path');
var caller = require('./caller.js');
var nodeModulesPaths = require('./node-modules-paths.js');
var normalizeOptions = require('./normalize-options.js');
var isCore = require('./is-core');
var isCore = require('is-core-module');

var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath;

Expand Down
2 changes: 2 additions & 0 deletions lib/core.js
@@ -1,3 +1,5 @@
console.warn('`resolve/lib/core` is deprecated; please use `is-core-module` directly');

var current = (process.versions && process.versions.node && process.versions.node.split('.')) || [];

function specifierIncluded(specifier) {
Expand Down
4 changes: 2 additions & 2 deletions lib/is-core.js
@@ -1,5 +1,5 @@
var core = require('./core');
var isCoreModule = require('is-core-module');

module.exports = function isCore(x) {
return Object.prototype.hasOwnProperty.call(core, x);
return isCoreModule(x);
};
2 changes: 1 addition & 1 deletion lib/sync.js
@@ -1,4 +1,4 @@
var isCore = require('./is-core');
var isCore = require('is-core-module');
var fs = require('fs');
var path = require('path');
var caller = require('./caller.js');
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -14,8 +14,8 @@
"module"
],
"scripts": {
"prepublish": "safe-publish-latest",
"lint": "eslint .",
"prepublish": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/",
"lint": "eslint --ext=js,mjs .",
"pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async",
"tests-only": "tape test/*.js",
"pretest": "npm run lint",
Expand All @@ -42,6 +42,7 @@
"url": "https://github.com/sponsors/ljharb"
},
"dependencies": {
"is-core-module": "^2.0.0",
"path-parse": "^1.0.6"
}
}

0 comments on commit 205b660

Please sign in to comment.