Skip to content

Commit

Permalink
[resolvers] [*] [deps] update is-core-module, resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 5, 2023
1 parent 132a433 commit 5209a43
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions resolvers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ If the resolver cannot resolve `source` relative to `file`, it should just retur
Here is most of the [Node resolver] at the time of this writing. It is just a wrapper around substack/Browserify's synchronous [`resolve`]:

```js
var resolve = require('resolve');
var resolve = require('resolve/sync');
var isCoreModule = require('is-core-module');
exports.resolve = function (source, file, config) {
if (isCoreModule(source)) return { found: true, path: null };
try {
return { found: true, path: resolve.sync(source, opts(file, config)) };
return { found: true, path: resolve(source, opts(file, config)) };
} catch (err) {
return { found: false };
}
Expand Down
8 changes: 4 additions & 4 deletions resolvers/node/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const resolve = require('resolve');
const resolve = require('resolve/sync');
const isCoreModule = require('is-core-module');
const path = require('path');

Expand All @@ -19,7 +19,7 @@ exports.resolve = function (source, file, config) {

try {
const cachedFilter = function (pkg, dir) { return packageFilter(pkg, dir, config); };
resolvedPath = resolve.sync(source, opts(file, config, cachedFilter));
resolvedPath = resolve(source, opts(file, config, cachedFilter));
log('Resolved to:', resolvedPath);
return { found: true, path: resolvedPath };
} catch (err) {
Expand All @@ -46,7 +46,7 @@ function packageFilter(pkg, dir, config) {
const file = path.join(dir, 'dummy.js');
if (pkg.module) {
try {
resolve.sync(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
resolve(String(pkg.module).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
pkg.main = pkg.module;
found = true;
} catch (err) {
Expand All @@ -55,7 +55,7 @@ function packageFilter(pkg, dir, config) {
}
if (!found && pkg['jsnext:main']) {
try {
resolve.sync(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
resolve(String(pkg['jsnext:main']).replace(/^(?:\.\/)?/, './'), opts(file, config, identity));
pkg.main = pkg['jsnext:main'];
found = true;
} catch (err) {
Expand Down
4 changes: 2 additions & 2 deletions resolvers/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"homepage": "https://github.com/import-js/eslint-plugin-import",
"dependencies": {
"debug": "^3.2.7",
"is-core-module": "^2.12.0",
"resolve": "^1.22.2"
"is-core-module": "^2.13.0",
"resolve": "^1.22.4"
},
"devDependencies": {
"chai": "^3.5.0",
Expand Down
6 changes: 3 additions & 3 deletions resolvers/webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const find = require('array-find');
const interpret = require('interpret');
const fs = require('fs');
const isCore = require('is-core-module');
const resolve = require('resolve');
const resolve = require('resolve/sync');
const semver = require('semver');
const has = require('has');
const isRegex = require('is-regex');
Expand Down Expand Up @@ -190,11 +190,11 @@ function createResolveSync(configPath, webpackConfig, cwd) {

try {
// Attempt to resolve webpack from the given `basedir`
const webpackFilename = resolve.sync('webpack', { basedir, preserveSymlinks: false });
const webpackFilename = resolve('webpack', { basedir, preserveSymlinks: false });
const webpackResolveOpts = { basedir: path.dirname(webpackFilename), preserveSymlinks: false };

webpackRequire = function (id) {
return require(resolve.sync(id, webpackResolveOpts));
return require(resolve(id, webpackResolveOpts));
};
} catch (e) {
// Something has gone wrong (or we're in a test). Use our own bundled
Expand Down
4 changes: 2 additions & 2 deletions resolvers/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"find-root": "^1.1.0",
"has": "^1.0.3",
"interpret": "^1.4.0",
"is-core-module": "^2.12.0",
"is-core-module": "^2.13.0",
"is-regex": "^1.1.4",
"lodash": "^4.17.21",
"resolve": "^1.22.2",
"resolve": "^1.22.4",
"semver": "^5.7.1"
},
"peerDependencies": {
Expand Down

0 comments on commit 5209a43

Please sign in to comment.