{"size": 603, "ext": "js", "max_stars_repo_path": "src/resolver.js", "max_stars_repo_name": "deepfunc/minipack", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/resolver.js", "max_issues_repo_name": "deepfunc/minipack", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/resolver.js", "max_forks_repo_name": "deepfunc/minipack", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.12, "max_line_length": 79, "alphanum_fraction": 0.6351575456}
const fs = require('fs');
const { CachedInputFileSystem, ResolverFactory } = require('enhanced-resolve');

const originalResolver = ResolverFactory.createResolver({
  fileSystem: new CachedInputFileSystem(fs, 4000),
  extensions: ['.js', '.json']
});

const resolver = {};

resolver.resolve = function (...args) {
  return new Promise((resolve, reject) => {
    const callback = function (err, filepath, meta) {
      if (err) {
        reject(err);
      } else {
        resolve({ filepath, meta });
      }
    };
    originalResolver.resolve(...args, callback);
  });
};

module.exports = resolver;
