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
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.44.3 to 3.45.0

15

CHANGELOG.json

@@ -5,2 +5,17 @@ {

{
"version": "3.45.0",
"tag": "@rushstack/node-core-library_v3.45.0",
"date": "Wed, 05 Jan 2022 16:07:47 GMT",
"comments": {
"minor": [
{
"comment": "Expose a FileSystem.readFolderItems and FileSystem.readFolderItemsAsync API to get folder entries with types in a single API call."
},
{
"comment": "Deprecate FileSystem.readFolder in favor of FileSystem.readFolderItemNames."
}
]
}
},
{
"version": "3.44.3",

@@ -7,0 +22,0 @@ "tag": "@rushstack/node-core-library_v3.44.3",

10

CHANGELOG.md
# Change Log - @rushstack/node-core-library
This log was last generated on Mon, 27 Dec 2021 16:10:40 GMT and should not be manually modified.
This log was last generated on Wed, 05 Jan 2022 16:07:47 GMT and should not be manually modified.
## 3.45.0
Wed, 05 Jan 2022 16:07:47 GMT
### Minor changes
- Expose a FileSystem.readFolderItems and FileSystem.readFolderItemsAsync API to get folder entries with types in a single API call.
- Deprecate FileSystem.readFolder in favor of FileSystem.readFolderItemNames.
## 3.44.3

@@ -6,0 +14,0 @@ Mon, 27 Dec 2021 16:10:40 GMT

@@ -14,2 +14,10 @@ /// <reference types="node" />

/**
* An alias for the Node.js `fs.Dirent` object.
*
* @remarks
* This avoids the need to import the `fs` package when using the {@link FileSystem} API.
* @public
*/
export declare type FolderItem = fs.Dirent;
/**
* The options for {@link FileSystem.readFolder}

@@ -366,3 +374,13 @@ * @public

/**
* Reads the contents of the folder, not including "." or "..".
* @deprecated
* Use {@link FileSystem.readFolderItemNames} instead.
*/
static readFolder(folderPath: string, options?: IFileSystemReadFolderOptions): string[];
/**
* @deprecated
* Use {@link FileSystem.readFolderItemNamesAsync} instead.
*/
static readFolderAsync(folderPath: string, options?: IFileSystemReadFolderOptions): Promise<string[]>;
/**
* Reads the names of folder entries, not including "." or "..".
* Behind the scenes it uses `fs.readdirSync()`.

@@ -372,8 +390,20 @@ * @param folderPath - The absolute or relative path to the folder which should be read.

*/
static readFolder(folderPath: string, options?: IFileSystemReadFolderOptions): string[];
static readFolderItemNames(folderPath: string, options?: IFileSystemReadFolderOptions): string[];
/**
* An async version of {@link FileSystem.readFolder}.
* An async version of {@link FileSystem.readFolderItemNames}.
*/
static readFolderAsync(folderPath: string, options?: IFileSystemReadFolderOptions): Promise<string[]>;
static readFolderItemNamesAsync(folderPath: string, options?: IFileSystemReadFolderOptions): Promise<string[]>;
/**
* Reads the contents of the folder, not including "." or "..", returning objects including the
* entry names and types.
* Behind the scenes it uses `fs.readdirSync()`.
* @param folderPath - The absolute or relative path to the folder which should be read.
* @param options - Optional settings that can change the behavior. Type: `IReadFolderOptions`
*/
static readFolderItems(folderPath: string, options?: IFileSystemReadFolderOptions): FolderItem[];
/**
* An async version of {@link FileSystem.readFolderItems}.
*/
static readFolderItemsAsync(folderPath: string, options?: IFileSystemReadFolderOptions): Promise<FolderItem[]>;
/**
* Deletes a folder, including all of its contents.

@@ -380,0 +410,0 @@ * Behind the scenes is uses `fs-extra.removeSync()`.

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

const PosixModeBits_1 = require("./PosixModeBits");
const LegacyAdapters_1 = require("./LegacyAdapters");
/**

@@ -316,3 +317,17 @@ * Specifies the behavior of APIs such as {@link FileSystem.copyFile} or

/**
* Reads the contents of the folder, not including "." or "..".
* @deprecated
* Use {@link FileSystem.readFolderItemNames} instead.
*/
static readFolder(folderPath, options) {
return FileSystem.readFolderItemNames(folderPath, options);
}
/**
* @deprecated
* Use {@link FileSystem.readFolderItemNamesAsync} instead.
*/
static async readFolderAsync(folderPath, options) {
return await FileSystem.readFolderItemNamesAsync(folderPath, options);
}
/**
* Reads the names of folder entries, not including "." or "..".
* Behind the scenes it uses `fs.readdirSync()`.

@@ -322,6 +337,5 @@ * @param folderPath - The absolute or relative path to the folder which should be read.

*/
static readFolder(folderPath, options) {
static readFolderItemNames(folderPath, options) {
return FileSystem._wrapException(() => {
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
const fileNames = fsx.readdirSync(folderPath);

@@ -337,8 +351,7 @@ if (options.absolutePaths) {

/**
* An async version of {@link FileSystem.readFolder}.
* An async version of {@link FileSystem.readFolderItemNames}.
*/
static async readFolderAsync(folderPath, options) {
static async readFolderItemNamesAsync(folderPath, options) {
return await FileSystem._wrapExceptionAsync(async () => {
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
const fileNames = await fsx.readdir(folderPath);

@@ -354,2 +367,42 @@ if (options.absolutePaths) {

/**
* Reads the contents of the folder, not including "." or "..", returning objects including the
* entry names and types.
* Behind the scenes it uses `fs.readdirSync()`.
* @param folderPath - The absolute or relative path to the folder which should be read.
* @param options - Optional settings that can change the behavior. Type: `IReadFolderOptions`
*/
static readFolderItems(folderPath, options) {
return FileSystem._wrapException(() => {
options = Object.assign(Object.assign({}, READ_FOLDER_DEFAULT_OPTIONS), options);
const folderEntries = fsx.readdirSync(folderPath, { withFileTypes: true });
if (options.absolutePaths) {
return folderEntries.map((folderEntry) => {
folderEntry.name = nodeJsPath.resolve(folderPath, folderEntry.name);
return folderEntry;
});
}
else {
return folderEntries;
}
});
}
/**
* An async version of {@link FileSystem.readFolderItems}.
*/
static async readFolderItemsAsync(folderPath, options) {
return await FileSystem._wrapExceptionAsync(async () => {
options = Object.assign(Object.assign({}, READ_FOLDER_DEFAULT_OPTIONS), options);
const folderEntries = await LegacyAdapters_1.LegacyAdapters.convertCallbackToPromise(fs.readdir, folderPath, { withFileTypes: true });
if (options.absolutePaths) {
return folderEntries.map((folderEntry) => {
folderEntry.name = nodeJsPath.resolve(folderPath, folderEntry.name);
return folderEntry;
});
}
else {
return folderEntries;
}
});
}
/**
* Deletes a folder, including all of its contents.

@@ -592,3 +645,3 @@ * Behind the scenes is uses `fs-extra.removeSync()`.

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

@@ -595,0 +648,0 @@ }

2

lib/index.d.ts

@@ -28,3 +28,3 @@ /**

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

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

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

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

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

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

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

@@ -0,0 +0,0 @@ # @rushstack/node-core-library

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

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