1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
From: =?utf-8?q?Bastien_Roucari=C3=A8s?= <rouca@debian.org>
Date: Sun, 2 Nov 2025 17:53:30 +0100
Subject: Port to glob@8
forwarded: not-needed
---
package.json | 2 +-
rimraf.js | 10 ++++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 1bf8d5e..da84d70 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
},
"bin": "./bin.js",
"dependencies": {
- "glob": "^7.1.3"
+ "glob": ">=8.0.0"
},
"files": [
"LICENSE",
diff --git a/rimraf.js b/rimraf.js
index 34da417..d6d254a 100644
--- a/rimraf.js
+++ b/rimraf.js
@@ -2,8 +2,11 @@ const assert = require("assert")
const path = require("path")
const fs = require("fs")
let glob = undefined
+let globversion = undefined
try {
glob = require("glob")
+ const { version } = require('glob/package.json');
+ globversion = version
} catch (_err) {
// treat glob as optional.
}
@@ -109,8 +112,11 @@ const rimraf = (p, options, cb) => {
options.lstat(p, (er, stat) => {
if (!er)
return afterGlob(null, [p])
-
- glob(p, options.glob, afterGlob)
+ if (parseInt(globversion.split('.')[0], 10) < 9) {
+ glob(p, options.glob, afterGlob);
+ } else {
+ glob(p, options.glob).then(files => afterGlob(null, files)).catch(err => afterGlob(err, null));
+ }
})
}
|