rimraf 2.3.0 → 2.3.4

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 (3) hide show
  1. package/LICENSE +12 -20
  2. package/package.json +3 -6
  3. package/rimraf.js +32 -9
package/LICENSE CHANGED
@@ -1,23 +1,15 @@
1
- Copyright 2009, 2010, 2011 Isaac Z. Schlueter.
2
- All rights reserved.
1
+ The ISC License
3
2
 
4
- Permission is hereby granted, free of charge, to any person
5
- obtaining a copy of this software and associated documentation
6
- files (the "Software"), to deal in the Software without
7
- restriction, including without limitation the rights to use,
8
- copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the
10
- Software is furnished to do so, subject to the following
11
- conditions:
3
+ Copyright (c) Isaac Z. Schlueter and Contributors
12
4
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
15
8
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
- OTHER DEALINGS IN THE SOFTWARE.
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/package.json CHANGED
@@ -1,20 +1,17 @@
1
1
  {
2
2
  "name": "rimraf",
3
- "version": "2.3.0",
3
+ "version": "2.3.4",
4
4
  "main": "rimraf.js",
5
5
  "description": "A deep deletion module for node (like `rm -rf`)",
6
6
  "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
7
- "license": {
8
- "type": "MIT",
9
- "url": "https://github.com/isaacs/rimraf/raw/master/LICENSE"
10
- },
7
+ "license": "ISC",
11
8
  "repository": "git://github.com/isaacs/rimraf.git",
12
9
  "scripts": {
13
10
  "test": "cd test && bash run.sh"
14
11
  },
15
12
  "bin": "./bin.js",
16
13
  "dependencies": {
17
- "glob": "^4.4.1"
14
+ "glob": "^4.4.2"
18
15
  },
19
16
  "files": [
20
17
  "bin.js",
package/rimraf.js CHANGED
@@ -42,19 +42,28 @@ function rimraf (p, options, cb) {
42
42
  cb = options
43
43
  options = {}
44
44
  }
45
- assert(p)
46
- assert(options)
47
- assert(typeof cb === 'function')
48
45
 
49
- defaults(options)
46
+ assert(p, 'rimraf: missing path')
47
+ assert.equal(typeof p, 'string', 'rimraf: path should be a string')
48
+ assert(options, 'rimraf: missing options')
49
+ assert.equal(typeof options, 'object', 'rimraf: options should be object')
50
+ assert.equal(typeof cb, 'function', 'rimraf: callback function required')
50
51
 
51
- if (!cb) throw new Error("No callback passed to rimraf()")
52
+ defaults(options)
52
53
 
53
54
  var busyTries = 0
54
55
  var errState = null
55
56
  var n = 0
56
57
 
57
- glob(p, globOpts, afterGlob)
58
+ if (!glob.hasMagic(p))
59
+ return afterGlob(null, [p])
60
+
61
+ fs.lstat(p, function (er, stat) {
62
+ if (!er)
63
+ return afterGlob(null, [p])
64
+
65
+ glob(p, globOpts, afterGlob)
66
+ })
58
67
 
59
68
  function next (er) {
60
69
  errState = errState || er
@@ -246,10 +255,24 @@ function rimrafSync (p, options) {
246
255
  options = options || {}
247
256
  defaults(options)
248
257
 
249
- assert(p)
250
- assert(options)
258
+ assert(p, 'rimraf: missing path')
259
+ assert.equal(typeof p, 'string', 'rimraf: path should be a string')
260
+ assert(options, 'rimraf: missing options')
261
+ assert.equal(typeof options, 'object', 'rimraf: options should be object')
262
+
263
+ var results
264
+
265
+ if (!glob.hasMagic(p)) {
266
+ results = [p]
267
+ } else {
268
+ try {
269
+ fs.lstatSync(p)
270
+ results = [p]
271
+ } catch (er) {
272
+ results = glob.sync(p, globOpts)
273
+ }
274
+ }
251
275
 
252
- var results = glob.sync(p, globOpts)
253
276
  if (!results.length)
254
277
  return
255
278