@yarnpkg/fslib
Advanced tools
Comparing version 3.0.0-rc.18 to 3.0.0-rc.20
@@ -37,5 +37,1 @@ export declare function EBUSY(message: string): Error & { | ||
}; | ||
export declare class LibzipError extends Error { | ||
code: string; | ||
constructor(message: string, code: string); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LibzipError = exports.ERR_DIR_CLOSED = exports.EOPNOTSUPP = exports.ENOTEMPTY = exports.EROFS = exports.EEXIST = exports.EISDIR = exports.ENOTDIR = exports.ENOENT = exports.EBADF = exports.EINVAL = exports.ENOSYS = exports.EBUSY = void 0; | ||
exports.ERR_DIR_CLOSED = exports.EOPNOTSUPP = exports.ENOTEMPTY = exports.EROFS = exports.EEXIST = exports.EISDIR = exports.ENOTDIR = exports.ENOENT = exports.EBADF = exports.EINVAL = exports.ENOSYS = exports.EBUSY = void 0; | ||
function makeError(code, message) { | ||
@@ -56,10 +56,1 @@ return Object.assign(new Error(`${code}: ${message}`), { code }); | ||
exports.ERR_DIR_CLOSED = ERR_DIR_CLOSED; | ||
// ------------------------------------------------------------------------ | ||
class LibzipError extends Error { | ||
constructor(message, code) { | ||
super(message); | ||
this.name = `Libzip Error`; | ||
this.code = code; | ||
} | ||
} | ||
exports.LibzipError = LibzipError; |
import * as constants from './constants'; | ||
import * as errors from './errors'; | ||
import * as statUtils from './statUtils'; | ||
export { constants }; | ||
export { errors }; | ||
export { statUtils }; | ||
export type { LinkStrategy } from './algorithms/copyPromise'; | ||
export { setupCopyIndex } from './algorithms/copyPromise'; | ||
export { opendir } from './algorithms/opendir'; | ||
export { statUtils }; | ||
export { watchFile, unwatchFile, unwatchAllFiles } from './algorithms/watchFile'; | ||
export { normalizeLineEndings } from './FakeFS'; | ||
@@ -24,5 +27,4 @@ export type { BufferEncodingOrBuffer } from './FakeFS'; | ||
export type { OpendirOptions } from './FakeFS'; | ||
export type { StatOptions, StatSyncOptions } from './FakeFS'; | ||
export type { Stats, BigIntStats } from './FakeFS'; | ||
export { DEFAULT_COMPRESSION_LEVEL } from './ZipFS'; | ||
export type { ZipCompression } from './ZipFS'; | ||
export { PortablePath, Filename } from './path'; | ||
@@ -33,3 +35,3 @@ export type { FSPath, Path, NativePath } from './path'; | ||
export { AliasFS } from './AliasFS'; | ||
export { FakeFS } from './FakeFS'; | ||
export { FakeFS, BasePortableFakeFS } from './FakeFS'; | ||
export { CwdFS } from './CwdFS'; | ||
@@ -45,6 +47,4 @@ export { JailFS } from './JailFS'; | ||
export { VirtualFS } from './VirtualFS'; | ||
export { ZipFS } from './ZipFS'; | ||
export { ZipOpenFS } from './ZipOpenFS'; | ||
export { patchFs, extendFs } from './patchFs/patchFs'; | ||
export { xfs } from './xfs'; | ||
export type { XFS } from './xfs'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.xfs = exports.extendFs = exports.patchFs = exports.ZipOpenFS = exports.ZipFS = exports.VirtualFS = exports.ProxiedFS = exports.PosixFS = exports.NodeFS = exports.NoFS = exports.MountFS = exports.LazyFS = exports.JailFS = exports.CwdFS = exports.FakeFS = exports.AliasFS = exports.toFilename = exports.ppath = exports.npath = exports.Filename = exports.PortablePath = exports.DEFAULT_COMPRESSION_LEVEL = exports.normalizeLineEndings = exports.statUtils = exports.opendir = exports.setupCopyIndex = exports.constants = void 0; | ||
exports.xfs = exports.extendFs = exports.patchFs = exports.VirtualFS = exports.ProxiedFS = exports.PosixFS = exports.NodeFS = exports.NoFS = exports.MountFS = exports.LazyFS = exports.JailFS = exports.CwdFS = exports.BasePortableFakeFS = exports.FakeFS = exports.AliasFS = exports.toFilename = exports.ppath = exports.npath = exports.Filename = exports.PortablePath = exports.normalizeLineEndings = exports.unwatchAllFiles = exports.unwatchFile = exports.watchFile = exports.opendir = exports.setupCopyIndex = exports.statUtils = exports.errors = exports.constants = void 0; | ||
const tslib_1 = require("tslib"); | ||
const constants = tslib_1.__importStar(require("./constants")); | ||
exports.constants = constants; | ||
const errors = tslib_1.__importStar(require("./errors")); | ||
exports.errors = errors; | ||
const statUtils = tslib_1.__importStar(require("./statUtils")); | ||
@@ -13,6 +15,8 @@ exports.statUtils = statUtils; | ||
Object.defineProperty(exports, "opendir", { enumerable: true, get: function () { return opendir_1.opendir; } }); | ||
var watchFile_1 = require("./algorithms/watchFile"); | ||
Object.defineProperty(exports, "watchFile", { enumerable: true, get: function () { return watchFile_1.watchFile; } }); | ||
Object.defineProperty(exports, "unwatchFile", { enumerable: true, get: function () { return watchFile_1.unwatchFile; } }); | ||
Object.defineProperty(exports, "unwatchAllFiles", { enumerable: true, get: function () { return watchFile_1.unwatchAllFiles; } }); | ||
var FakeFS_1 = require("./FakeFS"); | ||
Object.defineProperty(exports, "normalizeLineEndings", { enumerable: true, get: function () { return FakeFS_1.normalizeLineEndings; } }); | ||
var ZipFS_1 = require("./ZipFS"); | ||
Object.defineProperty(exports, "DEFAULT_COMPRESSION_LEVEL", { enumerable: true, get: function () { return ZipFS_1.DEFAULT_COMPRESSION_LEVEL; } }); | ||
var path_1 = require("./path"); | ||
@@ -29,2 +33,3 @@ Object.defineProperty(exports, "PortablePath", { enumerable: true, get: function () { return path_1.PortablePath; } }); | ||
Object.defineProperty(exports, "FakeFS", { enumerable: true, get: function () { return FakeFS_2.FakeFS; } }); | ||
Object.defineProperty(exports, "BasePortableFakeFS", { enumerable: true, get: function () { return FakeFS_2.BasePortableFakeFS; } }); | ||
var CwdFS_1 = require("./CwdFS"); | ||
@@ -48,6 +53,2 @@ Object.defineProperty(exports, "CwdFS", { enumerable: true, get: function () { return CwdFS_1.CwdFS; } }); | ||
Object.defineProperty(exports, "VirtualFS", { enumerable: true, get: function () { return VirtualFS_1.VirtualFS; } }); | ||
var ZipFS_2 = require("./ZipFS"); | ||
Object.defineProperty(exports, "ZipFS", { enumerable: true, get: function () { return ZipFS_2.ZipFS; } }); | ||
var ZipOpenFS_1 = require("./ZipOpenFS"); | ||
Object.defineProperty(exports, "ZipOpenFS", { enumerable: true, get: function () { return ZipOpenFS_1.ZipOpenFS; } }); | ||
var patchFs_1 = require("./patchFs/patchFs"); | ||
@@ -54,0 +55,0 @@ Object.defineProperty(exports, "patchFs", { enumerable: true, get: function () { return patchFs_1.patchFs; } }); |
@@ -19,2 +19,3 @@ /// <reference types="node" /> | ||
filter?: RegExp | null; | ||
magicByte?: number; | ||
maxOpenFiles?: number; | ||
@@ -49,2 +50,3 @@ useCache?: boolean; | ||
private readonly getMountPoint; | ||
private readonly magic; | ||
private readonly maxAge; | ||
@@ -55,3 +57,3 @@ private readonly maxOpenFiles; | ||
private realPaths; | ||
constructor({ baseFs, filter, maxOpenFiles, useCache, maxAge, getMountPoint, factoryPromise, factorySync }: MountFSOptions<MountedFS>); | ||
constructor({ baseFs, filter, magicByte, maxOpenFiles, useCache, maxAge, getMountPoint, factoryPromise, factorySync }: MountFSOptions<MountedFS>); | ||
getExtractHint(hints: ExtractHintOptions): boolean; | ||
@@ -58,0 +60,0 @@ getRealPath(): PortablePath; |
@@ -19,5 +19,6 @@ "use strict"; | ||
const MOUNT_MASK = 0xff000000; | ||
const MOUNT_MAGIC = 0x2a000000; | ||
class MountFS extends FakeFS_1.BasePortableFakeFS { | ||
constructor({ baseFs = new NodeFS_1.NodeFS(), filter = null, maxOpenFiles = Infinity, useCache = true, maxAge = 5000, getMountPoint, factoryPromise, factorySync }) { | ||
constructor({ baseFs = new NodeFS_1.NodeFS(), filter = null, magicByte = 0x2a, maxOpenFiles = Infinity, useCache = true, maxAge = 5000, getMountPoint, factoryPromise, factorySync }) { | ||
if (Math.floor(magicByte) !== magicByte || !(magicByte > 1 && magicByte <= 127)) | ||
throw new Error(`The magic byte must be set to a round value between 1 and 127 included`); | ||
super(); | ||
@@ -36,2 +37,3 @@ this.fdMap = new Map(); | ||
this.getMountPoint = getMountPoint; | ||
this.magic = magicByte << 24; | ||
this.maxAge = maxAge; | ||
@@ -70,3 +72,3 @@ this.maxOpenFiles = maxOpenFiles; | ||
remapFd(mountFs, fd) { | ||
const remappedFd = this.nextFd++ | MOUNT_MAGIC; | ||
const remappedFd = this.nextFd++ | this.magic; | ||
this.fdMap.set(remappedFd, [mountFs, fd]); | ||
@@ -108,3 +110,3 @@ return remappedFd; | ||
async readPromise(fd, buffer, offset, length, position) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return await this.baseFs.readPromise(fd, buffer, offset, length, position); | ||
@@ -118,3 +120,3 @@ const entry = this.fdMap.get(fd); | ||
readSync(fd, buffer, offset, length, position) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.readSync(fd, buffer, offset, length, position); | ||
@@ -128,3 +130,3 @@ const entry = this.fdMap.get(fd); | ||
async writePromise(fd, buffer, offset, length, position) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) { | ||
if ((fd & MOUNT_MASK) !== this.magic) { | ||
if (typeof buffer === `string`) { | ||
@@ -149,3 +151,3 @@ return await this.baseFs.writePromise(fd, buffer, offset); | ||
writeSync(fd, buffer, offset, length, position) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) { | ||
if ((fd & MOUNT_MASK) !== this.magic) { | ||
if (typeof buffer === `string`) { | ||
@@ -170,3 +172,3 @@ return this.baseFs.writeSync(fd, buffer, offset); | ||
async closePromise(fd) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return await this.baseFs.closePromise(fd); | ||
@@ -181,3 +183,3 @@ const entry = this.fdMap.get(fd); | ||
closeSync(fd) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.closeSync(fd); | ||
@@ -281,3 +283,3 @@ const entry = this.fdMap.get(fd); | ||
async fstatPromise(fd, opts) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.fstatPromise(fd, opts); | ||
@@ -291,3 +293,3 @@ const entry = this.fdMap.get(fd); | ||
fstatSync(fd, opts) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.fstatSync(fd, opts); | ||
@@ -315,3 +317,3 @@ const entry = this.fdMap.get(fd); | ||
async fchmodPromise(fd, mask) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.fchmodPromise(fd, mask); | ||
@@ -325,3 +327,3 @@ const entry = this.fdMap.get(fd); | ||
fchmodSync(fd, mask) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.fchmodSync(fd, mask); | ||
@@ -349,3 +351,3 @@ const entry = this.fdMap.get(fd); | ||
async fchownPromise(fd, uid, gid) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.fchownPromise(fd, uid, gid); | ||
@@ -359,3 +361,3 @@ const entry = this.fdMap.get(fd); | ||
fchownSync(fd, uid, gid) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.fchownSync(fd, uid, gid); | ||
@@ -663,3 +665,3 @@ const entry = this.fdMap.get(fd); | ||
async ftruncatePromise(fd, len) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.ftruncatePromise(fd, len); | ||
@@ -673,3 +675,3 @@ const entry = this.fdMap.get(fd); | ||
ftruncateSync(fd, len) { | ||
if ((fd & MOUNT_MASK) !== MOUNT_MAGIC) | ||
if ((fd & MOUNT_MASK) !== this.magic) | ||
return this.baseFs.ftruncateSync(fd, len); | ||
@@ -741,3 +743,3 @@ const entry = this.fdMap.get(fd); | ||
filePath = this.pathUtils.join(filePath, mountPoint); | ||
if (this.isMount.has(filePath) === false) { | ||
if (!this.isMount.has(filePath)) { | ||
if (this.notMount.has(filePath)) | ||
@@ -787,3 +789,3 @@ continue; | ||
} | ||
if (this.limitOpenFilesTimeout === null && ((max === null && this.mountInstances.size > 0) || max !== null)) { | ||
if (this.limitOpenFilesTimeout === null && ((max === null && this.mountInstances.size > 0) || max !== null) && isFinite(nextExpiresAt)) { | ||
this.limitOpenFilesTimeout = setTimeout(() => { | ||
@@ -790,0 +792,0 @@ this.limitOpenFilesTimeout = null; |
{ | ||
"name": "@yarnpkg/fslib", | ||
"version": "3.0.0-rc.18", | ||
"version": "3.0.0-rc.20", | ||
"stableVersion": "2.7.0", | ||
"license": "BSD-2-Clause", | ||
"main": "./lib/index.js", | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@yarnpkg/libzip": "^3.0.0-rc.18", | ||
"tslib": "^2.4.0" | ||
}, | ||
"devDependencies": { | ||
"@yarnpkg/libzip": "^3.0.0-rc.20" | ||
}, | ||
"scripts": { | ||
@@ -21,3 +27,6 @@ "postpack": "rm -rf lib", | ||
"main": "./lib/index.js", | ||
"typings": "./lib/index.d.ts" | ||
"exports": { | ||
".": "./lib/index.js", | ||
"./package.json": "./package.json" | ||
} | ||
}, | ||
@@ -34,4 +43,3 @@ "files": [ | ||
"node": ">=14.15.0" | ||
}, | ||
"typings": "./lib/index.d.ts" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
2
219807
1
50
5633
- Removed@yarnpkg/libzip@^3.0.0-rc.18
- Removed@types/emscripten@1.39.13(transitive)
- Removed@yarnpkg/fslib@3.1.0(transitive)
- Removed@yarnpkg/libzip@3.1.0(transitive)