@file-services/utils
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -5,7 +5,17 @@ "use strict"; | ||
function createFileSystem(baseFs) { | ||
return Object.assign(Object.assign(Object.assign({}, baseFs), createExtendedSyncActions(baseFs)), { promises: Object.assign(Object.assign({}, baseFs.promises), createExtendedFileSystemPromiseActions(baseFs)) }); | ||
return { | ||
...baseFs, | ||
...createExtendedSyncActions(baseFs), | ||
promises: { | ||
...baseFs.promises, | ||
...createExtendedFileSystemPromiseActions(baseFs) | ||
} | ||
}; | ||
} | ||
exports.createFileSystem = createFileSystem; | ||
function createSyncFileSystem(baseFs) { | ||
return Object.assign(Object.assign({}, baseFs), createExtendedSyncActions(baseFs)); | ||
return { | ||
...baseFs, | ||
...createExtendedSyncActions(baseFs) | ||
}; | ||
} | ||
@@ -19,3 +29,3 @@ exports.createSyncFileSystem = createSyncFileSystem; | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -31,3 +41,3 @@ } | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -170,3 +180,9 @@ } | ||
function createAsyncFileSystem(baseFs) { | ||
return Object.assign(Object.assign({}, baseFs), { promises: Object.assign(Object.assign({}, baseFs.promises), createExtendedFileSystemPromiseActions(baseFs)) }); | ||
return { | ||
...baseFs, | ||
promises: { | ||
...baseFs.promises, | ||
...createExtendedFileSystemPromiseActions(baseFs) | ||
} | ||
}; | ||
} | ||
@@ -180,3 +196,3 @@ exports.createAsyncFileSystem = createAsyncFileSystem; | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -189,3 +205,3 @@ } | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -192,0 +208,0 @@ } |
@@ -5,3 +5,7 @@ "use strict"; | ||
function syncToAsyncFs(syncFs) { | ||
return Object.assign(Object.assign({}, syncFs), { watchService: syncFs.watchService, caseSensitive: syncFs.caseSensitive, promises: { | ||
return { | ||
...syncFs, | ||
watchService: syncFs.watchService, | ||
caseSensitive: syncFs.caseSensitive, | ||
promises: { | ||
readFile: async function readFile(...args) { | ||
@@ -46,7 +50,21 @@ return syncFs.readFileSync(...args); | ||
} | ||
}, exists(nodePath, callback) { | ||
}, | ||
exists(nodePath, callback) { | ||
callback(syncFs.existsSync(nodePath)); | ||
}, readFile: callbackify_1.callbackify(syncFs.readFileSync), writeFile: callbackify_1.callbackify(syncFs.writeFileSync), copyFile: callbackify_1.callbackify(syncFs.copyFileSync), unlink: callbackify_1.callbackify(syncFs.unlinkSync), readdir: callbackify_1.callbackify(syncFs.readdirSync), mkdir: callbackify_1.callbackify(syncFs.mkdirSync), rmdir: callbackify_1.callbackify(syncFs.rmdirSync), stat: callbackify_1.callbackify(syncFs.statSync), lstat: callbackify_1.callbackify(syncFs.lstatSync), realpath: callbackify_1.callbackify(syncFs.realpathSync), rename: callbackify_1.callbackify(syncFs.renameSync), readlink: callbackify_1.callbackify(syncFs.readlinkSync) }); | ||
}, | ||
readFile: callbackify_1.callbackify(syncFs.readFileSync), | ||
writeFile: callbackify_1.callbackify(syncFs.writeFileSync), | ||
copyFile: callbackify_1.callbackify(syncFs.copyFileSync), | ||
unlink: callbackify_1.callbackify(syncFs.unlinkSync), | ||
readdir: callbackify_1.callbackify(syncFs.readdirSync), | ||
mkdir: callbackify_1.callbackify(syncFs.mkdirSync), | ||
rmdir: callbackify_1.callbackify(syncFs.rmdirSync), | ||
stat: callbackify_1.callbackify(syncFs.statSync), | ||
lstat: callbackify_1.callbackify(syncFs.lstatSync), | ||
realpath: callbackify_1.callbackify(syncFs.realpathSync), | ||
rename: callbackify_1.callbackify(syncFs.renameSync), | ||
readlink: callbackify_1.callbackify(syncFs.readlinkSync) | ||
}; | ||
} | ||
exports.syncToAsyncFs = syncToAsyncFs; | ||
//# sourceMappingURL=sync-to-async-fs.js.map |
const returnsTrue = () => true; | ||
export function createFileSystem(baseFs) { | ||
return Object.assign(Object.assign(Object.assign({}, baseFs), createExtendedSyncActions(baseFs)), { promises: Object.assign(Object.assign({}, baseFs.promises), createExtendedFileSystemPromiseActions(baseFs)) }); | ||
return { | ||
...baseFs, | ||
...createExtendedSyncActions(baseFs), | ||
promises: { | ||
...baseFs.promises, | ||
...createExtendedFileSystemPromiseActions(baseFs) | ||
} | ||
}; | ||
} | ||
export function createSyncFileSystem(baseFs) { | ||
return Object.assign(Object.assign({}, baseFs), createExtendedSyncActions(baseFs)); | ||
return { | ||
...baseFs, | ||
...createExtendedSyncActions(baseFs) | ||
}; | ||
} | ||
@@ -14,3 +24,3 @@ export function createExtendedSyncActions(baseFs) { | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -26,3 +36,3 @@ } | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -164,3 +174,9 @@ } | ||
export function createAsyncFileSystem(baseFs) { | ||
return Object.assign(Object.assign({}, baseFs), { promises: Object.assign(Object.assign({}, baseFs.promises), createExtendedFileSystemPromiseActions(baseFs)) }); | ||
return { | ||
...baseFs, | ||
promises: { | ||
...baseFs.promises, | ||
...createExtendedFileSystemPromiseActions(baseFs) | ||
} | ||
}; | ||
} | ||
@@ -173,3 +189,3 @@ export function createExtendedFileSystemPromiseActions(baseFs) { | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -182,3 +198,3 @@ } | ||
} | ||
catch (_a) { | ||
catch { | ||
return false; | ||
@@ -185,0 +201,0 @@ } |
import { callbackify } from './callbackify'; | ||
export function syncToAsyncFs(syncFs) { | ||
return Object.assign(Object.assign({}, syncFs), { watchService: syncFs.watchService, caseSensitive: syncFs.caseSensitive, promises: { | ||
return { | ||
...syncFs, | ||
watchService: syncFs.watchService, | ||
caseSensitive: syncFs.caseSensitive, | ||
promises: { | ||
readFile: async function readFile(...args) { | ||
@@ -43,6 +47,20 @@ return syncFs.readFileSync(...args); | ||
} | ||
}, exists(nodePath, callback) { | ||
}, | ||
exists(nodePath, callback) { | ||
callback(syncFs.existsSync(nodePath)); | ||
}, readFile: callbackify(syncFs.readFileSync), writeFile: callbackify(syncFs.writeFileSync), copyFile: callbackify(syncFs.copyFileSync), unlink: callbackify(syncFs.unlinkSync), readdir: callbackify(syncFs.readdirSync), mkdir: callbackify(syncFs.mkdirSync), rmdir: callbackify(syncFs.rmdirSync), stat: callbackify(syncFs.statSync), lstat: callbackify(syncFs.lstatSync), realpath: callbackify(syncFs.realpathSync), rename: callbackify(syncFs.renameSync), readlink: callbackify(syncFs.readlinkSync) }); | ||
}, | ||
readFile: callbackify(syncFs.readFileSync), | ||
writeFile: callbackify(syncFs.writeFileSync), | ||
copyFile: callbackify(syncFs.copyFileSync), | ||
unlink: callbackify(syncFs.unlinkSync), | ||
readdir: callbackify(syncFs.readdirSync), | ||
mkdir: callbackify(syncFs.mkdirSync), | ||
rmdir: callbackify(syncFs.rmdirSync), | ||
stat: callbackify(syncFs.statSync), | ||
lstat: callbackify(syncFs.lstatSync), | ||
realpath: callbackify(syncFs.realpathSync), | ||
rename: callbackify(syncFs.renameSync), | ||
readlink: callbackify(syncFs.readlinkSync) | ||
}; | ||
} | ||
//# sourceMappingURL=sync-to-async-fs.js.map |
{ | ||
"name": "@file-services/utils", | ||
"description": "Common file system utility functions.", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"main": "cjs/index.js", | ||
@@ -14,3 +14,3 @@ "module": "esm/index.js", | ||
"dependencies": { | ||
"@file-services/types": "^2.1.0" | ||
"@file-services/types": "^2.2.0" | ||
}, | ||
@@ -28,4 +28,3 @@ "files": [ | ||
}, | ||
"sideEffects": false, | ||
"gitHead": "d0f4daec4165377749c39bb159c24b6e0808fae4" | ||
"sideEffects": false | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
101623
1580
1
Updated@file-services/types@^2.2.0