UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

134 lines (133 loc) 5.37 kB
import { CopyOptions } from './options'; /** * Represents file path ignoring behavior. */ export declare abstract class IgnoreStrategy { /** * Ignores file paths based on simple glob patterns. * * @returns `GlobIgnorePattern` associated with the given patterns. * @param absoluteRootPath the absolute path to the root directory of the paths to be considered */ static glob(absoluteRootPath: string, patterns: string[]): GlobIgnoreStrategy; /** * Ignores file paths based on the [`.gitignore specification`](https://git-scm.com/docs/gitignore). * * @returns `GitIgnorePattern` associated with the given patterns. * @param absoluteRootPath the absolute path to the root directory of the paths to be considered */ static git(absoluteRootPath: string, patterns: string[]): GitIgnoreStrategy; /** * Ignores file paths based on the [`.dockerignore specification`](https://docs.docker.com/engine/reference/builder/#dockerignore-file). * * @returns `DockerIgnorePattern` associated with the given patterns. * @param absoluteRootPath the absolute path to the root directory of the paths to be considered */ static docker(absoluteRootPath: string, patterns: string[]): DockerIgnoreStrategy; /** * Creates an IgnoreStrategy based on the `ignoreMode` and `exclude` in a `CopyOptions`. * * @returns `IgnoreStrategy` based on the `CopyOptions` * @param absoluteRootPath the absolute path to the root directory of the paths to be considered * @param options the `CopyOptions` to create the `IgnoreStrategy` from */ static fromCopyOptions(options: CopyOptions, absoluteRootPath: string): IgnoreStrategy; /** * Adds another pattern. * @params pattern the pattern to add */ abstract add(pattern: string): void; /** * Determines whether a given file path should be ignored or not. * * @param absoluteFilePath absolute file path to be assessed against the pattern * @returns `true` if the file should be ignored */ abstract ignores(absoluteFilePath: string): boolean; /** * Determines whether a given file path should be ignored and have all of its children ignored * if its a directory. * * @param absoluteFilePath absolute file path to be assessed against the pattern * @returns `true` if the file should be ignored */ completelyIgnores(absoluteFilePath: string): boolean; } /** * Ignores file paths based on simple glob patterns. */ export declare class GlobIgnoreStrategy extends IgnoreStrategy { private readonly absoluteRootPath; private readonly patterns; constructor(absoluteRootPath: string, patterns: string[]); /** * Adds another pattern. * @params pattern the pattern to add */ add(pattern: string): void; /** * Determines whether a given file path should be ignored or not. * * @param absoluteFilePath absolute file path to be assessed against the pattern * @returns `true` if the file should be ignored */ ignores(absoluteFilePath: string): boolean; } /** * Ignores file paths based on the [`.gitignore specification`](https://git-scm.com/docs/gitignore). */ export declare class GitIgnoreStrategy extends IgnoreStrategy { private readonly absoluteRootPath; private readonly ignore; constructor(absoluteRootPath: string, patterns: string[]); /** * Adds another pattern. * @params pattern the pattern to add */ add(pattern: string): void; /** * Determines whether a given file path should be ignored or not. * * @param absoluteFilePath absolute file path to be assessed against the pattern * @returns `true` if the file should be ignored */ ignores(absoluteFilePath: string): boolean; } /** * Ignores file paths based on the [`.dockerignore specification`](https://docs.docker.com/engine/reference/builder/#dockerignore-file). */ export declare class DockerIgnoreStrategy extends IgnoreStrategy { private readonly absoluteRootPath; private readonly ignore; private readonly completeIgnore; private readonly negativeIgnoreRegex; constructor(absoluteRootPath: string, patterns: string[]); /** * Adds the pattern to completeIgnore. If its an exclude pattern, it also adds an entry for each parent directory. * This is useful in detecting folders that are ignored, but that could have children files which are not ignored. * * @param pattern pattern to add */ private completelyAdd; /** * Adds another pattern. * @params pattern the pattern to add */ add(pattern: string): void; private getRelativePath; /** * Determines whether a given file path should be ignored or not. * * @param absoluteFilePath absolute file path to be assessed against the pattern * @returns `true` if the file should be ignored */ ignores(absoluteFilePath: string): boolean; /** * Determines whether a given file path should be ignored and have all of its children ignored * if its a directory. * * @param absoluteFilePath absolute file path to be assessed against the pattern * @returns `true` if the file should be ignored */ completelyIgnores(absoluteFilePath: string): boolean; }