Home > @rushstack/node-core-library
node-core-library package
Core libraries that every NodeJS toolchain project should use.
Classes
Class | Description |
---|---|
AlreadyReportedError | This exception can be thrown to indicate that an operation failed and an error message has already been reported appropriately. Thus, the catch handler does not have responsibility for reporting the error. |
AnsiEscape | Operations for working with text strings that contain ANSI escape codes. The most commonly used escape codes set the foreground/background color for console output. |
Async | (BETA) Utilities for parallel asynchronous operations, for use with the system Promise APIs. |
AsyncQueue | A queue that allows for asynchronous iteration. During iteration, the queue will wait until the next item is pushed into the queue before yielding. If instead all queue items are consumed and all callbacks have been called, the queue will return. |
Colors | (BETA) The static functions on this class are used to produce colored text for use with the node-core-library terminal. |
ConsoleTerminalProvider | (BETA) Terminal provider that prints to STDOUT (for log- and verbose-level messages) and STDERR (for warning- and error-level messsages). |
Enum | A helper for looking up TypeScript enum keys/values. |
EnvironmentMap | A map data structure that stores process environment variables. On Windows operating system, the variable names are case-insensitive. |
Executable | The Executable class provides a safe, portable, recommended solution for tools that need to launch child processes. |
FileError | An Error subclass that should be thrown to report an unexpected state that specifically references a location in a file. |
FileSystem | The FileSystem API provides a complete set of recommended operations for interacting with the file system. |
FileWriter | API for interacting with file handles. |
Import | Helpers for resolving and importing Node.js modules. |
InternalError | An Error subclass that should be thrown to report an unexpected state that may indicate a software defect. An application may handle this error by instructing the end user to report an issue to the application maintainers. |
JsonFile | Utilities for reading/writing JSON files. |
JsonSchema | Represents a JSON schema that can be used to validate JSON data files loaded by the JsonFile class. |
LegacyAdapters | Helper functions used when interacting with APIs that do not follow modern coding practices. |
LockFile | The LockFile implements a file-based mutex for synchronizing access to a shared resource between multiple Node.js processes. It is not recommended for synchronization solely within a single Node.js process. |
MapExtensions | Helper functions for working with the Map<K, V> data type. |
PackageJsonLookup | This class provides methods for finding the nearest "package.json" for a folder and retrieving the name of the package. The results are cached. |
PackageName | Provides basic operations for validating and manipulating NPM package names such as my-package or @scope/my-package . |
PackageNameParser | A configurable parser for validating and manipulating NPM package names such as my-package or @scope/my-package . |
Path | Common operations for manipulating file and directory paths. |
PrefixProxyTerminalProvider | (BETA) Wraps an existing ITerminalProvider that prefixes each line of output with a specified prefix string. |
ProtectableMap | The ProtectableMap provides an easy way for an API to expose a Map<K, V> property while intercepting and validating any write operations that are performed by consumers of the API. |
Sort | Operations for sorting collections. |
StringBufferTerminalProvider | (BETA) Terminal provider that stores written data in buffers separated by severity. This terminal provider is designed to be used when code that prints to a terminal is being unit tested. |
StringBuilder | This class allows a large text string to be constructed incrementally by appending small chunks. The final string can be obtained by calling StringBuilder.toString(). |
SubprocessTerminator | (BETA) When a child process is created, registering it with the SubprocessTerminator will ensure that the child gets terminated when the current process terminates. |
Terminal | (BETA) This class facilitates writing to a console. |
TerminalWritable | (BETA) A adapter to allow writing to a provided terminal using Writable streams. |
Text | Operations for working with strings that contain text. |
TypeUuid | Provides a version-independent implementation of the JavaScript instanceof operator. |
Enumerations
Enumeration | Description |
---|---|
AlreadyExistsBehavior | Specifies the behavior of APIs such as FileSystem.copyFile() or FileSystem.createSymbolicLinkFile() when the output file path already exists. |
ColorValue | (BETA) Colors used with IColorableSequence. |
Encoding | The allowed types of encodings, as supported by Node.js |
FileConstants | String constants for common filenames and parts of filenames. |
FolderConstants | String constants for common folder names. |
JsonSyntax | Specifies the variant of JSON syntax to be used. |
NewlineKind | Enumeration controlling conversion of newline characters. |
PosixModeBits | An integer value used to specify file permissions for POSIX-like operating systems. |
TerminalProviderSeverity | (BETA) Similar to many popular logging packages, terminal providers support a range of message severities. These severities have built-in formatting defaults in the Terminal object (warnings are yellow, errors are red, etc.). Terminal providers may choose to suppress certain messages based on their severity, or to route some messages to other providers or not based on severity. Severity | Purpose --------- | ------- error | Build errors and fatal issues warning | Not necessarily fatal, but indicate a problem the user should fix log | Informational messages verbose | Additional information that may not always be necessary debug | Highest detail level, best used for troubleshooting information |
TextAttribute | (BETA) Text styles used with IColorableSequence. |
Interfaces
Type Aliases
Type Alias | Description |
---|---|
Brand | A "branded type" is a primitive type with a compile-type key that makes it incompatible with other aliases for the primitive type. |
ExecutableStdioMapping | Types for IExecutableSpawnSyncOptions.stdio and IExecutableSpawnOptions.stdio |
ExecutableStdioStreamMapping | Typings for one of the streams inside IExecutableSpawnSyncOptions.stdio. |
FileLocationStyle | The format that the FileError message should conform to. The supported formats are: - Unix: <path>:<line>:<column> - <message> - VisualStudio: <path>(<line>,<column>) - <message> |
FileSystemCopyFilesAsyncFilter | Callback function type for IFileSystemCopyFilesAsyncOptions.filter |
FileSystemCopyFilesFilter | Callback function type for IFileSystemCopyFilesOptions.filter |
FileSystemStats | An alias for the Node.js fs.Stats object. |
FolderItem | An alias for the Node.js fs.Dirent object. |
IPrefixProxyTerminalProviderOptions | (BETA) |
JsonNull | The Rush Stack lint rules discourage usage of null . However, JSON parsers always return JavaScript's null to keep the two syntaxes consistent. When creating interfaces that describe JSON structures, use JsonNull to avoid triggering the lint rule. Do not use JsonNull for any other purpose. |
JsonObject | Represents a JSON-serializable object whose type has not been determined yet. |
LegacyCallback | Callback used by LegacyAdapters. |