update(rimraf): update to version 3.0 (#43188)

- v2 created
- removed BUSYTRIES_MAX and EMFILE_MAX
- other minor changes

https://github.com/isaacs/rimraf/blob/master/rimraf.js

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2020-03-20 19:02:50 +01:00
committed by GitHub
parent d3c19af135
commit 551f768a3f
6 changed files with 99 additions and 12 deletions

View File

@@ -1,13 +1,12 @@
// Type definitions for rimraf 2.0
// Type definitions for rimraf 3.0
// Project: https://github.com/isaacs/rimraf
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
// e-cloud <https://github.com/e-cloud>
// Ruben Schmidmeister <https://github.com/bash>
// Oganexon <https://github.com/oganexon>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/rimraf.d.ts
/// <reference types="node" />
import glob = require('glob');
@@ -16,13 +15,20 @@ import fs = require('fs');
declare function rimraf(path: string, options: rimraf.Options, callback: (error: Error) => void): void;
declare function rimraf(path: string, callback: (error: Error) => void): void;
declare namespace rimraf {
function __promisify__(path: string, options?: Options): Promise<void>;
/**
* It can remove stuff synchronously, too.
* But that's not so good. Use the async API.
* It's better.
*/
function sync(path: string, options?: Options): void;
let EMFILE_MAX: number;
let BUSYTRIES_MAX: number;
/**
* see {@link https://github.com/isaacs/rimraf/blob/79b933fb362b2c51bedfa448be848e1d7ed32d7e/README.md#options}
*/
interface Options {
maxBusyTries?: number;
emfileWait?: number;
/** @default false */
disableGlob?: boolean;
glob?: glob.IOptions | false;
@@ -32,7 +38,6 @@ declare namespace rimraf {
lstat?: typeof fs.lstat;
rmdir?: typeof fs.rmdir;
readdir?: typeof fs.readdir;
unlinkSync?: typeof fs.unlinkSync;
chmodSync?: typeof fs.chmodSync;
statSync?: typeof fs.statSync;

View File

@@ -1,10 +1,7 @@
import rimraf = require('rimraf');
rimraf('./xyz', (err: Error) => { });
rimraf('./xyz', (err: Error) => {});
rimraf.sync('./xyz');
rimraf('./xyz', { glob: { ignore: '' } }, (err: Error) => { });
rimraf('./xyz', { glob: { ignore: '' } }, (err: Error) => {});
rimraf.sync('./xyz', { glob: { ignore: '' } });
rimraf.EMFILE_MAX = 0;
rimraf.BUSYTRIES_MAX = 0;

44
types/rimraf/v2/index.d.ts vendored Normal file
View File

@@ -0,0 +1,44 @@
// Type definitions for rimraf 2.0
// Project: https://github.com/isaacs/rimraf
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
// e-cloud <https://github.com/e-cloud>
// Ruben Schmidmeister <https://github.com/bash>
// Oganexon <https://github.com/oganexon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/rimraf.d.ts
/// <reference types="node" />
import glob = require('glob');
import fs = require('fs');
declare function rimraf(path: string, options: rimraf.Options, callback: (error: Error) => void): void;
declare function rimraf(path: string, callback: (error: Error) => void): void;
declare namespace rimraf {
function __promisify__(path: string, options?: Options): Promise<void>;
function sync(path: string, options?: Options): void;
let EMFILE_MAX: number;
let BUSYTRIES_MAX: number;
interface Options {
maxBusyTries?: number;
emfileWait?: number;
disableGlob?: boolean;
glob?: glob.IOptions | false;
unlink?: typeof fs.unlink;
chmod?: typeof fs.chmod;
stat?: typeof fs.stat;
lstat?: typeof fs.lstat;
rmdir?: typeof fs.rmdir;
readdir?: typeof fs.readdir;
unlinkSync?: typeof fs.unlinkSync;
chmodSync?: typeof fs.chmodSync;
statSync?: typeof fs.statSync;
lstatSync?: typeof fs.lstatSync;
rmdirSync?: typeof fs.rmdirSync;
readdirSync?: typeof fs.readdirSync;
}
}
export = rimraf;

View File

@@ -0,0 +1,10 @@
import rimraf = require('rimraf');
rimraf('./xyz', (err: Error) => { });
rimraf.sync('./xyz');
rimraf('./xyz', { glob: { ignore: '' } }, (err: Error) => { });
rimraf.sync('./xyz', { glob: { ignore: '' } });
rimraf.EMFILE_MAX = 0;
rimraf.BUSYTRIES_MAX = 0;

View File

@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"rimraf": [
"rimraf/v2"
]
}
},
"files": [
"index.d.ts",
"rimraf-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}