1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const Path = require("path");
|
4 | const minimatch_1 = require("minimatch");
|
5 | const unix = Path.sep === '/';
|
6 | function normalize(pattern) {
|
7 | if (pattern.startsWith('!') || pattern.startsWith('#')) {
|
8 | return pattern[0] + normalize(pattern.substr(1));
|
9 | }
|
10 | if (unix) {
|
11 | pattern = pattern.replace(/[\\]/g, '/').replace(/^\w:/, '');
|
12 | }
|
13 | if (pattern.substr(0, 2) !== '**') {
|
14 | pattern = Path.resolve(pattern);
|
15 | }
|
16 | if (!unix) {
|
17 | pattern = pattern.replace(/[\\]/g, '/');
|
18 | }
|
19 | return pattern;
|
20 | }
|
21 | function createMinimatch(patterns) {
|
22 | return patterns.map(pattern => new minimatch_1.Minimatch(normalize(pattern), { dot: true }));
|
23 | }
|
24 | exports.createMinimatch = createMinimatch;
|
25 |
|
\ | No newline at end of file |