"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findStylesheetFiles = findStylesheetFiles;
const core_1 = require("@angular-devkit/core");
const STYLESHEET_REGEX = /.*\.(css|scss|less|sass)/;
function findStylesheetFiles(tree, startDirectory = '/') {
    const result = [];
    const visitDir = (dirPath) => {
        const { subfiles, subdirs } = tree.getDir(dirPath);
        subfiles.forEach((fileName) => {
            if (STYLESHEET_REGEX.test(fileName)) {
                result.push((0, core_1.join)(dirPath, fileName));
            }
        });
        // Visit directories within the current directory to find other stylesheets.
        subdirs.forEach((fragment) => {
            // Do not visit directories or files inside node modules or `dist/` folders.
            if (fragment !== 'node_modules' && fragment !== 'dist') {
                visitDir((0, core_1.join)(dirPath, fragment));
            }
        });
    };
    visitDir(startDirectory);
    return result;
}
//# sourceMappingURL=file-utils.js.map