@nxworker/workspace
Version:
Nx plugin providing generators for managing workspace files, including the move-file generator for safely moving files between projects while updating all imports
19 lines (18 loc) • 820 B
TypeScript
export interface PathValidationOptions {
allowUnicode?: boolean;
maxLength?: number;
additionalAllowedChars?: string;
allowGlobPatterns?: boolean;
}
/**
* Validate user input intended to be used as a literal file/path fragment using
* a whitelist approach. The default configuration allows ASCII alphanumerics
* plus a small set of safe punctuation, but callers can opt into
* internationalized filenames, length limits, or extra literal characters.
*
* Prefer invoking this before interpolating user input into generated regexes
* or other sensitive contexts. Adjust the options to suit your project's
* filename/path conventions. Set `allowUnicode: true` to accept
* international characters.
*/
export declare function isValidPathInput(str: string, options: PathValidationOptions): boolean;