BVB Source Codes

reactide Show resolve.js Source code

Return Download reactide: download resolve.js Source code - Download reactide Source code - Type:.js
  1. "use strict";
  2.  
  3. exports.__esModule = true;
  4.  
  5. var _typeof2 = require("babel-runtime/helpers/typeof");
  6.  
  7. var _typeof3 = _interopRequireDefault(_typeof2);
  8.  
  9. exports.default = function (loc) {
  10.   var relative = arguments.length <= 1 || arguments[1] === undefined ? process.cwd() : arguments[1];
  11.  
  12.   // we're in the browser, probably
  13.   if ((typeof _module2.default === "undefined" ? "undefined" : (0, _typeof3.default)(_module2.default)) === "object") return null;
  14.  
  15.   var relativeMod = relativeModules[relative];
  16.  
  17.   if (!relativeMod) {
  18.     relativeMod = new _module2.default();
  19.  
  20.     // We need to define an id and filename on our "fake" relative` module so that
  21.     // Node knows what "." means in the case of us trying to resolve a plugin
  22.     // such as "./myPlugins/somePlugin.js". If we don't specify id and filename here,
  23.     // Node presumes "." is process.cwd(), not our relative path.
  24.     // Since this fake module is never "loaded", we don't have to worry about mutating
  25.     // any global Node module cache state here.
  26.     var filename = _path2.default.join(relative, ".babelrc");
  27.     relativeMod.id = filename;
  28.     relativeMod.filename = filename;
  29.  
  30.     relativeMod.paths = _module2.default._nodeModulePaths(relative);
  31.     relativeModules[relative] = relativeMod;
  32.   }
  33.  
  34.   try {
  35.     return _module2.default._resolveFilename(loc, relativeMod);
  36.   } catch (err) {
  37.     return null;
  38.   }
  39. };
  40.  
  41. var _module = require("module");
  42.  
  43. var _module2 = _interopRequireDefault(_module);
  44.  
  45. var _path = require("path");
  46.  
  47. var _path2 = _interopRequireDefault(_path);
  48.  
  49. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  50.  
  51. var relativeModules = {};
  52.  
  53. module.exports = exports["default"];
downloadresolve.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top