docs/libs/typescript.js
function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) {
        // We watch a directory recursively if it contains a wildcard anywhere in a directory segment
        // of the pattern:
        //
        //  /a/b/**/d   - Watch /a/b recursively to catch changes to any d in any subfolder recursively
        //  /a/b/*/d    - Watch /a/b recursively to catch any d in any immediate subfolder, even if a new subfolder is added
        //
        // We watch a directory without recursion if it contains a wildcard in the file segment of
        // the pattern:
        //
        //  /a/b/*      - Watch /a/b directly to catch any new file
        //  /a/b/a?z    - Watch /a/b directly to catch any new file matching a?z
        var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude");
        var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
        var wildcardDirectories = ts.createMap();
        if (include !== undefined) {
            var recursiveKeys = [];
            for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {
                var file = include_1[_i];
                var name_36 = ts.normalizePath(ts.combinePaths(path, file));
                if (excludeRegex && excludeRegex.test(name_36)) {
                    continue;
                }
                var match = wildcardDirectoryPattern.exec(name_36);
                if (match) {
                    var key = useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase();
                    var flags = watchRecursivePattern.test(name_36) ? 1 /* Recursive */ : 0 /* None */;
                    var existingFlags = wildcardDirectories[key];
                    if (existingFlags === undefined || existingFlags < flags) {
                        wildcardDirectories[key] = flags;
                        if (flags === 1 /* Recursive */) {
                            recursiveKeys.push(key);
                        }
                    }
                }
            }
            // Remove any subpaths under an existing recursively watched directory.
            for (var key in wildcardDirectories) {
                for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) {
                    var recursiveKey = recursiveKeys_1[_a];
                    if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {
                        delete wildcardDirectories[key];
                    }
                }
            }
        }
        return wildcardDirectories;
    }
function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) {
        // We watch a directory recursively if it contains a wildcard anywhere in a directory segment
        // of the pattern:
        //
        //  /a/b/**/d   - Watch /a/b recursively to catch changes to any d in any subfolder recursively
        //  /a/b/*/d    - Watch /a/b recursively to catch any d in any immediate subfolder, even if a new subfolder is added
        //
        // We watch a directory without recursion if it contains a wildcard in the file segment of
        // the pattern:
        //
        //  /a/b/*      - Watch /a/b directly to catch any new file
        //  /a/b/a?z    - Watch /a/b directly to catch any new file matching a?z
        var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude");
        var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
        var wildcardDirectories = ts.createMap();
        if (include !== undefined) {
            var recursiveKeys = [];
            for (var _i = 0, include_1 = include; _i < include_1.length; _i++) {
                var file = include_1[_i];
                var name_36 = ts.normalizePath(ts.combinePaths(path, file));
                if (excludeRegex && excludeRegex.test(name_36)) {
                    continue;
                }
                var match = wildcardDirectoryPattern.exec(name_36);
                if (match) {
                    var key = useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase();
                    var flags = watchRecursivePattern.test(name_36) ? 1 /* Recursive */ : 0 /* None */;
                    var existingFlags = wildcardDirectories[key];
                    if (existingFlags === undefined || existingFlags < flags) {
                        wildcardDirectories[key] = flags;
                        if (flags === 1 /* Recursive */) {
                            recursiveKeys.push(key);
                        }
                    }
                }
            }
            // Remove any subpaths under an existing recursively watched directory.
            for (var key in wildcardDirectories) {
                for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) {
                    var recursiveKey = recursiveKeys_1[_a];
                    if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {
                        delete wildcardDirectories[key];
                    }
                }
            }
        }
        return wildcardDirectories;
    }
function getWildcardDirectories ( include , exclude , path , useCaseSensitiveFileNames ) { // We watch a directory recursively if it contains a wildcard anywhere in a directory segment // of the pattern: // //  /a/b/**/d   - Watch /a/b recursively to catch changes to any d in any subfolder recursively //  /a/b/*/d    - Watch /a/b recursively to catch any d in any immediate subfolder, even if a new subfolder is added // // We watch a directory without recursion if it contains a wildcard in the file segment of // the pattern: // //  /a/b/*      - Watch /a/b directly to catch any new file //  /a/b/a?z    - Watch /a/b directly to catch any new file matching a?z var rawExcludeRegex = ts . getRegularExpressionForWildcard ( exclude , path , "exclude" ) ; var excludeRegex = rawExcludeRegex && new RegExp ( rawExcludeRegex , useCaseSensitiveFileNames ? "" : "i" ) ; var wildcardDirectories = ts . createMap ( ) ; if ( include !== undefined ) { var recursiveKeys = [ ] ; for ( var _i = 0 , include_1 = include ; _i < include_1 . length ; _i ++ ) { var file = include_1 [ _i ] ; var name_36 = ts . normalizePath ( ts . combinePaths ( path , file ) ) ; if ( excludeRegex && excludeRegex . test ( name_36 ) ) { continue ; } var match = wildcardDirectoryPattern . exec ( name_36 ) ; if ( match ) { var key = useCaseSensitiveFileNames ? match [ 0 ] : match [ 0 ] . toLowerCase ( ) ; var flags = watchRecursivePattern . test ( name_36 ) ? 1 /* Recursive */ : 0 /* None */ ; var existingFlags = wildcardDirectories [ key ] ; if ( existingFlags === undefined || existingFlags < flags ) { wildcardDirectories [ key ] = flags ; if ( flags === 1 /* Recursive */ ) { recursiveKeys . push ( key ) ; } } } } // Remove any subpaths under an existing recursively watched directory. for ( var key in wildcardDirectories ) { for ( var _a = 0 , recursiveKeys_1 = recursiveKeys ; _a < recursiveKeys_1 . length ; _a ++ ) { var recursiveKey = recursiveKeys_1 [ _a ] ; if ( key !== recursiveKey && ts . containsPath ( recursiveKey , key , path , ! useCaseSensitiveFileNames ) ) { delete wildcardDirectories [ key ] ; } } } } return wildcardDirectories ; }
Gets directories in a set of include patterns that should be watched for changes.
Gets directories in a set of include patterns that should be watched for changes .