Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/node-core-library

Package Overview
Dependencies
Maintainers
3
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/node-core-library - npm Package Compare versions

Comparing version 3.33.6 to 3.34.0

lib/Enum.d.ts

25

CHANGELOG.json

@@ -5,2 +5,27 @@ {

{
"version": "3.34.0",
"tag": "@rushstack/node-core-library_v3.34.0",
"date": "Wed, 30 Sep 2020 06:53:53 GMT",
"comments": {
"minor": [
{
"comment": "Add Path.isEqual(), Path.formatConcisely(), Path.convertToSlashes(), Path.convertToBackslashes(), and Path.isDownwardRelative()"
},
{
"comment": "Upgrade compiler; the API now requires TypeScript 3.9 or newer"
}
],
"patch": [
{
"comment": "Update README.md"
}
],
"dependency": [
{
"comment": "Updating dependency \"@rushstack/eslint-config\" to `2.1.2`"
}
]
}
},
{
"version": "3.33.6",

@@ -7,0 +32,0 @@ "tag": "@rushstack/node-core-library_v3.33.6",

14

CHANGELOG.md
# Change Log - @rushstack/node-core-library
This log was last generated on Tue, 22 Sep 2020 05:45:57 GMT and should not be manually modified.
This log was last generated on Wed, 30 Sep 2020 06:53:53 GMT and should not be manually modified.
## 3.34.0
Wed, 30 Sep 2020 06:53:53 GMT
### Minor changes
- Add Path.isEqual(), Path.formatConcisely(), Path.convertToSlashes(), Path.convertToBackslashes(), and Path.isDownwardRelative()
- Upgrade compiler; the API now requires TypeScript 3.9 or newer
### Patches
- Update README.md
## 3.33.6

@@ -6,0 +18,0 @@ Tue, 22 Sep 2020 05:45:57 GMT

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.AlreadyReportedError = void 0;
const TypeUuid_1 = require("./TypeUuid");

@@ -7,0 +8,0 @@ const uuidAlreadyReportedError = 'f26b0640-a49b-49d1-9ead-1a516d5920c7';

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Executable = void 0;
const child_process = require("child_process");

@@ -7,0 +8,0 @@ const os = require("os");

33

lib/FileSystem.js

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.FileSystem = void 0;
const nodeJsPath = require("path");

@@ -191,3 +192,3 @@ const fs = require("fs");

FileSystem._wrapException(() => {
options = Object.assign({}, MOVE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, MOVE_DEFAULT_OPTIONS), options);
try {

@@ -216,3 +217,3 @@ fsx.moveSync(options.sourcePath, options.destinationPath, { overwrite: options.overwrite });

await FileSystem._wrapExceptionAsync(async () => {
options = Object.assign({}, MOVE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, MOVE_DEFAULT_OPTIONS), options);
try {

@@ -267,3 +268,3 @@ await fsx.move(options.sourcePath, options.destinationPath, { overwrite: options.overwrite });

return FileSystem._wrapException(() => {
options = Object.assign({}, READ_FOLDER_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, READ_FOLDER_DEFAULT_OPTIONS), options);
// @todo: Update this to use Node 10's `withFileTypes: true` option when we drop support for Node 8

@@ -284,3 +285,3 @@ const fileNames = fsx.readdirSync(folderPath);

return await FileSystem._wrapExceptionAsync(async () => {
options = Object.assign({}, READ_FOLDER_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, READ_FOLDER_DEFAULT_OPTIONS), options);
// @todo: Update this to use Node 10's `withFileTypes: true` option when we drop support for Node 8

@@ -351,3 +352,3 @@ const fileNames = await fsx.readdir(folderPath);

FileSystem._wrapException(() => {
options = Object.assign({}, WRITE_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, WRITE_FILE_DEFAULT_OPTIONS), options);
if (options.convertLineEndings) {

@@ -379,3 +380,3 @@ contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);

await FileSystem._wrapExceptionAsync(async () => {
options = Object.assign({}, WRITE_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, WRITE_FILE_DEFAULT_OPTIONS), options);
if (options.convertLineEndings) {

@@ -413,3 +414,3 @@ contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);

FileSystem._wrapException(() => {
options = Object.assign({}, APPEND_TO_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, APPEND_TO_FILE_DEFAULT_OPTIONS), options);
if (options.convertLineEndings) {

@@ -441,3 +442,3 @@ contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);

await FileSystem._wrapExceptionAsync(async () => {
options = Object.assign({}, APPEND_TO_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, APPEND_TO_FILE_DEFAULT_OPTIONS), options);
if (options.convertLineEndings) {

@@ -472,3 +473,3 @@ contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);

return FileSystem._wrapException(() => {
options = Object.assign({}, READ_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, READ_FILE_DEFAULT_OPTIONS), options);
let contents = FileSystem.readFileToBuffer(filePath).toString(options.encoding);

@@ -486,3 +487,3 @@ if (options.convertLineEndings) {

return await FileSystem._wrapExceptionAsync(async () => {
options = Object.assign({}, READ_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, READ_FILE_DEFAULT_OPTIONS), options);
let contents = (await FileSystem.readFileToBufferAsync(filePath)).toString(options.encoding);

@@ -524,3 +525,3 @@ if (options.convertLineEndings) {

static copyFile(options) {
options = Object.assign({}, COPY_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, COPY_FILE_DEFAULT_OPTIONS), options);
if (FileSystem.getStatistics(options.sourcePath).isDirectory()) {

@@ -540,3 +541,3 @@ throw new Error('The specified path refers to a folder; this operation expects a file object:\n' + options.sourcePath);

static async copyFileAsync(options) {
options = Object.assign({}, COPY_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, COPY_FILE_DEFAULT_OPTIONS), options);
if (FileSystem.getStatistics(options.sourcePath).isDirectory()) {

@@ -563,3 +564,3 @@ throw new Error('The specified path refers to a folder; this operation expects a file object:\n' + options.sourcePath);

static copyFiles(options) {
options = Object.assign({}, COPY_FILES_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, COPY_FILES_DEFAULT_OPTIONS), options);
FileSystem._wrapException(() => {

@@ -579,3 +580,3 @@ fsx.copySync(options.sourcePath, options.destinationPath, {

static async copyFilesAsync(options) {
options = Object.assign({}, COPY_FILES_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, COPY_FILES_DEFAULT_OPTIONS), options);
await FileSystem._wrapExceptionAsync(async () => {

@@ -599,3 +600,3 @@ fsx.copySync(options.sourcePath, options.destinationPath, {

FileSystem._wrapException(() => {
options = Object.assign({}, DELETE_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, DELETE_FILE_DEFAULT_OPTIONS), options);
try {

@@ -616,3 +617,3 @@ fsx.unlinkSync(filePath);

await FileSystem._wrapExceptionAsync(async () => {
options = Object.assign({}, DELETE_FILE_DEFAULT_OPTIONS, options);
options = Object.assign(Object.assign({}, DELETE_FILE_DEFAULT_OPTIONS), options);
try {

@@ -619,0 +620,0 @@ await fsx.unlink(filePath);

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.FileWriter = void 0;
const Import_1 = require("./Import");

@@ -7,0 +8,0 @@ const fsx = Import_1.Import.lazy('fs-extra', require);

@@ -74,3 +74,3 @@ /**

private static __builtInModules;
private static readonly _builtInModules;
private static get _builtInModules();
/**

@@ -77,0 +77,0 @@ * Provides a way to improve process startup times by lazy-loading imported modules.

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Import = void 0;
const path = require("path");

@@ -7,0 +8,0 @@ const importLazy = require("import-lazy");

@@ -10,2 +10,3 @@ /**

export { FileConstants, FolderConstants } from './Constants';
export { Enum } from './Enum';
export { ExecutableStdioStreamMapping, ExecutableStdioMapping, IExecutableResolveOptions, IExecutableSpawnSyncOptions, Executable } from './Executable';

@@ -23,3 +24,3 @@ export { INodePackageJson, IPackageJson, IPackageJsonDependencyTable, IPackageJsonScriptTable } from './IPackageJson';

export { PackageName, PackageNameParser, IPackageNameParserOptions, IParsedPackageName, IParsedPackageNameOrError } from './PackageName';
export { Path } from './Path';
export { Path, IPathFormatConciselyOptions } from './Path';
export { Encoding, Text, NewlineKind } from './Text';

@@ -26,0 +27,0 @@ export { Sort } from './Sort';

@@ -11,54 +11,56 @@ "use strict";

var AlreadyReportedError_1 = require("./AlreadyReportedError");
exports.AlreadyReportedError = AlreadyReportedError_1.AlreadyReportedError;
Object.defineProperty(exports, "AlreadyReportedError", { enumerable: true, get: function () { return AlreadyReportedError_1.AlreadyReportedError; } });
var AnsiEscape_1 = require("./Terminal/AnsiEscape");
exports.AnsiEscape = AnsiEscape_1.AnsiEscape;
Object.defineProperty(exports, "AnsiEscape", { enumerable: true, get: function () { return AnsiEscape_1.AnsiEscape; } });
var Enum_1 = require("./Enum");
Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return Enum_1.Enum; } });
var Executable_1 = require("./Executable");
exports.Executable = Executable_1.Executable;
Object.defineProperty(exports, "Executable", { enumerable: true, get: function () { return Executable_1.Executable; } });
var Import_1 = require("./Import");
exports.Import = Import_1.Import;
Object.defineProperty(exports, "Import", { enumerable: true, get: function () { return Import_1.Import; } });
var InternalError_1 = require("./InternalError");
exports.InternalError = InternalError_1.InternalError;
Object.defineProperty(exports, "InternalError", { enumerable: true, get: function () { return InternalError_1.InternalError; } });
var JsonFile_1 = require("./JsonFile");
exports.JsonFile = JsonFile_1.JsonFile;
Object.defineProperty(exports, "JsonFile", { enumerable: true, get: function () { return JsonFile_1.JsonFile; } });
var JsonSchema_1 = require("./JsonSchema");
exports.JsonSchema = JsonSchema_1.JsonSchema;
Object.defineProperty(exports, "JsonSchema", { enumerable: true, get: function () { return JsonSchema_1.JsonSchema; } });
var LockFile_1 = require("./LockFile");
exports.LockFile = LockFile_1.LockFile;
Object.defineProperty(exports, "LockFile", { enumerable: true, get: function () { return LockFile_1.LockFile; } });
var MapExtensions_1 = require("./MapExtensions");
exports.MapExtensions = MapExtensions_1.MapExtensions;
Object.defineProperty(exports, "MapExtensions", { enumerable: true, get: function () { return MapExtensions_1.MapExtensions; } });
var ProtectableMap_1 = require("./ProtectableMap");
exports.ProtectableMap = ProtectableMap_1.ProtectableMap;
Object.defineProperty(exports, "ProtectableMap", { enumerable: true, get: function () { return ProtectableMap_1.ProtectableMap; } });
var PackageJsonLookup_1 = require("./PackageJsonLookup");
exports.PackageJsonLookup = PackageJsonLookup_1.PackageJsonLookup;
Object.defineProperty(exports, "PackageJsonLookup", { enumerable: true, get: function () { return PackageJsonLookup_1.PackageJsonLookup; } });
var PackageName_1 = require("./PackageName");
exports.PackageName = PackageName_1.PackageName;
exports.PackageNameParser = PackageName_1.PackageNameParser;
Object.defineProperty(exports, "PackageName", { enumerable: true, get: function () { return PackageName_1.PackageName; } });
Object.defineProperty(exports, "PackageNameParser", { enumerable: true, get: function () { return PackageName_1.PackageNameParser; } });
var Path_1 = require("./Path");
exports.Path = Path_1.Path;
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_1.Path; } });
var Text_1 = require("./Text");
exports.Text = Text_1.Text;
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return Text_1.Text; } });
var Sort_1 = require("./Sort");
exports.Sort = Sort_1.Sort;
Object.defineProperty(exports, "Sort", { enumerable: true, get: function () { return Sort_1.Sort; } });
var FileSystem_1 = require("./FileSystem");
exports.FileSystem = FileSystem_1.FileSystem;
Object.defineProperty(exports, "FileSystem", { enumerable: true, get: function () { return FileSystem_1.FileSystem; } });
var FileWriter_1 = require("./FileWriter");
exports.FileWriter = FileWriter_1.FileWriter;
Object.defineProperty(exports, "FileWriter", { enumerable: true, get: function () { return FileWriter_1.FileWriter; } });
var LegacyAdapters_1 = require("./LegacyAdapters");
exports.LegacyAdapters = LegacyAdapters_1.LegacyAdapters;
Object.defineProperty(exports, "LegacyAdapters", { enumerable: true, get: function () { return LegacyAdapters_1.LegacyAdapters; } });
var StringBuilder_1 = require("./StringBuilder");
exports.StringBuilder = StringBuilder_1.StringBuilder;
Object.defineProperty(exports, "StringBuilder", { enumerable: true, get: function () { return StringBuilder_1.StringBuilder; } });
var Terminal_1 = require("./Terminal/Terminal");
exports.Terminal = Terminal_1.Terminal;
Object.defineProperty(exports, "Terminal", { enumerable: true, get: function () { return Terminal_1.Terminal; } });
var Colors_1 = require("./Terminal/Colors");
exports.Colors = Colors_1.Colors;
exports.ColorValue = Colors_1.ColorValue;
exports.TextAttribute = Colors_1.TextAttribute;
Object.defineProperty(exports, "Colors", { enumerable: true, get: function () { return Colors_1.Colors; } });
Object.defineProperty(exports, "ColorValue", { enumerable: true, get: function () { return Colors_1.ColorValue; } });
Object.defineProperty(exports, "TextAttribute", { enumerable: true, get: function () { return Colors_1.TextAttribute; } });
var ITerminalProvider_1 = require("./Terminal/ITerminalProvider");
exports.TerminalProviderSeverity = ITerminalProvider_1.TerminalProviderSeverity;
Object.defineProperty(exports, "TerminalProviderSeverity", { enumerable: true, get: function () { return ITerminalProvider_1.TerminalProviderSeverity; } });
var ConsoleTerminalProvider_1 = require("./Terminal/ConsoleTerminalProvider");
exports.ConsoleTerminalProvider = ConsoleTerminalProvider_1.ConsoleTerminalProvider;
Object.defineProperty(exports, "ConsoleTerminalProvider", { enumerable: true, get: function () { return ConsoleTerminalProvider_1.ConsoleTerminalProvider; } });
var StringBufferTerminalProvider_1 = require("./Terminal/StringBufferTerminalProvider");
exports.StringBufferTerminalProvider = StringBufferTerminalProvider_1.StringBufferTerminalProvider;
Object.defineProperty(exports, "StringBufferTerminalProvider", { enumerable: true, get: function () { return StringBufferTerminalProvider_1.StringBufferTerminalProvider; } });
var TypeUuid_1 = require("./TypeUuid");
exports.TypeUuid = TypeUuid_1.TypeUuid;
Object.defineProperty(exports, "TypeUuid", { enumerable: true, get: function () { return TypeUuid_1.TypeUuid; } });
//# sourceMappingURL=index.js.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.InternalError = void 0;
/**

@@ -45,2 +46,3 @@ * An `Error` subclass that should be thrown to report an unexpected state that may indicate a software defect.

}
exports.InternalError = InternalError;
/**

@@ -55,3 +57,2 @@ * If true, a JavScript `debugger;` statement will be invoked whenever the `InternalError` constructor is called.

InternalError.breakInDebugger = true;
exports.InternalError = InternalError;
//# sourceMappingURL=InternalError.js.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonFile = void 0;
const os = require("os");

@@ -309,2 +310,3 @@ const jju = require("jju");

}
exports.JsonFile = JsonFile;
/**

@@ -314,3 +316,2 @@ * @internal

JsonFile._formatPathForError = (path) => path;
exports.JsonFile = JsonFile;
//# sourceMappingURL=JsonFile.js.map

@@ -90,3 +90,3 @@ import { JsonObject } from './JsonFile';

*/
readonly shortName: string;
get shortName(): string;
/**

@@ -93,0 +93,0 @@ * If not already done, this loads the schema from disk and compiles it.

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonSchema = void 0;
const os = require("os");

@@ -7,0 +8,0 @@ const path = require("path");

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.LegacyAdapters = void 0;
const timsort_1 = require("timsort");

@@ -82,4 +83,4 @@ const semver = require("semver");

}
exports.LegacyAdapters = LegacyAdapters;
LegacyAdapters._useTimsort = undefined;
exports.LegacyAdapters = LegacyAdapters;
//# sourceMappingURL=LegacyAdapters.js.map

@@ -78,12 +78,12 @@ /**

*/
readonly dirtyWhenAcquired: boolean;
get dirtyWhenAcquired(): boolean;
/**
* Returns the absolute path to the lockfile
*/
readonly filePath: string;
get filePath(): string;
/**
* Returns true if this lock is currently being held.
*/
readonly isReleased: boolean;
get isReleased(): boolean;
}
//# sourceMappingURL=LockFile.d.ts.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.LockFile = exports.getProcessStartTime = exports.getProcessStartTimeFromProcStat = void 0;
const path = require("path");

@@ -392,4 +393,4 @@ const child_process = require("child_process");

}
exports.LockFile = LockFile;
LockFile._getStartTime = getProcessStartTime;
exports.LockFile = LockFile;
//# sourceMappingURL=LockFile.js.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.MapExtensions = void 0;
/**

@@ -7,0 +8,0 @@ * Helper functions for working with the `Map<K, V>` data type.

@@ -34,3 +34,3 @@ import { IPackageJson, INodePackageJson } from './IPackageJson';

*/
static readonly instance: PackageJsonLookup;
static get instance(): PackageJsonLookup;
private _loadExtraFields;

@@ -37,0 +37,0 @@ private _packageFolderCache;

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.PackageJsonLookup = void 0;
const path = require("path");

@@ -7,0 +8,0 @@ const JsonFile_1 = require("./JsonFile");

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.PackageName = exports.PackageNameParser = void 0;
/**

@@ -167,6 +168,6 @@ * A configurable parser for validating and manipulating NPM package names such as `my-package` or `@scope/my-package`.

}
exports.PackageNameParser = PackageNameParser;
// encodeURIComponent() escapes all characters except: A-Z a-z 0-9 - _ . ! ~ * ' ( )
// However, these are disallowed because they are shell characters: ! ~ * ' ( )
PackageNameParser._invalidNameCharactersRegExp = /[^A-Za-z0-9\-_\.]/;
exports.PackageNameParser = PackageNameParser;
/**

@@ -212,4 +213,4 @@ * Provides basic operations for validating and manipulating NPM package names such as `my-package`

}
exports.PackageName = PackageName;
PackageName._parser = new PackageNameParser();
exports.PackageName = PackageName;
//# sourceMappingURL=PackageName.js.map
/**
* Options for {@link Path.formatConcisely}.
* @public
*/
export interface IPathFormatConciselyOptions {
/**
* The path to be converted.
*/
pathToConvert: string;
/**
* The base path to use when converting `pathToConvert` to a relative path.
*/
baseFolder: string;
}
/**
* Common operations for manipulating file and directory paths.

@@ -9,2 +23,3 @@ * @remarks

private static _relativePathRegex;
private static _upwardPathSegmentRegex;
/**

@@ -31,3 +46,53 @@ * Returns true if "childPath" is located inside the "parentFolderPath" folder

static isUnderOrEqual(childPath: string, parentFolderPath: string): boolean;
/**
* Returns true if `path1` and `path2` refer to the same underlying path.
*
* @remarks
*
* The comparison is performed using `path.relative()`.
*/
static isEqual(path1: string, path2: string): boolean;
/**
* Formats a path to look nice for reporting purposes.
* @remarks
* If `pathToConvert` is under the `baseFolder`, then it will be converted to a relative with the `./` prefix.
* Otherwise, it will be converted to an absolute path.
*
* Backslashes will be converted to slashes, unless the path starts with an OS-specific string like `C:\`.
*/
static formatConcisely(options: IPathFormatConciselyOptions): string;
/**
* Replaces Windows-style backslashes with POSIX-style slashes.
*
* @remarks
* POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
*/
static convertToSlashes(inputPath: string): string;
/**
* Replaces POSIX-style slashes with Windows-style backslashes
*
* @remarks
* POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
*/
static convertToBackslashes(inputPath: string): string;
/**
* Returns true if the specified path is a relative path and does not use `..` to walk upwards.
*
* @example
* ```ts
* // These evaluate to true
* isDownwardRelative('folder');
* isDownwardRelative('file');
* isDownwardRelative('folder/');
* isDownwardRelative('./folder/');
* isDownwardRelative('./folder/file');
*
* // These evaluate to false
* isDownwardRelative('../folder');
* isDownwardRelative('folder/../file');
* isDownwardRelative('/folder/file');
* ```
*/
static isDownwardRelative(inputPath: string): boolean;
}
//# sourceMappingURL=Path.d.ts.map

@@ -5,3 +5,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Path = void 0;
const path = require("path");
const Text_1 = require("./Text");
/**

@@ -44,5 +46,85 @@ * Common operations for manipulating file and directory paths.

}
/**
* Returns true if `path1` and `path2` refer to the same underlying path.
*
* @remarks
*
* The comparison is performed using `path.relative()`.
*/
static isEqual(path1, path2) {
return path.relative(path1, path2) === '';
}
/**
* Formats a path to look nice for reporting purposes.
* @remarks
* If `pathToConvert` is under the `baseFolder`, then it will be converted to a relative with the `./` prefix.
* Otherwise, it will be converted to an absolute path.
*
* Backslashes will be converted to slashes, unless the path starts with an OS-specific string like `C:\`.
*/
static formatConcisely(options) {
// Same logic as Path.isUnderOrEqual()
const relativePath = path.relative(options.pathToConvert, options.baseFolder);
const isUnderOrEqual = relativePath === '' || Path._relativePathRegex.test(relativePath);
if (isUnderOrEqual) {
// Note that isUnderOrEqual()'s relativePath is the reverse direction
return './' + Path.convertToSlashes(path.relative(options.baseFolder, options.pathToConvert));
}
const absolutePath = path.resolve(options.pathToConvert);
return absolutePath;
}
/**
* Replaces Windows-style backslashes with POSIX-style slashes.
*
* @remarks
* POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
*/
static convertToSlashes(inputPath) {
return Text_1.Text.replaceAll(inputPath, '\\', '/');
}
/**
* Replaces POSIX-style slashes with Windows-style backslashes
*
* @remarks
* POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
*/
static convertToBackslashes(inputPath) {
return Text_1.Text.replaceAll(inputPath, '/', '\\');
}
/**
* Returns true if the specified path is a relative path and does not use `..` to walk upwards.
*
* @example
* ```ts
* // These evaluate to true
* isDownwardRelative('folder');
* isDownwardRelative('file');
* isDownwardRelative('folder/');
* isDownwardRelative('./folder/');
* isDownwardRelative('./folder/file');
*
* // These evaluate to false
* isDownwardRelative('../folder');
* isDownwardRelative('folder/../file');
* isDownwardRelative('/folder/file');
* ```
*/
static isDownwardRelative(inputPath) {
if (path.isAbsolute(inputPath)) {
return false;
}
// Does it contain ".."
if (Path._upwardPathSegmentRegex.test(inputPath)) {
return false;
}
return true;
}
}
exports.Path = Path;
// Matches a relative path consisting entirely of periods and slashes
// Example: ".", "..", "../..", etc
Path._relativePathRegex = /^[.\/\\]+$/;
exports.Path = Path;
// Matches a relative path segment that traverses upwards
// Example: "a/../b"
Path._upwardPathSegmentRegex = /([\/\\]|^)\.\.([\/\\]|$)/;
//# sourceMappingURL=Path.js.map

@@ -48,3 +48,3 @@ /**

*/
readonly protectedView: Map<K, V>;
get protectedView(): Map<K, V>;
/**

@@ -82,4 +82,4 @@ * Removes all entries from the map.

*/
readonly size: number;
get size(): number;
}
//# sourceMappingURL=ProtectableMap.d.ts.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ProtectableMap = void 0;
const ProtectableMapView_1 = require("./ProtectableMapView");

@@ -7,0 +8,0 @@ /**

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ProtectableMapView = void 0;
/**

@@ -7,0 +8,0 @@ * The internal wrapper used by ProtectableMap. It extends the real `Map<K, V>` base class,

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Sort = void 0;
const LegacyAdapters_1 = require("./LegacyAdapters");

@@ -7,0 +8,0 @@ /**

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.StringBuilder = void 0;
/**

@@ -7,0 +8,0 @@ * This class allows a large text string to be constructed incrementally by appending small chunks. The final

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.AnsiEscape = void 0;
const Colors_1 = require("./Colors");

@@ -126,2 +127,3 @@ /**

}
exports.AnsiEscape = AnsiEscape;
// For now, we only care about the Control Sequence Introducer (CSI) commands which always start with "[".

@@ -135,3 +137,2 @@ // eslint-disable-next-line no-control-regex

AnsiEscape._backslashRRegExp = /\r/g;
exports.AnsiEscape = AnsiEscape;
//# sourceMappingURL=AnsiEscape.js.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Colors = exports.ConsoleColorCodes = exports.TextAttribute = exports.ColorValue = exports.eolSequence = void 0;
exports.eolSequence = {

@@ -84,54 +85,54 @@ isEol: true

static black(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Black });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Black });
}
static red(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Red });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Red });
}
static green(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Green });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Green });
}
static yellow(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Yellow });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Yellow });
}
static blue(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Blue });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Blue });
}
static magenta(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Magenta });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Magenta });
}
static cyan(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Cyan });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Cyan });
}
static white(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.White });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.White });
}
static gray(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { foregroundColor: ColorValue.Gray });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { foregroundColor: ColorValue.Gray });
}
static blackBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Black });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Black });
}
static redBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Red });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Red });
}
static greenBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Green });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Green });
}
static yellowBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Yellow });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Yellow });
}
static blueBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Blue });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Blue });
}
static magentaBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Magenta });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Magenta });
}
static cyanBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Cyan });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Cyan });
}
static whiteBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.White });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.White });
}
static grayBackground(text) {
return Object.assign({}, Colors._normalizeStringOrColorableSequence(text), { backgroundColor: ColorValue.Gray });
return Object.assign(Object.assign({}, Colors._normalizeStringOrColorableSequence(text)), { backgroundColor: ColorValue.Gray });
}

@@ -138,0 +139,0 @@ static bold(text) {

@@ -32,8 +32,8 @@ import { ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';

*/
readonly eolCharacter: string;
get eolCharacter(): string;
/**
* {@inheritDoc ITerminalProvider.supportsColor}
*/
readonly supportsColor: boolean;
get supportsColor(): boolean;
}
//# sourceMappingURL=ConsoleTerminalProvider.d.ts.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ConsoleTerminalProvider = void 0;
const os_1 = require("os");

@@ -7,0 +8,0 @@ const safe_1 = require("colors/safe");

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TerminalProviderSeverity = void 0;
/**

@@ -7,0 +8,0 @@ * @beta

@@ -35,7 +35,7 @@ import { ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';

*/
readonly eolCharacter: string;
get eolCharacter(): string;
/**
* {@inheritDoc ITerminalProvider.supportsColor}
*/
readonly supportsColor: boolean;
get supportsColor(): boolean;
/**

@@ -42,0 +42,0 @@ * Get everything that has been written at log-level severity.

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.StringBufferTerminalProvider = void 0;
const ITerminalProvider_1 = require("./ITerminalProvider");

@@ -7,0 +8,0 @@ const StringBuilder_1 = require("../StringBuilder");

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Terminal = void 0;
const ITerminalProvider_1 = require("./ITerminalProvider");

@@ -51,3 +52,3 @@ const Colors_1 = require("./Colors");

writeWarning(...messageParts) {
this._writeSegmentsToProviders(messageParts.map((part) => (Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part), { foregroundColor: Colors_1.ColorValue.Yellow }))), ITerminalProvider_1.TerminalProviderSeverity.warning);
this._writeSegmentsToProviders(messageParts.map((part) => (Object.assign(Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part)), { foregroundColor: Colors_1.ColorValue.Yellow }))), ITerminalProvider_1.TerminalProviderSeverity.warning);
}

@@ -62,3 +63,3 @@ /**

this._writeSegmentsToProviders([
...messageParts.map((part) => (Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part), { foregroundColor: Colors_1.ColorValue.Yellow }))),
...messageParts.map((part) => (Object.assign(Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part)), { foregroundColor: Colors_1.ColorValue.Yellow }))),
Colors_1.eolSequence

@@ -74,3 +75,3 @@ ], ITerminalProvider_1.TerminalProviderSeverity.warning);

writeError(...messageParts) {
this._writeSegmentsToProviders(messageParts.map((part) => (Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part), { foregroundColor: Colors_1.ColorValue.Red }))), ITerminalProvider_1.TerminalProviderSeverity.error);
this._writeSegmentsToProviders(messageParts.map((part) => (Object.assign(Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part)), { foregroundColor: Colors_1.ColorValue.Red }))), ITerminalProvider_1.TerminalProviderSeverity.error);
}

@@ -85,3 +86,3 @@ /**

this._writeSegmentsToProviders([
...messageParts.map((part) => (Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part), { foregroundColor: Colors_1.ColorValue.Red }))),
...messageParts.map((part) => (Object.assign(Object.assign({}, Colors_1.Colors._normalizeStringOrColorableSequence(part)), { foregroundColor: Colors_1.ColorValue.Red }))),
Colors_1.eolSequence

@@ -88,0 +89,0 @@ ], ITerminalProvider_1.TerminalProviderSeverity.error);

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Text = void 0;
const os = require("os");

@@ -129,5 +130,5 @@ /**

}
exports.Text = Text;
Text._newLineRegEx = /\r\n|\n\r|\r|\n/g;
Text._newLineAtEndRegEx = /(\r\n|\n\r|\r|\n)$/;
exports.Text = Text;
//# sourceMappingURL=Text.js.map

@@ -5,2 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeUuid = void 0;
const InternalError_1 = require("./InternalError");

@@ -84,4 +85,4 @@ const classPrototypeUuidSymbol = Symbol.for('TypeUuid.classPrototypeUuid');

}
exports.TypeUuid = TypeUuid;
TypeUuid._uuidRegExp = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
exports.TypeUuid = TypeUuid;
//# sourceMappingURL=TypeUuid.js.map
{
"name": "@rushstack/node-core-library",
"version": "3.33.6",
"version": "3.34.0",
"description": "Core libraries that every NodeJS toolchain project should use",
"main": "lib/index.js",
"typings": "dist/node-core-library.d.ts",
"typings": "lib/index.d.ts",
"license": "MIT",

@@ -26,4 +26,4 @@ "repository": {

"devDependencies": {
"@microsoft/rush-stack-compiler-3.5": "0.8.10",
"@rushstack/eslint-config": "2.1.1",
"@microsoft/rush-stack-compiler-3.9": "0.4.21",
"@rushstack/eslint-config": "2.1.2",
"@rushstack/heft": "0.8.0",

@@ -30,0 +30,0 @@ "@types/fs-extra": "7.0.0",

@@ -31,2 +31,9 @@ # @rushstack/node-core-library

API documentation for this package: https://rushstack.io/pages/api/node-core-library/
## Links
- [CHANGELOG.md](
https://github.com/microsoft/rushstack/blob/master/libraries/node-core-library/CHANGELOG.md) - Find
out what's new in the latest version
- [API Reference](https://rushstack.io/pages/api/node-core-library/)
`@rushstack/node-core-library` is part of the [Rush Stack](https://rushstack.io/) family of projects.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc