Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library

node-core-library package

Core libraries that every NodeJS toolchain project should use.


AlreadyReportedErrorThis 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.
AnsiEscapeOperations 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.
AsyncQueueA 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).
EnumA helper for looking up TypeScript enum keys/values.
EnvironmentMapA map data structure that stores process environment variables. On Windows operating system, the variable names are case-insensitive.
ExecutableThe Executable class provides a safe, portable, recommended solution for tools that need to launch child processes.
FileErrorAn Error subclass that should be thrown to report an unexpected state that specifically references a location in a file.
FileSystemThe FileSystem API provides a complete set of recommended operations for interacting with the file system.
FileWriterAPI for interacting with file handles.
ImportHelpers for resolving and importing Node.js modules.
InternalErrorAn 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.
JsonFileUtilities for reading/writing JSON files.
JsonSchemaRepresents a JSON schema that can be used to validate JSON data files loaded by the JsonFile class.
LegacyAdaptersHelper functions used when interacting with APIs that do not follow modern coding practices.
LockFileThe 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.
MapExtensionsHelper functions for working with the Map<K, V> data type.
PackageJsonLookupThis class provides methods for finding the nearest "package.json" for a folder and retrieving the name of the package. The results are cached.
PackageNameProvides basic operations for validating and manipulating NPM package names such as my-package or @scope/my-package.
PackageNameParserA configurable parser for validating and manipulating NPM package names such as my-package or @scope/my-package.
PathCommon operations for manipulating file and directory paths.
PrefixProxyTerminalProvider(BETA) Wraps an existing ITerminalProvider that prefixes each line of output with a specified prefix string.
ProtectableMapThe 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.
SortOperations 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.
StringBuilderThis 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.
TextOperations for working with strings that contain text.
TypeUuidProvides a version-independent implementation of the JavaScript instanceof operator.


AlreadyExistsBehaviorSpecifies the behavior of APIs such as FileSystem.copyFile() or FileSystem.createSymbolicLinkFile() when the output file path already exists.
ColorValue(BETA) Colors used with IColorableSequence.
EncodingThe allowed types of encodings, as supported by Node.js
FileConstantsString constants for common filenames and parts of filenames.
FolderConstantsString constants for common folder names.
JsonSyntaxSpecifies the variant of JSON syntax to be used.
NewlineKindEnumeration controlling conversion of newline characters.
PosixModeBitsAn integer value used to specify file permissions for POSIX-like operating systems.

(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.


IAnsiEscapeConvertForTestsOptionsOptions for AnsiEscape.formatForTests().
IAsyncParallelismOptions(BETA) Options for controlling the parallelism of asynchronous operations.
IConsoleTerminalProviderOptions(BETA) Options to be provided to a ConsoleTerminalProvider
IDynamicPrefixProxyTerminalProviderOptions(BETA) Options for PrefixProxyTerminalProvider.
IEnvironmentEntryA process environment variable name and its value. Used by EnvironmentMap.
IExecutableResolveOptionsOptions for Executable.tryResolve().
IExecutableSpawnOptionsOptions for Executable.spawn()
IExecutableSpawnSyncOptionsOptions for Executable.spawnSync()
IFileErrorFormattingOptionsProvides options for the output message of a file error.
IFileErrorOptionsProvides options for the creation of a FileError.
IFileSystemCopyFileOptionsThe options for FileSystem.copyFile()
IFileSystemCopyFilesAsyncOptionsThe options for FileSystem.copyFilesAsync()
IFileSystemCopyFilesOptionsThe options for FileSystem.copyFiles()
IFileSystemCreateLinkOptionsThe options for FileSystem.createSymbolicLinkJunction(), FileSystem.createSymbolicLinkFile(), FileSystem.createSymbolicLinkFolder(), and FileSystem.createHardLink().
IFileSystemDeleteFileOptionsThe options for FileSystem.deleteFile()
IFileSystemMoveOptionsThe options for FileSystem.move()
IFileSystemReadFileOptionsThe options for FileSystem.readFile()
IFileSystemReadFolderOptionsThe options for FileSystem.readFolder()
IFileSystemUpdateTimeParametersThe options for FileSystem.updateTimes() Both times must be specified.
IFileSystemWriteFileOptionsThe options for FileSystem.writeFile()
IFileWriterFlagsInterface which represents the flags about which mode the file should be opened in.
IImportResolveAsyncOptionsCommon options shared by IImportResolveModuleAsyncOptions and IImportResolvePackageAsyncOptions
IImportResolveModuleAsyncOptionsOptions for Import.resolveModuleAsync()
IImportResolveModuleOptionsOptions for Import.resolveModule()
IImportResolveOptionsCommon options shared by IImportResolveModuleOptions and IImportResolvePackageOptions
IImportResolvePackageAsyncOptionsOptions for Import.resolvePackageAsync()
IImportResolvePackageOptionsOptions for Import.resolvePackage()
IJsonFileLoadAndValidateOptionsOptions for JsonFile.loadAndValidate() and JsonFile.loadAndValidateAsync()
IJsonFileParseOptionsOptions for JsonFile.parseString(), JsonFile.load(), and JsonFile.loadAsync().
IJsonFileSaveOptionsOptions for and JsonFile.saveAsync().
IJsonFileStringifyOptionsOptions for JsonFile.stringify()
IJsonSchemaErrorInfoCallback function arguments for JsonSchema.validateObjectWithCallback();
IJsonSchemaFromFileOptionsOptions for JsonSchema.fromFile()
IJsonSchemaValidateOptionsOptions for JsonSchema.validateObject()
INodePackageJsonAn interface for accessing common fields from a package.json file whose version field may be missing.
IPackageJsonAn interface for accessing common fields from a package.json file.
IPackageJsonDependencyTableThis interface is part of the IPackageJson file format. It is used for the "dependencies", "optionalDependencies", and "devDependencies" fields.
IPackageJsonLookupParametersConstructor parameters for PackageJsonLookup
IPackageJsonRepositoryThis interface is part of the IPackageJson file format. It is used for the "repository" field.
IPackageJsonScriptTableThis interface is part of the IPackageJson file format. It is used for the "scripts" field.
IPackageNameParserOptionsOptions that configure the validation rules used by a PackageNameParser instance.
IParsedPackageNameA package name that has been separated into its scope and unscoped name.
IParsedPackageNameOrErrorResult object returned by PackageName.tryParse()
IPathFormatConciselyOptionsOptions for Path.formatConcisely().
IPathFormatFileLocationOptionsOptions for Path.formatFileLocation().
IPeerDependenciesMetaTableThis interface is part of the IPackageJson file format. It is used for the "peerDependenciesMeta" field.
IProtectableMapParametersConstructor parameters for ProtectableMap
IStaticPrefixProxyTerminalProviderOptions(BETA) Options for PrefixProxyTerminalProvider, with a static prefix.
IStringBuilderAn interface for a builder object that allows a large text string to be constructed incrementally by appending small chunks.
ISubprocessOptions(BETA) Details about how the child_process.ChildProcess was created.
ITerminalProvider(BETA) Implement the interface to create a terminal provider. Terminal providers can be registered to a Terminal instance to receive messages.
ITerminalWritableOptions(BETA) Options for TerminalWritable.

Type Aliases

Type AliasDescription
BrandA "branded type" is a primitive type with a compile-type key that makes it incompatible with other aliases for the primitive type.
ExecutableStdioMappingTypes for IExecutableSpawnSyncOptions.stdio and IExecutableSpawnOptions.stdio
ExecutableStdioStreamMappingTypings for one of the streams inside IExecutableSpawnSyncOptions.stdio.
FileLocationStyleThe format that the FileError message should conform to. The supported formats are: - Unix: <path>:<line>:<column> - <message> - VisualStudio: <path>(<line>,<column>) - <message>
FileSystemCopyFilesAsyncFilterCallback function type for IFileSystemCopyFilesAsyncOptions.filter
FileSystemCopyFilesFilterCallback function type for IFileSystemCopyFilesOptions.filter
FileSystemStatsAn alias for the Node.js fs.Stats object.
FolderItemAn alias for the Node.js fs.Dirent object.
JsonNullThe 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.
JsonObjectRepresents a JSON-serializable object whose type has not been determined yet.
LegacyCallbackCallback used by LegacyAdapters.