Home > @rushstack/node-core-library

node-core-library package

Core libraries that every NodeJS toolchain project should use.


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.
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.
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.
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().
Terminal (BETA) This class facilitates writing to a console.
Text Operations for working with strings that contain text.
TypeUuid Provides a version-independent implementation of the JavaScript instanceof operator.


Enumeration Description
AlreadyExistsBehavior Specifies the behavior of FileSystem.copyFiles() in a situation where the target object 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.
NewlineKind Enumeration controlling conversion of newline characters.
PosixModeBits An integer value used to specify file permissions for POSIX-like operating systems.
TerminalProviderSeverity (BETA)
TextAttribute (BETA) Text styles used with IColorableSequence.


Interface Description
IAnsiEscapeConvertForTestsOptions Options for AnsiEscape.formatForTests().
IAsyncParallelismOptions (BETA) Options for controlling the parallelism of asynchronous operations.
IColorableSequence (BETA)
IConsoleTerminalProviderOptions (BETA) Options to be provided to a ConsoleTerminalProvider
IEnvironmentEntry A process environment variable name and its value. Used by EnvironmentMap.
IExecutableResolveOptions Options for Executable.tryResolve().
IExecutableSpawnOptions Options for Executable.spawn()
IExecutableSpawnSyncOptions Options for Executable.spawnSync()
IFileSystemCopyFileOptions The options for FileSystem.copyFile()
IFileSystemCopyFilesAsyncOptions The options for FileSystem.copyFilesAsync()
IFileSystemCopyFilesOptions The options for FileSystem.copyFiles()
IFileSystemCreateLinkOptions The options for FileSystem.createSymbolicLinkJunction(), FileSystem.createSymbolicLinkFile(), FileSystem.createSymbolicLinkFolder(), and FileSystem.createHardLink().
IFileSystemDeleteFileOptions The options for FileSystem.deleteFile()
IFileSystemMoveOptions The options for FileSystem.move()
IFileSystemReadFileOptions The options for FileSystem.readFile()
IFileSystemReadFolderOptions The options for FileSystem.readFolder()
IFileSystemUpdateTimeParameters The options for FileSystem.updateTimes() Both times must be specified.
IFileSystemWriteFileOptions The options for FileSystem.writeFile()
IFileWriterFlags Interface which represents the flags about which mode the file should be opened in.
IImportResolveModuleOptions Options for Import.resolveModule()
IImportResolveOptions Common options shared by IImportResolveModuleOptions and IImportResolvePackageOptions
IImportResolvePackageOptions Options for Import.resolvePackage()
IJsonFileSaveOptions Options for JsonFile.saveJsonFile()
IJsonFileStringifyOptions Options for JsonFile.stringify()
IJsonSchemaErrorInfo Callback function arguments for JsonSchema.validateObjectWithCallback();
IJsonSchemaFromFileOptions Options for JsonSchema.fromFile()
IJsonSchemaValidateOptions Options for JsonSchema.validateObject()
INodePackageJson An interface for accessing common fields from a package.json file whose version field may be missing.
IPackageJson An interface for accessing common fields from a package.json file.
IPackageJsonDependencyTable This interface is part of the IPackageJson file format. It is used for the “dependencies”, “optionalDependencies”, and “devDependencies” fields.
IPackageJsonLookupParameters Constructor parameters for PackageJsonLookup
IPackageJsonScriptTable This interface is part of the IPackageJson file format. It is used for the “scripts” field.
IPackageNameParserOptions Options that configure the validation rules used by a PackageNameParser instance.
IParsedPackageName A package name that has been separated into its scope and unscoped name.
IParsedPackageNameOrError Result object returned by PackageName.tryParse()
IPathFormatConciselyOptions Options for Path.formatConcisely().
IProtectableMapParameters Constructor parameters for ProtectableMap
IStringBufferOutputOptions (BETA)
IStringBuilder An interface for a builder object that allows a large text string to be constructed incrementally by appending small chunks.
ITerminalProvider (BETA) Implement the interface to create a terminal provider. Terminal providers can be registered to a Terminal instance to receive messages.

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.
FileSystemCopyFilesAsyncFilter Callback function type for IFileSystemCopyFilesAsyncOptions.filter
FileSystemCopyFilesFilter Callback function type for IFileSystemCopyFilesOptions.filter
FileSystemStats An alias for the Node.js fs.Stats object.
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.