@parcel/fs
Advanced tools
Comparing version 2.0.0-canary.1735 to 2.0.0-canary.1736
@@ -62,3 +62,3 @@ var $cMIoD$path = require("path"); | ||
var $0f06d01047d305ef$exports = {}; | ||
$0f06d01047d305ef$exports = JSON.parse("{\"name\":\"@parcel/fs\",\"version\":\"2.0.0-canary.1735+f53f45037\",\"description\":\"Blazing fast, zero configuration web application bundler\",\"license\":\"MIT\",\"publishConfig\":{\"access\":\"public\"},\"funding\":{\"type\":\"opencollective\",\"url\":\"https://opencollective.com/parcel\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/parcel-bundler/parcel.git\"},\"main\":\"lib/index.js\",\"source\":\"src/index.js\",\"types\":\"index.d.ts\",\"engines\":{\"node\":\">= 16.0.0\"},\"targets\":{\"types\":false,\"main\":{\"includeNodeModules\":{\"@parcel/core\":false,\"@parcel/feature-flags\":false,\"@parcel/rust\":false,\"@parcel/types-internal\":false,\"@parcel/utils\":false,\"@parcel/watcher\":false,\"@parcel/watcher-watchman-js\":false,\"@parcel/workers\":false}},\"browser\":{\"includeNodeModules\":{\"@parcel/core\":false,\"@parcel/feature-flags\":false,\"@parcel/rust\":false,\"@parcel/types-internal\":false,\"@parcel/utils\":false,\"@parcel/watcher\":false,\"@parcel/watcher-watchman-js\":false,\"@parcel/workers\":false}}},\"scripts\":{\"build-ts\":\"mkdir -p lib && flow-to-ts src/types.js > lib/types.d.ts\",\"check-ts\":\"tsc --noEmit index.d.ts\"},\"dependencies\":{\"@parcel/feature-flags\":\"2.12.1-canary.3358+f53f45037\",\"@parcel/rust\":\"2.12.1-canary.3358+f53f45037\",\"@parcel/types-internal\":\"2.12.1-canary.3358+f53f45037\",\"@parcel/utils\":\"2.0.0-canary.1735+f53f45037\",\"@parcel/watcher\":\"^2.0.7\",\"@parcel/workers\":\"2.0.0-canary.1735+f53f45037\"},\"devDependencies\":{\"@parcel/watcher-watchman-js\":\"2.12.1-canary.3358+f53f45037\",\"graceful-fs\":\"^4.2.4\",\"ncp\":\"^2.0.0\",\"nullthrows\":\"^1.1.1\",\"utility-types\":\"^3.10.0\"},\"peerDependencies\":{\"@parcel/core\":\"^2.0.0-canary.1733+f53f45037\"},\"browser\":{\"@parcel/fs\":\"./lib/browser.js\",\"./src/NodeFS.js\":\"./src/NodeFS.browser.js\"},\"gitHead\":\"f53f4503799a07e3a01452f5e53ead44c30ebc53\"}"); | ||
$0f06d01047d305ef$exports = JSON.parse("{\"name\":\"@parcel/fs\",\"version\":\"2.0.0-canary.1736+046789362\",\"description\":\"Blazing fast, zero configuration web application bundler\",\"license\":\"MIT\",\"publishConfig\":{\"access\":\"public\"},\"funding\":{\"type\":\"opencollective\",\"url\":\"https://opencollective.com/parcel\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/parcel-bundler/parcel.git\"},\"main\":\"lib/index.js\",\"source\":\"src/index.js\",\"types\":\"index.d.ts\",\"engines\":{\"node\":\">= 16.0.0\"},\"targets\":{\"types\":false,\"main\":{\"includeNodeModules\":{\"@parcel/core\":false,\"@parcel/feature-flags\":false,\"@parcel/rust\":false,\"@parcel/types-internal\":false,\"@parcel/utils\":false,\"@parcel/watcher\":false,\"@parcel/watcher-watchman-js\":false,\"@parcel/workers\":false}},\"browser\":{\"includeNodeModules\":{\"@parcel/core\":false,\"@parcel/feature-flags\":false,\"@parcel/rust\":false,\"@parcel/types-internal\":false,\"@parcel/utils\":false,\"@parcel/watcher\":false,\"@parcel/watcher-watchman-js\":false,\"@parcel/workers\":false}}},\"scripts\":{\"build-ts\":\"mkdir -p lib && flow-to-ts src/types.js > lib/types.d.ts\",\"check-ts\":\"tsc --noEmit index.d.ts\"},\"dependencies\":{\"@parcel/feature-flags\":\"2.12.1-canary.3359+046789362\",\"@parcel/rust\":\"2.12.1-canary.3359+046789362\",\"@parcel/types-internal\":\"2.12.1-canary.3359+046789362\",\"@parcel/utils\":\"2.0.0-canary.1736+046789362\",\"@parcel/watcher\":\"^2.0.7\",\"@parcel/workers\":\"2.0.0-canary.1736+046789362\"},\"devDependencies\":{\"@parcel/watcher-watchman-js\":\"2.12.1-canary.3359+046789362\",\"graceful-fs\":\"^4.2.4\",\"ncp\":\"^2.0.0\",\"nullthrows\":\"^1.1.1\",\"utility-types\":\"^3.10.0\"},\"peerDependencies\":{\"@parcel/core\":\"^2.0.0-canary.1734+046789362\"},\"browser\":{\"@parcel/fs\":\"./lib/browser.js\",\"./src/NodeFS.js\":\"./src/NodeFS.browser.js\"},\"gitHead\":\"046789362d46cc453971642f683ef036af1b28e9\"}"); | ||
@@ -204,14 +204,18 @@ | ||
// get realpath by following symlinks | ||
if (realpath) { | ||
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($cMIoD$path))).parse(filePath); | ||
let parts = dir.slice(root.length).split((0, ($parcel$interopDefault($cMIoD$path))).sep).concat(base); | ||
let res = root; | ||
for (let part of parts){ | ||
res = (0, ($parcel$interopDefault($cMIoD$path))).join(res, part); | ||
let symlink = this.symlinks.get(res); | ||
if (symlink) res = symlink; | ||
} | ||
return res; | ||
let { root: root, dir: dir, base: base } = (0, ($parcel$interopDefault($cMIoD$path))).parse(filePath); | ||
let parts = dir.slice(root.length).split((0, ($parcel$interopDefault($cMIoD$path))).sep).concat(base); | ||
// If the realpath option is not true, don't follow the final link | ||
let last; | ||
if (!realpath) { | ||
last = parts[parts.length - 1]; | ||
parts = parts.slice(0, -1); | ||
} | ||
return filePath; | ||
let res = root; | ||
for (let part of parts){ | ||
res = (0, ($parcel$interopDefault($cMIoD$path))).join(res, part); | ||
let symlink = this.symlinks.get(res); | ||
if (symlink) res = symlink; | ||
} | ||
if (last) res = (0, ($parcel$interopDefault($cMIoD$path))).join(res, last); | ||
return res; | ||
} | ||
@@ -268,2 +272,19 @@ async writeFile(filePath, contents, options) { | ||
} | ||
lstatSync(filePath) { | ||
filePath = this._normalizePath(filePath, false); | ||
if (this.symlinks.has(filePath)) { | ||
let stat = new $10056bd3888f2e36$var$Stat(); | ||
stat.mode = $10056bd3888f2e36$var$S_IFLNK; | ||
return stat; | ||
} | ||
let dir = this.dirs.get(filePath); | ||
if (dir) return dir.stat(); | ||
let file = this.files.get(filePath); | ||
if (file == null) throw new $10056bd3888f2e36$export$d414276624ebf134('ENOENT', filePath, 'does not exist'); | ||
return file.stat(); | ||
} | ||
// eslint-disable-next-line require-await | ||
async lstat(filePath) { | ||
return this.lstatSync(filePath); | ||
} | ||
readdirSync(dir, opts) { | ||
@@ -450,2 +471,11 @@ dir = this._normalizePath(dir); | ||
} | ||
readlinkSync(filePath) { | ||
let symlink = this.symlinks.get(filePath); | ||
if (!symlink) throw new $10056bd3888f2e36$export$d414276624ebf134('EINVAL', filePath, 'is not a symlink'); | ||
return symlink; | ||
} | ||
// eslint-disable-next-line require-await | ||
async readlink(filePath) { | ||
return this.readlinkSync(filePath); | ||
} | ||
async symlink(target, path) { | ||
@@ -625,3 +655,3 @@ target = this._normalizePath(target); | ||
stat() { | ||
return new $10056bd3888f2e36$var$Stat(this); | ||
return $10056bd3888f2e36$var$Stat.fromEntry(this); | ||
} | ||
@@ -632,2 +662,3 @@ } | ||
ino = 0; | ||
mode = 0; | ||
nlink = 0; | ||
@@ -637,21 +668,32 @@ uid = 0; | ||
rdev = 0; | ||
size = 0; | ||
blksize = 0; | ||
blocks = 0; | ||
constructor(entry){ | ||
this.mode = entry.mode; | ||
this.size = entry.getSize(); | ||
this.atimeMs = entry.atime; | ||
this.mtimeMs = entry.mtime; | ||
this.ctimeMs = entry.ctime; | ||
this.birthtimeMs = entry.birthtime; | ||
this.atime = new Date(entry.atime); | ||
this.mtime = new Date(entry.mtime); | ||
this.ctime = new Date(entry.ctime); | ||
this.birthtime = new Date(entry.birthtime); | ||
atimeMs = 0; | ||
mtimeMs = 0; | ||
ctimeMs = 0; | ||
birthtimeMs = 0; | ||
atime = new Date(); | ||
mtime = new Date(); | ||
ctime = new Date(); | ||
birthtime = new Date(); | ||
static fromEntry(entry) { | ||
let stat = new $10056bd3888f2e36$var$Stat(); | ||
stat.mode = entry.mode; | ||
stat.size = entry.getSize(); | ||
stat.atimeMs = entry.atime; | ||
stat.mtimeMs = entry.mtime; | ||
stat.ctimeMs = entry.ctime; | ||
stat.birthtimeMs = entry.birthtime; | ||
stat.atime = new Date(entry.atime); | ||
stat.mtime = new Date(entry.mtime); | ||
stat.ctime = new Date(entry.ctime); | ||
stat.birthtime = new Date(entry.birthtime); | ||
return stat; | ||
} | ||
isFile() { | ||
return Boolean(this.mode & $10056bd3888f2e36$var$S_IFREG); | ||
return (this.mode & $10056bd3888f2e36$var$S_IFREG) === $10056bd3888f2e36$var$S_IFREG; | ||
} | ||
isDirectory() { | ||
return Boolean(this.mode & $10056bd3888f2e36$var$S_IFDIR); | ||
return (this.mode & $10056bd3888f2e36$var$S_IFDIR) === $10056bd3888f2e36$var$S_IFDIR; | ||
} | ||
@@ -665,3 +707,3 @@ isBlockDevice() { | ||
isSymbolicLink() { | ||
return false; | ||
return (this.mode & $10056bd3888f2e36$var$S_IFMT) === $10056bd3888f2e36$var$S_IFLNK; | ||
} | ||
@@ -931,2 +973,6 @@ isFIFO() { | ||
} | ||
// eslint-disable-next-line require-await | ||
async lstat(filePath) { | ||
return this.lstatSync(filePath); | ||
} | ||
async symlink(target, filePath) { | ||
@@ -1033,2 +1079,11 @@ target = this._normalizePath(target); | ||
} | ||
lstatSync(filePath) { | ||
filePath = this._normalizePath(filePath); | ||
try { | ||
return this.writable.lstatSync(filePath); | ||
} catch (e) { | ||
if (e.code === 'ENOENT') return this.readable.lstatSync(filePath); | ||
throw e; | ||
} | ||
} | ||
realpathSync(filePath) { | ||
@@ -1040,3 +1095,15 @@ filePath = this._deletedThrows(filePath); | ||
} | ||
readlinkSync(filePath) { | ||
filePath = this._deletedThrows(filePath); | ||
try { | ||
return this.writable.readlinkSync(filePath); | ||
} catch (err) { | ||
return this.readable.readlinkSync(filePath); | ||
} | ||
} | ||
// eslint-disable-next-line require-await | ||
async readlink(filePath) { | ||
return this.readlinkSync(filePath); | ||
} | ||
// eslint-disable-next-line require-await | ||
async exists(filePath) { | ||
@@ -1043,0 +1110,0 @@ return this.existsSync(filePath); |
{ | ||
"name": "@parcel/fs", | ||
"version": "2.0.0-canary.1735+f53f45037", | ||
"version": "2.0.0-canary.1736+046789362", | ||
"description": "Blazing fast, zero configuration web application bundler", | ||
@@ -55,11 +55,11 @@ "license": "MIT", | ||
"dependencies": { | ||
"@parcel/feature-flags": "2.12.1-canary.3358+f53f45037", | ||
"@parcel/rust": "2.12.1-canary.3358+f53f45037", | ||
"@parcel/types-internal": "2.12.1-canary.3358+f53f45037", | ||
"@parcel/utils": "2.0.0-canary.1735+f53f45037", | ||
"@parcel/feature-flags": "2.12.1-canary.3359+046789362", | ||
"@parcel/rust": "2.12.1-canary.3359+046789362", | ||
"@parcel/types-internal": "2.12.1-canary.3359+046789362", | ||
"@parcel/utils": "2.0.0-canary.1736+046789362", | ||
"@parcel/watcher": "^2.0.7", | ||
"@parcel/workers": "2.0.0-canary.1735+f53f45037" | ||
"@parcel/workers": "2.0.0-canary.1736+046789362" | ||
}, | ||
"devDependencies": { | ||
"@parcel/watcher-watchman-js": "2.12.1-canary.3358+f53f45037", | ||
"@parcel/watcher-watchman-js": "2.12.1-canary.3359+046789362", | ||
"graceful-fs": "^4.2.4", | ||
@@ -71,3 +71,3 @@ "ncp": "^2.0.0", | ||
"peerDependencies": { | ||
"@parcel/core": "^2.0.0-canary.1733+f53f45037" | ||
"@parcel/core": "^2.0.0-canary.1734+046789362" | ||
}, | ||
@@ -78,3 +78,3 @@ "browser": { | ||
}, | ||
"gitHead": "f53f4503799a07e3a01452f5e53ead44c30ebc53" | ||
"gitHead": "046789362d46cc453971642f683ef036af1b28e9" | ||
} |
@@ -148,18 +148,26 @@ // @flow | ||
// get realpath by following symlinks | ||
if (realpath) { | ||
let {root, dir, base} = path.parse(filePath); | ||
let parts = dir.slice(root.length).split(path.sep).concat(base); | ||
let res = root; | ||
for (let part of parts) { | ||
res = path.join(res, part); | ||
let symlink = this.symlinks.get(res); | ||
if (symlink) { | ||
res = symlink; | ||
} | ||
let {root, dir, base} = path.parse(filePath); | ||
let parts = dir.slice(root.length).split(path.sep).concat(base); | ||
// If the realpath option is not true, don't follow the final link | ||
let last; | ||
if (!realpath) { | ||
last = parts[parts.length - 1]; | ||
parts = parts.slice(0, -1); | ||
} | ||
let res = root; | ||
for (let part of parts) { | ||
res = path.join(res, part); | ||
let symlink = this.symlinks.get(res); | ||
if (symlink) { | ||
res = symlink; | ||
} | ||
} | ||
return res; | ||
if (last) { | ||
res = path.join(res, last); | ||
} | ||
return filePath; | ||
return res; | ||
} | ||
@@ -250,2 +258,29 @@ | ||
lstatSync(filePath: FilePath): Stat { | ||
filePath = this._normalizePath(filePath, false); | ||
if (this.symlinks.has(filePath)) { | ||
let stat = new Stat(); | ||
stat.mode = S_IFLNK; | ||
return stat; | ||
} | ||
let dir = this.dirs.get(filePath); | ||
if (dir) { | ||
return dir.stat(); | ||
} | ||
let file = this.files.get(filePath); | ||
if (file == null) { | ||
throw new FSError('ENOENT', filePath, 'does not exist'); | ||
} | ||
return file.stat(); | ||
} | ||
// eslint-disable-next-line require-await | ||
async lstat(filePath: FilePath): Promise<Stat> { | ||
return this.lstatSync(filePath); | ||
} | ||
readdirSync(dir: FilePath, opts?: ReaddirOptions): any { | ||
@@ -514,2 +549,15 @@ dir = this._normalizePath(dir); | ||
readlinkSync(filePath: FilePath): FilePath { | ||
let symlink = this.symlinks.get(filePath); | ||
if (!symlink) { | ||
throw new FSError('EINVAL', filePath, 'is not a symlink'); | ||
} | ||
return symlink; | ||
} | ||
// eslint-disable-next-line require-await | ||
async readlink(filePath: FilePath): Promise<FilePath> { | ||
return this.readlinkSync(filePath); | ||
} | ||
async symlink(target: FilePath, path: FilePath) { | ||
@@ -792,3 +840,3 @@ target = this._normalizePath(target); | ||
stat(): Stat { | ||
return new Stat(this); | ||
return Stat.fromEntry(this); | ||
} | ||
@@ -800,3 +848,3 @@ } | ||
ino: number = 0; | ||
mode: number; | ||
mode: number = 0; | ||
nlink: number = 0; | ||
@@ -806,33 +854,35 @@ uid: number = 0; | ||
rdev: number = 0; | ||
size: number; | ||
size: number = 0; | ||
blksize: number = 0; | ||
blocks: number = 0; | ||
atimeMs: number; | ||
mtimeMs: number; | ||
ctimeMs: number; | ||
birthtimeMs: number; | ||
atime: Date; | ||
mtime: Date; | ||
ctime: Date; | ||
birthtime: Date; | ||
atimeMs: number = 0; | ||
mtimeMs: number = 0; | ||
ctimeMs: number = 0; | ||
birthtimeMs: number = 0; | ||
atime: Date = new Date(); | ||
mtime: Date = new Date(); | ||
ctime: Date = new Date(); | ||
birthtime: Date = new Date(); | ||
constructor(entry: Entry) { | ||
this.mode = entry.mode; | ||
this.size = entry.getSize(); | ||
this.atimeMs = entry.atime; | ||
this.mtimeMs = entry.mtime; | ||
this.ctimeMs = entry.ctime; | ||
this.birthtimeMs = entry.birthtime; | ||
this.atime = new Date(entry.atime); | ||
this.mtime = new Date(entry.mtime); | ||
this.ctime = new Date(entry.ctime); | ||
this.birthtime = new Date(entry.birthtime); | ||
static fromEntry(entry: Entry): Stat { | ||
let stat = new Stat(); | ||
stat.mode = entry.mode; | ||
stat.size = entry.getSize(); | ||
stat.atimeMs = entry.atime; | ||
stat.mtimeMs = entry.mtime; | ||
stat.ctimeMs = entry.ctime; | ||
stat.birthtimeMs = entry.birthtime; | ||
stat.atime = new Date(entry.atime); | ||
stat.mtime = new Date(entry.mtime); | ||
stat.ctime = new Date(entry.ctime); | ||
stat.birthtime = new Date(entry.birthtime); | ||
return stat; | ||
} | ||
isFile(): boolean { | ||
return Boolean(this.mode & S_IFREG); | ||
return (this.mode & S_IFREG) === S_IFREG; | ||
} | ||
isDirectory(): boolean { | ||
return Boolean(this.mode & S_IFDIR); | ||
return (this.mode & S_IFDIR) === S_IFDIR; | ||
} | ||
@@ -849,3 +899,3 @@ | ||
isSymbolicLink(): boolean { | ||
return false; | ||
return (this.mode & S_IFMT) === S_IFLNK; | ||
} | ||
@@ -852,0 +902,0 @@ |
@@ -51,4 +51,6 @@ // @flow | ||
stat: any = promisify(fs.stat); | ||
lstat: any = promisify(fs.lstat); | ||
readdir: any = promisify(fs.readdir); | ||
symlink: any = promisify(fs.symlink); | ||
readlink: any = promisify(fs.readlink); | ||
unlink: any = promisify(fs.unlink); | ||
@@ -63,4 +65,6 @@ utimes: any = promisify(fs.utimes); | ||
statSync: (path: string) => Stats = path => fs.statSync(path); | ||
lstatSync: (path: string) => Stats = path => fs.lstatSync(path); | ||
realpathSync: (path: string, cache?: any) => string = | ||
process.platform === 'win32' ? fs.realpathSync : fs.realpathSync.native; | ||
readlinkSync: any = (fs.readlinkSync: any); | ||
existsSync: (path: string) => boolean = fs.existsSync; | ||
@@ -67,0 +71,0 @@ readdirSync: any = (fs.readdirSync: any); |
@@ -175,2 +175,7 @@ // @flow | ||
// eslint-disable-next-line require-await | ||
async lstat(filePath: FilePath): Promise<FileStats> { | ||
return this.lstatSync(filePath); | ||
} | ||
async symlink(target: FilePath, filePath: FilePath): Promise<void> { | ||
@@ -305,2 +310,14 @@ target = this._normalizePath(target); | ||
lstatSync(filePath: FilePath): FileStats { | ||
filePath = this._normalizePath(filePath); | ||
try { | ||
return this.writable.lstatSync(filePath); | ||
} catch (e) { | ||
if (e.code === 'ENOENT') { | ||
return this.readable.lstatSync(filePath); | ||
} | ||
throw e; | ||
} | ||
} | ||
realpathSync(filePath: FilePath): FilePath { | ||
@@ -315,3 +332,17 @@ filePath = this._deletedThrows(filePath); | ||
readlinkSync(filePath: FilePath): FilePath { | ||
filePath = this._deletedThrows(filePath); | ||
try { | ||
return this.writable.readlinkSync(filePath); | ||
} catch (err) { | ||
return this.readable.readlinkSync(filePath); | ||
} | ||
} | ||
// eslint-disable-next-line require-await | ||
async readlink(filePath: FilePath): Promise<FilePath> { | ||
return this.readlinkSync(filePath); | ||
} | ||
// eslint-disable-next-line require-await | ||
async exists(filePath: FilePath): Promise<boolean> { | ||
@@ -318,0 +349,0 @@ return this.existsSync(filePath); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
437678
5349
+ Addedcaniuse-lite@1.0.30001686(transitive)
+ Addeddotenv@16.4.6(transitive)
+ Addedelectron-to-chromium@1.5.68(transitive)
- Removedcaniuse-lite@1.0.30001685(transitive)
- Removeddotenv@16.4.5(transitive)
- Removedelectron-to-chromium@1.5.67(transitive)