@yarnpkg/fslib
Advanced tools
Comparing version 2.7.0 to 2.7.1
@@ -12,3 +12,11 @@ "use strict"; | ||
const path_1 = require("./path"); | ||
const ZIP_FD = 0x80000000; | ||
// Only file descriptors prefixed by those values will be forwarded to the ZipFS | ||
// instances. Note that the highest ZIP_MAGIC bit MUST NOT be set, otherwise the | ||
// resulting fd becomes a negative integer, which isn't supposed to happen per | ||
// the unix rules (caused problems w/ Go). | ||
// | ||
// Those values must be synced with packages/yarnpkg-pnp/sources/esm-loader/fspatch.ts | ||
// | ||
const ZIP_MASK = 0xff000000; | ||
const ZIP_MAGIC = 0x2a000000; | ||
/** | ||
@@ -101,3 +109,3 @@ * Extracts the archive part (ending in the first instance of `extension`) from a path. | ||
remapFd(zipFs, fd) { | ||
const remappedFd = this.nextFd++ | ZIP_FD; | ||
const remappedFd = this.nextFd++ | ZIP_MAGIC; | ||
this.fdMap.set(remappedFd, [zipFs, fd]); | ||
@@ -139,3 +147,3 @@ return remappedFd; | ||
async readPromise(fd, buffer, offset, length, position) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return await this.baseFs.readPromise(fd, buffer, offset, length, position); | ||
@@ -149,3 +157,3 @@ const entry = this.fdMap.get(fd); | ||
readSync(fd, buffer, offset, length, position) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.readSync(fd, buffer, offset, length, position); | ||
@@ -159,3 +167,3 @@ const entry = this.fdMap.get(fd); | ||
async writePromise(fd, buffer, offset, length, position) { | ||
if ((fd & ZIP_FD) === 0) { | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) { | ||
if (typeof buffer === `string`) { | ||
@@ -180,3 +188,3 @@ return await this.baseFs.writePromise(fd, buffer, offset); | ||
writeSync(fd, buffer, offset, length, position) { | ||
if ((fd & ZIP_FD) === 0) { | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) { | ||
if (typeof buffer === `string`) { | ||
@@ -201,3 +209,3 @@ return this.baseFs.writeSync(fd, buffer, offset); | ||
async closePromise(fd) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return await this.baseFs.closePromise(fd); | ||
@@ -212,3 +220,3 @@ const entry = this.fdMap.get(fd); | ||
closeSync(fd) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.closeSync(fd); | ||
@@ -312,3 +320,3 @@ const entry = this.fdMap.get(fd); | ||
async fstatPromise(fd, opts) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.fstatPromise(fd, opts); | ||
@@ -322,3 +330,3 @@ const entry = this.fdMap.get(fd); | ||
fstatSync(fd, opts) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.fstatSync(fd, opts); | ||
@@ -346,3 +354,3 @@ const entry = this.fdMap.get(fd); | ||
async fchmodPromise(fd, mask) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.fchmodPromise(fd, mask); | ||
@@ -356,3 +364,3 @@ const entry = this.fdMap.get(fd); | ||
fchmodSync(fd, mask) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.fchmodSync(fd, mask); | ||
@@ -686,3 +694,3 @@ const entry = this.fdMap.get(fd); | ||
async ftruncatePromise(fd, len) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.ftruncatePromise(fd, len); | ||
@@ -696,3 +704,3 @@ const entry = this.fdMap.get(fd); | ||
ftruncateSync(fd, len) { | ||
if ((fd & ZIP_FD) === 0) | ||
if ((fd & ZIP_MASK) !== ZIP_MAGIC) | ||
return this.baseFs.ftruncateSync(fd, len); | ||
@@ -699,0 +707,0 @@ const entry = this.fdMap.get(fd); |
{ | ||
"name": "@yarnpkg/fslib", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"license": "BSD-2-Clause", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
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
273808
6984