Comparing version 8.1.1 to 9.0.0
@@ -1,2 +0,2 @@ | ||
export interface Options { | ||
export type Options = { | ||
/** | ||
@@ -8,3 +8,3 @@ Enable globbing when matching file paths. | ||
readonly glob?: boolean; | ||
} | ||
}; | ||
@@ -11,0 +11,0 @@ /** |
@@ -8,3 +8,3 @@ import fs from 'node:fs'; | ||
export default async function trash(paths, options) { | ||
paths = [paths].flat().map(path => String(path)); | ||
paths = [paths].flat().map(String); | ||
@@ -43,3 +43,3 @@ options = { | ||
paths = paths.filter(isPath => isPath); | ||
paths = paths.filter(Boolean); | ||
@@ -52,9 +52,6 @@ if (paths.length === 0) { | ||
if (process.platform === 'darwin') { | ||
// eslint-disable-next-line node/no-unsupported-features/es-syntax | ||
module = await import('./lib/macos.js'); | ||
} else if (process.platform === 'win32') { | ||
// eslint-disable-next-line node/no-unsupported-features/es-syntax | ||
module = await import('./lib/windows.js'); | ||
} else { | ||
// eslint-disable-next-line node/no-unsupported-features/es-syntax | ||
module = await import('./lib/linux.js'); | ||
@@ -61,0 +58,0 @@ } |
import os from 'node:os'; | ||
import path from 'node:path'; | ||
import fs from 'node:fs'; | ||
import {v4 as uuidv4} from 'uuid'; | ||
import {randomUUID} from 'node:crypto'; | ||
import xdgTrashdir from 'xdg-trashdir'; | ||
@@ -25,7 +25,7 @@ import pMap from 'p-map'; | ||
const trash = async (filePath, trashPaths) => { | ||
const name = uuidv4(); | ||
const name = randomUUID(); | ||
const destination = path.join(trashPaths.filesPath, name); | ||
const trashInfoPath = path.join(trashPaths.infoPath, `${name}.trashinfo`); | ||
const trashInfoData = `[Trash Info]\nPath=${filePath.replace(/\s/g, '%20')}\nDeletionDate=${getDeletionDate(new Date())}`; | ||
const trashInfoData = `[Trash Info]\nPath=${filePath.replaceAll(/\s/g, '%20')}\nDeletionDate=${getDeletionDate(new Date())}`; | ||
@@ -58,7 +58,7 @@ await fs.promises.writeFile(trashInfoPath, trashInfoData); | ||
const getDeviceTrashPaths = async devId => { | ||
let trashPathsPromise = trashPathsCache.get(devId); | ||
const getDeviceTrashPaths = async developmentId => { | ||
let trashPathsPromise = trashPathsCache.get(developmentId); | ||
if (trashPathsPromise === undefined) { | ||
trashPathsPromise = (async () => { | ||
const trashPath = await xdgTrashdir(mountPointMap.get(devId)); | ||
const trashPath = await xdgTrashdir(mountPointMap.get(developmentId)); | ||
const paths = { | ||
@@ -72,3 +72,3 @@ filesPath: path.join(trashPath, 'files'), | ||
})(); | ||
trashPathsCache.set(devId, trashPathsPromise); | ||
trashPathsCache.set(developmentId, trashPathsPromise); | ||
} | ||
@@ -75,0 +75,0 @@ |
{ | ||
"name": "trash", | ||
"version": "8.1.1", | ||
"version": "9.0.0", | ||
"description": "Move files and folders to the trash", | ||
@@ -14,5 +14,9 @@ "license": "MIT", | ||
"type": "module", | ||
"exports": "./index.js", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
"node": ">=18" | ||
}, | ||
@@ -46,18 +50,20 @@ "scripts": { | ||
"dependencies": { | ||
"@sindresorhus/chunkify": "^0.2.0", | ||
"@sindresorhus/chunkify": "^1.0.0", | ||
"@stroncium/procfs": "^1.2.1", | ||
"globby": "^7.1.1", | ||
"is-path-inside": "^4.0.0", | ||
"move-file": "^3.0.0", | ||
"p-map": "^5.1.0", | ||
"uuid": "^8.3.2", | ||
"move-file": "^3.1.0", | ||
"p-map": "^7.0.2", | ||
"xdg-trashdir": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^3.15.0", | ||
"tempfile": "^4.0.0", | ||
"tsd": "^0.17.0", | ||
"typescript": "^4.4.3", | ||
"xo": "^0.44.0" | ||
"ava": "^6.1.3", | ||
"tempfile": "^5.0.0", | ||
"tsd": "^0.31.1", | ||
"typescript": "^5.5.4", | ||
"xo": "^0.59.2" | ||
}, | ||
"ava": { | ||
"workerThreads": false | ||
} | ||
} |
@@ -52,5 +52,5 @@ # ![trash](media/logo.png) | ||
```sh | ||
npm install --global trash-cli | ||
``` | ||
$ npm install --global trash-cli | ||
``` | ||
@@ -57,0 +57,0 @@ ## Info |
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
7
223704
162
+ Added@sindresorhus/chunkify@1.0.0(transitive)
+ Addedp-map@7.0.2(transitive)
- Removeduuid@^8.3.2
- Removed@sindresorhus/chunkify@0.2.0(transitive)
- Removedaggregate-error@4.0.1(transitive)
- Removedclean-stack@4.2.0(transitive)
- Removedescape-string-regexp@5.0.0(transitive)
- Removedindent-string@5.0.0(transitive)
- Removedp-map@5.5.0(transitive)
- Removeduuid@8.3.2(transitive)
Updatedmove-file@^3.1.0
Updatedp-map@^7.0.2