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.23.0 to 3.23.1

12

CHANGELOG.json

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

{
"version": "3.23.1",
"tag": "@rushstack/node-core-library_v3.23.1",
"date": "Thu, 28 May 2020 05:59:02 GMT",
"comments": {
"patch": [
{
"comment": "Improve async callstacks for FileSystem API (when using Node 12)"
}
]
}
},
{
"version": "3.23.0",

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

9

CHANGELOG.md
# Change Log - @rushstack/node-core-library
This log was last generated on Wed, 27 May 2020 05:15:10 GMT and should not be manually modified.
This log was last generated on Thu, 28 May 2020 05:59:02 GMT and should not be manually modified.
## 3.23.1
Thu, 28 May 2020 05:59:02 GMT
### Patches
- Improve async callstacks for FileSystem API (when using Node 12)
## 3.23.0

@@ -6,0 +13,0 @@ Wed, 27 May 2020 05:15:10 GMT

282

lib/FileSystem.js

@@ -88,4 +88,6 @@ "use strict";

static getStatisticsAsync(path) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.stat(path);
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => {
return fsx.stat(path);
});
});

@@ -109,6 +111,8 @@ }

static updateTimesAsync(path, times) {
return FileSystem._wrapExceptionAsync(() => {
// This cast is needed because the fs-extra typings require both parameters
// to have the same type (number or Date), whereas Node.js does not require that.
return fsx.utimes(path, times.accessedTime, times.modifiedTime);
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
// This cast is needed because the fs-extra typings require both parameters
// to have the same type (number or Date), whereas Node.js does not require that.
return fsx.utimes(path, times.accessedTime, times.modifiedTime);
});
});

@@ -131,4 +135,6 @@ }

static changePosixModeBitsAsync(path, mode) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.chmod(path, mode);
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.chmod(path, mode);
});
});

@@ -155,5 +161,7 @@ }

static getPosixModeBitsAsync(path) {
return FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
return (yield FileSystem.getStatisticsAsync(path)).mode;
}));
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
return (yield FileSystem.getStatisticsAsync(path)).mode;
}));
});
}

@@ -209,21 +217,23 @@ /**

static moveAsync(options) {
return FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, MOVE_DEFAULT_OPTIONS, options);
try {
yield fsx.move(options.sourcePath, options.destinationPath, { overwrite: options.overwrite });
}
catch (error) {
if (options.ensureFolderExists) {
if (!FileSystem.isNotExistError(error)) {
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, MOVE_DEFAULT_OPTIONS, options);
try {
yield fsx.move(options.sourcePath, options.destinationPath, { overwrite: options.overwrite });
}
catch (error) {
if (options.ensureFolderExists) {
if (!FileSystem.isNotExistError(error)) {
throw error;
}
const folderPath = nodeJsPath.dirname(options.destinationPath);
yield FileSystem.ensureFolderAsync(nodeJsPath.dirname(folderPath));
yield fsx.move(options.sourcePath, options.destinationPath, { overwrite: options.overwrite });
}
else {
throw error;
}
const folderPath = nodeJsPath.dirname(options.destinationPath);
yield FileSystem.ensureFolderAsync(nodeJsPath.dirname(folderPath));
yield fsx.move(options.sourcePath, options.destinationPath, { overwrite: options.overwrite });
}
else {
throw error;
}
}
}));
}));
});
}

@@ -249,4 +259,6 @@ // ===============

static ensureFolderAsync(folderPath) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.ensureDir(folderPath);
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.ensureDir(folderPath);
});
});

@@ -277,13 +289,15 @@ }

static readFolderAsync(folderPath, options) {
return FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = 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 = yield fsx.readdir(folderPath);
if (options.absolutePaths) {
return fileNames.map(fileName => nodeJsPath.resolve(folderPath, fileName));
}
else {
return fileNames;
}
}));
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = 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 = yield fsx.readdir(folderPath);
if (options.absolutePaths) {
return fileNames.map(fileName => nodeJsPath.resolve(folderPath, fileName));
}
else {
return fileNames;
}
}));
});
}

@@ -306,4 +320,6 @@ /**

static deleteFolderAsync(folderPath) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.remove(folderPath);
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.remove(folderPath);
});
});

@@ -328,4 +344,6 @@ }

static ensureEmptyFolderAsync(folderPath) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.emptyDir(folderPath);
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.emptyDir(folderPath);
});
});

@@ -373,24 +391,26 @@ }

static writeFileAsync(filePath, contents, options) {
return FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, WRITE_FILE_DEFAULT_OPTIONS, options);
if (options.convertLineEndings) {
contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);
}
try {
yield fsx.writeFile(filePath, contents, { encoding: options.encoding });
}
catch (error) {
if (options.ensureFolderExists) {
if (!FileSystem.isNotExistError(error)) {
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, WRITE_FILE_DEFAULT_OPTIONS, options);
if (options.convertLineEndings) {
contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);
}
try {
yield fsx.writeFile(filePath, contents, { encoding: options.encoding });
}
catch (error) {
if (options.ensureFolderExists) {
if (!FileSystem.isNotExistError(error)) {
throw error;
}
const folderPath = nodeJsPath.dirname(filePath);
yield FileSystem.ensureFolderAsync(folderPath);
yield fsx.writeFile(filePath, contents, { encoding: options.encoding });
}
else {
throw error;
}
const folderPath = nodeJsPath.dirname(filePath);
yield FileSystem.ensureFolderAsync(folderPath);
yield fsx.writeFile(filePath, contents, { encoding: options.encoding });
}
else {
throw error;
}
}
}));
}));
});
}

@@ -434,24 +454,26 @@ /**

static appendToFileAsync(filePath, contents, options) {
return FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, APPEND_TO_FILE_DEFAULT_OPTIONS, options);
if (options.convertLineEndings) {
contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);
}
try {
yield fsx.appendFile(filePath, contents, { encoding: options.encoding });
}
catch (error) {
if (options.ensureFolderExists) {
if (!FileSystem.isNotExistError(error)) {
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, APPEND_TO_FILE_DEFAULT_OPTIONS, options);
if (options.convertLineEndings) {
contents = Text_1.Text.convertTo(contents.toString(), options.convertLineEndings);
}
try {
yield fsx.appendFile(filePath, contents, { encoding: options.encoding });
}
catch (error) {
if (options.ensureFolderExists) {
if (!FileSystem.isNotExistError(error)) {
throw error;
}
const folderPath = nodeJsPath.dirname(filePath);
yield FileSystem.ensureFolderAsync(folderPath);
yield fsx.appendFile(filePath, contents, { encoding: options.encoding });
}
else {
throw error;
}
const folderPath = nodeJsPath.dirname(filePath);
yield FileSystem.ensureFolderAsync(folderPath);
yield fsx.appendFile(filePath, contents, { encoding: options.encoding });
}
else {
throw error;
}
}
}));
}));
});
}

@@ -478,10 +500,12 @@ /**

static readFileAsync(filePath, options) {
return FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, READ_FILE_DEFAULT_OPTIONS, options);
let contents = (yield FileSystem.readFileToBufferAsync(filePath)).toString(options.encoding);
if (options.convertLineEndings) {
contents = Text_1.Text.convertTo(contents, options.convertLineEndings);
}
return contents;
}));
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, READ_FILE_DEFAULT_OPTIONS, options);
let contents = (yield FileSystem.readFileToBufferAsync(filePath)).toString(options.encoding);
if (options.convertLineEndings) {
contents = Text_1.Text.convertTo(contents, options.convertLineEndings);
}
return contents;
}));
});
}

@@ -502,4 +526,6 @@ /**

static readFileToBufferAsync(filePath) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.readFile(filePath);
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => {
return fsx.readFile(filePath);
});
});

@@ -521,4 +547,6 @@ }

static copyFileAsync(options) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.copy(options.sourcePath, options.destinationPath);
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.copy(options.sourcePath, options.destinationPath);
});
});

@@ -549,13 +577,15 @@ }

static deleteFileAsync(filePath, options) {
return FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, DELETE_FILE_DEFAULT_OPTIONS, options);
try {
yield fsx.unlink(filePath);
}
catch (error) {
if (options.throwIfNotExists || !FileSystem.isNotExistError(error)) {
throw error;
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => __awaiter(this, void 0, void 0, function* () {
options = Object.assign({}, DELETE_FILE_DEFAULT_OPTIONS, options);
try {
yield fsx.unlink(filePath);
}
}
}));
catch (error) {
if (options.throwIfNotExists || !FileSystem.isNotExistError(error)) {
throw error;
}
}
}));
});
}

@@ -579,4 +609,6 @@ // ===============

static getLinkStatisticsAsync(path) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.lstat(path);
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => {
return fsx.lstat(path);
});
});

@@ -604,4 +636,6 @@ }

static readLinkAsync(path) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.readlink(path);
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => {
return fsx.readlink(path);
});
});

@@ -623,5 +657,7 @@ }

static createSymbolicLinkJunctionAsync(options) {
return FileSystem._wrapExceptionAsync(() => {
// For directories, we use a Windows "junction". On POSIX operating systems, this produces a regular symlink.
return fsx.symlink(options.linkTargetPath, options.newLinkPath, 'junction');
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
// For directories, we use a Windows "junction". On POSIX operating systems, this produces a regular symlink.
return fsx.symlink(options.linkTargetPath, options.newLinkPath, 'junction');
});
});

@@ -642,4 +678,6 @@ }

static createSymbolicLinkFileAsync(options) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.symlink(options.linkTargetPath, options.newLinkPath, 'file');
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.symlink(options.linkTargetPath, options.newLinkPath, 'file');
});
});

@@ -660,4 +698,6 @@ }

static createSymbolicLinkFolderAsync(options) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.symlink(options.linkTargetPath, options.newLinkPath, 'dir');
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.symlink(options.linkTargetPath, options.newLinkPath, 'dir');
});
});

@@ -678,4 +718,6 @@ }

static createHardLinkAsync(options) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.link(options.linkTargetPath, options.newLinkPath);
return __awaiter(this, void 0, void 0, function* () {
yield FileSystem._wrapExceptionAsync(() => {
return fsx.link(options.linkTargetPath, options.newLinkPath);
});
});

@@ -697,4 +739,6 @@ }

static getRealPathAsync(linkPath) {
return FileSystem._wrapExceptionAsync(() => {
return fsx.realpath(linkPath);
return __awaiter(this, void 0, void 0, function* () {
return yield FileSystem._wrapExceptionAsync(() => {
return fsx.realpath(linkPath);
});
});

@@ -701,0 +745,0 @@ }

{
"name": "@rushstack/node-core-library",
"version": "3.23.0",
"version": "3.23.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 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