@yarnpkg/fslib
Advanced tools
Comparing version 3.0.2 to 3.1.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.copyPromise = exports.setupCopyIndex = void 0; | ||
exports.setupCopyIndex = setupCopyIndex; | ||
exports.copyPromise = copyPromise; | ||
const tslib_1 = require("tslib"); | ||
@@ -19,3 +20,2 @@ const constants = tslib_1.__importStar(require("../constants")); | ||
} | ||
exports.setupCopyIndex = setupCopyIndex; | ||
async function copyPromise(destinationFs, destination, sourceFs, source, opts) { | ||
@@ -37,3 +37,2 @@ const normalizedDestination = destinationFs.pathUtils.normalize(destination); | ||
} | ||
exports.copyPromise = copyPromise; | ||
async function copyImpl(prelayout, postlayout, destinationFs, destination, sourceFs, source, opts) { | ||
@@ -40,0 +39,0 @@ const destinationStat = opts.didParentExist ? await maybeLStat(destinationFs, destination) : null; |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { NoParamCallback } from 'fs'; | ||
@@ -4,0 +2,0 @@ import { Dir, DirentNoPath, FakeFS } from '../FakeFS'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.opendir = exports.CustomDir = void 0; | ||
exports.CustomDir = void 0; | ||
exports.opendir = opendir; | ||
const tslib_1 = require("tslib"); | ||
@@ -66,2 +67,1 @@ const errors = tslib_1.__importStar(require("../errors")); | ||
} | ||
exports.opendir = opendir; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.unwatchAllFiles = exports.unwatchFile = exports.watchFile = void 0; | ||
exports.watchFile = watchFile; | ||
exports.unwatchFile = unwatchFile; | ||
exports.unwatchAllFiles = unwatchAllFiles; | ||
const CustomStatWatcher_1 = require("./watchFile/CustomStatWatcher"); | ||
@@ -42,3 +44,2 @@ const statWatchersByFakeFS = new WeakMap(); | ||
} | ||
exports.watchFile = watchFile; | ||
function unwatchFile(fakeFs, path, cb) { | ||
@@ -60,3 +61,2 @@ const statWatchers = statWatchersByFakeFS.get(fakeFs); | ||
} | ||
exports.unwatchFile = unwatchFile; | ||
function unwatchAllFiles(fakeFs) { | ||
@@ -70,2 +70,1 @@ const statWatchers = statWatchersByFakeFS.get(fakeFs); | ||
} | ||
exports.unwatchAllFiles = unwatchAllFiles; |
@@ -1,4 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
@@ -40,3 +37,3 @@ import { BigIntStats, Stats } from 'fs'; | ||
*/ | ||
makeInterval(opts: ListenerOptions): NodeJS.Timer; | ||
makeInterval(opts: ListenerOptions): NodeJS.Timeout; | ||
/** | ||
@@ -43,0 +40,0 @@ * Registers a listener and assigns it an interval. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CustomStatWatcher = exports.assertStatus = exports.Status = exports.Event = void 0; | ||
exports.CustomStatWatcher = exports.Status = exports.Event = void 0; | ||
exports.assertStatus = assertStatus; | ||
const tslib_1 = require("tslib"); | ||
@@ -23,3 +24,2 @@ const events_1 = require("events"); | ||
} | ||
exports.assertStatus = assertStatus; | ||
class CustomStatWatcher extends events_1.EventEmitter { | ||
@@ -26,0 +26,0 @@ static create(fakeFs, path, opts) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
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.EBUSY = EBUSY; | ||
exports.ENOSYS = ENOSYS; | ||
exports.EINVAL = EINVAL; | ||
exports.EBADF = EBADF; | ||
exports.ENOENT = ENOENT; | ||
exports.ENOTDIR = ENOTDIR; | ||
exports.EISDIR = EISDIR; | ||
exports.EEXIST = EEXIST; | ||
exports.EROFS = EROFS; | ||
exports.ENOTEMPTY = ENOTEMPTY; | ||
exports.EOPNOTSUPP = EOPNOTSUPP; | ||
exports.ERR_DIR_CLOSED = ERR_DIR_CLOSED; | ||
function makeError(code, message) { | ||
@@ -10,43 +21,32 @@ return Object.assign(new Error(`${code}: ${message}`), { code }); | ||
} | ||
exports.EBUSY = EBUSY; | ||
function ENOSYS(message, reason) { | ||
return makeError(`ENOSYS`, `${message}, ${reason}`); | ||
} | ||
exports.ENOSYS = ENOSYS; | ||
function EINVAL(reason) { | ||
return makeError(`EINVAL`, `invalid argument, ${reason}`); | ||
} | ||
exports.EINVAL = EINVAL; | ||
function EBADF(reason) { | ||
return makeError(`EBADF`, `bad file descriptor, ${reason}`); | ||
} | ||
exports.EBADF = EBADF; | ||
function ENOENT(reason) { | ||
return makeError(`ENOENT`, `no such file or directory, ${reason}`); | ||
} | ||
exports.ENOENT = ENOENT; | ||
function ENOTDIR(reason) { | ||
return makeError(`ENOTDIR`, `not a directory, ${reason}`); | ||
} | ||
exports.ENOTDIR = ENOTDIR; | ||
function EISDIR(reason) { | ||
return makeError(`EISDIR`, `illegal operation on a directory, ${reason}`); | ||
} | ||
exports.EISDIR = EISDIR; | ||
function EEXIST(reason) { | ||
return makeError(`EEXIST`, `file already exists, ${reason}`); | ||
} | ||
exports.EEXIST = EEXIST; | ||
function EROFS(reason) { | ||
return makeError(`EROFS`, `read-only filesystem, ${reason}`); | ||
} | ||
exports.EROFS = EROFS; | ||
function ENOTEMPTY(reason) { | ||
return makeError(`ENOTEMPTY`, `directory not empty, ${reason}`); | ||
} | ||
exports.ENOTEMPTY = ENOTEMPTY; | ||
function EOPNOTSUPP(reason) { | ||
return makeError(`EOPNOTSUPP`, `operation not supported, ${reason}`); | ||
} | ||
exports.EOPNOTSUPP = EOPNOTSUPP; | ||
// ------------------------------------------------------------------------ | ||
@@ -56,2 +56,1 @@ function ERR_DIR_CLOSED() { | ||
} | ||
exports.ERR_DIR_CLOSED = ERR_DIR_CLOSED; |
@@ -1,5 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { EventEmitter } from 'events'; | ||
@@ -58,4 +54,11 @@ import { Dirent as NodeDirent, ReadStream } from 'fs'; | ||
maxRetries: number; | ||
retryDelay: number; | ||
/** @deprecated Use `rm` instead of `rmdir` */ | ||
recursive: boolean; | ||
}>; | ||
export type RmOptions = Partial<{ | ||
maxRetries: number; | ||
retryDelay: number; | ||
force: boolean; | ||
recursive: boolean; | ||
}>; | ||
@@ -288,2 +291,4 @@ export type WriteFileOptions = Partial<{ | ||
abstract rmdirSync(p: P, opts?: RmdirOptions): void; | ||
abstract rmPromise(p: P, opts?: RmOptions): Promise<void>; | ||
abstract rmSync(p: P, opts?: RmOptions): void; | ||
abstract linkPromise(existingP: P, newP: P): Promise<void>; | ||
@@ -290,0 +295,0 @@ abstract linkSync(existingP: P, newP: P): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalizeLineEndings = exports.BasePortableFakeFS = exports.FakeFS = void 0; | ||
exports.BasePortableFakeFS = exports.FakeFS = void 0; | ||
exports.normalizeLineEndings = normalizeLineEndings; | ||
const crypto_1 = require("crypto"); | ||
@@ -451,2 +452,1 @@ const os_1 = require("os"); | ||
} | ||
exports.normalizeLineEndings = normalizeLineEndings; |
@@ -18,3 +18,3 @@ import * as constants from './constants'; | ||
export type { ReaddirOptions } from './FakeFS'; | ||
export type { RmdirOptions } from './FakeFS'; | ||
export type { RmdirOptions, RmOptions } from './FakeFS'; | ||
export type { WatchOptions } from './FakeFS'; | ||
@@ -21,0 +21,0 @@ export type { WatchCallback } from './FakeFS'; |
@@ -1,6 +0,3 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { BigIntStats, Stats } from 'fs'; | ||
import { WatchOptions, WatchCallback, Watcher, StatOptions, StatSyncOptions, DirentNoPath } from './FakeFS'; | ||
import { WatchOptions, WatchCallback, Watcher, StatOptions, StatSyncOptions, DirentNoPath, RmOptions } from './FakeFS'; | ||
import { FakeFS, MkdirOptions, RmdirOptions, WriteFileOptions, OpendirOptions } from './FakeFS'; | ||
@@ -177,2 +174,4 @@ import { Dirent, SymlinkType } from './FakeFS'; | ||
rmdirSync(p: PortablePath, opts?: RmdirOptions): void; | ||
rmPromise(p: PortablePath, opts?: RmOptions): Promise<void>; | ||
rmSync(p: PortablePath, opts?: RmOptions): void; | ||
linkPromise(existingP: PortablePath, newP: PortablePath): Promise<void>; | ||
@@ -179,0 +178,0 @@ linkSync(existingP: PortablePath, newP: PortablePath): void; |
@@ -574,2 +574,16 @@ "use strict"; | ||
} | ||
async rmPromise(p, opts) { | ||
return await this.makeCallPromise(p, async () => { | ||
return await this.baseFs.rmPromise(p, opts); | ||
}, async (mountFs, { subPath }) => { | ||
return await mountFs.rmPromise(subPath, opts); | ||
}); | ||
} | ||
rmSync(p, opts) { | ||
return this.makeCallSync(p, () => { | ||
return this.baseFs.rmSync(p, opts); | ||
}, (mountFs, { subPath }) => { | ||
return mountFs.rmSync(subPath, opts); | ||
}); | ||
} | ||
async linkPromise(existingP, newP) { | ||
@@ -576,0 +590,0 @@ return await this.makeCallPromise(newP, async () => { |
@@ -1,4 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import fs, { BigIntStats, Stats } from 'fs'; | ||
@@ -8,3 +5,3 @@ import { CreateReadStreamOptions, CreateWriteStreamOptions, Dir, StatWatcher, WatchFileCallback, WatchFileOptions, OpendirOptions, DirentNoPath } from './FakeFS'; | ||
import { BasePortableFakeFS, WriteFileOptions } from './FakeFS'; | ||
import { MkdirOptions, RmdirOptions, WatchOptions, WatchCallback, Watcher } from './FakeFS'; | ||
import { MkdirOptions, RmdirOptions, RmOptions, WatchOptions, WatchCallback, Watcher } from './FakeFS'; | ||
import { FSPath, PortablePath, Filename } from './path'; | ||
@@ -129,2 +126,4 @@ export declare class NodeFS extends BasePortableFakeFS { | ||
rmdirSync(p: PortablePath, opts?: RmdirOptions): void; | ||
rmPromise(p: PortablePath, opts?: RmOptions): Promise<void>; | ||
rmSync(p: PortablePath, opts?: RmOptions): void; | ||
linkPromise(existingP: PortablePath, newP: PortablePath): Promise<void>; | ||
@@ -131,0 +130,0 @@ linkSync(existingP: PortablePath, newP: PortablePath): void; |
@@ -348,2 +348,16 @@ "use strict"; | ||
} | ||
async rmPromise(p, opts) { | ||
return await new Promise((resolve, reject) => { | ||
// TODO: always pass opts when min node version is 12.10+ | ||
if (opts) { | ||
this.realFs.rm(path_1.npath.fromPortablePath(p), opts, this.makeCallback(resolve, reject)); | ||
} | ||
else { | ||
this.realFs.rm(path_1.npath.fromPortablePath(p), this.makeCallback(resolve, reject)); | ||
} | ||
}); | ||
} | ||
rmSync(p, opts) { | ||
return this.realFs.rmSync(path_1.npath.fromPortablePath(p), opts); | ||
} | ||
async linkPromise(existingP, newP) { | ||
@@ -350,0 +364,0 @@ return await new Promise((resolve, reject) => { |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { FakeFS } from './FakeFS'; | ||
@@ -3,0 +2,0 @@ import { ProxiedFS } from './ProxiedFS'; |
@@ -47,2 +47,4 @@ import { FakeFS } from './FakeFS'; | ||
rmdirSync(): never; | ||
rmPromise(): Promise<never>; | ||
rmSync(): never; | ||
linkPromise(): Promise<never>; | ||
@@ -49,0 +51,0 @@ linkSync(): never; |
@@ -134,2 +134,8 @@ "use strict"; | ||
} | ||
async rmPromise() { | ||
throw makeError(); | ||
} | ||
rmSync() { | ||
throw makeError(); | ||
} | ||
async linkPromise() { | ||
@@ -136,0 +142,0 @@ throw makeError(); |
@@ -1,5 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import type { BigIntStats, ReadStream, StatOptions, Stats, WriteStream, WriteVResult } from 'fs'; | ||
@@ -6,0 +2,0 @@ import type { CreateReadStreamOptions, CreateWriteStreamOptions, FakeFS } from '../FakeFS'; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import fs from 'fs'; | ||
@@ -3,0 +2,0 @@ import { FakeFS } from '../FakeFS'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extendFs = exports.patchFs = void 0; | ||
exports.patchFs = patchFs; | ||
exports.extendFs = extendFs; | ||
const util_1 = require("util"); | ||
@@ -32,2 +33,3 @@ const NodePathFS_1 = require("../NodePathFS"); | ||
`rmdirSync`, | ||
`rmSync`, | ||
`statSync`, | ||
@@ -68,2 +70,3 @@ `symlinkSync`, | ||
`rmdirPromise`, | ||
`rmPromise`, | ||
`statPromise`, | ||
@@ -260,3 +263,2 @@ `symlinkPromise`, | ||
} | ||
exports.patchFs = patchFs; | ||
function extendFs(realFs, fakeFs) { | ||
@@ -267,2 +269,1 @@ const patchedFs = Object.create(realFs); | ||
} | ||
exports.extendFs = extendFs; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertPath = exports.ppath = exports.npath = exports.Filename = exports.PortablePath = void 0; | ||
exports.ppath = exports.npath = exports.Filename = exports.PortablePath = void 0; | ||
exports.convertPath = convertPath; | ||
const tslib_1 = require("tslib"); | ||
@@ -103,2 +104,1 @@ const path_1 = tslib_1.__importDefault(require("path")); | ||
} | ||
exports.convertPath = convertPath; |
@@ -1,8 +0,5 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Stats, BigIntStats } from 'fs'; | ||
import { CreateReadStreamOptions, CreateWriteStreamOptions, FakeFS, ExtractHintOptions, WatchFileCallback, WatchFileOptions, StatWatcher, Dir, OpendirOptions, DirentNoPath } from './FakeFS'; | ||
import { Dirent, SymlinkType, StatSyncOptions, StatOptions } from './FakeFS'; | ||
import { MkdirOptions, RmdirOptions, WriteFileOptions, WatchCallback, WatchOptions, Watcher } from './FakeFS'; | ||
import { MkdirOptions, RmdirOptions, RmOptions, WriteFileOptions, WatchCallback, WatchOptions, Watcher } from './FakeFS'; | ||
import { FSPath, Filename, Path } from './path'; | ||
@@ -134,2 +131,4 @@ export declare abstract class ProxiedFS<P extends Path, IP extends Path> extends FakeFS<P> { | ||
rmdirSync(p: P, opts?: RmdirOptions): void; | ||
rmPromise(p: P, opts?: RmOptions): Promise<void>; | ||
rmSync(p: P, opts?: RmOptions): void; | ||
linkPromise(existingP: P, newP: P): Promise<void>; | ||
@@ -136,0 +135,0 @@ linkSync(existingP: P, newP: P): void; |
@@ -175,2 +175,8 @@ "use strict"; | ||
} | ||
async rmPromise(p, opts) { | ||
return this.baseFs.rmPromise(this.mapToBase(p), opts); | ||
} | ||
rmSync(p, opts) { | ||
return this.baseFs.rmSync(this.mapToBase(p), opts); | ||
} | ||
async linkPromise(existingP, newP) { | ||
@@ -177,0 +183,0 @@ return this.baseFs.linkPromise(this.mapToBase(existingP), this.mapToBase(newP)); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { BigIntStats, Stats } from 'fs'; | ||
@@ -3,0 +2,0 @@ import { Filename } from './path'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.areStatsEqual = exports.convertToBigIntStats = exports.clearStats = exports.makeEmptyStats = exports.makeDefaultStats = exports.BigIntStatsEntry = exports.StatEntry = exports.DirEntry = exports.DEFAULT_MODE = void 0; | ||
exports.BigIntStatsEntry = exports.StatEntry = exports.DirEntry = exports.DEFAULT_MODE = void 0; | ||
exports.makeDefaultStats = makeDefaultStats; | ||
exports.makeEmptyStats = makeEmptyStats; | ||
exports.clearStats = clearStats; | ||
exports.convertToBigIntStats = convertToBigIntStats; | ||
exports.areStatsEqual = areStatsEqual; | ||
const tslib_1 = require("tslib"); | ||
@@ -132,7 +137,5 @@ const nodeUtils = tslib_1.__importStar(require("util")); | ||
} | ||
exports.makeDefaultStats = makeDefaultStats; | ||
function makeEmptyStats() { | ||
return clearStats(makeDefaultStats()); | ||
} | ||
exports.makeEmptyStats = makeEmptyStats; | ||
/** | ||
@@ -161,3 +164,2 @@ * Mutates the provided stats object to zero it out then returns it for convenience | ||
} | ||
exports.clearStats = clearStats; | ||
function convertToBigIntStats(stats) { | ||
@@ -184,3 +186,2 @@ const bigintStats = new BigIntStatsEntry(); | ||
} | ||
exports.convertToBigIntStats = convertToBigIntStats; | ||
function areStatsEqual(a, b) { | ||
@@ -241,2 +242,1 @@ if (a.atimeMs !== b.atimeMs) | ||
} | ||
exports.areStatsEqual = areStatsEqual; |
{ | ||
"name": "@yarnpkg/fslib", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"license": "BSD-2-Clause", | ||
@@ -15,3 +15,3 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@yarnpkg/libzip": "^3.0.1" | ||
"@yarnpkg/libzip": "^3.1.0" | ||
}, | ||
@@ -18,0 +18,0 @@ "scripts": { |
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
231501
6003