src/index.js
function getFileMeta(dirname, sourceInputFile, value, opts) {
    const parsedUrl = url.parse(value, true);
    const filename = decodeURI(parsedUrl.pathname);
    const pathname = path.resolve(dirname, filename);
    const params = parsedUrl.search || '';
    const hash = parsedUrl.hash || '';

    // path between the basePath and the filename
    const basePath = findBasePath(opts.basePath, pathname);
    if (!basePath) {
        throw Error(`"basePath" not found in ${pathname}`);
    }

    const ext = path.extname(pathname);
    const fileMeta = {
        sourceInputFile,
        sourceValue: value,
        filename,
        // the absolute path without the #hash param and ?query
        absolutePath: pathname,
        fullName: path.basename(pathname),
        path: path.relative(basePath, path.dirname(pathname)),
        // name without extension
        name: path.basename(pathname, ext),
        // extension without the '.'
        ext: ext.slice(1),
        query: params + hash,
        qparams: params.length > 0 ? params.slice(1) : '',
        qhash: hash.length > 0 ? hash.slice(1) : '',
        basePath
    };

    return fileMeta;
}
function getFileMeta(dirname, sourceInputFile, value, opts) {
    const parsedUrl = url.parse(value, true);
    const filename = decodeURI(parsedUrl.pathname);
    const pathname = path.resolve(dirname, filename);
    const params = parsedUrl.search || '';
    const hash = parsedUrl.hash || '';

    // path between the basePath and the filename
    const basePath = findBasePath(opts.basePath, pathname);
    if (!basePath) {
        throw Error(`"basePath" not found in ${pathname}`);
    }

    const ext = path.extname(pathname);
    const fileMeta = {
        sourceInputFile,
        sourceValue: value,
        filename,
        // the absolute path without the #hash param and ?query
        absolutePath: pathname,
        fullName: path.basename(pathname),
        path: path.relative(basePath, path.dirname(pathname)),
        // name without extension
        name: path.basename(pathname, ext),
        // extension without the '.'
        ext: ext.slice(1),
        query: params + hash,
        qparams: params.length > 0 ? params.slice(1) : '',
        qhash: hash.length > 0 ? hash.slice(1) : '',
        basePath
    };

    return fileMeta;
}
function getFileMeta ( dirname , sourceInputFile , value , opts ) { const parsedUrl = url . parse ( value , true ) ; const filename = decodeURI ( parsedUrl . pathname ) ; const pathname = path . resolve ( dirname , filename ) ; const params = parsedUrl . search || '' ; const hash = parsedUrl . hash || '' ; // path between the basePath and the filename const basePath = findBasePath ( opts . basePath , pathname ) ; if ( ! basePath ) { throw Error ( ` ${ pathname } ` ) ; } const ext = path . extname ( pathname ) ; const fileMeta = { sourceInputFile , sourceValue : value , filename , // the absolute path without the #hash param and ?query absolutePath : pathname , fullName : path . basename ( pathname ) , path : path . relative ( basePath , path . dirname ( pathname ) ) , // name without extension name : path . basename ( pathname , ext ) , // extension without the '.' ext : ext . slice ( 1 ) , query : params + hash , qparams : params . length > 0 ? params . slice ( 1 ) : '' , qhash : hash . length > 0 ? hash . slice ( 1 ) : '' , basePath } ; return fileMeta ; }
Helper function that reads the file ang get some helpful information
to the copy process.

@param  {string} dirname path of the read file css
@param  {string} sourceInputFile path to the source input file css
@param  {string} value url
@param  {Object} opts plugin options
@return {Promise} resolve => fileMeta | reject => error message
Helper function that reads the file ang get some helpful information to the copy process .