rrdir 12.0.1 → 12.0.2

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 (2) hide show
  1. package/index.js +12 -3
  2. package/package.json +6 -6
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {readdir, stat, lstat} from "node:fs/promises";
2
2
  import {readdirSync, statSync, lstatSync} from "node:fs";
3
- import {sep} from "node:path";
3
+ import {sep, resolve} from "node:path";
4
4
  import picomatch from "picomatch";
5
5
 
6
6
  const sepBuffer = Buffer.from(sep);
@@ -36,9 +36,18 @@ function makeMatchers({include, exclude, insensitive}) {
36
36
  dot: true,
37
37
  flags: insensitive ? "i" : undefined,
38
38
  };
39
+
40
+ // resolve the path to an absolute one because picomatch can not deal properly
41
+ // with relative paths that start with ./ or .\
42
+ // > (await import("picomatch")).default(["**.js"])("./foo.js")
43
+ // false
39
44
  return {
40
- includeMatcher: include?.length ? picomatch(include, opts) : null,
41
- excludeMatcher: exclude?.length ? picomatch(exclude, opts) : null,
45
+ includeMatcher: include?.length ? (path => {
46
+ return picomatch(include, opts)(resolve(path));
47
+ }) : null,
48
+ excludeMatcher: exclude?.length ? (path => {
49
+ return picomatch(exclude, opts)(resolve(path));
50
+ }) : null,
42
51
  };
43
52
  }
44
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrdir",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
4
4
  "description": "Recursive directory reader with a delightful API",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/rrdir",
@@ -15,11 +15,11 @@
15
15
  "index.js"
16
16
  ],
17
17
  "devDependencies": {
18
- "eslint": "8.47.0",
19
- "eslint-config-silverwind": "74.1.2",
20
- "updates": "14.3.5",
21
- "versions": "11.0.2",
22
- "vitest": "0.34.2",
18
+ "eslint": "8.50.0",
19
+ "eslint-config-silverwind": "76.0.1",
20
+ "updates": "15.0.2",
21
+ "versions": "11.1.0",
22
+ "vitest": "0.34.5",
23
23
  "vitest-config-silverwind": "3.0.0"
24
24
  },
25
25
  "keywords": [