Socket
Socket
Sign inDemoInstall

@file-services/overlay

Package Overview
Dependencies
Maintainers
4
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 8.3.3 to 9.0.0

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export * from './overlay-fs';
export * from "./overlay-fs";
//# sourceMappingURL=index.d.ts.map

@@ -1,3 +0,3 @@

import type { IFileSystem } from '@file-services/types';
import type { IFileSystem } from "@file-services/types";
export declare function createOverlayFs(lowerFs: IFileSystem, upperFs: IFileSystem, baseDirectoryPath?: string): IFileSystem;
//# sourceMappingURL=overlay-fs.d.ts.map
{
"name": "@file-services/overlay",
"description": "Overlay files and directories from one file system on top of another.",
"version": "8.3.3",
"version": "9.0.0",
"main": "./dist/fs-overlay.cjs",

@@ -21,4 +21,4 @@ "types": "./dist/index.d.ts",

"dependencies": {
"@file-services/types": "^8.3.3",
"@file-services/utils": "^8.3.3"
"@file-services/types": "^9.0.0",
"@file-services/utils": "^9.0.0"
},

@@ -25,0 +25,0 @@ "files": [

@@ -26,10 +26,10 @@ # @file-services/overlay

```ts
import { createOverlayFs } from '@file-services/overlay';
import { createMemoryFs } from '@file-services/memory';
import { nodeFs } from '@file-services/node';
import { createOverlayFs } from "@file-services/overlay";
import { createMemoryFs } from "@file-services/memory";
import { nodeFs } from "@file-services/node";
const memFs = createMemoryFs({
src: {
'a.txt': `A`,
'b.txt': `B`,
"a.txt": `A`,
"b.txt": `B`,
},

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

@@ -1,1 +0,1 @@

export * from './overlay-fs';
export * from "./overlay-fs";

@@ -10,4 +10,4 @@ import type {

BufferEncoding,
} from '@file-services/types';
import { createFileSystem } from '@file-services/utils';
} from "@file-services/types";
import { createFileSystem } from "@file-services/utils";

@@ -19,3 +19,3 @@ const getEntryName = (item: IDirectoryEntry) => item.name;

upperFs: IFileSystem,
baseDirectoryPath = lowerFs.cwd()
baseDirectoryPath = lowerFs.cwd(),
): IFileSystem {

@@ -34,7 +34,7 @@ const { promises: lowerPromises } = lowerFs;

if (
relativeToBase !== '..' &&
relativeToBase !== ".." &&
!relativeToBase.startsWith(lowerFsRelativeUp) &&
!lowerFs.isAbsolute(relativeToBase)
) {
return { resolvedLowerPath, resolvedUpperPath: relativeToBase.replace(/\\/g, '/') };
return { resolvedLowerPath, resolvedUpperPath: relativeToBase.replace(/\\/g, "/") };
} else {

@@ -100,3 +100,3 @@ return { resolvedLowerPath };

return lowerFs.readFileSync(resolvedLowerPath, ...args);
} as IBaseFileSystemSyncActions['readFileSync'],
} as IBaseFileSystemSyncActions["readFileSync"],
statSync: function (path: string, ...args: []) {

@@ -115,3 +115,3 @@ const { resolvedLowerPath, resolvedUpperPath } = resolvePaths(path);

return lowerFs.statSync(resolvedLowerPath, ...args);
} as IBaseFileSystemSyncActions['statSync'],
} as IBaseFileSystemSyncActions["statSync"],
lstatSync: function lstatSync(path: string, ...args: []) {

@@ -130,3 +130,3 @@ const { resolvedLowerPath, resolvedUpperPath } = resolvePaths(path);

return lowerFs.lstatSync(resolvedLowerPath, ...args);
} as IBaseFileSystemSyncActions['lstatSync'],
} as IBaseFileSystemSyncActions["lstatSync"],
realpathSync,

@@ -157,3 +157,3 @@ readlinkSync(path) {

const resInLower = lowerFs.readdirSync(resolvedLowerPath, options);
if (options !== null && typeof options === 'object' && options.withFileTypes) {
if (options !== null && typeof options === "object" && options.withFileTypes) {
const namesInUpper = new Set<string>(resInUpper.map(getEntryName));

@@ -173,3 +173,3 @@ return [...resInLower.filter((item) => !namesInUpper.has(item.name)), ...resInUpper];

return lowerFs.readdirSync(resolvedLowerPath, options);
}) as IBaseFileSystemSyncActions['readdirSync'],
}) as IBaseFileSystemSyncActions["readdirSync"],
};

@@ -196,3 +196,3 @@

return lowerPromises.readFile(resolvedLowerPath, ...args);
} as IBaseFileSystemPromiseActions['readFile'],
} as IBaseFileSystemPromiseActions["readFile"],
async stat(path) {

@@ -249,3 +249,3 @@ const { resolvedLowerPath, resolvedUpperPath } = resolvePaths(path);

const resInLower = await lowerPromises.readdir(resolvedLowerPath, options);
if (options !== null && typeof options === 'object' && options.withFileTypes) {
if (options !== null && typeof options === "object" && options.withFileTypes) {
const namesInUpper = new Set<string>(resInUpper.map(getEntryName));

@@ -264,3 +264,3 @@ return [...resInLower.filter((item) => !namesInUpper.has(item.name)), ...resInUpper];

return lowerPromises.readdir(resolvedLowerPath, options);
} as IBaseFileSystemPromiseActions['readdir'],
} as IBaseFileSystemPromiseActions["readdir"],
};

@@ -285,9 +285,9 @@

path: string,
options?: ReadFileOptions | CallbackFn<Buffer>,
callback?: CallbackFn<string> | CallbackFn<Buffer> | CallbackFn<string | Buffer>
options?: ReadFileOptions | CallbackFn<Uint8Array>,
callback?: CallbackFn<string> | CallbackFn<Uint8Array> | CallbackFn<string | Uint8Array>,
): void {
if (typeof options === 'function') {
if (typeof options === "function") {
callback = options;
options = undefined;
} else if (typeof callback !== 'function') {
} else if (typeof callback !== "function") {
throw new Error(`callback is not a function.`);

@@ -299,9 +299,9 @@ }

if (upperError) {
lowerFs.readFile(resolvedLowerPath, options as BufferEncoding, callback as CallbackFn<string | Buffer>);
lowerFs.readFile(resolvedLowerPath, options as BufferEncoding, callback as CallbackFn<string | Uint8Array>);
} else {
(callback as CallbackFn<string | Buffer>)(upperError, upperValue);
(callback as CallbackFn<string | Uint8Array>)(upperError, upperValue);
}
});
} else {
lowerFs.readFile(resolvedLowerPath, options, callback as CallbackFn<string | Buffer>);
lowerFs.readFile(resolvedLowerPath, options, callback as CallbackFn<string | Uint8Array>);
}

@@ -368,8 +368,8 @@ },

options: string | { withFileTypes?: boolean } | undefined | null | CallbackFn<string[]>,
callback?: CallbackFn<string[]> | CallbackFn<IDirectoryEntry[]>
callback?: CallbackFn<string[]> | CallbackFn<IDirectoryEntry[]>,
) {
if (typeof options === 'function') {
if (typeof options === "function") {
callback = options;
options = undefined;
} else if (typeof callback !== 'function') {
} else if (typeof callback !== "function") {
throw new Error(`callback is not a function.`);

@@ -384,3 +384,3 @@ }

options as { withFileTypes: true },
callback as CallbackFn<IDirectoryEntry[]>
callback as CallbackFn<IDirectoryEntry[]>,
);

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

} else {
if (options !== null && typeof options === 'object' && options.withFileTypes) {
if (options !== null && typeof options === "object" && options.withFileTypes) {
const namesInUpper = new Set<string>(resInUpper.map(getEntryName));

@@ -409,3 +409,3 @@ const combined = [...resInLower.filter((item) => !namesInUpper.has(item.name)), ...resInUpper];

options as { withFileTypes: true },
callback as CallbackFn<IDirectoryEntry[]>
callback as CallbackFn<IDirectoryEntry[]>,
);

@@ -412,0 +412,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