source: trip-planner-front/node_modules/@angular/cdk/schematics/ng-update/find-stylesheets.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.9 KB
Line 
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.findStylesheetFiles = void 0;
11const core_1 = require("@angular-devkit/core");
12/** Regular expression that matches stylesheet paths */
13const STYLESHEET_REGEX = /.*\.(css|scss)/;
14/**
15 * Finds stylesheets in the given directory from within the specified tree.
16 * @param tree Devkit tree where stylesheet files can be found in.
17 * @param startDirectory Optional start directory where stylesheets should be searched in.
18 * This can be useful if only stylesheets within a given folder are relevant (to avoid
19 * unnecessary iterations).
20 */
21function findStylesheetFiles(tree, startDirectory = '/') {
22 const result = [];
23 const visitDir = (dirPath) => {
24 const { subfiles, subdirs } = tree.getDir(dirPath);
25 subfiles.forEach(fileName => {
26 if (STYLESHEET_REGEX.test(fileName)) {
27 result.push(core_1.join(dirPath, fileName));
28 }
29 });
30 // Visit directories within the current directory to find other stylesheets.
31 subdirs.forEach(fragment => {
32 // Do not visit directories or files inside node modules or `dist/` folders.
33 if (fragment !== 'node_modules' && fragment !== 'dist') {
34 visitDir(core_1.join(dirPath, fragment));
35 }
36 });
37 };
38 visitDir(startDirectory);
39 return result;
40}
41exports.findStylesheetFiles = findStylesheetFiles;
42//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmluZC1zdHlsZXNoZWV0cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGsvc2NoZW1hdGljcy9uZy11cGRhdGUvZmluZC1zdHlsZXNoZWV0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7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