function compilePaths(filePath) {
    filePath = path.normalize(filePath);
    if (!path.isAbsolute(filePath)) {
        throw new Error(`${filePath} is not an absolute path`);
    }
    const parsed = path.parse(filePath);
    if (filePath === parsed.root) {
        return [filePath];
    }
    return filePath
        .slice(parsed.root.length)
        .split(path.sep)
        .map((segment, i, array) => parsed.root + path.join(...array.slice(0, array.length - i)))
        .concat(parsed.root);
}
/**
 * Given an absolute system path, compile an array of paths working backwards
 * one directory at a time, always ending in the root directory.
 *
 * For example, `'/some/dir'` => `['/some/dir', '/some', '/']`
 *
 * @param filePath Absolute system base path.
 */
Given an absolute system path, compile an array of paths working backwards
one directory at a time, always ending in the root directory.



@param filePath Absolute system base path.
Given an absolute system path compile an array of paths working backwards one directory at a time always ending in the root directory . @param filePath Absolute system base path .
function compilePaths(filePath) {
    filePath = path.normalize(filePath);
    if (!path.isAbsolute(filePath)) {
        throw new Error(`${filePath} is not an absolute path`);
    }
    const parsed = path.parse(filePath);
    if (filePath === parsed.root) {
        return [filePath];
    }
    return filePath
        .slice(parsed.root.length)
        .split(path.sep)
        .map((segment, i, array) => parsed.root + path.join(...array.slice(0, array.length - i)))
        .concat(parsed.root);
}
function compilePaths ( filePath ) { filePath = path . normalize ( filePath ) ; if ( ! path . isAbsolute ( filePath ) ) { throw new Error ( ` ${ filePath } ` ) ; } const parsed = path . parse ( filePath ) ; if ( filePath === parsed . root ) { return [ filePath ] ; } return filePath . slice ( parsed . root . length ) . split ( path . sep ) . map ( ( segment , i , array ) => parsed . root + path . join ( ... array . slice ( 0 , array . length - i ) ) ) . concat ( parsed . root ) ; }
Given an absolute system path, compile an array of paths working backwards
 one directory at a time, always ending in the root directory.
Given an absolute system path compile an array of paths working backwards one directory at a time always ending in the root directory .