Comparing version 7.2.1 to 8.0.0
@@ -1,40 +0,38 @@ | ||
declare namespace fkill { | ||
interface Options { | ||
/** | ||
Force kill the processes. | ||
export interface Options { | ||
/** | ||
Force kill the processes. | ||
@default false | ||
*/ | ||
readonly force?: boolean; | ||
@default false | ||
*/ | ||
readonly force?: boolean; | ||
/** | ||
Force kill processes that did not exit within the given number of milliseconds. | ||
/** | ||
Force kill processes that did not exit within the given number of milliseconds. | ||
@default undefined | ||
*/ | ||
readonly forceAfterTimeout?: number; | ||
@default undefined | ||
*/ | ||
readonly forceAfterTimeout?: number; | ||
/** | ||
Kill all child processes along with the parent process. _(Windows only)_ | ||
/** | ||
Kill all child processes along with the parent process. _(Windows only)_ | ||
@default true | ||
*/ | ||
readonly tree?: boolean; | ||
@default true | ||
*/ | ||
readonly tree?: boolean; | ||
/** | ||
Ignore capitalization when killing a process. | ||
/** | ||
Ignore capitalization when killing a process. | ||
Note that the case is always ignored on Windows. | ||
Note that the case is always ignored on Windows. | ||
@default false | ||
*/ | ||
readonly ignoreCase?: boolean; | ||
@default false | ||
*/ | ||
readonly ignoreCase?: boolean; | ||
/** | ||
Suppress all error messages. For example: `Process doesn't exist`. | ||
/** | ||
Suppress all error messages. For example: `Process doesn't exist`. | ||
@default false | ||
*/ | ||
readonly silent?: boolean; | ||
} | ||
@default false | ||
*/ | ||
readonly silent?: boolean; | ||
} | ||
@@ -49,8 +47,6 @@ | ||
``` | ||
import fkill = require('fkill'); | ||
import fkill from 'fkill'; | ||
(async () => { | ||
await fkill(1337); | ||
console.log('Killed process'); | ||
})(); | ||
await fkill(1337); | ||
console.log('Killed process'); | ||
@@ -63,7 +59,5 @@ fkill('Safari'); | ||
*/ | ||
declare function fkill( | ||
export default function fkill( | ||
input: number | string | ReadonlyArray<string | number>, | ||
options?: fkill.Options | ||
options?: Options | ||
): Promise<void>; | ||
export = fkill; |
31
index.js
@@ -1,9 +0,8 @@ | ||
'use strict'; | ||
const arrify = require('arrify'); | ||
const taskkill = require('taskkill'); | ||
const execa = require('execa'); | ||
const AggregateError = require('aggregate-error'); | ||
const pidPort = require('pid-port'); | ||
const processExists = require('process-exists'); | ||
const psList = require('ps-list'); | ||
import process from 'node:process'; | ||
import taskkill from 'taskkill'; | ||
import execa from 'execa'; | ||
import AggregateError from 'aggregate-error'; | ||
import {portToPid} from 'pid-port'; | ||
import processExists from 'process-exists'; | ||
import psList from 'ps-list'; | ||
@@ -40,3 +39,3 @@ // If we check too soon, we're unlikely to see process killed so we essentially wait 3*ALIVE_CHECK_MIN_INTERVAL before the second check while producing unnecessary load. | ||
force: options.force, | ||
tree: typeof options.tree === 'undefined' ? true : options.tree | ||
tree: typeof options.tree === 'undefined' ? true : options.tree, | ||
}); | ||
@@ -102,3 +101,3 @@ } catch (error) { | ||
if (typeof input === 'string' && input[0] === ':') { | ||
return pidPort.portToPid(Number.parseInt(input.slice(1), 10)); | ||
return portToPid(Number.parseInt(input.slice(1), 10)); | ||
} | ||
@@ -129,4 +128,4 @@ | ||
const fkill = async (inputs, options = {}) => { | ||
inputs = arrify(inputs); | ||
export default async function fkill(inputs, options = {}) { | ||
inputs = [inputs].flat(); | ||
@@ -150,5 +149,3 @@ const exists = await processExists.all(inputs); | ||
await Promise.all( | ||
inputs.map(input => handleKill(input)) | ||
); | ||
await Promise.all(inputs.map(input => handleKill(input))); | ||
@@ -190,4 +187,2 @@ if (errors.length > 0 && !options.silent) { | ||
} | ||
}; | ||
module.exports = fkill; | ||
} |
{ | ||
"name": "fkill", | ||
"version": "7.2.1", | ||
"version": "8.0.0", | ||
"description": "Fabulously kill processes. Cross-platform.", | ||
"license": "MIT", | ||
"funding": { | ||
"url": "https://github.com/sponsors/sindresorhus" | ||
}, | ||
"repository": "sindresorhus/fkill", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
@@ -15,4 +13,6 @@ "name": "Sindre Sorhus", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=10" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -44,18 +44,17 @@ "scripts": { | ||
"dependencies": { | ||
"aggregate-error": "^3.1.0", | ||
"arrify": "^2.0.1", | ||
"execa": "^5.0.0", | ||
"pid-port": "^0.1.0", | ||
"process-exists": "^4.0.0", | ||
"aggregate-error": "^4.0.0", | ||
"execa": "^5.1.1", | ||
"pid-port": "^0.2.0", | ||
"process-exists": "^4.1.0", | ||
"ps-list": "^7.2.0", | ||
"taskkill": "^3.1.0" | ||
"taskkill": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"delay": "^4.4.0", | ||
"get-port": "^5.1.1", | ||
"noop-process": "^4.0.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.36.1" | ||
"ava": "^3.15.0", | ||
"delay": "^5.0.0", | ||
"get-port": "^6.0.0", | ||
"noop-process": "^5.0.0", | ||
"tsd": "^0.18.0", | ||
"xo": "^0.45.0" | ||
} | ||
} |
@@ -15,5 +15,5 @@ <h1 align="center"> | ||
```sh | ||
npm install fkill | ||
``` | ||
$ npm install fkill | ||
``` | ||
@@ -23,8 +23,6 @@ ## Usage | ||
```js | ||
const fkill = require('fkill'); | ||
import fkill from 'fkill'; | ||
(async () => { | ||
await fkill(1337); | ||
console.log('Killed process'); | ||
})(); | ||
await fkill(1337); | ||
console.log('Killed process'); | ||
@@ -31,0 +29,0 @@ fkill('Safari'); |
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
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
6
Yes
9569
191
92
+ Addedaggregate-error@4.0.1(transitive)
+ Addedarrify@3.0.0(transitive)
+ Addedclean-stack@4.2.0(transitive)
+ Addedescape-string-regexp@5.0.0(transitive)
+ Addedindent-string@5.0.0(transitive)
+ Addedpid-port@0.2.0(transitive)
+ Addedtaskkill@4.0.0(transitive)
- Removedarrify@^2.0.1
- Removedaggregate-error@3.1.0(transitive)
- Removedarrify@2.0.1(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedexeca@3.4.0(transitive)
- Removedget-stream@5.2.0(transitive)
- Removedhuman-signals@1.1.1(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-finally@2.0.1(transitive)
- Removedpid-port@0.1.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedtaskkill@3.1.0(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedaggregate-error@^4.0.0
Updatedexeca@^5.1.1
Updatedpid-port@^0.2.0
Updatedprocess-exists@^4.1.0
Updatedtaskkill@^4.0.0