src/utility/find-module.js
function buildRelativePath(from, to) {
    from = core_1.normalize(from);
    to = core_1.normalize(to);
    // Convert to arrays.
    const fromParts = from.split('/');
    const toParts = to.split('/');
    // Remove file names (preserving destination)
    fromParts.pop();
    const toFileName = toParts.pop();
    const relativePath = core_1.relative(core_1.normalize(fromParts.join('/')), core_1.normalize(toParts.join('/')));
    let pathPrefix = '';
    // Set the path prefix for same dir or child dir, parent dir starts with `..`
    if (!relativePath) {
        pathPrefix = '.';
    }
    else if (!relativePath.startsWith('.')) {
        pathPrefix = `./`;
    }
    if (pathPrefix && !pathPrefix.endsWith('/')) {
        pathPrefix += '/';
    }
    return pathPrefix + (relativePath ? relativePath + '/' : '') + toFileName;
}
function buildRelativePath(from, to) {
    from = core_1.normalize(from);
    to = core_1.normalize(to);
    // Convert to arrays.
    const fromParts = from.split('/');
    const toParts = to.split('/');
    // Remove file names (preserving destination)
    fromParts.pop();
    const toFileName = toParts.pop();
    const relativePath = core_1.relative(core_1.normalize(fromParts.join('/')), core_1.normalize(toParts.join('/')));
    let pathPrefix = '';
    // Set the path prefix for same dir or child dir, parent dir starts with `..`
    if (!relativePath) {
        pathPrefix = '.';
    }
    else if (!relativePath.startsWith('.')) {
        pathPrefix = `./`;
    }
    if (pathPrefix && !pathPrefix.endsWith('/')) {
        pathPrefix += '/';
    }
    return pathPrefix + (relativePath ? relativePath + '/' : '') + toFileName;
}
function buildRelativePath ( from , to ) { from = core_1 . normalize ( from ) ; to = core_1 . normalize ( to ) ; // Convert to arrays. const fromParts = from . split ( '/' ) ; const toParts = to . split ( '/' ) ; // Remove file names (preserving destination) fromParts . pop ( ) ; const toFileName = toParts . pop ( ) ; const relativePath = core_1 . relative ( core_1 . normalize ( fromParts . join ( '/' ) ) , core_1 . normalize ( toParts . join ( '/' ) ) ) ; let pathPrefix = '' ; // Set the path prefix for same dir or child dir, parent dir starts with `..` if ( ! relativePath ) { pathPrefix = '.' ; } else if ( ! relativePath . startsWith ( '.' ) ) { pathPrefix = ` ` ; } if ( pathPrefix && ! pathPrefix . endsWith ( '/' ) ) { pathPrefix += '/' ; } return pathPrefix + ( relativePath ? relativePath + '/' : '' ) + toFileName ; }
Build a relative path from one file path to another file path.
Build a relative path from one file path to another file path .