Skip to content

Commit 3d5a8a4

Browse files
committed
[New] extract isCore implementation to is-core-module
1 parent b50eb91 commit 3d5a8a4

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

lib/async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var path = require('path');
33
var caller = require('./caller.js');
44
var nodeModulesPaths = require('./node-modules-paths.js');
55
var normalizeOptions = require('./normalize-options.js');
6-
var isCore = require('./is-core');
6+
var isCore = require('is-core-module');
77

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

lib/core.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
console.warn('`resolve/lib/core` is deprecated; please use `is-core-module` directly');
2+
13
var current = (process.versions && process.versions.node && process.versions.node.split('.')) || [];
24

35
function specifierIncluded(specifier) {

lib/is-core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var core = require('./core');
1+
var isCoreModule = require('is-core-module');
22

33
module.exports = function isCore(x) {
4-
return Object.prototype.hasOwnProperty.call(core, x);
4+
return isCoreModule(x);
55
};

lib/sync.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var isCore = require('./is-core');
1+
var isCore = require('is-core-module');
22
var fs = require('fs');
33
var path = require('path');
44
var caller = require('./caller.js');

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"module"
5454
],
5555
"scripts": {
56-
"prepublish": "safe-publish-latest",
56+
"prepublish": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/",
5757
"lint": "eslint --ext=js,mjs .",
5858
"pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async",
5959
"tests-only": "tape test/*.js",
@@ -82,6 +82,7 @@
8282
"url": "https://github.com/sponsors/ljharb"
8383
},
8484
"dependencies": {
85+
"is-core-module": "^2.0.0",
8586
"path-parse": "^1.0.6"
8687
}
8788
}

0 commit comments

Comments
 (0)