diff --git a/DEV_CHECKLIST.md b/DEV_CHECKLIST.md index 79cead4..87f63ea 100644 --- a/DEV_CHECKLIST.md +++ b/DEV_CHECKLIST.md @@ -8,7 +8,6 @@ - [ ] Have you used the code locally? - [ ] Check your email and username. Protect PII. `git log -n1` - ```bash npm run build npm run test diff --git a/README.md b/README.md index 6d2a231..a3af904 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ A library project for nodejs. #nodejs #typescript #library 1. hello (for debugging) 2. `pojo` for converting class objects to Plain Old Javascript Objects. +3. `createFindDirectories` as a factory for finding directories; think `find path -type d`. ## Develop diff --git a/docs/README.md b/docs/README.md index 66c286a..3eddd0f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,6 +13,7 @@ A library project for nodejs. #nodejs #typescript #library 1. hello (for debugging) 2. `pojo` for converting class objects to Plain Old Javascript Objects. +3. `createFindDirectories` as a factory for finding directories; think `find path -type d`. ## Develop diff --git a/docs/docs.json b/docs/docs.json index 1321dda..9a7ca86 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -6,6 +6,782 @@ "kind": 1, "flags": {}, "children": [ + { + "id": 27, + "name": "FileSystemDependencies", + "variant": "declaration", + "kind": 256, + "flags": {}, + "children": [ + { + "id": 28, + "name": "readdir", + "variant": "declaration", + "kind": 1024, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 4, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ], + "type": { + "type": "reflection", + "declaration": { + "id": 29, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 13, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ], + "signatures": [ + { + "id": 30, + "name": "__type", + "variant": "signature", + "kind": 4096, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 13, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ], + "parameters": [ + { + "id": 31, + "name": "path", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + }, + { + "id": 32, + "name": "opts", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "reflection", + "declaration": { + "id": 33, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "children": [ + { + "id": 34, + "name": "withFileTypes", + "variant": "declaration", + "kind": 1024, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 36, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ], + "type": { + "type": "literal", + "value": true + } + } + ], + "groups": [ + { + "title": "Properties", + "children": [ + 34 + ] + } + ], + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 34, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ] + } + } + } + ], + "type": { + "type": "reference", + "target": { + "packageName": "typescript", + "packagePath": "lib/lib.es5.d.ts", + "qualifiedName": "Promise" + }, + "typeArguments": [ + { + "type": "array", + "elementType": { + "type": "reflection", + "declaration": { + "id": 35, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "children": [ + { + "id": 36, + "name": "name", + "variant": "declaration", + "kind": 1024, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 72, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ], + "type": { + "type": "intrinsic", + "name": "string" + } + }, + { + "id": 37, + "name": "isDirectory", + "variant": "declaration", + "kind": 2048, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 86, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ], + "signatures": [ + { + "id": 38, + "name": "isDirectory", + "variant": "signature", + "kind": 4096, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 86, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + } + } + ] + } + ], + "groups": [ + { + "title": "Properties", + "children": [ + 36 + ] + }, + { + "title": "Methods", + "children": [ + 37 + ] + } + ], + "sources": [ + { + "fileName": "find.ts", + "line": 4, + "character": 70, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4" + } + ] + } + } + } + ], + "name": "Promise", + "package": "typescript" + } + } + ] + } + } + }, + { + "id": 39, + "name": "stat", + "variant": "declaration", + "kind": 1024, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 5, + "character": 4, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L5" + } + ], + "type": { + "type": "reflection", + "declaration": { + "id": 40, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 5, + "character": 10, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L5" + } + ], + "signatures": [ + { + "id": 41, + "name": "__type", + "variant": "signature", + "kind": 4096, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 5, + "character": 10, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L5" + } + ], + "parameters": [ + { + "id": 42, + "name": "path", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ], + "type": { + "type": "reference", + "target": { + "packageName": "typescript", + "packagePath": "lib/lib.es5.d.ts", + "qualifiedName": "Promise" + }, + "typeArguments": [ + { + "type": "reflection", + "declaration": { + "id": 43, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "children": [ + { + "id": 44, + "name": "isDirectory", + "variant": "declaration", + "kind": 2048, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 5, + "character": 38, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L5" + } + ], + "signatures": [ + { + "id": 45, + "name": "isDirectory", + "variant": "signature", + "kind": 4096, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 5, + "character": 38, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L5" + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + } + } + ] + } + ], + "groups": [ + { + "title": "Methods", + "children": [ + 44 + ] + } + ], + "sources": [ + { + "fileName": "find.ts", + "line": 5, + "character": 36, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L5" + } + ] + } + } + ], + "name": "Promise", + "package": "typescript" + } + } + ] + } + } + } + ], + "groups": [ + { + "title": "Properties", + "children": [ + 28, + 39 + ] + } + ], + "sources": [ + { + "fileName": "find.ts", + "line": 3, + "character": 10, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L3" + } + ] + }, + { + "id": 14, + "name": "FindDirectoriesOptions", + "variant": "declaration", + "kind": 256, + "flags": {}, + "children": [ + { + "id": 17, + "name": "allowlist", + "variant": "declaration", + "kind": 1024, + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "find.ts", + "line": 11, + "character": 4, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L11" + } + ], + "type": { + "type": "union", + "types": [ + { + "type": "array", + "elementType": { + "type": "intrinsic", + "name": "string" + } + }, + { + "type": "reflection", + "declaration": { + "id": 18, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 11, + "character": 28, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L11" + } + ], + "signatures": [ + { + "id": 19, + "name": "__type", + "variant": "signature", + "kind": 4096, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 11, + "character": 28, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L11" + } + ], + "parameters": [ + { + "id": 20, + "name": "absPath", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + }, + { + "id": 21, + "name": "name", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + } + } + ] + } + } + ] + } + }, + { + "id": 22, + "name": "blocklist", + "variant": "declaration", + "kind": 1024, + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "find.ts", + "line": 12, + "character": 4, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L12" + } + ], + "type": { + "type": "union", + "types": [ + { + "type": "array", + "elementType": { + "type": "intrinsic", + "name": "string" + } + }, + { + "type": "reflection", + "declaration": { + "id": 23, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 12, + "character": 28, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L12" + } + ], + "signatures": [ + { + "id": 24, + "name": "__type", + "variant": "signature", + "kind": 4096, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 12, + "character": 28, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L12" + } + ], + "parameters": [ + { + "id": 25, + "name": "absPath", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + }, + { + "id": 26, + "name": "name", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + } + } + ] + } + } + ] + } + }, + { + "id": 16, + "name": "followSymlinks", + "variant": "declaration", + "kind": 1024, + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "find.ts", + "line": 10, + "character": 4, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L10" + } + ], + "type": { + "type": "intrinsic", + "name": "boolean" + } + }, + { + "id": 15, + "name": "maxDepth", + "variant": "declaration", + "kind": 1024, + "flags": { + "isOptional": true + }, + "sources": [ + { + "fileName": "find.ts", + "line": 9, + "character": 4, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L9" + } + ], + "type": { + "type": "intrinsic", + "name": "number" + } + } + ], + "groups": [ + { + "title": "Properties", + "children": [ + 17, + 22, + 16, + 15 + ] + } + ], + "sources": [ + { + "fileName": "find.ts", + "line": 8, + "character": 10, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L8" + } + ] + }, + { + "id": 7, + "name": "createFindDirectories", + "variant": "declaration", + "kind": 64, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 19, + "character": 9, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L19" + } + ], + "signatures": [ + { + "id": 8, + "name": "createFindDirectories", + "variant": "signature", + "kind": 4096, + "flags": {}, + "comment": { + "summary": [ + { + "kind": "text", + "text": "Factory that produces an async findDirectories function with\ninjected filesystem dependencies for full testability." + } + ] + }, + "sources": [ + { + "fileName": "find.ts", + "line": 19, + "character": 9, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L19" + } + ], + "parameters": [ + { + "id": 9, + "name": "deps", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "reference", + "target": 27, + "name": "FileSystemDependencies", + "package": "@wtasnorg/node-lib" + } + } + ], + "type": { + "type": "reflection", + "declaration": { + "id": 10, + "name": "__type", + "variant": "declaration", + "kind": 65536, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 23, + "character": 26, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L23" + } + ], + "signatures": [ + { + "id": 11, + "name": "__type", + "variant": "signature", + "kind": 4096, + "flags": {}, + "sources": [ + { + "fileName": "find.ts", + "line": 23, + "character": 26, + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L23" + } + ], + "parameters": [ + { + "id": 12, + "name": "root", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "intrinsic", + "name": "string" + } + }, + { + "id": 13, + "name": "options", + "variant": "param", + "kind": 32768, + "flags": {}, + "type": { + "type": "reference", + "target": 14, + "name": "FindDirectoriesOptions", + "package": "@wtasnorg/node-lib" + }, + "defaultValue": "{}" + } + ], + "type": { + "type": "reference", + "target": { + "packageName": "typescript", + "packagePath": "lib/lib.es5.d.ts", + "qualifiedName": "Promise" + }, + "typeArguments": [ + { + "type": "array", + "elementType": { + "type": "intrinsic", + "name": "string" + } + } + ], + "name": "Promise", + "package": "typescript" + } + } + ] + } + } + } + ] + }, { "id": 1, "name": "hello", @@ -17,7 +793,7 @@ "fileName": "hello.ts", "line": 6, "character": 15, - "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/hello.ts#L6" + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/hello.ts#L6" } ], "signatures": [ @@ -51,7 +827,7 @@ "fileName": "hello.ts", "line": 6, "character": 15, - "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/hello.ts#L6" + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/hello.ts#L6" } ], "type": { @@ -84,7 +860,7 @@ "fileName": "pojo.ts", "line": 10, "character": 9, - "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/pojo.ts#L10" + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/pojo.ts#L10" } ], "signatures": [ @@ -118,7 +894,7 @@ "fileName": "pojo.ts", "line": 10, "character": 9, - "url": "https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/pojo.ts#L10" + "url": "https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/pojo.ts#L10" } ], "typeParameters": [ @@ -172,7 +948,7 @@ }, { "type": "intrinsic", - "name": "any" + "name": "unknown" } ], "name": "Record", @@ -183,9 +959,17 @@ } ], "groups": [ + { + "title": "Interfaces", + "children": [ + 27, + 14 + ] + }, { "title": "Functions", "children": [ + 7, 1, 3 ] @@ -203,7 +987,23 @@ }, { "kind": "text", - "text": " for converting class objects to Plain Old Javascript Objects.\n\n## Develop\n\n" + "text": " for converting class objects to Plain Old Javascript Objects.\n3. " + }, + { + "kind": "code", + "text": "`createFindDirectories`" + }, + { + "kind": "text", + "text": " as a factory for finding directories; think " + }, + { + "kind": "code", + "text": "`find path -type d`" + }, + { + "kind": "text", + "text": ".\n\n## Develop\n\n" }, { "kind": "code", @@ -282,6 +1082,201 @@ "packageName": "@wtasnorg/node-lib", "packagePath": "src/pojo.ts", "qualifiedName": "instance" + }, + "7": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "createFindDirectories" + }, + "8": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "createFindDirectories" + }, + "9": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "deps" + }, + "10": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "findDirectories" + }, + "11": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "findDirectories" + }, + "12": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "root" + }, + "13": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "options" + }, + "14": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FindDirectoriesOptions" + }, + "15": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FindDirectoriesOptions.maxDepth" + }, + "16": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FindDirectoriesOptions.followSymlinks" + }, + "17": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FindDirectoriesOptions.allowlist" + }, + "18": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "19": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "20": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "absPath" + }, + "21": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "name" + }, + "22": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FindDirectoriesOptions.blocklist" + }, + "23": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "24": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "25": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "absPath" + }, + "26": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "name" + }, + "27": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FileSystemDependencies" + }, + "28": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FileSystemDependencies.readdir" + }, + "29": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "30": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "31": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "path" + }, + "32": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "opts" + }, + "33": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "34": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type.withFileTypes" + }, + "35": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "36": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type.name" + }, + "37": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type.isDirectory" + }, + "38": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type.isDirectory" + }, + "39": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "FileSystemDependencies.stat" + }, + "40": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "41": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "42": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "path" + }, + "43": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type" + }, + "44": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type.isDirectory" + }, + "45": { + "packageName": "@wtasnorg/node-lib", + "packagePath": "src/find.ts", + "qualifiedName": "__type.isDirectory" } }, "files": { diff --git a/docs/functions/createFindDirectories.md b/docs/functions/createFindDirectories.md new file mode 100644 index 0000000..ba2b719 --- /dev/null +++ b/docs/functions/createFindDirectories.md @@ -0,0 +1,38 @@ +[**@wtasnorg/node-lib**](../README.md) + +*** + +[@wtasnorg/node-lib](../globals.md) / createFindDirectories + +# Function: createFindDirectories() + +> **createFindDirectories**(`deps`): (`root`, `options`) => `Promise`\<`string`[]\> + +Defined in: [find.ts:19](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L19) + +Factory that produces an async findDirectories function with +injected filesystem dependencies for full testability. + +## Parameters + +### deps + +[`FileSystemDependencies`](../interfaces/FileSystemDependencies.md) + +## Returns + +> (`root`, `options`): `Promise`\<`string`[]\> + +### Parameters + +#### root + +`string` + +#### options + +[`FindDirectoriesOptions`](../interfaces/FindDirectoriesOptions.md) = `{}` + +### Returns + +`Promise`\<`string`[]\> diff --git a/docs/functions/hello.md b/docs/functions/hello.md index 7ddf9c4..62940d8 100644 --- a/docs/functions/hello.md +++ b/docs/functions/hello.md @@ -8,7 +8,7 @@ > **hello**(): `Promise`\<`string`\> -Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/hello.ts#L6) +Defined in: [hello.ts:6](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/hello.ts#L6) A sample function that should work to test if lib is installed correctly. diff --git a/docs/functions/pojo.md b/docs/functions/pojo.md index 1b930c8..7d2fdce 100644 --- a/docs/functions/pojo.md +++ b/docs/functions/pojo.md @@ -6,9 +6,9 @@ # Function: pojo() -> **pojo**\<`T`\>(`instance`): `Record`\<`string`, `any`\> +> **pojo**\<`T`\>(`instance`): `Record`\<`string`, `unknown`\> -Defined in: [pojo.ts:10](https://github.com/wtasg/node-lib/blob/890fd5e866d9096470d56594a5788bf55e34bf7c/src/pojo.ts#L10) +Defined in: [pojo.ts:10](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/pojo.ts#L10) Convert a class instance into a plain JavaScript object. Copies only the instance's own enumerable data properties @@ -30,6 +30,6 @@ A class instance to convert. ## Returns -`Record`\<`string`, `any`\> +`Record`\<`string`, `unknown`\> A plain JavaScript object containing only data fields. diff --git a/docs/globals.md b/docs/globals.md index 9ddc19f..db8ad51 100644 --- a/docs/globals.md +++ b/docs/globals.md @@ -4,7 +4,13 @@ # @wtasnorg/node-lib +## Interfaces + +- [FileSystemDependencies](interfaces/FileSystemDependencies.md) +- [FindDirectoriesOptions](interfaces/FindDirectoriesOptions.md) + ## Functions +- [createFindDirectories](functions/createFindDirectories.md) - [hello](functions/hello.md) - [pojo](functions/pojo.md) diff --git a/docs/interfaces/FileSystemDependencies.md b/docs/interfaces/FileSystemDependencies.md new file mode 100644 index 0000000..d5bbc32 --- /dev/null +++ b/docs/interfaces/FileSystemDependencies.md @@ -0,0 +1,51 @@ +[**@wtasnorg/node-lib**](../README.md) + +*** + +[@wtasnorg/node-lib](../globals.md) / FileSystemDependencies + +# Interface: FileSystemDependencies + +Defined in: [find.ts:3](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L3) + +## Properties + +### readdir() + +> **readdir**: (`path`, `opts`) => `Promise`\<`object`[]\> + +Defined in: [find.ts:4](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L4) + +#### Parameters + +##### path + +`string` + +##### opts + +###### withFileTypes + +`true` + +#### Returns + +`Promise`\<`object`[]\> + +*** + +### stat() + +> **stat**: (`path`) => `Promise`\<\{ `isDirectory`: `boolean`; \}\> + +Defined in: [find.ts:5](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L5) + +#### Parameters + +##### path + +`string` + +#### Returns + +`Promise`\<\{ `isDirectory`: `boolean`; \}\> diff --git a/docs/interfaces/FindDirectoriesOptions.md b/docs/interfaces/FindDirectoriesOptions.md new file mode 100644 index 0000000..f1b4a0b --- /dev/null +++ b/docs/interfaces/FindDirectoriesOptions.md @@ -0,0 +1,41 @@ +[**@wtasnorg/node-lib**](../README.md) + +*** + +[@wtasnorg/node-lib](../globals.md) / FindDirectoriesOptions + +# Interface: FindDirectoriesOptions + +Defined in: [find.ts:8](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L8) + +## Properties + +### allowlist? + +> `optional` **allowlist**: `string`[] \| (`absPath`, `name`) => `boolean` + +Defined in: [find.ts:11](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L11) + +*** + +### blocklist? + +> `optional` **blocklist**: `string`[] \| (`absPath`, `name`) => `boolean` + +Defined in: [find.ts:12](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L12) + +*** + +### followSymlinks? + +> `optional` **followSymlinks**: `boolean` + +Defined in: [find.ts:10](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L10) + +*** + +### maxDepth? + +> `optional` **maxDepth**: `number` + +Defined in: [find.ts:9](https://github.com/wtasg/node-lib/blob/cf7bf2c52d7290455ef5117574965703bedcc8a9/src/find.ts#L9) diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..deb6f4d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,47 @@ +// @ts-check + +import eslint from "@eslint/js"; +import { defineConfig } from "eslint/config"; +import tseslint from "typescript-eslint"; +import prettier from "eslint-config-prettier"; +import globals from "globals"; +import stylistic from "@stylistic/eslint-plugin"; + +export default defineConfig([ + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...tseslint.configs.strict, + ...tseslint.configs.stylistic, + prettier, + + { + languageOptions: { + globals: { + ...globals.node, + } + } + }, + + { + plugins: { + "@stylistic": stylistic + } + }, + + { + rules: { + "@typescript-eslint/no-unused-vars": [ + "warn", + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_" + } + ], + + semi: ["error", "always"], + // "no-unused-vars": ["error", { varsIgnorePattern: "^[A-Z_]" }], + "@stylistic/quotes": ["error", "double"] + } + } +]); diff --git a/package-lock.json b/package-lock.json index 5db807b..afca96e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@wtasnorg/node-lib", - "version": "0.0.5", + "version": "0.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@wtasnorg/node-lib", - "version": "0.0.5", + "version": "0.0.6", "cpu": [ "x64" ], @@ -15,137 +15,1281 @@ "!win32" ], "devDependencies": { + "@eslint/js": "^9.39.1", + "@stylistic/eslint-plugin": "^5.6.1", "@types/node": "^24.10.1", - "typedoc": "^0.28.14", + "eslint": "^9.39.1", + "eslint-config-prettier": "^10.1.8", + "globals": "^16.5.0", + "typedoc": "^0.28.15", "typedoc-plugin-markdown": "^4.9.0", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "typescript-eslint": "^8.48.1" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", + "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@gerrit0/mini-shiki": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.15.0.tgz", - "integrity": "sha512-L5IHdZIDa4bG4yJaOzfasOH/o22MCesY0mx+n6VATbaiCtMeR59pdRqYk4bEiQkIHfxsHPNgdi7VJlZb2FhdMQ==", + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.19.0.tgz", + "integrity": "sha512-ZSlWfLvr8Nl0T4iA3FF/8VH8HivYF82xQts2DY0tJxZd4wtXJ8AA0nmdW9lmO4hlrh3f9xNwEPtOgqETPqKwDA==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/engine-oniguruma": "^3.15.0", - "@shikijs/langs": "^3.15.0", - "@shikijs/themes": "^3.15.0", - "@shikijs/types": "^3.15.0", + "@shikijs/engine-oniguruma": "^3.19.0", + "@shikijs/langs": "^3.19.0", + "@shikijs/themes": "^3.19.0", + "@shikijs/types": "^3.19.0", "@shikijs/vscode-textmate": "^10.0.2" } }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@shikijs/engine-oniguruma": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.15.0.tgz", - "integrity": "sha512-HnqFsV11skAHvOArMZdLBZZApRSYS4LSztk2K3016Y9VCyZISnlYUYsL2hzlS7tPqKHvNqmI5JSUJZprXloMvA==", + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.19.0.tgz", + "integrity": "sha512-1hRxtYIJfJSZeM5ivbUXv9hcJP3PWRo5prG/V2sWwiubUKTa+7P62d2qxCW8jiVFX4pgRHhnHNp+qeR7Xl+6kg==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.15.0", + "@shikijs/types": "3.19.0", "@shikijs/vscode-textmate": "^10.0.2" } }, - "node_modules/@shikijs/langs": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.15.0.tgz", - "integrity": "sha512-WpRvEFvkVvO65uKYW4Rzxs+IG0gToyM8SARQMtGGsH4GDMNZrr60qdggXrFOsdfOVssG/QQGEl3FnJ3EZ+8w8A==", + "node_modules/@shikijs/langs": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.19.0.tgz", + "integrity": "sha512-dBMFzzg1QiXqCVQ5ONc0z2ebyoi5BKz+MtfByLm0o5/nbUu3Iz8uaTCa5uzGiscQKm7lVShfZHU1+OG3t5hgwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.19.0" + } + }, + "node_modules/@shikijs/themes": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.19.0.tgz", + "integrity": "sha512-H36qw+oh91Y0s6OlFfdSuQ0Ld+5CgB/VE6gNPK+Hk4VRbVG/XQgkjnt4KzfnnoO6tZPtKJKHPjwebOCfjd6F8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.19.0" + } + }, + "node_modules/@shikijs/types": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.19.0.tgz", + "integrity": "sha512-Z2hdeEQlzuntf/BZpFG8a+Fsw9UVXdML7w0o3TgSXV3yNESGon+bs9ITkQb3Ki7zxoXOOu5oJWqZ2uto06V9iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@stylistic/eslint-plugin": { + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-5.6.1.tgz", + "integrity": "sha512-JCs+MqoXfXrRPGbGmho/zGS/jMcn3ieKl/A8YImqib76C8kjgZwq5uUFzc30lJkMvcchuRn6/v8IApLxli3Jyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.0", + "@typescript-eslint/types": "^8.47.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "estraverse": "^5.3.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=9.0.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.1.tgz", + "integrity": "sha512-X63hI1bxl5ohelzr0LY5coufyl0LJNthld+abwxpCoo6Gq+hSqhKwci7MUWkXo67mzgUK6YFByhmaHmUcuBJmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/type-utils": "8.48.1", + "@typescript-eslint/utils": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.48.1", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.1.tgz", + "integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.1.tgz", + "integrity": "sha512-HQWSicah4s9z2/HifRPQ6b6R7G+SBx64JlFQpgSSHWPKdvCZX57XCbszg/bapbRsOEv42q5tayTYcEFpACcX1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.48.1", + "@typescript-eslint/types": "^8.48.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.48.1.tgz", + "integrity": "sha512-rj4vWQsytQbLxC5Bf4XwZ0/CKd362DkWMUkviT7DCS057SK64D5lH74sSGzhI6PDD2HCEq02xAP9cX68dYyg1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.1.tgz", + "integrity": "sha512-k0Jhs4CpEffIBm6wPaCXBAD7jxBtrHjrSgtfCjUvPp9AZ78lXKdTR8fxyZO5y4vWNlOvYXRtngSZNSn+H53Jkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.48.1.tgz", + "integrity": "sha512-1jEop81a3LrJQLTf/1VfPQdhIY4PlGDBc/i67EVWObrtvcziysbLN3oReexHOM6N3jyXgCrkBsZpqwH0hiDOQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/utils": "8.48.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.1.tgz", + "integrity": "sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.1.tgz", + "integrity": "sha512-/9wQ4PqaefTK6POVTjJaYS0bynCgzh6ClJHGSBj06XEHjkfylzB+A3qvyaXnErEZSaxhIo4YdyBgq6j4RysxDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.48.1", + "@typescript-eslint/tsconfig-utils": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "debug": "^4.3.4", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.48.1.tgz", + "integrity": "sha512-fAnhLrDjiVfey5wwFRwrweyRlCmdz5ZxXz2G/4cLn0YDLjTapmN4gcCsTBR1N2rWnZSDeWpYtgLDsJt+FpmcwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.48.1.tgz", + "integrity": "sha512-BmxxndzEWhE4TIEEMBs8lP3MBWN3jFPs/p6gPm/wkv02o41hI6cq9AuSmGAaTTHPtA1FTi2jBre4A9rm5ZmX+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", + "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.1", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, "license": "MIT", - "dependencies": { - "@shikijs/types": "3.15.0" + "engines": { + "node": ">= 4" } }, - "node_modules/@shikijs/themes": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.15.0.tgz", - "integrity": "sha512-8ow2zWb1IDvCKjYb0KiLNrK4offFdkfNVPXb1OZykpLCzRU6j+efkY+Y7VQjNlNFXonSw+4AOdGYtmqykDbRiQ==", + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "3.15.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@shikijs/types": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.15.0.tgz", - "integrity": "sha512-BnP+y/EQnhihgHy4oIAN+6FFtmfTekwOLsQbRw9hOKwqgNy8Bdsjq8B05oAt/ZgvIWWFrshV71ytOrlPfYjIJw==", + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, "license": "MIT", - "dependencies": { - "@shikijs/vscode-textmate": "^10.0.2", - "@types/hast": "^3.0.4" + "engines": { + "node": ">=0.8.19" } }, - "node_modules/@shikijs/vscode-textmate": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", - "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } }, - "node_modules/@types/hast": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", - "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, "license": "MIT", "dependencies": { - "@types/unist": "*" + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" } }, - "node_modules/@types/node": { - "version": "24.10.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", - "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.16.0" + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true, "license": "MIT" }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "license": "Python-2.0" + "license": "MIT" }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true, "license": "MIT" }, - "node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0" + "json-buffer": "3.0.1" } }, - "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.12" + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" + "engines": { + "node": ">= 0.8.0" } }, "node_modules/linkify-it": { @@ -158,6 +1302,29 @@ "uc.micro": "^2.0.0" } }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, "node_modules/lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", @@ -206,6 +1373,136 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/punycode.js": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", @@ -216,14 +1513,129 @@ "node": ">=6" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/typedoc": { - "version": "0.28.14", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.14.tgz", - "integrity": "sha512-ftJYPvpVfQvFzpkoSfHLkJybdA/geDJ8BGQt/ZnkkhnBYoYW6lBgPQXu6vqLxO4X75dA55hX8Af847H5KXlEFA==", + "version": "0.28.15", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.15.tgz", + "integrity": "sha512-mw2/2vTL7MlT+BVo43lOsufkkd2CJO4zeOSuWQQsiXoV2VuEn7f6IZp2jsUDPmBMABpgR0R5jlcJ2OGEFYmkyg==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@gerrit0/mini-shiki": "^3.12.0", + "@gerrit0/mini-shiki": "^3.17.0", "lunr": "^2.3.9", "markdown-it": "^14.1.0", "minimatch": "^9.0.5", @@ -267,6 +1679,30 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.48.1.tgz", + "integrity": "sha512-FbOKN1fqNoXp1hIl5KYpObVrp0mCn+CLgn479nmu2IsRMrx2vyv74MmsBLVlhg8qVwNFGbXSp8fh1zp8pEoC2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.48.1", + "@typescript-eslint/parser": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/utils": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, "node_modules/uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", @@ -281,10 +1717,46 @@ "dev": true, "license": "MIT" }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/yaml": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", - "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", + "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", "dev": true, "license": "ISC", "bin": { @@ -292,6 +1764,22 @@ }, "engines": { "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } } } diff --git a/package.json b/package.json index 1282283..390bc1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@wtasnorg/node-lib", - "version": "0.0.5", + "version": "0.0.6", "description": "node library", "main": "src/index.js", "scripts": { @@ -27,9 +27,15 @@ "url": "git+https://github.com/wtasg/node-lib.git" }, "devDependencies": { + "@eslint/js": "^9.39.1", + "@stylistic/eslint-plugin": "^5.6.1", "@types/node": "^24.10.1", - "typedoc": "^0.28.14", + "eslint": "^9.39.1", + "eslint-config-prettier": "^10.1.8", + "globals": "^16.5.0", + "typedoc": "^0.28.15", "typedoc-plugin-markdown": "^4.9.0", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "typescript-eslint": "^8.48.1" } } diff --git a/src/find.d.ts b/src/find.d.ts new file mode 100644 index 0000000..4e2b5c1 --- /dev/null +++ b/src/find.d.ts @@ -0,0 +1,25 @@ +interface FileSystemDependencies { + readdir: (path: string, opts: { + withFileTypes: true; + }) => Promise<{ + name: string; + isDirectory(): boolean; + }[]>; + stat: (path: string) => Promise<{ + isDirectory(): boolean; + }>; +} +interface FindDirectoriesOptions { + maxDepth?: number; + followSymlinks?: boolean; + allowlist?: string[] | ((absPath: string, name: string) => boolean); + blocklist?: string[] | ((absPath: string, name: string) => boolean); +} +/** + * Factory that produces an async findDirectories function with + * injected filesystem dependencies for full testability. + */ +declare function createFindDirectories(deps: FileSystemDependencies): (root: string, options?: FindDirectoriesOptions) => Promise; +export { createFindDirectories, }; +export type { FileSystemDependencies, FindDirectoriesOptions, }; +//# sourceMappingURL=find.d.ts.map \ No newline at end of file diff --git a/src/find.js b/src/find.js new file mode 100644 index 0000000..2d90680 --- /dev/null +++ b/src/find.js @@ -0,0 +1,62 @@ +import { resolve, join } from "node:path"; +/** + * Factory that produces an async findDirectories function with + * injected filesystem dependencies for full testability. + */ +function createFindDirectories(deps) { + const { readdir } = deps; + return async function findDirectories(root, options = {}) { + const { maxDepth = 1, allowlist, blocklist } = options; + const absRoot = resolve(root); + const results = []; + function isAllowed(absPath, name) { + if (allowlist) { + if (Array.isArray(allowlist)) { + if (!allowlist.includes(name)) + return false; + } + else if (!allowlist(absPath, name)) { + return false; + } + } + return true; + } + function isBlocked(absPath, name) { + if (blocklist) { + if (Array.isArray(blocklist)) { + if (blocklist.includes(name)) + return true; + } + else if (blocklist(absPath, name)) { + return true; + } + } + return false; + } + async function walk(currentPath, depth) { + if (depth > maxDepth) + return; + const entries = await readdir(currentPath, { withFileTypes: true }); + for (const entry of entries) { + const childPath = resolve(join(currentPath, entry.name)); + const isDirectory = entry.isDirectory(); + if (!isDirectory) + continue; + if (isBlocked(childPath, entry.name)) + continue; + if (!isAllowed(childPath, entry.name)) + continue; + results.push(childPath); + if (depth < maxDepth) { + await walk(childPath, depth + 1); + } + } + } + // match find(1): root is always included + results.push(absRoot); + await walk(absRoot, 1); + return results; + }; +} +export { createFindDirectories, }; +//# sourceMappingURL=find.js.map \ No newline at end of file diff --git a/src/find.test.d.ts b/src/find.test.d.ts new file mode 100644 index 0000000..ef7c299 --- /dev/null +++ b/src/find.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=find.test.d.ts.map \ No newline at end of file diff --git a/src/find.test.js b/src/find.test.js new file mode 100644 index 0000000..2e27324 --- /dev/null +++ b/src/find.test.js @@ -0,0 +1,123 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { createFindDirectories } from "./find.js"; +// Helper to build Dirent-like objects +function dir(name) { + return { name, isDirectory: () => true }; +} +function file(name) { + return { name, isDirectory: () => false }; +} +test("find: findDirectories success", async () => { + // Minimal mock FS: /root contains one directory "a" and one file "b" + const mockFS = { + readdir: async (path) => { + if (path === "/root") { + return [ + { name: "a", isDirectory: () => true }, + { name: "b", isDirectory: () => false }, + ]; + } + return []; + }, + stat: async (path) => ({ + isDirectory: () => path === "/root" || path === "/root/a" + }), + }; + const findDirectories = createFindDirectories(mockFS); + const result = await findDirectories("/root", { maxDepth: 1 }); + assert.deepEqual(result, [ + "/root", + "/root/a" + ]); +}); +test("find: findDirectories symlink is NOT treated as a directory", async () => { + const mockFS = { + readdir: async (path) => { + if (path === "/root") { + return [ + { + name: "linkToA", + isDirectory: () => false + } + ]; + } + return []; + }, + stat: async (path) => ({ + isDirectory: () => path === "/root" // only root is a directory + }), + readlink: async () => { + throw new Error("readlink should not be called when symlink support is removed"); + } + }; + const findDirectories = createFindDirectories(mockFS); + const result = await findDirectories("/root", { maxDepth: 1 }); + assert.deepEqual(result, [ + "/root" + ]); +}); +test("find: findDirectories at depth=2", async () => { + const deps = { + readdir: async (path) => { + switch (path) { + case "/root": + return [dir("a"), dir("b"), file("ignore.txt")]; + case "/root/a": + return [dir("a1")]; + case "/root/b": + return [dir("b1")]; + default: + return []; + } + }, + stat: async () => ({ + isDirectory: () => false + }) + }; + const find = createFindDirectories(deps); + const result = await find("/root", { maxDepth: 2 }); + assert.deepEqual(result.sort(), [ + "/root", + "/root/a", + "/root/b", + "/root/a/a1", + "/root/b/b1" + ].sort()); +}); +test("find: findDirectories at depth=3", async () => { + const deps = { + readdir: async (path) => { + switch (path) { + case "/root": + return [dir("a"), dir("b")]; + case "/root/a": + return [dir("a1")]; + case "/root/b": + return [dir("b1")]; + case "/root/a/a1": + case "/root/b/b1": + return [dir("c")]; + case "/root/b/b1/c": + return [dir("d"), file("fd")]; + default: + return []; + } + }, + stat: async () => ({ + isDirectory: () => false + }) + }; + const find = createFindDirectories(deps); + const result = await find("/root", { maxDepth: 3 }); + assert.deepEqual(result.sort(), [ + "/root", + "/root/a", + "/root/b", + "/root/a/a1", + "/root/a/a1/c", + "/root/b/b1", + "/root/b/b1/c", + ].sort()); +}); +//# sourceMappingURL=find.test.js.map \ No newline at end of file diff --git a/src/find.test.ts b/src/find.test.ts new file mode 100644 index 0000000..190cde7 --- /dev/null +++ b/src/find.test.ts @@ -0,0 +1,148 @@ +import test from "node:test"; +import assert from "node:assert/strict"; + +import { createFindDirectories } from "./find.js"; + +import type { FileSystemDependencies } from "./find.js"; + +// Helper to build Dirent-like objects +function dir(name: string): { name: string; isDirectory(): boolean } { + return { name, isDirectory: () => true }; +} +function file(name: string): { name: string; isDirectory(): boolean } { + return { name, isDirectory: () => false }; +} + +test("find: findDirectories success", async () => { + + // Minimal mock FS: /root contains one directory "a" and one file "b" + const mockFS = { + readdir: async (path: string) => { + if (path === "/root") { + return [ + { name: "a", isDirectory: () => true }, + { name: "b", isDirectory: () => false }, + ]; + } + return []; + }, + + stat: async (path: string) => ({ + isDirectory: () => path === "/root" || path === "/root/a" + }), + }; + + const findDirectories = createFindDirectories(mockFS); + + const result = await findDirectories("/root", { maxDepth: 1 }); + + assert.deepEqual(result, [ + "/root", + "/root/a" + ]); +}); + +test("find: findDirectories symlink is NOT treated as a directory", async () => { + + const mockFS = { + readdir: async (path: string) => { + if (path === "/root") { + return [ + { + name: "linkToA", + isDirectory: () => false + } + ]; + } + return []; + }, + + stat: async (path: string) => ({ + isDirectory: () => path === "/root" // only root is a directory + }), + + readlink: async () => { + throw new Error("readlink should not be called when symlink support is removed"); + } + }; + + const findDirectories = createFindDirectories(mockFS); + + const result = await findDirectories("/root", { maxDepth: 1 }); + + assert.deepEqual(result, [ + "/root" + ]); +}); + + +test("find: findDirectories at depth=2", async () => { + const deps: FileSystemDependencies = { + readdir: async (path: string): Promise<{ name: string; isDirectory(): boolean }[]> => { + switch (path) { + case "/root": + return [dir("a"), dir("b"), file("ignore.txt")]; + case "/root/a": + return [dir("a1")]; + case "/root/b": + return [dir("b1")]; + default: + return []; + } + }, + stat: async () => ({ + isDirectory: () => false + }) + }; + + const find = createFindDirectories(deps); + + const result = await find("/root", { maxDepth: 2 }); + + assert.deepEqual(result.sort(), [ + "/root", + "/root/a", + "/root/b", + "/root/a/a1", + "/root/b/b1" + ].sort()); +}); + +test("find: findDirectories at depth=3", async () => { + const deps: FileSystemDependencies = { + readdir: async (path: string): Promise<{ name: string; isDirectory(): boolean }[]> => { + switch (path) { + case "/root": + return [dir("a"), dir("b")]; + case "/root/a": + return [dir("a1")]; + case "/root/b": + return [dir("b1")]; + case "/root/a/a1": + case "/root/b/b1": + return [dir("c")]; + case "/root/b/b1/c": + return [dir("d"), file("fd")]; + default: + return []; + } + }, + stat: async () => ({ + isDirectory: () => false + }) + }; + + const find = createFindDirectories(deps); + + const result = await find("/root", { maxDepth: 3 }); + + assert.deepEqual(result.sort(), [ + "/root", + "/root/a", + "/root/b", + "/root/a/a1", + "/root/a/a1/c", + "/root/b/b1", + "/root/b/b1/c", + ].sort()); +}); diff --git a/src/find.ts b/src/find.ts new file mode 100644 index 0000000..3c95e34 --- /dev/null +++ b/src/find.ts @@ -0,0 +1,99 @@ +import { resolve, join } from "node:path"; + +interface FileSystemDependencies { + readdir: (path: string, opts: { withFileTypes: true }) => Promise<{ name: string; isDirectory(): boolean; }[]>; + stat: (path: string) => Promise<{ isDirectory(): boolean }>; +} + +interface FindDirectoriesOptions { + maxDepth?: number; + followSymlinks?: boolean; + allowlist?: string[] | ((absPath: string, name: string) => boolean); + blocklist?: string[] | ((absPath: string, name: string) => boolean); +} + +/** + * Factory that produces an async findDirectories function with + * injected filesystem dependencies for full testability. + */ +function createFindDirectories(deps: FileSystemDependencies) { + + const { readdir } = deps; + + return async function findDirectories( + root: string, + options: FindDirectoriesOptions = {} + ): Promise { + + const { + maxDepth = 1, + allowlist, + blocklist + } = options; + + const absRoot = resolve(root); + const results: string[] = []; + + + function isAllowed(absPath: string, name: string): boolean { + if (allowlist) { + if (Array.isArray(allowlist)) { + if (!allowlist.includes(name)) return false; + } else if (!allowlist(absPath, name)) { + return false; + } + } + return true; + } + + function isBlocked(absPath: string, name: string): boolean { + if (blocklist) { + if (Array.isArray(blocklist)) { + if (blocklist.includes(name)) return true; + } else if (blocklist(absPath, name)) { + return true; + } + } + return false; + } + + async function walk(currentPath: string, depth: number): Promise { + if (depth > maxDepth) return; + + const entries = await readdir(currentPath, { withFileTypes: true }); + + for (const entry of entries) { + const childPath = resolve(join(currentPath, entry.name)); + + const isDirectory = entry.isDirectory(); + + if (!isDirectory) continue; + + if (isBlocked(childPath, entry.name)) continue; + if (!isAllowed(childPath, entry.name)) continue; + + results.push(childPath); + + if (depth < maxDepth) { + await walk(childPath, depth + 1); + } + } + } + + // match find(1): root is always included + results.push(absRoot); + + await walk(absRoot, 1); + + return results; + }; +} + +export { + createFindDirectories, +}; + +export type { + FileSystemDependencies, + FindDirectoriesOptions, +}; diff --git a/src/index.d.ts b/src/index.d.ts index e0f3de3..bdc2875 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,4 +1,7 @@ import { hello } from "./hello.js"; import { pojo } from "./pojo.js"; -export { hello, pojo }; +import type { FindDirectoriesOptions, FileSystemDependencies } from "./find.js"; +import { createFindDirectories } from "./find.js"; +export { hello, pojo, createFindDirectories }; +export type { FindDirectoriesOptions, FileSystemDependencies, }; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/src/index.js b/src/index.js index 498f174..501d42e 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ import { hello } from "./hello.js"; import { pojo } from "./pojo.js"; -export { hello, pojo }; +import { createFindDirectories } from "./find.js"; +export { hello, pojo, createFindDirectories }; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index c99ae46..f2664a7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,15 @@ import { hello } from "./hello.js"; import { pojo } from "./pojo.js"; +import type { FindDirectoriesOptions, FileSystemDependencies } from "./find.js"; +import { createFindDirectories } from "./find.js"; export { hello, - pojo + pojo, + createFindDirectories +}; + +export type { + FindDirectoriesOptions, + FileSystemDependencies, }; diff --git a/src/pojo.d.ts b/src/pojo.d.ts index fcaa76b..54a4a31 100644 --- a/src/pojo.d.ts +++ b/src/pojo.d.ts @@ -5,8 +5,8 @@ * * @template T * @param {T} instance - A class instance to convert. - * @returns {Object} A plain JavaScript object containing only data fields. + * @returns {Object} A plain JavaScript object containing only data fields. */ -declare function pojo(instance: T): Record; +declare function pojo(instance: T): Record; export { pojo }; //# sourceMappingURL=pojo.d.ts.map \ No newline at end of file diff --git a/src/pojo.js b/src/pojo.js index 486a427..066d8b0 100644 --- a/src/pojo.js +++ b/src/pojo.js @@ -5,7 +5,7 @@ * * @template T * @param {T} instance - A class instance to convert. - * @returns {Object} A plain JavaScript object containing only data fields. + * @returns {Object} A plain JavaScript object containing only data fields. */ function pojo(instance) { return Object.fromEntries(Object.entries(instance).filter(([_, value]) => typeof value !== "function")); diff --git a/src/pojo.ts b/src/pojo.ts index f7c0d19..8c65ecc 100644 --- a/src/pojo.ts +++ b/src/pojo.ts @@ -5,9 +5,9 @@ * * @template T * @param {T} instance - A class instance to convert. - * @returns {Object} A plain JavaScript object containing only data fields. + * @returns {Object} A plain JavaScript object containing only data fields. */ -function pojo(instance: T): Record { +function pojo(instance: T): Record { return Object.fromEntries( Object.entries(instance).filter(([_, value]) => typeof value !== "function") ); diff --git a/test_report b/test_report new file mode 100644 index 0000000..09b91f6 --- /dev/null +++ b/test_report @@ -0,0 +1,26 @@ + +> @wtasnorg/node-lib@0.0.6 test +> bash -c 'node --test src/**/*.test.js' + +✔ find: findDirectories success (1.136601ms) +✔ find: findDirectories symlink is NOT treated as a directory (0.189308ms) +✔ find: findDirectories at depth=2 (0.274118ms) +✔ find: findDirectories at depth=3 (0.250638ms) +hello from @wtasnorg/node-lib +hello from @wtasnorg/node-lib +▶ hello + ✔ returns a string that has the word 'hello' in it (0.938832ms) + ✔ returns exact string (0.133668ms) +✔ hello (1.739206ms) +✔ pojo() should return only enumerable data fields (1.058661ms) +✔ pojo() should exclude methods (0.165029ms) +✔ pojo() should exclude prototype properties (0.143849ms) +✔ pojo() should ignore non-enumerable own properties (0.693624ms) +ℹ tests 10 +ℹ suites 1 +ℹ pass 10 +ℹ fail 0 +ℹ cancelled 0 +ℹ skipped 0 +ℹ todo 0 +ℹ duration_ms 47.072307 diff --git a/typedoc.json b/typedoc.json index eea8f6d..2fc98af 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,11 +1,15 @@ { "$schema": "https://typedoc.org/schema.json", - "entryPoints": ["./src/index.ts"], + "entryPoints": [ + "./src/index.ts" + ], "excludePrivate": true, "excludeProtected": true, "name": "@wtasnorg/node-lib", "out": "docs", - "plugin": ["typedoc-plugin-markdown"], + "plugin": [ + "typedoc-plugin-markdown" + ], "theme": "default", "tsconfig": "./tsconfig.json", }