Socket
Socket
Sign inDemoInstall

@rushstack/node-core-library

Package Overview
Dependencies
Maintainers
2
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.43.2 to 3.44.0

12

CHANGELOG.json

@@ -5,2 +5,14 @@ {

{
"version": "3.44.0",
"tag": "@rushstack/node-core-library_v3.44.0",
"date": "Fri, 03 Dec 2021 03:05:22 GMT",
"comments": {
"minor": [
{
"comment": "Replace const enums with conventional enums to allow for compatability with JavaScript consumers."
}
]
}
},
{
"version": "3.43.2",

@@ -7,0 +19,0 @@ "tag": "@rushstack/node-core-library_v3.43.2",

9

CHANGELOG.md
# Change Log - @rushstack/node-core-library
This log was last generated on Sat, 06 Nov 2021 00:09:13 GMT and should not be manually modified.
This log was last generated on Fri, 03 Dec 2021 03:05:22 GMT and should not be manually modified.
## 3.44.0
Fri, 03 Dec 2021 03:05:22 GMT
### Minor changes
- Replace const enums with conventional enums to allow for compatability with JavaScript consumers.
## 3.43.2

@@ -6,0 +13,0 @@ Sat, 06 Nov 2021 00:09:13 GMT

2

dist/tsdoc-metadata.json

@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.

"packageName": "@microsoft/api-extractor",
"packageVersion": "7.18.15"
"packageVersion": "7.18.19"
}
]
}

@@ -6,3 +6,3 @@ /**

*/
export declare const enum FileConstants {
export declare enum FileConstants {
/**

@@ -18,3 +18,3 @@ * "package.json" - the configuration file that defines an NPM package

*/
export declare const enum FolderConstants {
export declare enum FolderConstants {
/**

@@ -21,0 +21,0 @@ * ".git" - the data storage for a Git working folder

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.FolderConstants = exports.FileConstants = void 0;
/**
* String constants for common filenames and parts of filenames.
*
* @public
*/
var FileConstants;
(function (FileConstants) {
/**
* "package.json" - the configuration file that defines an NPM package
*/
FileConstants["PackageJson"] = "package.json";
})(FileConstants = exports.FileConstants || (exports.FileConstants = {}));
/**
* String constants for common folder names.
*
* @public
*/
var FolderConstants;
(function (FolderConstants) {
/**
* ".git" - the data storage for a Git working folder
*/
FolderConstants["Git"] = ".git";
/**
* "node_modules" - the folder where package managers install their files
*/
FolderConstants["NodeModules"] = "node_modules";
})(FolderConstants = exports.FolderConstants || (exports.FolderConstants = {}));
//# sourceMappingURL=Constants.js.map

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

const FileSystem_1 = require("./FileSystem");
const PosixModeBits_1 = require("./PosixModeBits");
/**

@@ -313,3 +314,3 @@ * The Executable class provides a safe, portable, recommended solution for tools that need

// eslint-disable-next-line no-bitwise
if ((FileSystem_1.FileSystem.getPosixModeBits(filePath) & 73 /* AllExecute */) === 0) {
if ((FileSystem_1.FileSystem.getPosixModeBits(filePath) & PosixModeBits_1.PosixModeBits.AllExecute) === 0) {
return false; // not executable

@@ -316,0 +317,0 @@ }

@@ -126,3 +126,3 @@ /// <reference types="node" />

*/
export declare const enum AlreadyExistsBehavior {
export declare enum AlreadyExistsBehavior {
/**

@@ -129,0 +129,0 @@ * If the output file path already exists, try to overwrite the existing object.

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

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

@@ -30,2 +30,40 @@ const fs = __importStar(require("fs"));

const Text_1 = require("./Text");
const PosixModeBits_1 = require("./PosixModeBits");
/**
* Specifies the behavior of APIs such as {@link FileSystem.copyFile} or
* {@link FileSystem.createSymbolicLinkFile} when the output file path already exists.
*
* @remarks
* For {@link FileSystem.copyFile} and related APIs, the "output file path" is
* {@link IFileSystemCopyFileOptions.destinationPath}.
*
* For {@link FileSystem.createSymbolicLinkFile} and related APIs, the "output file path" is
* {@link IFileSystemCreateLinkOptions.newLinkPath}.
*
* @public
*/
var AlreadyExistsBehavior;
(function (AlreadyExistsBehavior) {
/**
* If the output file path already exists, try to overwrite the existing object.
*
* @remarks
* If overwriting the object would require recursively deleting a folder tree,
* then the operation will fail. As an example, suppose {@link FileSystem.copyFile}
* is copying a single file `/a/b/c` to the destination path `/d/e`, and `/d/e` is a
* nonempty folder. In this situation, an error will be reported; specifying
* `AlreadyExistsBehavior.Overwrite` does not help. Empty folders can be overwritten
* depending on the details of the implementation.
*/
AlreadyExistsBehavior["Overwrite"] = "overwrite";
/**
* If the output file path already exists, the operation will fail, and an error
* will be reported.
*/
AlreadyExistsBehavior["Error"] = "error";
/**
* If the output file path already exists, skip this item, and continue the operation.
*/
AlreadyExistsBehavior["Ignore"] = "ignore";
})(AlreadyExistsBehavior = exports.AlreadyExistsBehavior || (exports.AlreadyExistsBehavior = {}));
const MOVE_DEFAULT_OPTIONS = {

@@ -41,14 +79,14 @@ overwrite: true,

convertLineEndings: undefined,
encoding: "utf8" /* Utf8 */
encoding: Text_1.Encoding.Utf8
};
const APPEND_TO_FILE_DEFAULT_OPTIONS = Object.assign({}, WRITE_FILE_DEFAULT_OPTIONS);
const READ_FILE_DEFAULT_OPTIONS = {
encoding: "utf8" /* Utf8 */,
encoding: Text_1.Encoding.Utf8,
convertLineEndings: undefined
};
const COPY_FILE_DEFAULT_OPTIONS = {
alreadyExistsBehavior: "overwrite" /* Overwrite */
alreadyExistsBehavior: AlreadyExistsBehavior.Overwrite
};
const COPY_FILES_DEFAULT_OPTIONS = {
alreadyExistsBehavior: "overwrite" /* Overwrite */
alreadyExistsBehavior: AlreadyExistsBehavior.Overwrite
};

@@ -196,11 +234,11 @@ const DELETE_FILE_DEFAULT_OPTIONS = {

let result = '-'; // (later we may add support for additional states such as S_IFDIR or S_ISUID)
result += modeBits & 256 /* UserRead */ ? 'r' : '-';
result += modeBits & 128 /* UserWrite */ ? 'w' : '-';
result += modeBits & 64 /* UserExecute */ ? 'x' : '-';
result += modeBits & 32 /* GroupRead */ ? 'r' : '-';
result += modeBits & 16 /* GroupWrite */ ? 'w' : '-';
result += modeBits & 8 /* GroupExecute */ ? 'x' : '-';
result += modeBits & 4 /* OthersRead */ ? 'r' : '-';
result += modeBits & 2 /* OthersWrite */ ? 'w' : '-';
result += modeBits & 1 /* OthersExecute */ ? 'x' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.UserRead ? 'r' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.UserWrite ? 'w' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.UserExecute ? 'x' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.GroupRead ? 'r' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.GroupWrite ? 'w' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.GroupExecute ? 'x' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.OthersRead ? 'r' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.OthersWrite ? 'w' : '-';
result += modeBits & PosixModeBits_1.PosixModeBits.OthersExecute ? 'x' : '-';
return result;

@@ -543,4 +581,4 @@ }

fsx.copySync(options.sourcePath, options.destinationPath, {
errorOnExist: options.alreadyExistsBehavior === "error" /* Error */,
overwrite: options.alreadyExistsBehavior === "overwrite" /* Overwrite */
errorOnExist: options.alreadyExistsBehavior === AlreadyExistsBehavior.Error,
overwrite: options.alreadyExistsBehavior === AlreadyExistsBehavior.Overwrite
});

@@ -559,4 +597,4 @@ });

return fsx.copy(options.sourcePath, options.destinationPath, {
errorOnExist: options.alreadyExistsBehavior === "error" /* Error */,
overwrite: options.alreadyExistsBehavior === "overwrite" /* Overwrite */
errorOnExist: options.alreadyExistsBehavior === AlreadyExistsBehavior.Error,
overwrite: options.alreadyExistsBehavior === AlreadyExistsBehavior.Overwrite
});

@@ -580,4 +618,4 @@ });

dereference: !!options.dereferenceSymlinks,
errorOnExist: options.alreadyExistsBehavior === "error" /* Error */,
overwrite: options.alreadyExistsBehavior === "overwrite" /* Overwrite */,
errorOnExist: options.alreadyExistsBehavior === AlreadyExistsBehavior.Error,
overwrite: options.alreadyExistsBehavior === AlreadyExistsBehavior.Overwrite,
preserveTimestamps: !!options.preserveTimestamps,

@@ -596,4 +634,4 @@ filter: options.filter

dereference: !!options.dereferenceSymlinks,
errorOnExist: options.alreadyExistsBehavior === "error" /* Error */,
overwrite: options.alreadyExistsBehavior === "overwrite" /* Overwrite */,
errorOnExist: options.alreadyExistsBehavior === AlreadyExistsBehavior.Error,
overwrite: options.alreadyExistsBehavior === AlreadyExistsBehavior.Overwrite,
preserveTimestamps: !!options.preserveTimestamps,

@@ -883,5 +921,5 @@ filter: options.filter

switch (options.alreadyExistsBehavior) {
case "ignore" /* Ignore */:
case AlreadyExistsBehavior.Ignore:
break;
case "overwrite" /* Overwrite */:
case AlreadyExistsBehavior.Overwrite:
// fsx.linkSync does not allow overwriting so we must manually delete. If it's

@@ -892,3 +930,3 @@ // a folder, it will throw an error.

break;
case "error" /* Error */:
case AlreadyExistsBehavior.Error:
default:

@@ -922,5 +960,5 @@ throw error;

switch (options.alreadyExistsBehavior) {
case "ignore" /* Ignore */:
case AlreadyExistsBehavior.Ignore:
break;
case "overwrite" /* Overwrite */:
case AlreadyExistsBehavior.Overwrite:
// fsx.linkSync does not allow overwriting so we must manually delete. If it's

@@ -931,3 +969,3 @@ // a folder, it will throw an error.

break;
case "error" /* Error */:
case AlreadyExistsBehavior.Error:
default:

@@ -934,0 +972,0 @@ throw error;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeUuid = exports.StringBufferTerminalProvider = exports.ConsoleTerminalProvider = exports.TerminalProviderSeverity = exports.TextAttribute = exports.ColorValue = exports.Colors = exports.Terminal = exports.StringBuilder = exports.LegacyAdapters = exports.FileWriter = exports.FileSystem = exports.Sort = exports.Text = exports.Path = exports.PackageNameParser = exports.PackageName = exports.PackageJsonLookup = exports.ProtectableMap = exports.MapExtensions = exports.LockFile = exports.JsonSchema = exports.JsonFile = exports.InternalError = exports.Import = exports.Executable = exports.EnvironmentMap = exports.Enum = exports.Async = exports.AnsiEscape = exports.AlreadyReportedError = void 0;
exports.TypeUuid = exports.StringBufferTerminalProvider = exports.ConsoleTerminalProvider = exports.TerminalProviderSeverity = exports.TextAttribute = exports.ColorValue = exports.Colors = exports.Terminal = exports.StringBuilder = exports.LegacyAdapters = exports.FileWriter = exports.FileSystem = exports.AlreadyExistsBehavior = exports.Sort = exports.NewlineKind = exports.Text = exports.Encoding = exports.Path = exports.PackageNameParser = exports.PackageName = exports.PackageJsonLookup = exports.ProtectableMap = exports.PosixModeBits = exports.MapExtensions = exports.LockFile = exports.JsonSchema = exports.JsonFile = exports.InternalError = exports.Import = exports.Executable = exports.EnvironmentMap = exports.Enum = exports.FolderConstants = exports.FileConstants = exports.Async = exports.AnsiEscape = exports.AlreadyReportedError = void 0;
/**

@@ -18,2 +18,5 @@ * Core libraries that every NodeJS toolchain project should use.

Object.defineProperty(exports, "Async", { enumerable: true, get: function () { return Async_1.Async; } });
var Constants_1 = require("./Constants");
Object.defineProperty(exports, "FileConstants", { enumerable: true, get: function () { return Constants_1.FileConstants; } });
Object.defineProperty(exports, "FolderConstants", { enumerable: true, get: function () { return Constants_1.FolderConstants; } });
var Enum_1 = require("./Enum");

@@ -37,2 +40,4 @@ Object.defineProperty(exports, "Enum", { enumerable: true, get: function () { return Enum_1.Enum; } });

Object.defineProperty(exports, "MapExtensions", { enumerable: true, get: function () { return MapExtensions_1.MapExtensions; } });
var PosixModeBits_1 = require("./PosixModeBits");
Object.defineProperty(exports, "PosixModeBits", { enumerable: true, get: function () { return PosixModeBits_1.PosixModeBits; } });
var ProtectableMap_1 = require("./ProtectableMap");

@@ -48,6 +53,9 @@ Object.defineProperty(exports, "ProtectableMap", { enumerable: true, get: function () { return ProtectableMap_1.ProtectableMap; } });

var Text_1 = require("./Text");
Object.defineProperty(exports, "Encoding", { enumerable: true, get: function () { return Text_1.Encoding; } });
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return Text_1.Text; } });
Object.defineProperty(exports, "NewlineKind", { enumerable: true, get: function () { return Text_1.NewlineKind; } });
var Sort_1 = require("./Sort");
Object.defineProperty(exports, "Sort", { enumerable: true, get: function () { return Sort_1.Sort; } });
var FileSystem_1 = require("./FileSystem");
Object.defineProperty(exports, "AlreadyExistsBehavior", { enumerable: true, get: function () { return FileSystem_1.AlreadyExistsBehavior; } });
Object.defineProperty(exports, "FileSystem", { enumerable: true, get: function () { return FileSystem_1.FileSystem; } });

@@ -54,0 +62,0 @@ var FileWriter_1 = require("./FileWriter");

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

const JsonFile_1 = require("./JsonFile");
const Constants_1 = require("./Constants");
const FileSystem_1 = require("./FileSystem");

@@ -152,3 +153,3 @@ /**

}
return path.join(packageJsonFolder, "package.json" /* PackageJson */);
return path.join(packageJsonFolder, Constants_1.FileConstants.PackageJson);
}

@@ -258,3 +259,3 @@ /**

// Is resolvedFileOrFolderPath itself a folder with a package.json file? If so, return it.
if (FileSystem_1.FileSystem.exists(path.join(resolvedFileOrFolderPath, "package.json" /* PackageJson */))) {
if (FileSystem_1.FileSystem.exists(path.join(resolvedFileOrFolderPath, Constants_1.FileConstants.PackageJson))) {
this._packageFolderCache.set(resolvedFileOrFolderPath, resolvedFileOrFolderPath);

@@ -261,0 +262,0 @@ return resolvedFileOrFolderPath;

@@ -16,3 +16,3 @@ /**

*/
export declare const enum PosixModeBits {
export declare enum PosixModeBits {
/**

@@ -19,0 +19,0 @@ * Indicates that the item's owner can read the item.

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.PosixModeBits = void 0;
// The PosixModeBits are intended to be used with bitwise operations.
/* eslint-disable no-bitwise */
/**
* An integer value used to specify file permissions for POSIX-like operating systems.
*
* @remarks
*
* This bitfield corresponds to the "mode_t" structure described in this document:
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html
*
* It is used with NodeJS APIs such as fs.Stat.mode and fs.chmodSync(). These values
* represent a set of permissions and can be combined using bitwise arithmetic.
*
* POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
*
* @public
*/
var PosixModeBits;
(function (PosixModeBits) {
// The bits
/**
* Indicates that the item's owner can read the item.
*/
PosixModeBits[PosixModeBits["UserRead"] = 256] = "UserRead";
/**
* Indicates that the item's owner can modify the item.
*/
PosixModeBits[PosixModeBits["UserWrite"] = 128] = "UserWrite";
/**
* Indicates that the item's owner can execute the item (if it is a file)
* or search the item (if it is a directory).
*/
PosixModeBits[PosixModeBits["UserExecute"] = 64] = "UserExecute";
/**
* Indicates that users belonging to the item's group can read the item.
*/
PosixModeBits[PosixModeBits["GroupRead"] = 32] = "GroupRead";
/**
* Indicates that users belonging to the item's group can modify the item.
*/
PosixModeBits[PosixModeBits["GroupWrite"] = 16] = "GroupWrite";
/**
* Indicates that users belonging to the item's group can execute the item (if it is a file)
* or search the item (if it is a directory).
*/
PosixModeBits[PosixModeBits["GroupExecute"] = 8] = "GroupExecute";
/**
* Indicates that other users (besides the item's owner user or group) can read the item.
*/
PosixModeBits[PosixModeBits["OthersRead"] = 4] = "OthersRead";
/**
* Indicates that other users (besides the item's owner user or group) can modify the item.
*/
PosixModeBits[PosixModeBits["OthersWrite"] = 2] = "OthersWrite";
/**
* Indicates that other users (besides the item's owner user or group) can execute the item (if it is a file)
* or search the item (if it is a directory).
*/
PosixModeBits[PosixModeBits["OthersExecute"] = 1] = "OthersExecute";
// Helpful aliases
/**
* A zero value where no permissions bits are set.
*/
PosixModeBits[PosixModeBits["None"] = 0] = "None";
/**
* An alias combining OthersRead, GroupRead, and UserRead permission bits.
*/
PosixModeBits[PosixModeBits["AllRead"] = 292] = "AllRead";
/**
* An alias combining OthersWrite, GroupWrite, and UserWrite permission bits.
*/
PosixModeBits[PosixModeBits["AllWrite"] = 146] = "AllWrite";
/**
* An alias combining OthersExecute, GroupExecute, and UserExecute permission bits.
*/
PosixModeBits[PosixModeBits["AllExecute"] = 73] = "AllExecute";
})(PosixModeBits = exports.PosixModeBits || (exports.PosixModeBits = {}));
//# sourceMappingURL=PosixModeBits.js.map

@@ -5,3 +5,3 @@ /**

*/
export declare const enum Encoding {
export declare enum Encoding {
Utf8 = "utf8"

@@ -13,3 +13,3 @@ }

*/
export declare const enum NewlineKind {
export declare enum NewlineKind {
/**

@@ -16,0 +16,0 @@ * Windows-style newlines

@@ -24,5 +24,35 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Text = void 0;
exports.Text = exports.NewlineKind = exports.Encoding = void 0;
const os = __importStar(require("os"));
/**
* The allowed types of encodings, as supported by Node.js
* @public
*/
var Encoding;
(function (Encoding) {
Encoding["Utf8"] = "utf8";
})(Encoding = exports.Encoding || (exports.Encoding = {}));
/**
* Enumeration controlling conversion of newline characters.
* @public
*/
var NewlineKind;
(function (NewlineKind) {
/**
* Windows-style newlines
*/
NewlineKind["CrLf"] = "\r\n";
/**
* POSIX-style newlines
*
* @remarks
* POSIX is a registered trademark of the Institute of Electrical and Electronic Engineers, Inc.
*/
NewlineKind["Lf"] = "\n";
/**
* Default newline type for this operating system (`os.EOL`).
*/
NewlineKind["OsDefault"] = "os";
})(NewlineKind = exports.NewlineKind || (exports.NewlineKind = {}));
/**
* Operations for working with strings that contain text.

@@ -72,7 +102,7 @@ *

switch (newlineKind) {
case "\r\n" /* CrLf */:
case NewlineKind.CrLf:
return '\r\n';
case "\n" /* Lf */:
case NewlineKind.Lf:
return '\n';
case "os" /* OsDefault */:
case NewlineKind.OsDefault:
return os.EOL;

@@ -143,3 +173,3 @@ default:

*/
static ensureTrailingNewline(s, newlineKind = "\n" /* Lf */) {
static ensureTrailingNewline(s, newlineKind = NewlineKind.Lf) {
// Is there already a newline?

@@ -146,0 +176,0 @@ if (Text._newLineAtEndRegEx.test(s)) {

{
"name": "@rushstack/node-core-library",
"version": "3.43.2",
"version": "3.44.0",
"description": "Core libraries that every NodeJS toolchain project should use",

@@ -26,4 +26,4 @@ "main": "lib/index.js",

"@rushstack/eslint-config": "2.4.5",
"@rushstack/heft": "0.41.6",
"@rushstack/heft-node-rig": "1.2.25",
"@rushstack/heft": "0.42.3",
"@rushstack/heft-node-rig": "1.2.32",
"@types/fs-extra": "7.0.0",

@@ -30,0 +30,0 @@ "@types/heft-jest": "1.0.1",

Sorry, the diff of this file is too big to display

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