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.24.0 to 3.24.1

12

CHANGELOG.json

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

{
"version": "3.24.1",
"tag": "@rushstack/node-core-library_v3.24.1",
"date": "Wed, 10 Jun 2020 20:48:30 GMT",
"comments": {
"patch": [
{
"comment": "Improve API docs for \"LockFile\""
}
]
}
},
{
"version": "3.24.0",

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

9

CHANGELOG.md
# Change Log - @rushstack/node-core-library
This log was last generated on Sat, 30 May 2020 02:59:54 GMT and should not be manually modified.
This log was last generated on Wed, 10 Jun 2020 20:48:30 GMT and should not be manually modified.
## 3.24.1
Wed, 10 Jun 2020 20:48:30 GMT
### Patches
- Improve API docs for "LockFile"
## 3.24.0

@@ -6,0 +13,0 @@ Sat, 30 May 2020 02:59:54 GMT

14

lib/Executable.js

@@ -106,4 +106,3 @@ "use strict";

// http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/
const environment = options && options.environment
|| process.env;
const environment = (options && options.environment) || process.env;
const fileExtension = path.extname(resolvedPath);

@@ -126,4 +125,4 @@ if (os.platform() === 'win32') {

if (!shellPath) {
throw new Error(`Unable to execute "${path.basename(resolvedPath)}" `
+ `because CMD.exe was not found in the PATH`);
throw new Error(`Unable to execute "${path.basename(resolvedPath)}" ` +
`because CMD.exe was not found in the PATH`);
}

@@ -171,4 +170,3 @@ const shellArgs = [];

// must be interpreted as a path delimiter
const hasPathSeparators = filename.indexOf('/') >= 0
|| (os.platform() === 'win32' && filename.indexOf('\\') >= 0);
const hasPathSeparators = filename.indexOf('/') >= 0 || (os.platform() === 'win32' && filename.indexOf('\\') >= 0);
// Are there any path separators?

@@ -335,4 +333,4 @@ if (hasPathSeparators) {

// Thus, there is no generally reliable way to pass these characters.
throw new Error(`The command line argument ${JSON.stringify(arg)} contains a`
+ ` special character ${JSON.stringify(match[0])} that cannot be escaped for the Windows shell`);
throw new Error(`The command line argument ${JSON.stringify(arg)} contains a` +
` special character ${JSON.stringify(match[0])} that cannot be escaped for the Windows shell`);
}

@@ -339,0 +337,0 @@ }

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

* @public
*/
*/
export interface IFileSystemDeleteFileOptions {

@@ -186,0 +186,0 @@ /**

@@ -179,11 +179,11 @@ "use strict";

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 & 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' : '-';
return result;

@@ -279,3 +279,3 @@ }

if (options.absolutePaths) {
return fileNames.map(fileName => nodeJsPath.resolve(folderPath, fileName));
return fileNames.map((fileName) => nodeJsPath.resolve(folderPath, fileName));
}

@@ -297,3 +297,3 @@ else {

if (options.absolutePaths) {
return fileNames.map(fileName => nodeJsPath.resolve(folderPath, fileName));
return fileNames.map((fileName) => nodeJsPath.resolve(folderPath, fileName));
}

@@ -542,4 +542,3 @@ else {

if (FileSystem.getStatistics(options.sourcePath).isDirectory()) {
throw new Error('The specified path refers to a folder; this operation expects a file object:\n'
+ options.sourcePath);
throw new Error('The specified path refers to a folder; this operation expects a file object:\n' + options.sourcePath);
}

@@ -560,4 +559,3 @@ FileSystem._wrapException(() => {

if (FileSystem.getStatistics(options.sourcePath).isDirectory()) {
throw new Error('The specified path refers to a folder; this operation expects a file object:\n'
+ options.sourcePath);
throw new Error('The specified path refers to a folder; this operation expects a file object:\n' + options.sourcePath);
}

@@ -808,3 +806,3 @@ yield FileSystem._wrapExceptionAsync(() => {

static isFileDoesNotExistError(error) {
return FileSystem.isErrnoException(error) && (error.code === 'ENOENT');
return FileSystem.isErrnoException(error) && error.code === 'ENOENT';
}

@@ -815,3 +813,3 @@ /**

static isFolderDoesNotExistError(error) {
return FileSystem.isErrnoException(error) && (error.code === 'ENOTDIR');
return FileSystem.isErrnoException(error) && error.code === 'ENOTDIR';
}

@@ -850,6 +848,8 @@ /**

if (FileSystem.isErrnoException(error)) {
if (FileSystem.isFileDoesNotExistError(error)) { // eslint-disable-line @typescript-eslint/no-use-before-define
if (FileSystem.isFileDoesNotExistError(error)) {
// eslint-disable-line @typescript-eslint/no-use-before-define
error.message = `File does not exist: ${error.path}\n${error.message}`;
}
else if (FileSystem.isFolderDoesNotExistError(error)) { // eslint-disable-line @typescript-eslint/no-use-before-define
else if (FileSystem.isFolderDoesNotExistError(error)) {
// eslint-disable-line @typescript-eslint/no-use-before-define
error.message = `Folder does not exist: ${error.path}\n${error.message}`;

@@ -856,0 +856,0 @@ }

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

flags = Object.assign({ append: false, exclusive: false }, flags);
return [flags.append ? 'a' : 'w',
flags.exclusive ? 'x' : '']
.join('');
return [flags.append ? 'a' : 'w', flags.exclusive ? 'x' : ''].join('');
}

@@ -36,0 +34,0 @@ /**

@@ -21,3 +21,3 @@ /**

export { Sort } from './Sort';
export { AlreadyExistsBehavior, FileSystem, FileSystemStats, IFileSystemReadFolderOptions, IFileSystemWriteFileOptions, IFileSystemReadFileOptions, IFileSystemMoveOptions, IFileSystemCopyFileOptions, IFileSystemDeleteFileOptions, IFileSystemUpdateTimeParameters, IFileSystemCreateLinkOptions, IFileSystemCopyFilesAsyncOptions, IFileSystemCopyFilesOptions, FileSystemCopyFilesAsyncFilter, FileSystemCopyFilesFilter, } from './FileSystem';
export { AlreadyExistsBehavior, FileSystem, FileSystemStats, IFileSystemReadFolderOptions, IFileSystemWriteFileOptions, IFileSystemReadFileOptions, IFileSystemMoveOptions, IFileSystemCopyFileOptions, IFileSystemDeleteFileOptions, IFileSystemUpdateTimeParameters, IFileSystemCreateLinkOptions, IFileSystemCopyFilesAsyncOptions, IFileSystemCopyFilesOptions, FileSystemCopyFilesAsyncFilter, FileSystemCopyFilesFilter } from './FileSystem';
export { FileWriter, IFileWriterFlags } from './FileWriter';

@@ -24,0 +24,0 @@ export { LegacyAdapters, LegacyCallback } from './LegacyAdapters';

@@ -36,4 +36,4 @@ "use strict";

static _formatMessage(unformattedMessage) {
return `Internal Error: ${unformattedMessage}\n\nYou have encountered a software defect. Please consider`
+ ` reporting the issue to the maintainers of this application.`;
return (`Internal Error: ${unformattedMessage}\n\nYou have encountered a software defect. Please consider` +
` reporting the issue to the maintainers of this application.`);
}

@@ -40,0 +40,0 @@ /** @override */

@@ -36,11 +36,11 @@ /**

* {@link https://nodejs.org/dist/latest-v10.x/docs/api/modules.html#modules_folders_as_modules
* | "Folders as Modules" section} from the NodeJS documentation gives an example of a package.json file
* that has only the `name` and `main` fields. NodeJS does not consider the `version` field during resolution,
* so it can be omitted. Some libraries do this.
*
* Use the `INodePackageJson` interface when loading such files. Use `IPackageJson` for package.json files
* that are installed from an NPM registry, or are otherwise known to have a `version` field.
*
* @public
*/
* | "Folders as Modules" section} from the NodeJS documentation gives an example of a package.json file
* that has only the `name` and `main` fields. NodeJS does not consider the `version` field during resolution,
* so it can be omitted. Some libraries do this.
*
* Use the `INodePackageJson` interface when loading such files. Use `IPackageJson` for package.json files
* that are installed from an NPM registry, or are otherwise known to have a `version` field.
*
* @public
*/
export interface INodePackageJson {

@@ -47,0 +47,0 @@ /**

@@ -293,3 +293,4 @@ "use strict";

// To this: A path: \"C:\\file\"
const escapedKey = key.replace(/[\\]/g, '\\\\') // escape backslashes
const escapedKey = key
.replace(/[\\]/g, '\\\\') // escape backslashes
.replace(/["]/g, '\\'); // escape quotes

@@ -296,0 +297,0 @@ result += `["${escapedKey}"]`;

@@ -65,8 +65,7 @@ "use strict";

if (schemaId === '') {
throw new Error(`This schema ${dependentSchema.shortName} cannot be referenced`
+ ' because is missing the "id" field');
throw new Error(`This schema ${dependentSchema.shortName} cannot be referenced` +
' because is missing the "id" field');
}
if (seenIds.has(schemaId)) {
throw new Error(`This schema ${dependentSchema.shortName} has the same "id" as`
+ ' another schema in this set');
throw new Error(`This schema ${dependentSchema.shortName} has the same "id" as another schema in this set`);
}

@@ -94,4 +93,3 @@ seenIds.add(schemaId);

if (truncatedDescription.length > MAX_LENGTH) {
truncatedDescription = truncatedDescription.substr(0, MAX_LENGTH - 3)
+ '...';
truncatedDescription = truncatedDescription.substr(0, MAX_LENGTH - 3) + '...';
}

@@ -142,10 +140,3 @@ buffer += ` (${truncatedDescription})`;

const anythingSchema = {
'type': [
'array',
'boolean',
'integer',
'number',
'object',
'string'
]
type: ['array', 'boolean', 'integer', 'number', 'object', 'string']
};

@@ -162,4 +153,5 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any

if (!newValidator.validateSchema(collectedSchema._schemaObject)) {
throw new Error(`Failed to validate schema "${collectedSchema.shortName}":` + os.EOL
+ JsonSchema._formatErrorDetails(newValidator.getLastErrors()));
throw new Error(`Failed to validate schema "${collectedSchema.shortName}":` +
os.EOL +
JsonSchema._formatErrorDetails(newValidator.getLastErrors()));
}

@@ -180,6 +172,4 @@ }

this.validateObjectWithCallback(jsonObject, (errorInfo) => {
const prefix = (options && options.customErrorHeader) ? options.customErrorHeader
: 'JSON validation failed:';
throw new Error(prefix + os.EOL +
filenameForErrors + os.EOL + errorInfo.details);
const prefix = options && options.customErrorHeader ? options.customErrorHeader : 'JSON validation failed:';
throw new Error(prefix + os.EOL + filenameForErrors + os.EOL + errorInfo.details);
});

@@ -186,0 +176,0 @@ }

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

*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static scrubError(error) {

@@ -49,0 +50,0 @@ if (error instanceof Error) {

@@ -13,5 +13,9 @@ /**

/**
* A helper utility for working with file-based locks.
* This class should only be used for locking resources across processes,
* but should not be used for attempting to lock a resource in the same process.
* 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.
* @remarks
* The implementation works on Windows, Mac, and Linux without requiring any native helpers.
* On non-Windows systems, the algorithm requires access to the `ps` shell command. On Linux,
* it requires access the `/proc/${pidString}/stat` filesystem.
* @public

@@ -26,20 +30,32 @@ */

/**
* Returns the path to the lockfile, should it be created successfully.
* Returns the path of the lockfile that will be created when a lock is successfully acquired.
* @param resourceFolder - The folder where the lock file will be created
* @param resourceName - An alphanumeric name that describes the resource being locked. This will become
* the filename of the temporary file created to manage the lock.
* @param pid - The PID for the current Node.js process (`process.pid`), which is used by the locking algorithm.
*/
static getLockFilePath(resourceDir: string, resourceName: string, pid?: number): string;
static getLockFilePath(resourceFolder: string, resourceName: string, pid?: number): string;
/**
* Attempts to create a lockfile with the given filePath.
* If successful, returns a LockFile instance.
* If unable to get a lock, returns undefined.
* @param resourceName - the name of the resource we are locking on. Should be an alphabetic string.
* @param resourceFolder - The folder where the lock file will be created
* @param resourceName - An alphanumeric name that describes the resource being locked. This will become
* the filename of the temporary file created to manage the lock.
* @returns If successful, returns a `LockFile` instance. If unable to get a lock, returns `undefined`.
*/
static tryAcquire(resourceDir: string, resourceName: string): LockFile | undefined;
static tryAcquire(resourceFolder: string, resourceName: string): LockFile | undefined;
/**
* Attempts to create the lockfile.
* Will continue to loop at every 100ms until the lock becomes available or the maxWaitMs is surpassed.
* @remarks This function is subject to starvation, whereby it does not ensure that the process that has been
* waiting the longest to acquire the lock will get it first. This means that a process could theoretically
* wait for the lock forever, while other processes skipped it in line and acquired the lock first.
* Attempts to create the lockfile. Will continue to loop at every 100ms until the lock becomes available
* or the maxWaitMs is surpassed.
*
* @remarks
* This function is subject to starvation, whereby it does not ensure that the process that has been
* waiting the longest to acquire the lock will get it first. This means that a process could theoretically
* wait for the lock forever, while other processes skipped it in line and acquired the lock first.
*
* @param resourceFolder - The folder where the lock file will be created
* @param resourceName - An alphanumeric name that describes the resource being locked. This will become
* the filename of the temporary file created to manage the lock.
* @param maxWaitMs - The maximum number of milliseconds to wait for the lock before reporting an error
*/
static acquire(resourceDir: string, resourceName: string, maxWaitMs?: number): Promise<LockFile>;
static acquire(resourceFolder: string, resourceName: string, maxWaitMs?: number): Promise<LockFile>;
private static _sleepForMs;

@@ -46,0 +62,0 @@ /**

@@ -105,4 +105,4 @@ "use strict";

if (startTimeJiffies === undefined) {
throw new Error(`Could not retrieve the start time of process ${pidString} from the OS because the `
+ `contents of /proc/${pidString}/stat have an unexpected format`);
throw new Error(`Could not retrieve the start time of process ${pidString} from the OS because the ` +
`contents of /proc/${pidString}/stat have an unexpected format`);
}

@@ -131,5 +131,9 @@ return startTimeJiffies;

/**
* A helper utility for working with file-based locks.
* This class should only be used for locking resources across processes,
* but should not be used for attempting to lock a resource in the same process.
* 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.
* @remarks
* The implementation works on Windows, Mac, and Linux without requiring any native helpers.
* On non-Windows systems, the algorithm requires access to the `ps` shell command. On Linux,
* it requires access the `/proc/${pidString}/stat` filesystem.
* @public

@@ -144,14 +148,18 @@ */

/**
* Returns the path to the lockfile, should it be created successfully.
* Returns the path of the lockfile that will be created when a lock is successfully acquired.
* @param resourceFolder - The folder where the lock file will be created
* @param resourceName - An alphanumeric name that describes the resource being locked. This will become
* the filename of the temporary file created to manage the lock.
* @param pid - The PID for the current Node.js process (`process.pid`), which is used by the locking algorithm.
*/
static getLockFilePath(resourceDir, resourceName, pid = process.pid) {
static getLockFilePath(resourceFolder, resourceName, pid = process.pid) {
if (!resourceName.match(/^[a-zA-Z0-9][a-zA-Z0-9-.]+[a-zA-Z0-9]$/)) {
throw new Error(`The resource name "${resourceName}" is invalid.`
+ ` It must be an alphanumberic string with only "-" or "." It must start with an alphanumeric character.`);
throw new Error(`The resource name "${resourceName}" is invalid.` +
` It must be an alphanumberic string with only "-" or "." It must start with an alphanumeric character.`);
}
if (process.platform === 'win32') {
return path.join(path.resolve(resourceDir), `${resourceName}.lock`);
return path.join(path.resolve(resourceFolder), `${resourceName}.lock`);
}
else if (process.platform === 'linux' || process.platform === 'darwin') {
return path.join(path.resolve(resourceDir), `${resourceName}#${pid}.lock`);
return path.join(path.resolve(resourceFolder), `${resourceName}#${pid}.lock`);
}

@@ -162,13 +170,14 @@ throw new Error(`File locking not implemented for platform: "${process.platform}"`);

* Attempts to create a lockfile with the given filePath.
* If successful, returns a LockFile instance.
* If unable to get a lock, returns undefined.
* @param resourceName - the name of the resource we are locking on. Should be an alphabetic string.
* @param resourceFolder - The folder where the lock file will be created
* @param resourceName - An alphanumeric name that describes the resource being locked. This will become
* the filename of the temporary file created to manage the lock.
* @returns If successful, returns a `LockFile` instance. If unable to get a lock, returns `undefined`.
*/
static tryAcquire(resourceDir, resourceName) {
FileSystem_1.FileSystem.ensureFolder(resourceDir);
static tryAcquire(resourceFolder, resourceName) {
FileSystem_1.FileSystem.ensureFolder(resourceFolder);
if (process.platform === 'win32') {
return LockFile._tryAcquireWindows(resourceDir, resourceName);
return LockFile._tryAcquireWindows(resourceFolder, resourceName);
}
else if (process.platform === 'linux' || process.platform === 'darwin') {
return LockFile._tryAcquireMacOrLinux(resourceDir, resourceName);
return LockFile._tryAcquireMacOrLinux(resourceFolder, resourceName);
}

@@ -178,17 +187,24 @@ throw new Error(`File locking not implemented for platform: "${process.platform}"`);

/**
* Attempts to create the lockfile.
* Will continue to loop at every 100ms until the lock becomes available or the maxWaitMs is surpassed.
* @remarks This function is subject to starvation, whereby it does not ensure that the process that has been
* waiting the longest to acquire the lock will get it first. This means that a process could theoretically
* wait for the lock forever, while other processes skipped it in line and acquired the lock first.
* Attempts to create the lockfile. Will continue to loop at every 100ms until the lock becomes available
* or the maxWaitMs is surpassed.
*
* @remarks
* This function is subject to starvation, whereby it does not ensure that the process that has been
* waiting the longest to acquire the lock will get it first. This means that a process could theoretically
* wait for the lock forever, while other processes skipped it in line and acquired the lock first.
*
* @param resourceFolder - The folder where the lock file will be created
* @param resourceName - An alphanumeric name that describes the resource being locked. This will become
* the filename of the temporary file created to manage the lock.
* @param maxWaitMs - The maximum number of milliseconds to wait for the lock before reporting an error
*/
static acquire(resourceDir, resourceName, maxWaitMs) {
static acquire(resourceFolder, resourceName, maxWaitMs) {
const interval = 100;
const startTime = Date.now();
const retryLoop = () => {
const lock = LockFile.tryAcquire(resourceDir, resourceName);
const lock = LockFile.tryAcquire(resourceFolder, resourceName);
if (lock) {
return Promise.resolve(lock);
}
if (maxWaitMs && (Date.now() > startTime + maxWaitMs)) {
if (maxWaitMs && Date.now() > startTime + maxWaitMs) {
return Promise.reject(new Error(`Exceeded maximum wait time to acquire lock for resource "${resourceName}"`));

@@ -212,3 +228,3 @@ }

*/
static _tryAcquireMacOrLinux(resourceDir, resourceName) {
static _tryAcquireMacOrLinux(resourceFolder, resourceName) {
let dirtyWhenAcquired = false;

@@ -221,3 +237,3 @@ // get the current process' pid

}
const pidLockFilePath = LockFile.getLockFilePath(resourceDir, resourceName);
const pidLockFilePath = LockFile.getLockFilePath(resourceFolder, resourceName);
let lockFileHandle;

@@ -235,3 +251,3 @@ let lockFile;

// now, scan the directory for all lockfiles
const files = FileSystem_1.FileSystem.readFolder(resourceDir);
const files = FileSystem_1.FileSystem.readFolder(resourceFolder);
// look for anything ending with # then numbers and ".lock"

@@ -242,7 +258,7 @@ const lockFileRegExp = /^(.+)#([0-9]+)\.lock$/;

for (const fileInFolder of files) {
if ((match = fileInFolder.match(lockFileRegExp))
&& (match[1] === resourceName)
&& ((otherPid = match[2]) !== pid.toString())) {
if ((match = fileInFolder.match(lockFileRegExp)) &&
match[1] === resourceName &&
(otherPid = match[2]) !== pid.toString()) {
// we found at least one lockfile hanging around that isn't ours
const fileInFolderPath = path.join(resourceDir, fileInFolder);
const fileInFolderPath = path.join(resourceFolder, fileInFolder);
dirtyWhenAcquired = true;

@@ -273,4 +289,5 @@ // console.log(`FOUND OTHER LOCKFILE: ${otherPid}`);

}
else if (otherBirthtimeMs - currentBirthTimeMs < 0 // it was created before us AND
&& otherBirthtimeMs - currentBirthTimeMs > -1000) { // it was created less than a second before
else if (otherBirthtimeMs - currentBirthTimeMs < 0 && // it was created before us AND
otherBirthtimeMs - currentBirthTimeMs > -1000) {
// it was created less than a second before
// conservatively be unable to keep the lock

@@ -318,4 +335,4 @@ return undefined;

*/
static _tryAcquireWindows(resourceDir, resourceName) {
const lockFilePath = LockFile.getLockFilePath(resourceDir, resourceName);
static _tryAcquireWindows(resourceFolder, resourceName) {
const lockFilePath = LockFile.getLockFilePath(resourceFolder, resourceName);
let dirtyWhenAcquired = false;

@@ -322,0 +339,0 @@ let fileHandle;

@@ -48,7 +48,6 @@ "use strict";

static loadOwnPackageJson(dirnameOfCaller) {
const packageJson = PackageJsonLookup._loadOwnPackageJsonLookup
.tryLoadPackageJsonFor(dirnameOfCaller);
const packageJson = PackageJsonLookup._loadOwnPackageJsonLookup.tryLoadPackageJsonFor(dirnameOfCaller);
if (packageJson === undefined) {
throw new Error(`PackageJsonLookup.loadOwnPackageJson() failed to find the caller's package.json.`
+ ` The __dirname was: ${dirnameOfCaller}`);
throw new Error(`PackageJsonLookup.loadOwnPackageJson() failed to find the caller's package.json.` +
` The __dirname was: ${dirnameOfCaller}`);
}

@@ -58,6 +57,6 @@ if (packageJson.version !== undefined) {

}
const errorPath = PackageJsonLookup._loadOwnPackageJsonLookup.tryGetPackageJsonFilePathFor(dirnameOfCaller)
|| 'package.json';
throw new Error(`PackageJsonLookup.loadOwnPackageJson() failed because the "version" field is missing in`
+ ` ${errorPath}`);
const errorPath = PackageJsonLookup._loadOwnPackageJsonLookup.tryGetPackageJsonFilePathFor(dirnameOfCaller) ||
'package.json';
throw new Error(`PackageJsonLookup.loadOwnPackageJson() failed because the "version" field is missing in` +
` ${errorPath}`);
}

@@ -166,4 +165,3 @@ /**

if (!packageJson.version) {
throw new Error(`Error reading "${jsonFilename}":\n `
+ 'The required field "version" was not found');
throw new Error(`Error reading "${jsonFilename}":\n The required field "version" was not found`);
}

@@ -189,4 +187,3 @@ return packageJson;

if (!loadedPackageJson.name) {
throw new Error(`Error reading "${jsonFilename}":\n `
+ 'The required field "name" was not found');
throw new Error(`Error reading "${jsonFilename}":\n The required field "name" was not found`);
}

@@ -247,4 +244,6 @@ if (this._loadExtraFields) {

}
PackageJsonLookup._loadOwnPackageJsonLookup = new PackageJsonLookup({ loadExtraFields: true });
PackageJsonLookup._loadOwnPackageJsonLookup = new PackageJsonLookup({
loadExtraFields: true
});
exports.PackageJsonLookup = PackageJsonLookup;
//# sourceMappingURL=PackageJsonLookup.js.map

@@ -72,4 +72,3 @@ "use strict";

// Convert "@scope/unscoped-name" --> "scopeunscoped-name"
const nameWithoutScopeSymbols = (result.scope ? result.scope.slice(1, -1) : '')
+ result.unscopedName;
const nameWithoutScopeSymbols = (result.scope ? result.scope.slice(1, -1) : '') + result.unscopedName;
if (!this._options.allowUpperCase) {

@@ -76,0 +75,0 @@ // "New packages must not have uppercase letters in the name."

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

clear() {
// override
if (this._parameters.onClear) {

@@ -26,2 +27,3 @@ this._parameters.onClear(this._owner);

delete(key) {
// override
if (this._parameters.onDelete) {

@@ -33,2 +35,3 @@ this._parameters.onDelete(this._owner, key);

set(key, value) {
// override
let modifiedValue = value;

@@ -35,0 +38,0 @@ if (this._parameters.onSet) {

@@ -46,6 +46,8 @@ "use strict";

// Null is smaller than anything except undefined
if (x === null) { // eslint-disable-line @rushstack/no-null
if (x === null) {
// eslint-disable-line @rushstack/no-null
return -1;
}
if (y === null) { // eslint-disable-line @rushstack/no-null
if (y === null) {
// eslint-disable-line @rushstack/no-null
return 1;

@@ -74,4 +76,7 @@ }

*/
static sortBy(array,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static sortBy(array, keySelector, comparer = Sort.compareByValue) {
keySelector,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
comparer = Sort.compareByValue) {
LegacyAdapters_1.LegacyAdapters.sortStable(array, (x, y) => comparer(keySelector(x), keySelector(y)));

@@ -103,4 +108,7 @@ }

*/
static isSortedBy(array,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static isSortedBy(array, keySelector, comparer = Sort.compareByValue) {
keySelector,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
comparer = Sort.compareByValue) {
let previousKey = undefined;

@@ -135,6 +143,6 @@ for (const element of array) {

// Sorting a map is expensive, so first check whether it's already sorted.
if (Sort.isSortedBy(pairs, x => x[0], keyComparer)) {
if (Sort.isSortedBy(pairs, (x) => x[0], keyComparer)) {
return;
}
Sort.sortBy(pairs, x => x[0], keyComparer);
Sort.sortBy(pairs, (x) => x[0], keyComparer);
map.clear();

@@ -160,4 +168,5 @@ for (const pair of pairs) {

*/
static sortSetBy(set,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static sortSetBy(set, keySelector, keyComparer = Sort.compareByValue) {
keySelector, keyComparer = Sort.compareByValue) {
const array = Array.from(set);

@@ -164,0 +173,0 @@ // Sorting a set is expensive, so first check whether it's already sorted.

@@ -273,7 +273,3 @@ "use strict";

const code = startColorCodes[j];
segmentsToJoin.push(...[
'\u001b[',
code.toString(),
'm'
]);
segmentsToJoin.push(...['\u001b[', code.toString(), 'm']);
}

@@ -283,7 +279,3 @@ segmentsToJoin.push(segment.text);

const code = endColorCodes[j];
segmentsToJoin.push(...[
'\u001b[',
code.toString(),
'm'
]);
segmentsToJoin.push(...['\u001b[', code.toString(), 'm']);
}

@@ -290,0 +282,0 @@ }

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

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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

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