This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/babel-plugin-module-resolver/lib/mapToRelative.js
2019-08-11 20:48:02 +02:00

23 lines
No EOL
597 B
JavaScript

"use strict";
exports.__esModule = true;
exports.default = mapToRelative;
var _path = _interopRequireDefault(require("path"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function mapToRelative(cwd, currentFile, module) {
let from = _path.default.dirname(currentFile);
let to = _path.default.normalize(module);
from = _path.default.resolve(cwd, from);
to = _path.default.resolve(cwd, to);
const moduleMapped = _path.default.relative(from, to);
return (0, _utils.toPosixPath)(moduleMapped);
}