Socket
Socket
Sign inDemoInstall

@file-services/memory

Package Overview
Dependencies
Maintainers
4
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@file-services/memory - npm Package Compare versions

Comparing version 4.1.1 to 4.1.2

40

cjs/memory-fs.js

@@ -263,12 +263,28 @@ "use strict";

function realpathSync(nodePath) {
let actualPath = resolvePath(nodePath);
let node = getRawNode(actualPath);
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
actualPath = posixPath.resolve(posixPath.dirname(actualPath), node.target);
node = getRawNode(actualPath);
const resolvedPath = resolvePath(nodePath);
let currentPath = '/';
let node = root;
for (const depthName of resolvedPath.split(posixPath.sep)) {
if (!node) {
break;
}
if (depthName === '') {
continue;
}
if (node.type === 'dir') {
node = node.contents.get(depthName);
currentPath = posixPath.join(currentPath, depthName);
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
currentPath = posixPath.resolve(posixPath.dirname(currentPath), node.target);
node = getRawNode(currentPath);
}
}
else {
node = undefined;
}
}
if (!node) {
throw createFsError(actualPath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, error_codes_1.FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}
return actualPath;
return currentPath;
}

@@ -394,2 +410,3 @@ function readlinkSync(nodePath) {

function getRawNode(nodePath) {
let currentPath = '/';
let node = root;

@@ -400,11 +417,12 @@ for (const depthName of nodePath.split(posixPath.sep)) {

}
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
nodePath = posixPath.resolve(posixPath.dirname(nodePath), node.target);
node = getRawNode(nodePath);
}
if (depthName === '') {
continue;
}
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
currentPath = posixPath.resolve(posixPath.dirname(currentPath), node.target);
node = getRawNode(currentPath);
}
if ((node === null || node === void 0 ? void 0 : node.type) === 'dir') {
node = node.contents.get(depthName);
currentPath = posixPath.join(currentPath, depthName);
}

@@ -411,0 +429,0 @@ else {

@@ -255,12 +255,28 @@ import { createFileSystem, syncToAsyncFs, SetMultiMap } from '@file-services/utils';

function realpathSync(nodePath) {
let actualPath = resolvePath(nodePath);
let node = getRawNode(actualPath);
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
actualPath = posixPath.resolve(posixPath.dirname(actualPath), node.target);
node = getRawNode(actualPath);
const resolvedPath = resolvePath(nodePath);
let currentPath = '/';
let node = root;
for (const depthName of resolvedPath.split(posixPath.sep)) {
if (!node) {
break;
}
if (depthName === '') {
continue;
}
if (node.type === 'dir') {
node = node.contents.get(depthName);
currentPath = posixPath.join(currentPath, depthName);
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
currentPath = posixPath.resolve(posixPath.dirname(currentPath), node.target);
node = getRawNode(currentPath);
}
}
else {
node = undefined;
}
}
if (!node) {
throw createFsError(actualPath, FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}
return actualPath;
return currentPath;
}

@@ -386,2 +402,3 @@ function readlinkSync(nodePath) {

function getRawNode(nodePath) {
let currentPath = '/';
let node = root;

@@ -392,11 +409,12 @@ for (const depthName of nodePath.split(posixPath.sep)) {

}
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
nodePath = posixPath.resolve(posixPath.dirname(nodePath), node.target);
node = getRawNode(nodePath);
}
if (depthName === '') {
continue;
}
while ((node === null || node === void 0 ? void 0 : node.type) === 'symlink') {
currentPath = posixPath.resolve(posixPath.dirname(currentPath), node.target);
node = getRawNode(currentPath);
}
if ((node === null || node === void 0 ? void 0 : node.type) === 'dir') {
node = node.contents.get(depthName);
currentPath = posixPath.join(currentPath, depthName);
}

@@ -403,0 +421,0 @@ else {

{
"name": "@file-services/memory",
"description": "An in-memory, sync/async, file system implementation.",
"version": "4.1.1",
"version": "4.1.2",
"main": "cjs/index.js",

@@ -6,0 +6,0 @@ "module": "esm/index.js",

@@ -314,12 +314,27 @@ import { createFileSystem, syncToAsyncFs, SetMultiMap } from '@file-services/utils';

function realpathSync(nodePath: string): string {
let actualPath = resolvePath(nodePath);
let node = getRawNode(actualPath);
while (node?.type === 'symlink') {
actualPath = posixPath.resolve(posixPath.dirname(actualPath), node.target);
node = getRawNode(actualPath);
const resolvedPath = resolvePath(nodePath);
let currentPath = '/';
let node: IFsMemNodeType | undefined = root;
for (const depthName of resolvedPath.split(posixPath.sep)) {
if (!node) {
break;
}
if (depthName === '') {
continue;
}
if (node.type === 'dir') {
node = node.contents.get(depthName);
currentPath = posixPath.join(currentPath, depthName);
while (node?.type === 'symlink') {
currentPath = posixPath.resolve(posixPath.dirname(currentPath), node.target);
node = getRawNode(currentPath);
}
} else {
node = undefined;
}
}
if (!node) {
throw createFsError(actualPath, FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
throw createFsError(resolvedPath, FsErrorCodes.NO_FILE_OR_DIRECTORY, 'ENOENT');
}
return actualPath;
return currentPath;
}

@@ -471,2 +486,3 @@

function getRawNode(nodePath: string): IFsMemNodeType | undefined {
let currentPath = '/';
let node: IFsMemNodeType | undefined = root;

@@ -476,12 +492,13 @@ for (const depthName of nodePath.split(posixPath.sep)) {

break;
}
if (depthName === '') {
continue;
}
while (node?.type === 'symlink') {
nodePath = posixPath.resolve(posixPath.dirname(nodePath), node.target);
node = getRawNode(nodePath);
currentPath = posixPath.resolve(posixPath.dirname(currentPath), node.target);
node = getRawNode(currentPath);
}
if (depthName === '') {
continue;
}
if (node?.type === 'dir') {
node = node.contents.get(depthName);
currentPath = posixPath.join(currentPath, depthName);
} else {

@@ -488,0 +505,0 @@ node = undefined;

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