UNPKG

4.32 kBTypeScriptView Raw
1import { CopyOptions } from './options';
2/**
3 * Represents file path ignoring behavior.
4 */
5export declare abstract class IgnoreStrategy {
6 /**
7 * Ignores file paths based on simple glob patterns.
8 *
9 * @returns `GlobIgnorePattern` associated with the given patterns.
10 * @param absoluteRootPath the absolute path to the root directory of the paths to be considered
11 * @param patterns
12 */
13 static glob(absoluteRootPath: string, patterns: string[]): GlobIgnoreStrategy;
14 /**
15 * Ignores file paths based on the [`.gitignore specification`](https://git-scm.com/docs/gitignore).
16 *
17 * @returns `GitIgnorePattern` associated with the given patterns.
18 * @param absoluteRootPath the absolute path to the root directory of the paths to be considered
19 * @param patterns
20 */
21 static git(absoluteRootPath: string, patterns: string[]): GitIgnoreStrategy;
22 /**
23 * Ignores file paths based on the [`.dockerignore specification`](https://docs.docker.com/engine/reference/builder/#dockerignore-file).
24 *
25 * @returns `DockerIgnorePattern` associated with the given patterns.
26 * @param absoluteRootPath the absolute path to the root directory of the paths to be considered
27 * @param patterns
28 */
29 static docker(absoluteRootPath: string, patterns: string[]): DockerIgnoreStrategy;
30 /**
31 * Creates an IgnoreStrategy based on the `ignoreMode` and `exclude` in a `CopyOptions`.
32 *
33 * @returns `IgnoreStrategy` based on the `CopyOptions`
34 * @param absoluteRootPath the absolute path to the root directory of the paths to be considered
35 * @param options the `CopyOptions` to create the `IgnoreStrategy` from
36 */
37 static fromCopyOptions(options: CopyOptions, absoluteRootPath: string): IgnoreStrategy;
38 /**
39 * Adds another pattern.
40 * @params pattern the pattern to add
41 */
42 abstract add(pattern: string): void;
43 /**
44 * Determines whether a given file path should be ignored or not.
45 *
46 * @param absoluteFilePath absolute file path to be assessed against the pattern
47 * @returns `true` if the file should be ignored
48 */
49 abstract ignores(absoluteFilePath: string): boolean;
50}
51/**
52 * Ignores file paths based on simple glob patterns.
53 */
54export declare class GlobIgnoreStrategy extends IgnoreStrategy {
55 private readonly absoluteRootPath;
56 private readonly patterns;
57 constructor(absoluteRootPath: string, patterns: string[]);
58 /**
59 * Adds another pattern.
60 * @params pattern the pattern to add
61 */
62 add(pattern: string): void;
63 /**
64 * Determines whether a given file path should be ignored or not.
65 *
66 * @param absoluteFilePath absolute file path to be assessed against the pattern
67 * @returns `true` if the file should be ignored
68 */
69 ignores(absoluteFilePath: string): boolean;
70}
71/**
72 * Ignores file paths based on the [`.gitignore specification`](https://git-scm.com/docs/gitignore).
73 */
74export declare class GitIgnoreStrategy extends IgnoreStrategy {
75 private readonly absoluteRootPath;
76 private readonly ignore;
77 constructor(absoluteRootPath: string, patterns: string[]);
78 /**
79 * Adds another pattern.
80 * @params pattern the pattern to add
81 */
82 add(pattern: string): void;
83 /**
84 * Determines whether a given file path should be ignored or not.
85 *
86 * @param absoluteFilePath absolute file path to be assessed against the pattern
87 * @returns `true` if the file should be ignored
88 */
89 ignores(absoluteFilePath: string): boolean;
90}
91/**
92 * Ignores file paths based on the [`.dockerignore specification`](https://docs.docker.com/engine/reference/builder/#dockerignore-file).
93 */
94export declare class DockerIgnoreStrategy extends IgnoreStrategy {
95 private readonly absoluteRootPath;
96 private readonly ignore;
97 constructor(absoluteRootPath: string, patterns: string[]);
98 /**
99 * Adds another pattern.
100 * @params pattern the pattern to add
101 */
102 add(pattern: string): void;
103 /**
104 * Determines whether a given file path should be ignored or not.
105 *
106 * @param absoluteFilePath absolute file path to be assessed against the pattern
107 * @returns `true` if the file should be ignored
108 */
109 ignores(absoluteFilePath: string): boolean;
110}
111
\No newline at end of file