rimraf 3.0.2 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +129 -64
  3. package/dist/cjs/package.json +74 -0
  4. package/dist/cjs/src/bin.d.ts +7 -0
  5. package/dist/cjs/src/bin.js +144 -0
  6. package/dist/cjs/src/bin.js.map +1 -0
  7. package/dist/cjs/src/default-tmp.d.ts +2 -0
  8. package/dist/cjs/src/default-tmp.js +61 -0
  9. package/dist/cjs/src/default-tmp.js.map +1 -0
  10. package/dist/cjs/src/fix-eperm.d.ts +2 -0
  11. package/dist/cjs/src/fix-eperm.js +58 -0
  12. package/dist/cjs/src/fix-eperm.js.map +1 -0
  13. package/dist/cjs/src/fs.d.ts +17 -0
  14. package/dist/cjs/src/fs.js +41 -0
  15. package/dist/cjs/src/fs.js.map +1 -0
  16. package/dist/cjs/src/ignore-enoent.d.ts +2 -0
  17. package/dist/cjs/src/ignore-enoent.js +21 -0
  18. package/dist/cjs/src/ignore-enoent.js.map +1 -0
  19. package/dist/cjs/src/index.d.ts +60 -0
  20. package/dist/cjs/src/index.js +79 -0
  21. package/dist/cjs/src/index.js.map +1 -0
  22. package/dist/cjs/src/opt-arg.d.ts +3 -0
  23. package/dist/cjs/src/opt-arg.js +8 -0
  24. package/dist/cjs/src/opt-arg.js.map +1 -0
  25. package/dist/cjs/src/path-arg.d.ts +3 -0
  26. package/dist/cjs/src/path-arg.js +54 -0
  27. package/dist/cjs/src/path-arg.js.map +1 -0
  28. package/dist/cjs/src/platform.d.ts +2 -0
  29. package/dist/cjs/src/platform.js +4 -0
  30. package/dist/cjs/src/platform.js.map +1 -0
  31. package/dist/cjs/src/readdir-or-error.d.ts +3 -0
  32. package/dist/cjs/src/readdir-or-error.js +19 -0
  33. package/dist/cjs/src/readdir-or-error.js.map +1 -0
  34. package/dist/cjs/src/retry-busy.d.ts +7 -0
  35. package/dist/cjs/src/retry-busy.js +65 -0
  36. package/dist/cjs/src/retry-busy.js.map +1 -0
  37. package/dist/cjs/src/rimraf-manual.d.ts +2 -0
  38. package/dist/cjs/src/rimraf-manual.js +12 -0
  39. package/dist/cjs/src/rimraf-manual.js.map +1 -0
  40. package/dist/cjs/src/rimraf-move-remove.d.ts +3 -0
  41. package/dist/cjs/src/rimraf-move-remove.js +124 -0
  42. package/dist/cjs/src/rimraf-move-remove.js.map +1 -0
  43. package/dist/cjs/src/rimraf-native.d.ts +3 -0
  44. package/dist/cjs/src/rimraf-native.js +18 -0
  45. package/dist/cjs/src/rimraf-native.js.map +1 -0
  46. package/dist/cjs/src/rimraf-posix.d.ts +3 -0
  47. package/dist/cjs/src/rimraf-posix.js +60 -0
  48. package/dist/cjs/src/rimraf-posix.js.map +1 -0
  49. package/dist/cjs/src/rimraf-windows.d.ts +3 -0
  50. package/dist/cjs/src/rimraf-windows.js +110 -0
  51. package/dist/cjs/src/rimraf-windows.js.map +1 -0
  52. package/dist/cjs/src/use-native.d.ts +2 -0
  53. package/dist/cjs/src/use-native.js +15 -0
  54. package/dist/cjs/src/use-native.js.map +1 -0
  55. package/dist/mjs/package.json +74 -0
  56. package/dist/mjs/src/bin.d.ts +7 -0
  57. package/dist/mjs/src/bin.js +138 -0
  58. package/dist/mjs/src/bin.js.map +1 -0
  59. package/dist/mjs/src/default-tmp.d.ts +2 -0
  60. package/dist/mjs/src/default-tmp.js +55 -0
  61. package/dist/mjs/src/default-tmp.js.map +1 -0
  62. package/dist/mjs/src/fix-eperm.d.ts +2 -0
  63. package/dist/mjs/src/fix-eperm.js +53 -0
  64. package/dist/mjs/src/fix-eperm.js.map +1 -0
  65. package/dist/mjs/src/fs.d.ts +17 -0
  66. package/dist/mjs/src/fs.js +27 -0
  67. package/dist/mjs/src/fs.js.map +1 -0
  68. package/dist/mjs/src/ignore-enoent.d.ts +2 -0
  69. package/dist/mjs/src/ignore-enoent.js +16 -0
  70. package/dist/mjs/src/ignore-enoent.js.map +1 -0
  71. package/dist/mjs/src/index.d.ts +60 -0
  72. package/dist/mjs/src/index.js +71 -0
  73. package/dist/mjs/src/index.js.map +1 -0
  74. package/dist/mjs/src/opt-arg.d.ts +3 -0
  75. package/dist/mjs/src/opt-arg.js +6 -0
  76. package/dist/mjs/src/opt-arg.js.map +1 -0
  77. package/dist/mjs/src/path-arg.d.ts +3 -0
  78. package/dist/mjs/src/path-arg.js +49 -0
  79. package/dist/mjs/src/path-arg.js.map +1 -0
  80. package/dist/mjs/src/platform.d.ts +2 -0
  81. package/dist/mjs/src/platform.js +2 -0
  82. package/dist/mjs/src/platform.js.map +1 -0
  83. package/dist/mjs/src/readdir-or-error.d.ts +3 -0
  84. package/dist/mjs/src/readdir-or-error.js +14 -0
  85. package/dist/mjs/src/readdir-or-error.js.map +1 -0
  86. package/dist/mjs/src/retry-busy.d.ts +7 -0
  87. package/dist/mjs/src/retry-busy.js +60 -0
  88. package/dist/mjs/src/retry-busy.js.map +1 -0
  89. package/dist/mjs/src/rimraf-manual.d.ts +2 -0
  90. package/dist/mjs/src/rimraf-manual.js +6 -0
  91. package/dist/mjs/src/rimraf-manual.js.map +1 -0
  92. package/dist/mjs/src/rimraf-move-remove.d.ts +3 -0
  93. package/dist/mjs/src/rimraf-move-remove.js +119 -0
  94. package/dist/mjs/src/rimraf-move-remove.js.map +1 -0
  95. package/dist/mjs/src/rimraf-native.d.ts +3 -0
  96. package/dist/mjs/src/rimraf-native.js +13 -0
  97. package/dist/mjs/src/rimraf-native.js.map +1 -0
  98. package/dist/mjs/src/rimraf-posix.d.ts +3 -0
  99. package/dist/mjs/src/rimraf-posix.js +55 -0
  100. package/dist/mjs/src/rimraf-posix.js.map +1 -0
  101. package/dist/mjs/src/rimraf-windows.d.ts +3 -0
  102. package/dist/mjs/src/rimraf-windows.js +105 -0
  103. package/dist/mjs/src/rimraf-windows.js.map +1 -0
  104. package/dist/mjs/src/use-native.d.ts +2 -0
  105. package/dist/mjs/src/use-native.js +9 -0
  106. package/dist/mjs/src/use-native.js.map +1 -0
  107. package/package.json +57 -15
  108. package/CHANGELOG.md +0 -65
  109. package/bin.js +0 -68
  110. package/rimraf.js +0 -360
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The ISC License
2
2
 
3
- Copyright (c) Isaac Z. Schlueter and Contributors
3
+ Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
6
6
  purpose with or without fee is hereby granted, provided that the above
package/README.md CHANGED
@@ -1,101 +1,166 @@
1
- [![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies)
2
-
3
- The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node.
1
+ The [UNIX command](<http://en.wikipedia.org/wiki/Rm_(Unix)>) `rm -rf` for node.
4
2
 
5
3
  Install with `npm install rimraf`, or just drop rimraf.js somewhere.
6
4
 
5
+ ## Major Changes from v3 to v4
6
+
7
+ - The function returns a `Promise` instead of taking a callback.
8
+ - Built-in glob support removed.
9
+ - Functions take arrays of paths, as well as a single path.
10
+ - Native implementation used by default when available, except on
11
+ Windows, where this implementation is faster and more reliable.
12
+ - New implementation on Windows, falling back to "move then
13
+ remove" strategy when exponential backoff for `EBUSY` fails to
14
+ resolve the situation.
15
+ - Simplified implementation on Posix, since the Windows affordances are not
16
+ necessary there.
17
+
7
18
  ## API
8
19
 
9
- `rimraf(f, [opts], callback)`
20
+ Hybrid module, load either with `import` or `require()`.
21
+
22
+ ```js
23
+ // default export is the main rimraf function
24
+ import rimraf from 'rimraf'
25
+ // or
26
+ const rimraf = require('rimraf').default
27
+
28
+ // other strategies exported as well
29
+ import { rimraf, rimrafSync, native, nativeSync } from 'rimraf'
30
+ // or
31
+ const { rimraf, rimrafSync, native, nativeSync } = require('rimraf')
32
+ ```
33
+
34
+ ### `rimraf(f, [opts]) -> Promise`
35
+
36
+ This first parameter is a path or array of paths. The second
37
+ argument is an options object.
38
+
39
+ Options:
40
+
41
+ - `preserveRoot`: If set to boolean `false`, then allow the
42
+ recursive removal of the root directory. Otherwise, this is
43
+ not allowed.
44
+ - `tmp`: Windows only. Temp folder to use to place files and
45
+ folders for the "move then remove" fallback. Must be on the
46
+ same physical device as the path being deleted. Defaults to
47
+ `os.tmpdir()` when that is on the same drive letter as the path
48
+ being deleted, or `${drive}:\temp` if present, or `${drive}:\`
49
+ if not.
50
+ - `maxRetries`: Windows and Native only. Maximum number of
51
+ retry attempts in case of `EBUSY`, `EMFILE`, and `ENFILE`
52
+ errors. Default `10` for Windows implementation, `0` for Native
53
+ implementation.
54
+ - `backoff`: Windows only. Rate of exponential backoff for async
55
+ removal in case of `EBUSY`, `EMFILE`, and `ENFILE` errors.
56
+ Should be a number greater than 1. Default `1.2`
57
+ - `maxBackoff`: Windows only. Maximum total backoff time in ms to
58
+ attempt asynchronous retries in case of `EBUSY`, `EMFILE`, and
59
+ `ENFILE` errors. Default `200`. With the default `1.2` backoff
60
+ rate, this results in 14 retries, with the final retry being
61
+ delayed 33ms.
62
+ - `retryDelay`: Native only. Time to wait between retries, using
63
+ linear backoff. Default `100`.
64
+
65
+ Any other options are provided to the native Node.js `fs.rm` implementation
66
+ when that is used.
10
67
 
11
- The first parameter will be interpreted as a globbing pattern for files. If you
12
- want to disable globbing you can do so with `opts.disableGlob` (defaults to
13
- `false`). This might be handy, for instance, if you have filenames that contain
14
- globbing wildcard characters.
68
+ This will attempt to choose the best implementation, based on Node.js
69
+ version and `process.platform`. To force a specific implementation, use
70
+ one of the other functions provided.
15
71
 
16
- The callback will be called with an error if there is one. Certain
17
- errors are handled for you:
72
+ ### `rimraf.sync(f, [opts])` `rimraf.rimrafSync(f, [opts])`
18
73
 
19
- * Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of
20
- `opts.maxBusyTries` times before giving up, adding 100ms of wait
21
- between each attempt. The default `maxBusyTries` is 3.
22
- * `ENOENT` - If the file doesn't exist, rimraf will return
23
- successfully, since your desired outcome is already the case.
24
- * `EMFILE` - Since `readdir` requires opening a file descriptor, it's
25
- possible to hit `EMFILE` if too many file descriptors are in use.
26
- In the sync case, there's nothing to be done for this. But in the
27
- async case, rimraf will gradually back off with timeouts up to
28
- `opts.emfileWait` ms, which defaults to 1000.
74
+ Synchronous form of `rimraf()`
29
75
 
30
- ## options
76
+ Note that, unlike many file system operations, the synchronous form will
77
+ typically be significantly _slower_ than the async form, because recursive
78
+ deletion is extremely parallelizable.
31
79
 
32
- * unlink, chmod, stat, lstat, rmdir, readdir,
33
- unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync
80
+ ### `rimraf.native(f, [opts])`
34
81
 
35
- In order to use a custom file system library, you can override
36
- specific fs functions on the options object.
82
+ Uses the built-in `fs.rm` implementation that Node.js provides. This is
83
+ used by default on Node.js versions greater than or equal to `14.14.0`.
37
84
 
38
- If any of these functions are present on the options object, then
39
- the supplied function will be used instead of the default fs
40
- method.
85
+ ### `rimraf.nativeSync(f, [opts])` `rimraf.native.sync(f, [opts])`
41
86
 
42
- Sync methods are only relevant for `rimraf.sync()`, of course.
87
+ Synchronous form of `rimraf.native`
43
88
 
44
- For example:
89
+ ### `rimraf.manual(f, [opts])`
45
90
 
46
- ```javascript
47
- var myCustomFS = require('some-custom-fs')
91
+ Use the JavaScript implementation appropriate for your operating system.
48
92
 
49
- rimraf('some-thing', myCustomFS, callback)
50
- ```
93
+ ### `rimraf.manualSync(f, [opts])` `rimraf.manualSync(f, opts)`
51
94
 
52
- * maxBusyTries
95
+ Synchronous form of `rimraf.manual()`
53
96
 
54
- If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered
55
- on Windows systems, then rimraf will retry with a linear backoff
56
- wait of 100ms longer on each try. The default maxBusyTries is 3.
97
+ ### `rimraf.windows(f, [opts])`
57
98
 
58
- Only relevant for async usage.
99
+ JavaScript implementation of file removal appropriate for Windows
100
+ platforms. Works around `unlink` and `rmdir` not being atomic
101
+ operations, and `EPERM` when deleting files with certain
102
+ permission modes.
59
103
 
60
- * emfileWait
104
+ First deletes all non-directory files within the tree, and then
105
+ removes all directories, which should ideally be empty by that
106
+ time. When an `ENOTEMPTY` is raised in the second pass, falls
107
+ back to the `rimraf.moveRemove` strategy as needed.
61
108
 
62
- If an `EMFILE` error is encountered, then rimraf will retry
63
- repeatedly with a linear backoff of 1ms longer on each try, until
64
- the timeout counter hits this max. The default limit is 1000.
109
+ ### `rimraf.windows.sync(path, [opts])` `rimraf.windowsSync(path, [opts])`
65
110
 
66
- If you repeatedly encounter `EMFILE` errors, then consider using
67
- [graceful-fs](http://npm.im/graceful-fs) in your program.
111
+ Synchronous form of `rimraf.windows()`
68
112
 
69
- Only relevant for async usage.
113
+ ### `rimraf.moveRemove(path, [opts])`
70
114
 
71
- * glob
115
+ Moves all files and folders to the parent directory of `path`
116
+ with a temporary filename prior to attempting to remove them.
72
117
 
73
- Set to `false` to disable [glob](http://npm.im/glob) pattern
74
- matching.
118
+ Note that, in cases where the operation fails, this _may_ leave
119
+ files lying around in the parent directory with names like
120
+ `.file-basename.txt.0.123412341`. Until the Windows kernel
121
+ provides a way to perform atomic `unlink` and `rmdir` operations,
122
+ this is unfortunately unavoidable.
75
123
 
76
- Set to an object to pass options to the glob module. The default
77
- glob options are `{ nosort: true, silent: true }`.
124
+ To move files to a different temporary directory other than the
125
+ parent, provide `opts.tmp`. Note that this _must_ be on the same
126
+ physical device as the folder being deleted, or else the
127
+ operation will fail.
78
128
 
79
- Glob version 6 is used in this module.
129
+ This is the slowest strategy, but most reliable on Windows
130
+ platforms. Used as a last-ditch fallback by `rimraf.windows()`.
80
131
 
81
- Relevant for both sync and async usage.
132
+ ### `rimraf.moveRemove.sync(path, [opts])` `rimraf.moveRemoveSync(path, [opts])`
82
133
 
83
- * disableGlob
134
+ Synchronous form of `rimraf.moveRemove()`
84
135
 
85
- Set to any non-falsey value to disable globbing entirely.
86
- (Equivalent to setting `glob: false`.)
136
+ ### Command Line Interface
87
137
 
88
- ## rimraf.sync
138
+ ```
139
+ Usage: rimraf <path> [<path> ...]
140
+ Deletes all files and folders at "path", recursively.
89
141
 
90
- It can remove stuff synchronously, too. But that's not so good. Use
91
- the async API. It's better.
142
+ Options:
143
+ -- Treat all subsequent arguments as paths
144
+ -h --help Display this usage info
145
+ --preserve-root Do not remove '/' recursively (default)
146
+ --no-preserve-root Do not treat '/' specially
92
147
 
93
- ## CLI
148
+ --impl=<type> Specify the implementationt to use.
149
+ rimraf: choose the best option
150
+ native: the C++ implementation in Node.js
151
+ manual: the platform-specific JS implementation
152
+ posix: the Posix JS implementation
153
+ windows: the Windows JS implementation
154
+ move-remove: a slower Windows JS fallback implementation
94
155
 
95
- If installed with `npm install rimraf -g` it can be used as a global
96
- command `rimraf <path> [<path> ...]` which is useful for cross platform support.
156
+ Implementation-specific options:
157
+ --tmp=<path> Folder to hold temp files for 'move-remove' implementation
158
+ --max-retries=<n> maxRetries for the 'native' and 'windows' implementations
159
+ --retry-delay=<n> retryDelay for the 'native' implementation, default 100
160
+ --backoff=<n> Exponential backoff factor for retries (default: 1.2)
161
+ ```
97
162
 
98
163
  ## mkdirp
99
164
 
100
- If you need to create a directory recursively, check out
101
- [mkdirp](https://github.com/substack/node-mkdirp).
165
+ If you need to _create_ a directory recursively, check out
166
+ [mkdirp](https://github.com/isaacs/node-mkdirp).
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "rimraf",
3
+ "version": "4.0.1",
4
+ "main": "./dist/cjs/src/index.js",
5
+ "module": "./dist/mjs/src/index.js",
6
+ "bin": "./dist/cjs/src/bin.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/mjs/src/index.js",
10
+ "require": "./dist/cjs/src/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "description": "A deep deletion module for node (like `rm -rf`)",
17
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
18
+ "license": "ISC",
19
+ "repository": "git://github.com/isaacs/rimraf.git",
20
+ "scripts": {
21
+ "preversion": "npm test",
22
+ "postversion": "npm publish",
23
+ "prepublishOnly": "git push origin --follow-tags",
24
+ "preprepare": "rm -rf dist",
25
+ "prepare": "tsc -p tsconfig-cjs.json && tsc -p tsconfig-esm.json",
26
+ "postprepare": "bash fixup.sh",
27
+ "pretest": "npm run prepare",
28
+ "presnap": "npm run prepare",
29
+ "test": "c8 tap",
30
+ "snap": "c8 tap",
31
+ "format": "prettier --write . --loglevel warn",
32
+ "benchmark": "node benchmark/index.js",
33
+ "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts"
34
+ },
35
+ "prettier": {
36
+ "semi": false,
37
+ "printWidth": 80,
38
+ "tabWidth": 2,
39
+ "useTabs": false,
40
+ "singleQuote": true,
41
+ "jsxSingleQuote": false,
42
+ "bracketSameLine": true,
43
+ "arrowParens": "avoid",
44
+ "endOfLine": "lf"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^18.11.9",
48
+ "@types/tap": "^15.0.7",
49
+ "c8": "^7.12.0",
50
+ "eslint-config-prettier": "^8.6.0",
51
+ "mkdirp": "1",
52
+ "prettier": "^2.8.2",
53
+ "tap": "^16.3.3",
54
+ "ts-node": "^10.9.1",
55
+ "typedoc": "^0.23.21",
56
+ "typescript": "^4.9.3"
57
+ },
58
+ "tap": {
59
+ "coverage": false,
60
+ "libtap-settings": "libtap-settings.js",
61
+ "node-arg": [
62
+ "--no-warnings",
63
+ "--loader",
64
+ "ts-node/esm"
65
+ ],
66
+ "ts": false
67
+ },
68
+ "funding": {
69
+ "url": "https://github.com/sponsors/isaacs"
70
+ },
71
+ "engines": {
72
+ "node": ">=14"
73
+ }
74
+ }
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ export declare const help: string;
3
+ declare const main: {
4
+ (...args: string[]): Promise<1 | 0>;
5
+ help: string;
6
+ };
7
+ export default main;
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.help = void 0;
8
+ const package_json_1 = require("../package.json");
9
+ const _1 = __importDefault(require("./"));
10
+ const runHelpForUsage = () => console.error('run `rimraf --help` for usage information');
11
+ exports.help = `rimraf version ${package_json_1.version}
12
+
13
+ Usage: rimraf <path> [<path> ...]
14
+ Deletes all files and folders at "path", recursively.
15
+
16
+ Options:
17
+ -- Treat all subsequent arguments as paths
18
+ -h --help Display this usage info
19
+ --preserve-root Do not remove '/' recursively (default)
20
+ --no-preserve-root Do not treat '/' specially
21
+
22
+ --impl=<type> Specify the implementationt to use.
23
+ rimraf: choose the best option
24
+ native: the C++ implementation in Node.js
25
+ manual: the platform-specific JS implementation
26
+ posix: the Posix JS implementation
27
+ windows: the Windows JS implementation
28
+ move-remove: a slower Windows JS fallback implementation
29
+
30
+ Implementation-specific options:
31
+ --tmp=<path> Folder to hold temp files for 'move-remove' implementation
32
+ --max-retries=<n> maxRetries for the 'native' and 'windows' implementations
33
+ --retry-delay=<n> retryDelay for the 'native' implementation, default 100
34
+ --backoff=<n> Exponential backoff factor for retries (default: 1.2)
35
+ `;
36
+ const path_1 = require("path");
37
+ const main = async (...args) => {
38
+ if (process.env.__RIMRAF_TESTING_BIN_FAIL__ === '1') {
39
+ throw new Error('simulated rimraf failure');
40
+ }
41
+ const opt = {};
42
+ const paths = [];
43
+ let dashdash = false;
44
+ let impl = _1.default;
45
+ for (const arg of args) {
46
+ if (dashdash) {
47
+ paths.push(arg);
48
+ continue;
49
+ }
50
+ if (arg === '--') {
51
+ dashdash = true;
52
+ continue;
53
+ }
54
+ else if (arg === '-h' || arg === '--help') {
55
+ console.log(exports.help);
56
+ return 0;
57
+ }
58
+ else if (arg === '--preserve-root') {
59
+ opt.preserveRoot = true;
60
+ continue;
61
+ }
62
+ else if (arg === '--no-preserve-root') {
63
+ opt.preserveRoot = false;
64
+ continue;
65
+ }
66
+ else if (/^--tmp=/.test(arg)) {
67
+ const val = arg.substring('--tmp='.length);
68
+ opt.tmp = val;
69
+ continue;
70
+ }
71
+ else if (/^--max-retries=/.test(arg)) {
72
+ const val = +arg.substring('--max-retries='.length);
73
+ opt.maxRetries = val;
74
+ continue;
75
+ }
76
+ else if (/^--retry-delay=/.test(arg)) {
77
+ const val = +arg.substring('--retry-delay='.length);
78
+ opt.retryDelay = val;
79
+ continue;
80
+ }
81
+ else if (/^--backoff=/.test(arg)) {
82
+ const val = +arg.substring('--backoff='.length);
83
+ opt.backoff = val;
84
+ continue;
85
+ }
86
+ else if (/^--impl=/.test(arg)) {
87
+ const val = arg.substring('--impl='.length);
88
+ switch (val) {
89
+ case 'rimraf':
90
+ impl = _1.default;
91
+ continue;
92
+ case 'native':
93
+ case 'manual':
94
+ case 'posix':
95
+ case 'windows':
96
+ impl = _1.default[val];
97
+ continue;
98
+ case 'move-remove':
99
+ impl = _1.default.moveRemove;
100
+ continue;
101
+ default:
102
+ console.error(`unknown implementation: ${val}`);
103
+ runHelpForUsage();
104
+ return 1;
105
+ }
106
+ }
107
+ else if (/^-/.test(arg)) {
108
+ console.error(`unknown option: ${arg}`);
109
+ runHelpForUsage();
110
+ return 1;
111
+ }
112
+ else {
113
+ paths.push(arg);
114
+ }
115
+ }
116
+ if (opt.preserveRoot !== false) {
117
+ for (const path of paths.map(p => (0, path_1.resolve)(p))) {
118
+ if (path === (0, path_1.parse)(path).root) {
119
+ console.error(`rimraf: it is dangerous to operate recursively on '/'`);
120
+ console.error('use --no-preserve-root to override this failsafe');
121
+ return 1;
122
+ }
123
+ }
124
+ }
125
+ if (!paths.length) {
126
+ console.error('rimraf: must provide a path to remove');
127
+ runHelpForUsage();
128
+ return 1;
129
+ }
130
+ await impl(paths, opt);
131
+ return 0;
132
+ };
133
+ main.help = exports.help;
134
+ exports.default = main;
135
+ if (typeof require === 'function' &&
136
+ typeof module === 'object' &&
137
+ require.main === module) {
138
+ const args = process.argv.slice(2);
139
+ main(...args).then(code => process.exit(code), er => {
140
+ console.error(er);
141
+ process.exit(1);
142
+ });
143
+ }
144
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../src/bin.ts"],"names":[],"mappings":";;;;;;;AACA,kDAAyC;AACzC,0CAA0C;AAE1C,MAAM,eAAe,GAAG,GAAG,EAAE,CAC3B,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAA;AAE/C,QAAA,IAAI,GAAG,kBAAkB,sBAAO;;;;;;;;;;;;;;;;;;;;;;;;CAwB5C,CAAA;AAED,+BAAqC;AAErC,MAAM,IAAI,GAAG,KAAK,EAAE,GAAG,IAAc,EAAE,EAAE;IACvC,IAAI,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,GAAG,EAAE;QACnD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;KAC5C;IAED,MAAM,GAAG,GAAkB,EAAE,CAAA;IAC7B,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,QAAQ,GAAG,KAAK,CAAA;IACpB,IAAI,IAAI,GACN,UAAM,CAAA;IAER,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,IAAI,QAAQ,EAAE;YACZ,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACf,SAAQ;SACT;QACD,IAAI,GAAG,KAAK,IAAI,EAAE;YAChB,QAAQ,GAAG,IAAI,CAAA;YACf,SAAQ;SACT;aAAM,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,QAAQ,EAAE;YAC3C,OAAO,CAAC,GAAG,CAAC,YAAI,CAAC,CAAA;YACjB,OAAO,CAAC,CAAA;S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AI,GAAG,YAAI,CAAA;AAEhB,kBAAe,IAAI,CAAA;AAEnB,IACE,OAAO,OAAO,KAAK,UAAU;IAC7B,OAAO,MAAM,KAAK,QAAQ;IAC1B,OAAO,CAAC,IAAI,KAAK,MAAM,EACvB;IACA,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAClC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAChB,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAC1B,EAAE,CAAC,EAAE;QACH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CACF,CAAA;CACF"}
@@ -0,0 +1,2 @@
1
+ export declare const defaultTmp: (path: string) => Promise<string>;
2
+ export declare const defaultTmpSync: (path: string) => string;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.defaultTmpSync = exports.defaultTmp = void 0;
7
+ // The default temporary folder location for use in the windows algorithm.
8
+ // It's TEMPting to use dirname(path), since that's guaranteed to be on the
9
+ // same device. However, this means that:
10
+ // rimraf(path).then(() => rimraf(dirname(path)))
11
+ // will often fail with EBUSY, because the parent dir contains
12
+ // marked-for-deletion directory entries (which do not show up in readdir).
13
+ // The approach here is to use os.tmpdir() if it's on the same drive letter,
14
+ // or resolve(path, '\\temp') if it exists, or the root of the drive if not.
15
+ // On Posix (not that you'd be likely to use the windows algorithm there),
16
+ // it uses os.tmpdir() always.
17
+ const os_1 = require("os");
18
+ const path_1 = require("path");
19
+ const fs_1 = require("./fs");
20
+ const platform_1 = __importDefault(require("./platform"));
21
+ const { stat } = fs_1.promises;
22
+ const isDirSync = (path) => {
23
+ try {
24
+ return (0, fs_1.statSync)(path).isDirectory();
25
+ }
26
+ catch (er) {
27
+ return false;
28
+ }
29
+ };
30
+ const isDir = (path) => stat(path).then(st => st.isDirectory(), () => false);
31
+ const win32DefaultTmp = async (path) => {
32
+ const { root } = (0, path_1.parse)(path);
33
+ const tmp = (0, os_1.tmpdir)();
34
+ const { root: tmpRoot } = (0, path_1.parse)(tmp);
35
+ if (root.toLowerCase() === tmpRoot.toLowerCase()) {
36
+ return tmp;
37
+ }
38
+ const driveTmp = (0, path_1.resolve)(root, '/temp');
39
+ if (await isDir(driveTmp)) {
40
+ return driveTmp;
41
+ }
42
+ return root;
43
+ };
44
+ const win32DefaultTmpSync = (path) => {
45
+ const { root } = (0, path_1.parse)(path);
46
+ const tmp = (0, os_1.tmpdir)();
47
+ const { root: tmpRoot } = (0, path_1.parse)(tmp);
48
+ if (root.toLowerCase() === tmpRoot.toLowerCase()) {
49
+ return tmp;
50
+ }
51
+ const driveTmp = (0, path_1.resolve)(root, '/temp');
52
+ if (isDirSync(driveTmp)) {
53
+ return driveTmp;
54
+ }
55
+ return root;
56
+ };
57
+ const posixDefaultTmp = async () => (0, os_1.tmpdir)();
58
+ const posixDefaultTmpSync = () => (0, os_1.tmpdir)();
59
+ exports.defaultTmp = platform_1.default === 'win32' ? win32DefaultTmp : posixDefaultTmp;
60
+ exports.defaultTmpSync = platform_1.default === 'win32' ? win32DefaultTmpSync : posixDefaultTmpSync;
61
+ //# sourceMappingURL=default-tmp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-tmp.js","sourceRoot":"","sources":["../../../src/default-tmp.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,0CAA0C;AAC1C,iDAAiD;AACjD,8DAA8D;AAC9D,2EAA2E;AAC3E,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,8BAA8B;AAC9B,2BAA2B;AAC3B,+BAAqC;AACrC,6BAAyC;AACzC,0DAAiC;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AG,CAAC,CAAA;IACpC,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,EAAE;QAChD,OAAO,GAAG,CAAA;KACX;IAED,MAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACvC,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE;QACvB,OAAO,QAAQ,CAAA;KAChB;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,KAAK,IAAI,EAAE,CAAC,IAAA,WAAM,GAAE,CAAA;AAC5C,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,IAAA,WAAM,GAAE,CAAA;AAE7B,QAAA,UAAU,GACrB,kBAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAA;AAC7C,QAAA,cAAc,GACzB,kBAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const fixEPERM: (fn: (path: string) => Promise<any>) => (path: string) => Promise<any>;
2
+ export declare const fixEPERMSync: (fn: (path: string) => any) => (path: string) => any;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fixEPERMSync = exports.fixEPERM = void 0;
4
+ const fs_1 = require("./fs");
5
+ const { chmod } = fs_1.promises;
6
+ const fixEPERM = (fn) => async (path) => {
7
+ try {
8
+ return await fn(path);
9
+ }
10
+ catch (er) {
11
+ const fer = er;
12
+ if (fer?.code === 'ENOENT') {
13
+ return;
14
+ }
15
+ if (fer?.code === 'EPERM') {
16
+ try {
17
+ await chmod(path, 0o666);
18
+ }
19
+ catch (er2) {
20
+ const fer2 = er2;
21
+ if (fer2?.code === 'ENOENT') {
22
+ return;
23
+ }
24
+ throw er;
25
+ }
26
+ return await fn(path);
27
+ }
28
+ throw er;
29
+ }
30
+ };
31
+ exports.fixEPERM = fixEPERM;
32
+ const fixEPERMSync = (fn) => (path) => {
33
+ try {
34
+ return fn(path);
35
+ }
36
+ catch (er) {
37
+ const fer = er;
38
+ if (fer?.code === 'ENOENT') {
39
+ return;
40
+ }
41
+ if (fer?.code === 'EPERM') {
42
+ try {
43
+ (0, fs_1.chmodSync)(path, 0o666);
44
+ }
45
+ catch (er2) {
46
+ const fer2 = er2;
47
+ if (fer2?.code === 'ENOENT') {
48
+ return;
49
+ }
50
+ throw er;
51
+ }
52
+ return fn(path);
53
+ }
54
+ throw er;
55
+ }
56
+ };
57
+ exports.fixEPERMSync = fixEPERMSync;
58
+ //# sourceMappingURL=fix-eperm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-eperm.js","sourceRoot":"","sources":["../../../src/fix-eperm.ts"],"names":[],"mappings":";;;AAAA,6BAAmD;AACnD,MAAM,EAAE,KAAK,EAAE,GAAG,aAAQ,CAAA;AAEnB,MAAM,QAAQ,GACnB,CAAC,EAAkC,EAAE,EAAE,CAAC,KAAK,EAAE,IAAY,EAAE,EAAE;IAC7D,IAAI;QACF,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,CAAA;KACtB;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAAa,CAAA;QACzB,IAAI,GAAG,EAAE,IAAI,KAAK,QAAQ,EAAE;YAC1B,OAAM;SACP;QACD,IAAI,GAAG,EAAE,IAAI,KAAK,OAAO,EAAE;YACzB,IAAI;gBACF,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;aACzB;YAAC,OAAO,GAAG,EAAE;gBACZ,MAAM,IAAI,GAAG,GAAc,CAAA;gBAC3B,IAAI,IAAI,EAAE,IAAI,KAAK,QAAQ,EAAE;oBAC3B,OAAM;iBACP;gBACD,MAAM,EAAE,CAAA;aACT;YACD,OAAO,MAAM,EAAE,CAAC,IAAI,CAAC,CAAA;SACtB;QACD,MAAM,EAAE,CAAA;KACT;AACH,CAAC,CAAA;AAvBU,QAAA,QAAQ,YAuBlB;AAEI,MAAM,YAAY,GAAG,CAAC,EAAyB,EAAE,EAAE,CAAC,CAAC,IAAY,EAAE,EAAE;IAC1E,IAAI;QACF,OAAO,EAAE,CAAC,IAAI,CAAC,CAAA;KAChB;IAAC,OAAO,EAAE,EAAE;QACX,MAAM,GAAG,GAAG,EAAa,CAAA;QACzB,IAAI,GAAG,EAAE,IAAI,KAAK,QAAQ,EAAE;YAC1B,OAAM;SACP;QACD,IAAI,GAAG,EAAE,IAAI,KAAK,OAAO,EAAE;YACzB,IAAI;gBACF,IAAA,cAAS,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;aACvB;YAAC,OAAO,GAAG,EAAE;gBACZ,MAAM,IAAI,GAAG,GAAc,CAAA;gBAC3B,IAAI,IAAI,EAAE,IAAI,KAAK,QAAQ,EAAE;oBAC3B,OAAM;iBACP;gBACD,MAAM,EAAE,CAAA;aACT;YACD,OAAO,EAAE,CAAC,IAAI,CAAC,CAAA;SAChB;QACD,MAAM,EAAE,CAAA;KACT;AACH,CAAC,CAAA;AAtBY,QAAA,YAAY,gBAsBxB"}
@@ -0,0 +1,17 @@
1
+ import fs from 'fs';
2
+ export type FsError = Error & {
3
+ code?: string;
4
+ };
5
+ export { chmodSync, mkdirSync, readdirSync, renameSync, rmdirSync, rmSync, statSync, unlinkSync, } from 'fs';
6
+ export declare const promises: {
7
+ chmod: (path: fs.PathLike, mode: fs.Mode) => Promise<void>;
8
+ mkdir: (path: fs.PathLike, options?: fs.Mode | (fs.MakeDirectoryOptions & {
9
+ recursive?: boolean | null;
10
+ }) | undefined | null) => Promise<string | undefined>;
11
+ readdir: (path: fs.PathLike) => Promise<string[]>;
12
+ rename: (oldPath: fs.PathLike, newPath: fs.PathLike) => Promise<void>;
13
+ rm: (path: fs.PathLike, options: fs.RmOptions) => Promise<void>;
14
+ rmdir: (path: fs.PathLike) => Promise<void>;
15
+ stat: (path: fs.PathLike) => Promise<fs.Stats>;
16
+ unlink: (path: fs.PathLike) => Promise<void>;
17
+ };