Rush StackShopBlogEvents
Skip to main content

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.

Async

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.

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.

MinimumHeap

Implements a standard heap data structure for items of type T and a custom comparator. The root will always be the minimum value as determined by the comparator.

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.

RealNodeModulePathResolver

This class encapsulates a caching resolver for symlinks in node_modules directories. It assumes that the only symlinks that exist in input paths are those that correspond to npm packages.

Sort

Operations for sorting collections.

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.

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.

Encoding

The allowed types of encodings, as supported by Node.js

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.

Interfaces

Interface

Description

IAsyncParallelismOptions

Options for controlling the parallelism of asynchronous operations.

IDependenciesMetaTable

This interface is part of the IPackageJson file format. It is used for the "dependenciesMeta" field.

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

IFileErrorFormattingOptions

Provides options for the output message of a file error.

IFileErrorOptions

Provides options for the creation of a FileError.

IFileSystemCopyFileBaseOptions

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.readFolderItems() and FileSystem.readFolderItemNames().

IFileSystemUpdateTimeParameters

The options for FileSystem.updateTimes() Both times must be specified.

IFileSystemWriteBinaryFileOptions

The options for FileSystem.writeBuffersToFile()

IFileSystemWriteFileOptions

The options for FileSystem.writeFile()

IFileWriterFlags

Interface which represents the flags about which mode the file should be opened in.

IImportResolveAsyncOptions

Common options shared by IImportResolveModuleAsyncOptions and IImportResolvePackageAsyncOptions

IImportResolveModuleAsyncOptions

Options for Import.resolveModuleAsync()

IImportResolveModuleOptions

Options for Import.resolveModule()

IImportResolveOptions

Common options shared by IImportResolveModuleOptions and IImportResolvePackageOptions

IImportResolvePackageAsyncOptions

Options for Import.resolvePackageAsync()

IImportResolvePackageOptions

Options for Import.resolvePackage()

IJsonFileLoadAndValidateOptions

Options for JsonFile.loadAndValidate() and JsonFile.loadAndValidateAsync()

IJsonFileParseOptions

Options for JsonFile.parseString(), JsonFile.load(), and JsonFile.loadAsync().

IJsonFileSaveOptions

Options for JsonFile.save() and JsonFile.saveAsync().

IJsonFileStringifyOptions

Options for JsonFile.stringify()

IJsonSchemaCustomFormat

A definition for a custom format to consider during validation.

IJsonSchemaErrorInfo

Callback function arguments for JsonSchema.validateObjectWithCallback()

IJsonSchemaLoadOptions

Options for JsonSchema.fromFile() and JsonSchema.fromLoadedObject()

IJsonSchemaValidateObjectWithOptions

Options for JsonSchema.validateObjectWithCallback()

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.

IPackageJsonExports

This interface is part of the IPackageJson file format. It is used for the values of the "exports" field.

See Node.js documentation on Conditional Exports and Node.js documentation on Community Conditional Exports.

IPackageJsonLookupParameters

Constructor parameters for PackageJsonLookup

IPackageJsonRepository

This interface is part of the IPackageJson file format. It is used for the "repository" field.

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

IPathFormatFileLocationOptions

Options for Path.formatFileLocation().

IPeerDependenciesMetaTable

This interface is part of the IPackageJson file format. It is used for the "peerDependenciesMeta" field.

IProblemPattern

VS Code style problem matcher pattern definition.

IProcessInfo

Process information sourced from the system. This process info is sourced differently depending on the operating system: - On Windows, this uses powershell.exe and a scriptlet to retrieve process information. The wmic utility that was previously used is no longer present on the latest Windows versions. - On Unix, this uses the ps utility.

IProtectableMapParameters

Constructor parameters for ProtectableMap

IReadLinesFromIterableOptions

Options used when calling the Text.readLinesFromIterable() or Text.readLinesFromIterableAsync() methods.

IRealNodeModulePathResolverOptions

Arguments used to create a function that resolves symlinked node_modules in a path

IRunWithRetriesOptions

IRunWithTimeoutOptions

IStringBuilder

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

IWaitForExitOptions

The options for running a process to completion using Executable.waitForExitAsync().

IWaitForExitResult

The result of running a process to completion using Executable.waitForExitAsync(), or Executable.waitForExitAsync().

IWaitForExitResultWithoutOutput

The result of running a process to completion using Executable.waitForExitAsync(). This interface does not include stdout or stderr output because an IWaitForExitOptions.encoding was not specified.

IWaitForExitWithBufferOptions

The options for running a process to completion using Executable.waitForExitAsync().

IWaitForExitWithStringOptions

The options for running a process to completion using Executable.waitForExitAsync().

IWeighted

Namespaces

Namespace

Description

Disposables

Objects

User

Variables

Variable

Description

FileConstants

String constants for common filenames and parts of filenames.

FolderConstants

String constants for common folder names.

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.

IJsonSchemaFromFileOptions

Options for JsonSchema.fromFile()

IJsonSchemaFromObjectOptions

Options for JsonSchema.fromLoadedObject()

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.

JsonSchemaVersion

Specifies the version of json-schema to be validated against. https://json-schema.org/specification

LegacyCallback

Callback used by LegacyAdapters.