rrdir 8.2.2 → 9.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 (3) hide show
  1. package/README.md +6 -6
  2. package/index.js +12 -14
  3. package/package.json +14 -23
package/README.md CHANGED
@@ -10,26 +10,26 @@
10
10
  npm i rrdir
11
11
  ```
12
12
  ```js
13
- const rrdir = require("rrdir");
13
+ import {rrdir, rrdirAsync, rrdirSync} from "rrdir";
14
14
 
15
15
  for await (const entry of rrdir("dir")) {
16
16
  // => {path: 'dir/file', directory: false, symlink: false}
17
17
  }
18
18
 
19
- const entries = await rrdir.async("dir");
19
+ const entries = await rrdirAsync("dir");
20
20
  // => [{path: 'dir/file', directory: false, symlink: false}]
21
21
 
22
- const entries = rrdir.sync("dir");
22
+ const entries = rrdirSync("dir");
23
23
  // => [{path: 'dir/file', directory: false, symlink: false}]
24
24
 
25
25
  ```
26
26
 
27
27
  ## API
28
28
  ### `rrdir(dir, [options])`
29
- ### `rrdir.async(dir, [options])`
30
- ### `rrdir.sync(dir, [options])`
29
+ ### `rrdirAsync(dir, [options])`
30
+ ### `rrdirSync(dir, [options])`
31
31
 
32
- `rrdir` is an async iterator which yields `entry`. `rrdir.async` and `rrdir.sync` return an Array of `entry`.
32
+ `rrdir` is an async iterator which yields `entry`. `rrdirAsync` and `rrdirSync` return an Array of `entry`.
33
33
 
34
34
  #### `dir` *String* | *Buffer*
35
35
 
package/index.js CHANGED
@@ -1,9 +1,7 @@
1
- "use strict";
2
-
3
- const {readdir, stat, lstat} = require("fs").promises;
4
- const {readdirSync, statSync, lstatSync} = require("fs");
5
- const {sep} = require("path");
6
- const picomatch = require("picomatch");
1
+ import {readdir, stat, lstat} from "fs/promises";
2
+ import {readdirSync, statSync, lstatSync} from "fs";
3
+ import {sep} from "path";
4
+ import picomatch from "picomatch";
7
5
 
8
6
  const sepBuffer = Buffer.from(sep);
9
7
 
@@ -42,7 +40,7 @@ function makeMatchers({include, exclude, match}) {
42
40
  };
43
41
  }
44
42
 
45
- const rrdir = module.exports = async function* (dir, opts = {}, {includeMatcher, excludeMatcher, encoding} = {}) {
43
+ export async function* rrdir(dir, opts = {}, {includeMatcher, excludeMatcher, encoding} = {}) {
46
44
  if (includeMatcher === undefined) {
47
45
  opts = Object.assign({}, defaults, opts);
48
46
  ({includeMatcher, excludeMatcher} = makeMatchers(opts));
@@ -94,9 +92,9 @@ const rrdir = module.exports = async function* (dir, opts = {}, {includeMatcher,
94
92
 
95
93
  if (recurse) yield* await rrdir(path, opts, {includeMatcher, excludeMatcher, encoding});
96
94
  }
97
- };
95
+ }
98
96
 
99
- module.exports.async = async (dir, opts = {}, {includeMatcher, excludeMatcher, encoding} = {}) => {
97
+ export async function rrdirAsync(dir, opts = {}, {includeMatcher, excludeMatcher, encoding} = {}) {
100
98
  if (includeMatcher === undefined) {
101
99
  opts = Object.assign({}, defaults, opts);
102
100
  ({includeMatcher, excludeMatcher} = makeMatchers(opts));
@@ -147,13 +145,13 @@ module.exports.async = async (dir, opts = {}, {includeMatcher, excludeMatcher, e
147
145
  recurse = true;
148
146
  }
149
147
 
150
- if (recurse) results.push(...await module.exports.async(path, opts, {includeMatcher, excludeMatcher, encoding}));
148
+ if (recurse) results.push(...await rrdirAsync(path, opts, {includeMatcher, excludeMatcher, encoding}));
151
149
  }));
152
150
 
153
151
  return results;
154
- };
152
+ }
155
153
 
156
- module.exports.sync = (dir, opts = {}, {includeMatcher, excludeMatcher, encoding} = {}) => {
154
+ export function rrdirSync(dir, opts = {}, {includeMatcher, excludeMatcher, encoding} = {}) {
157
155
  if (includeMatcher === undefined) {
158
156
  opts = Object.assign({}, defaults, opts);
159
157
  ({includeMatcher, excludeMatcher} = makeMatchers(opts));
@@ -203,8 +201,8 @@ module.exports.sync = (dir, opts = {}, {includeMatcher, excludeMatcher, encoding
203
201
  recurse = true;
204
202
  }
205
203
 
206
- if (recurse) results.push(...module.exports.sync(path, opts, {includeMatcher, excludeMatcher, encoding}));
204
+ if (recurse) results.push(...rrdirSync(path, opts, {includeMatcher, excludeMatcher, encoding}));
207
205
  }
208
206
 
209
207
  return results;
210
- };
208
+ }
package/package.json CHANGED
@@ -1,32 +1,30 @@
1
1
  {
2
2
  "name": "rrdir",
3
- "version": "8.2.2",
3
+ "version": "9.0.1",
4
4
  "description": "Recursive directory reader with a delightful API",
5
5
  "author": "silverwind <me@silverwind.io>",
6
6
  "repository": "silverwind/rrdir",
7
7
  "license": "BSD-2-Clause",
8
- "main": "index.js",
9
- "scripts": {
10
- "test": "make test"
11
- },
8
+ "exports": "./index.js",
9
+ "type": "module",
10
+ "sideEffects": false,
12
11
  "engines": {
13
- "node": ">=10.10"
12
+ "node": ">=14"
14
13
  },
15
14
  "files": [
16
15
  "index.js"
17
16
  ],
18
17
  "dependencies": {
19
- "picomatch": "^2.2.2"
18
+ "picomatch": "^2.3.1"
20
19
  },
21
20
  "devDependencies": {
22
- "del": "6.0.0",
23
- "eslint": "7.21.0",
24
- "eslint-config-silverwind": "29.0.0",
25
- "jest": "26.6.3",
26
- "semver": "7.3.4",
27
- "tempy": "1.0.0",
28
- "updates": "11.4.3",
29
- "versions": "8.4.5"
21
+ "eslint": "8.23.1",
22
+ "eslint-config-silverwind": "54.0.2",
23
+ "jest": "29.0.3",
24
+ "semver": "7.3.7",
25
+ "tempy": "3.0.0",
26
+ "updates": "13.1.5",
27
+ "versions": "9.3.0"
30
28
  },
31
29
  "keywords": [
32
30
  "recursive readdir",
@@ -38,12 +36,5 @@
38
36
  "crawl",
39
37
  "crawler",
40
38
  "scandir"
41
- ],
42
- "jest": {
43
- "verbose": false,
44
- "testTimeout": 10000,
45
- "collectCoverageFrom": [
46
- "*.js"
47
- ]
48
- }
39
+ ]
49
40
  }