Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@file-services/overlay

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@file-services/overlay - npm Package Compare versions

Comparing version 1.0.5 to 2.0.0

18

cjs/overlay-fs.js

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

function createOverlayFs(lowerFs, upperFs, baseDirectoryPath = lowerFs.cwd()) {
const { promises: lowerPromises, path: lowerPath } = lowerFs;
const { promises: lowerPromises } = lowerFs;
const { promises: upperPromises } = upperFs;
const lowerFsRelativeUp = `..${lowerPath.sep}`;
const lowerFsRelativeUp = `..${lowerFs.sep}`;
// ensure base Directory is absolute
baseDirectoryPath = lowerPath.resolve(baseDirectoryPath);
baseDirectoryPath = lowerFs.resolve(baseDirectoryPath);
function resolvePaths(path) {
const resolvedLowerPath = lowerPath.resolve(path);
const relativeToBase = lowerPath.relative(baseDirectoryPath, resolvedLowerPath);
if (!relativeToBase.startsWith(lowerFsRelativeUp) && !lowerPath.isAbsolute(lowerFsRelativeUp)) {
const resolvedLowerPath = lowerFs.resolve(path);
const relativeToBase = lowerFs.relative(baseDirectoryPath, resolvedLowerPath);
if (!relativeToBase.startsWith(lowerFsRelativeUp) && !lowerFs.isAbsolute(lowerFsRelativeUp)) {
return { resolvedLowerPath, resolvedUpperPath: relativeToBase.replace(/\\/g, '/') };

@@ -71,3 +71,3 @@ }

try {
return lowerPath.join(baseDirectoryPath, upperFs.realpathSync(resolvedUpperPath));
return lowerFs.join(baseDirectoryPath, upperFs.realpathSync(resolvedUpperPath));
}

@@ -161,3 +161,3 @@ catch (_a) {

try {
return lowerPath.join(baseDirectoryPath, await upperPromises.realpath(resolvedUpperPath));
return lowerFs.join(baseDirectoryPath, await upperPromises.realpath(resolvedUpperPath));
}

@@ -282,3 +282,3 @@ catch (_a) {

else {
callback(e, lowerPath.join(baseDirectoryPath, realPath));
callback(e, lowerFs.join(baseDirectoryPath, realPath));
}

@@ -285,0 +285,0 @@ });

import { createFileSystem } from '@file-services/utils';
export function createOverlayFs(lowerFs, upperFs, baseDirectoryPath = lowerFs.cwd()) {
const { promises: lowerPromises, path: lowerPath } = lowerFs;
const { promises: lowerPromises } = lowerFs;
const { promises: upperPromises } = upperFs;
const lowerFsRelativeUp = `..${lowerPath.sep}`;
const lowerFsRelativeUp = `..${lowerFs.sep}`;
// ensure base Directory is absolute
baseDirectoryPath = lowerPath.resolve(baseDirectoryPath);
baseDirectoryPath = lowerFs.resolve(baseDirectoryPath);
function resolvePaths(path) {
const resolvedLowerPath = lowerPath.resolve(path);
const relativeToBase = lowerPath.relative(baseDirectoryPath, resolvedLowerPath);
if (!relativeToBase.startsWith(lowerFsRelativeUp) && !lowerPath.isAbsolute(lowerFsRelativeUp)) {
const resolvedLowerPath = lowerFs.resolve(path);
const relativeToBase = lowerFs.relative(baseDirectoryPath, resolvedLowerPath);
if (!relativeToBase.startsWith(lowerFsRelativeUp) && !lowerFs.isAbsolute(lowerFsRelativeUp)) {
return { resolvedLowerPath, resolvedUpperPath: relativeToBase.replace(/\\/g, '/') };

@@ -68,3 +68,3 @@ }

try {
return lowerPath.join(baseDirectoryPath, upperFs.realpathSync(resolvedUpperPath));
return lowerFs.join(baseDirectoryPath, upperFs.realpathSync(resolvedUpperPath));
}

@@ -158,3 +158,3 @@ catch (_a) {

try {
return lowerPath.join(baseDirectoryPath, await upperPromises.realpath(resolvedUpperPath));
return lowerFs.join(baseDirectoryPath, await upperPromises.realpath(resolvedUpperPath));
}

@@ -279,3 +279,3 @@ catch (_a) {

else {
callback(e, lowerPath.join(baseDirectoryPath, realPath));
callback(e, lowerFs.join(baseDirectoryPath, realPath));
}

@@ -282,0 +282,0 @@ });

{
"name": "@file-services/overlay",
"description": "Overlay files and directories from one file system on top of another.",
"version": "1.0.5",
"version": "2.0.0",
"main": "cjs/index.js",

@@ -17,4 +17,4 @@ "module": "esm/index.js",

"dependencies": {
"@file-services/types": "^1.0.4",
"@file-services/utils": "^1.0.4"
"@file-services/types": "^2.0.0",
"@file-services/utils": "^2.0.0"
},

@@ -34,3 +34,3 @@ "files": [

"sideEffects": false,
"gitHead": "5324bae9c23054284cb0727692dae2b6a1cb1560"
"gitHead": "1a5d5c8e7ab35d213ba47fe0585ec5887df08d7c"
}

@@ -17,14 +17,14 @@ import {

): IFileSystem {
const { promises: lowerPromises, path: lowerPath } = lowerFs;
const { promises: lowerPromises } = lowerFs;
const { promises: upperPromises } = upperFs;
const lowerFsRelativeUp = `..${lowerPath.sep}`;
const lowerFsRelativeUp = `..${lowerFs.sep}`;
// ensure base Directory is absolute
baseDirectoryPath = lowerPath.resolve(baseDirectoryPath);
baseDirectoryPath = lowerFs.resolve(baseDirectoryPath);
function resolvePaths(path: string): { resolvedLowerPath: string; resolvedUpperPath?: string } {
const resolvedLowerPath = lowerPath.resolve(path);
const relativeToBase = lowerPath.relative(baseDirectoryPath, resolvedLowerPath);
const resolvedLowerPath = lowerFs.resolve(path);
const relativeToBase = lowerFs.relative(baseDirectoryPath, resolvedLowerPath);
if (!relativeToBase.startsWith(lowerFsRelativeUp) && !lowerPath.isAbsolute(lowerFsRelativeUp)) {
if (!relativeToBase.startsWith(lowerFsRelativeUp) && !lowerFs.isAbsolute(lowerFsRelativeUp)) {
return { resolvedLowerPath, resolvedUpperPath: relativeToBase.replace(/\\/g, '/') };

@@ -82,3 +82,3 @@ } else {

try {
return lowerPath.join(baseDirectoryPath, upperFs.realpathSync(resolvedUpperPath));
return lowerFs.join(baseDirectoryPath, upperFs.realpathSync(resolvedUpperPath));
} catch {

@@ -167,3 +167,3 @@ /**/

try {
return lowerPath.join(baseDirectoryPath, await upperPromises.realpath(resolvedUpperPath));
return lowerFs.join(baseDirectoryPath, await upperPromises.realpath(resolvedUpperPath));
} catch {

@@ -279,3 +279,3 @@ /**/

} else {
callback(e, lowerPath.join(baseDirectoryPath, realPath));
callback(e, lowerFs.join(baseDirectoryPath, realPath));
}

@@ -282,0 +282,0 @@ });

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