function toGlob()

in core/glob-utils.js [75:105]


function toGlob(globlike, exts) {
    /** @type {Array.<string>} */
    const finalizedGlobs = [];

    globlike = globlike
        .replace(/[\\|\/]/ig, path.sep)
        .replace(Regex.PathRef, (match, pathName) => configs.buildInfos.paths[pathName]);

    if (Regex.GlobLike.test(globlike)) {
        finalizedGlobs.push(globlike);
        
        return finalizedGlobs;
    }

    if (!exts || exts.length <= 0) {
        if (globlike.endsWith("/") || globlike.endsWith("\\")) {
            finalizedGlobs.push(globlike.substr(0, glob.length - 1));
        } else {
            finalizedGlobs.push(globlike);
        }

        finalizedGlobs.push(path.join(globlike, "**", "*"));

    } else {
        for (const ext of exts) {
            finalizedGlobs.push(path.join(globlike, "**", `*.${ext}`));
        }
    }

    return finalizedGlobs;
}