@stryke/fs 0.11.3 → 0.12.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.
- package/dist/list-files.cjs +21 -20
- package/dist/list-files.d.ts +20 -5
- package/dist/list-files.mjs +1 -1
- package/dist/package-fns.d.ts +1 -2
- package/package.json +4 -4
package/dist/list-files.cjs
CHANGED
|
@@ -3,26 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.list = list;
|
|
7
|
+
exports.listDirectories = listDirectories;
|
|
6
8
|
exports.listFiles = listFiles;
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var _promises = require("node:fs/promises");
|
|
10
|
-
var _picomatch = _interopRequireDefault(require("picomatch"));
|
|
9
|
+
var _defu = _interopRequireDefault(require("defu"));
|
|
10
|
+
var _glob = require("glob");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
const p = {
|
|
13
|
+
dot: !0
|
|
14
|
+
};
|
|
15
|
+
async function list(i, t) {
|
|
16
|
+
return (0, _glob.glob)(i, (0, _defu.default)(t ?? {}, p));
|
|
17
|
+
}
|
|
18
|
+
async function listFiles(i, t) {
|
|
19
|
+
const s = (await list(i, (0, _defu.default)({
|
|
20
|
+
withFileTypes: !0
|
|
21
|
+
}, t ?? {}))).filter(e => e.isFile());
|
|
22
|
+
return t?.withFileTypes ? s : s.map(e => e.fullpath());
|
|
23
|
+
}
|
|
24
|
+
async function listDirectories(i, t) {
|
|
25
|
+
const s = (await list(i, (0, _defu.default)({
|
|
26
|
+
withFileTypes: !0
|
|
27
|
+
}, t ?? {}))).filter(e => e.isDirectory());
|
|
28
|
+
return t?.withFileTypes ? s : s.map(e => e.fullpath());
|
|
28
29
|
}
|
package/dist/list-files.d.ts
CHANGED
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type
|
|
1
|
+
import type { GlobOptions, Path } from "glob";
|
|
2
|
+
export type ListOptions = GlobOptions;
|
|
3
|
+
export type InferListReturnType<TOptions extends GlobOptions> = TOptions["withFileTypes"] extends true ? Path[] : string[];
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* A files and directories listing helper function
|
|
5
6
|
*
|
|
6
|
-
* @param
|
|
7
|
+
* @param filesGlob - A glob pattern to match files
|
|
7
8
|
* @returns A list of file paths
|
|
8
9
|
*/
|
|
9
|
-
export declare function
|
|
10
|
+
export declare function list<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): Promise<InferListReturnType<TOptions>>;
|
|
11
|
+
/**
|
|
12
|
+
* A file listing helper function
|
|
13
|
+
*
|
|
14
|
+
* @param filesGlob - A glob pattern to match files
|
|
15
|
+
* @returns A list of file paths
|
|
16
|
+
*/
|
|
17
|
+
export declare function listFiles<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): Promise<InferListReturnType<TOptions>>;
|
|
18
|
+
/**
|
|
19
|
+
* A directories listing helper function
|
|
20
|
+
*
|
|
21
|
+
* @param filesGlob - A glob pattern to match files
|
|
22
|
+
* @returns A list of file paths
|
|
23
|
+
*/
|
|
24
|
+
export declare function listDirectories<TOptions extends ListOptions>(filesGlob: string, options?: TOptions): Promise<InferListReturnType<TOptions>>;
|
package/dist/list-files.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import n from"defu";import{glob as r}from"glob";const p={dot:!0};export async function list(i,t){return r(i,n(t??{},p))}export async function listFiles(i,t){const s=(await list(i,n({withFileTypes:!0},t??{}))).filter(e=>e.isFile());return t?.withFileTypes?s:s.map(e=>e.fullpath())}export async function listDirectories(i,t){const s=(await list(i,n({withFileTypes:!0},t??{}))).filter(e=>e.isDirectory());return t?.withFileTypes?s:s.map(e=>e.fullpath())}
|
package/dist/package-fns.d.ts
CHANGED
|
@@ -38,8 +38,7 @@ export declare function getPackageInfoSync(name: string, options?: PackageResolv
|
|
|
38
38
|
/**
|
|
39
39
|
* Get the package info from the package.json file
|
|
40
40
|
*
|
|
41
|
-
* @param
|
|
42
|
-
* @param options - The options to use when resolving the package
|
|
41
|
+
* @param cwd - The current working directory
|
|
43
42
|
* @returns The package info
|
|
44
43
|
*/
|
|
45
44
|
export declare function loadPackageJSON(cwd?: any): Promise<PackageJson | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/fs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.",
|
|
6
6
|
"repository": {
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
"@antfu/install-pkg": "^1.0.0",
|
|
16
16
|
"@zkochan/js-yaml": "^0.0.7",
|
|
17
17
|
"chalk": "^5.4.1",
|
|
18
|
+
"defu": "^6.1.4",
|
|
19
|
+
"glob": "^11.0.1",
|
|
18
20
|
"nanotar": "^0.2.0",
|
|
19
|
-
"picomatch": "^4.0.2",
|
|
20
21
|
"semver": "7.7.1",
|
|
21
22
|
"@stryke/json": "^0.7.1",
|
|
22
|
-
"@stryke/path": "^0.4.
|
|
23
|
+
"@stryke/path": "^0.4.9",
|
|
23
24
|
"@stryke/type-checks": "^0.3.1",
|
|
24
25
|
"@stryke/types": "^0.8.1"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@types/node": "^22.13.1",
|
|
28
|
-
"@types/picomatch": "^3.0.2",
|
|
29
29
|
"@types/semver": "^7.5.8",
|
|
30
30
|
"nx": "^20.5.0",
|
|
31
31
|
"tinyexec": "^0.3.2"
|