@isdk/util 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/index.d.mts +464 -1
  2. package/dist/index.d.ts +464 -1
  3. package/dist/index.js +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/docs/classes/BinarySemaphore.md +418 -0
  6. package/docs/classes/ConfigFile.md +9 -9
  7. package/docs/classes/Deque.md +1912 -0
  8. package/docs/classes/IntSet.md +216 -0
  9. package/docs/classes/Semaphore.md +538 -0
  10. package/docs/classes/SignalGate.md +184 -0
  11. package/docs/functions/RateLimit.md +37 -0
  12. package/docs/functions/arrayHasAll.md +1 -1
  13. package/docs/functions/extNameLevel.md +1 -1
  14. package/docs/functions/filenameReservedRegex.md +1 -1
  15. package/docs/functions/findPort.md +25 -0
  16. package/docs/functions/getMultiLevelExtname.md +1 -1
  17. package/docs/functions/glob.md +3 -3
  18. package/docs/functions/isStringIn.md +1 -1
  19. package/docs/functions/isValidFilename.md +1 -1
  20. package/docs/functions/isValidFilepath.md +1 -1
  21. package/docs/functions/normalizeIncludeFiles.md +2 -2
  22. package/docs/functions/parseFrontMatter.md +1 -1
  23. package/docs/functions/parseYaml.md +2 -2
  24. package/docs/functions/reControlCharsRegex.md +1 -1
  25. package/docs/functions/registerYamlTag.md +2 -2
  26. package/docs/functions/removeLeadingEmptyLines.md +1 -1
  27. package/docs/functions/sanitizeFilename.md +1 -1
  28. package/docs/functions/sanitizeFilepath.md +1 -1
  29. package/docs/functions/sleep.md +36 -0
  30. package/docs/functions/stringifyYaml.md +2 -2
  31. package/docs/functions/toCamelCase.md +1 -1
  32. package/docs/functions/toCapitalCase.md +1 -1
  33. package/docs/functions/toPascalCase.md +1 -1
  34. package/docs/functions/traverseFolder.md +1 -1
  35. package/docs/functions/traverseFolderSync.md +1 -1
  36. package/docs/functions/yieldExec.md +27 -0
  37. package/docs/globals.md +17 -0
  38. package/docs/interfaces/BinarySemaphoreAcquireOptions.md +25 -0
  39. package/docs/interfaces/BinarySemaphoreOptions.md +57 -0
  40. package/docs/interfaces/BinarySemaphoreReleaseOptions.md +25 -0
  41. package/docs/interfaces/BinarySemaphoreReleaserFunc.md +37 -0
  42. package/docs/interfaces/IncludeFiles.md +3 -3
  43. package/docs/interfaces/LoadConfigFileOptions.md +3 -3
  44. package/docs/interfaces/SanitizeFilenameOptions.md +3 -3
  45. package/docs/interfaces/SemaphoreOptions.md +89 -0
  46. package/docs/interfaces/SemaphoreTaskItem.md +73 -0
  47. package/docs/type-aliases/SemaphoreIsReadyFuncType.md +15 -0
  48. package/docs/type-aliases/StringifyFunc.md +1 -1
  49. package/docs/type-aliases/TraverseFolderHandler.md +1 -1
  50. package/docs/type-aliases/TraverseFolderSyncHandler.md +1 -1
  51. package/docs/variables/DefaultAllTextFiles.md +1 -1
  52. package/docs/variables/DefaultAsyncSemaphoreCapacity.md +11 -0
  53. package/docs/variables/FilenameReservedRegex.md +1 -1
  54. package/docs/variables/WindowsReservedNameRegex.md +1 -1
  55. package/package.json +19 -17
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Interface: SanitizeFilenameOptions
8
8
 
9
- Defined in: [filename.ts:83](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/filename.ts#L83)
9
+ Defined in: [src/filename.ts:83](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L83)
10
10
 
11
11
  ## Properties
12
12
 
@@ -14,7 +14,7 @@ Defined in: [filename.ts:83](https://github.com/isdk/util.js/blob/e52ad0627fc33d
14
14
 
15
15
  > `optional` **maxLength**: `number`
16
16
 
17
- Defined in: [filename.ts:85](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/filename.ts#L85)
17
+ Defined in: [src/filename.ts:85](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L85)
18
18
 
19
19
  ***
20
20
 
@@ -22,4 +22,4 @@ Defined in: [filename.ts:85](https://github.com/isdk/util.js/blob/e52ad0627fc33d
22
22
 
23
23
  > `optional` **replacement**: `string`
24
24
 
25
- Defined in: [filename.ts:84](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/filename.ts#L84)
25
+ Defined in: [src/filename.ts:84](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L84)
@@ -0,0 +1,89 @@
1
+ [**@isdk/util**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/util](../globals.md) / SemaphoreOptions
6
+
7
+ # Interface: SemaphoreOptions
8
+
9
+ Defined in: [src/async-semaphore.ts:42](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L42)
10
+
11
+ ## Extends
12
+
13
+ - [`BinarySemaphoreOptions`](BinarySemaphoreOptions.md)
14
+
15
+ ## Properties
16
+
17
+ ### capacity?
18
+
19
+ > `optional` **capacity**: `number`
20
+
21
+ Defined in: [src/async-semaphore.ts:25](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L25)
22
+
23
+ #### Inherited from
24
+
25
+ [`BinarySemaphoreOptions`](BinarySemaphoreOptions.md).[`capacity`](BinarySemaphoreOptions.md#capacity)
26
+
27
+ ***
28
+
29
+ ### initFn()?
30
+
31
+ > `optional` **initFn**: () => `any`
32
+
33
+ Defined in: [src/async-semaphore.ts:22](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L22)
34
+
35
+ #### Returns
36
+
37
+ `any`
38
+
39
+ #### Inherited from
40
+
41
+ [`BinarySemaphoreOptions`](BinarySemaphoreOptions.md).[`initFn`](BinarySemaphoreOptions.md#initfn)
42
+
43
+ ***
44
+
45
+ ### isReadyFn?
46
+
47
+ > `optional` **isReadyFn**: [`SemaphoreIsReadyFuncType`](../type-aliases/SemaphoreIsReadyFuncType.md)
48
+
49
+ Defined in: [src/async-semaphore.ts:44](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L44)
50
+
51
+ ***
52
+
53
+ ### maxConcurrency?
54
+
55
+ > `optional` **maxConcurrency**: `number`
56
+
57
+ Defined in: [src/async-semaphore.ts:43](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L43)
58
+
59
+ ***
60
+
61
+ ### pauseFn()?
62
+
63
+ > `optional` **pauseFn**: () => `void`
64
+
65
+ Defined in: [src/async-semaphore.ts:23](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L23)
66
+
67
+ #### Returns
68
+
69
+ `void`
70
+
71
+ #### Inherited from
72
+
73
+ [`BinarySemaphoreOptions`](BinarySemaphoreOptions.md).[`pauseFn`](BinarySemaphoreOptions.md#pausefn)
74
+
75
+ ***
76
+
77
+ ### resumeFn()?
78
+
79
+ > `optional` **resumeFn**: () => `void`
80
+
81
+ Defined in: [src/async-semaphore.ts:24](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L24)
82
+
83
+ #### Returns
84
+
85
+ `void`
86
+
87
+ #### Inherited from
88
+
89
+ [`BinarySemaphoreOptions`](BinarySemaphoreOptions.md).[`resumeFn`](BinarySemaphoreOptions.md#resumefn)
@@ -0,0 +1,73 @@
1
+ [**@isdk/util**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/util](../globals.md) / SemaphoreTaskItem
6
+
7
+ # Interface: SemaphoreTaskItem
8
+
9
+ Defined in: [src/async-semaphore.ts:52](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L52)
10
+
11
+ ## Extends
12
+
13
+ - [`BinarySemaphoreAcquireOptions`](BinarySemaphoreAcquireOptions.md)
14
+
15
+ ## Indexable
16
+
17
+ \[`n`: `string`\]: `any`
18
+
19
+ ## Properties
20
+
21
+ ### reject()
22
+
23
+ > **reject**: (`reason?`) => `void`
24
+
25
+ Defined in: [src/async-semaphore.ts:54](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L54)
26
+
27
+ #### Parameters
28
+
29
+ ##### reason?
30
+
31
+ `any`
32
+
33
+ #### Returns
34
+
35
+ `void`
36
+
37
+ ***
38
+
39
+ ### resolve()
40
+
41
+ > **resolve**: (`value`) => `void`
42
+
43
+ Defined in: [src/async-semaphore.ts:53](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L53)
44
+
45
+ #### Parameters
46
+
47
+ ##### value
48
+
49
+ `any`
50
+
51
+ #### Returns
52
+
53
+ `void`
54
+
55
+ ***
56
+
57
+ ### signal?
58
+
59
+ > `optional` **signal**: `AbortSignal`
60
+
61
+ Defined in: [src/async-semaphore.ts:29](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L29)
62
+
63
+ #### Inherited from
64
+
65
+ [`BinarySemaphoreAcquireOptions`](BinarySemaphoreAcquireOptions.md).[`signal`](BinarySemaphoreAcquireOptions.md#signal)
66
+
67
+ ***
68
+
69
+ ### token?
70
+
71
+ > `optional` **token**: `any`
72
+
73
+ Defined in: [src/async-semaphore.ts:55](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L55)
@@ -0,0 +1,15 @@
1
+ [**@isdk/util**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/util](../globals.md) / SemaphoreIsReadyFuncType
6
+
7
+ # Type Alias: SemaphoreIsReadyFuncType()
8
+
9
+ > **SemaphoreIsReadyFuncType** = () => `Promise`\<`boolean`\> \| `boolean`
10
+
11
+ Defined in: [src/async-semaphore.ts:11](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L11)
12
+
13
+ ## Returns
14
+
15
+ `Promise`\<`boolean`\> \| `boolean`
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **StringifyFunc** = (`content`) => `string`
10
10
 
11
- Defined in: [config-file.ts:18](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/config-file.ts#L18)
11
+ Defined in: [src/config-file.ts:18](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/config-file.ts#L18)
12
12
 
13
13
  ## Parameters
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **TraverseFolderHandler** = (`filePath`, `entry`) => `boolean` \| `void` \| `Promise`\<`boolean` \| `void`\>
10
10
 
11
- Defined in: [traverse-folder.ts:11](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/traverse-folder.ts#L11)
11
+ Defined in: [src/traverse-folder.ts:11](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/traverse-folder.ts#L11)
12
12
 
13
13
  A handler function for asynchronous folder traversal.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **TraverseFolderSyncHandler** = (`filePath`, `entry`) => `boolean` \| `void`
10
10
 
11
- Defined in: [traverse-folder.ts:18](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/traverse-folder.ts#L18)
11
+ Defined in: [src/traverse-folder.ts:18](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/traverse-folder.ts#L18)
12
12
 
13
13
  A handler function for synchronous folder traversal.
14
14
 
@@ -8,4 +8,4 @@
8
8
 
9
9
  > `const` **DefaultAllTextFiles**: `string`[]
10
10
 
11
- Defined in: [include-files.ts:1](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/include-files.ts#L1)
11
+ Defined in: [src/include-files.ts:1](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/include-files.ts#L1)
@@ -0,0 +1,11 @@
1
+ [**@isdk/util**](../README.md)
2
+
3
+ ***
4
+
5
+ [@isdk/util](../globals.md) / DefaultAsyncSemaphoreCapacity
6
+
7
+ # Variable: DefaultAsyncSemaphoreCapacity
8
+
9
+ > `const` **DefaultAsyncSemaphoreCapacity**: `32` = `32`
10
+
11
+ Defined in: [src/async-semaphore.ts:9](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L9)
@@ -8,7 +8,7 @@
8
8
 
9
9
  > `const` **FilenameReservedRegex**: `RegExp`
10
10
 
11
- Defined in: [filename.ts:8](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/filename.ts#L8)
11
+ Defined in: [src/filename.ts:8](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L8)
12
12
 
13
13
  Regular expression pattern for reserved characters in a filename.
14
14
  do not use /g global option here: when the regex is executed multiple times, it will always begin where it left off last time.
@@ -8,6 +8,6 @@
8
8
 
9
9
  > `const` **WindowsReservedNameRegex**: `RegExp`
10
10
 
11
- Defined in: [filename.ts:13](https://github.com/isdk/util.js/blob/e52ad0627fc33dea09d8db6ef431d619770364c0/src/filename.ts#L13)
11
+ Defined in: [src/filename.ts:13](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L13)
12
12
 
13
13
  Regular expression pattern for reserved names on Windows systems.
package/package.json CHANGED
@@ -1,33 +1,35 @@
1
1
  {
2
2
  "name": "@isdk/util",
3
3
  "description": "a set of utility functions",
4
- "version": "0.3.2",
4
+ "version": "0.3.4",
5
5
  "author": "Riceball LEE @snowyu",
6
6
  "bugs": "https://github.com/isdk/util.js/issues",
7
7
  "dependencies": {
8
- "@isdk/common-error": "^0.1.4",
9
- "@isdk/glob": "^0.1.0",
8
+ "@isdk/common-error": "^0.2.0",
9
+ "@isdk/glob": "^0.1.1",
10
+ "events-ex": "^2.1.1",
10
11
  "load-config-file": "^2.1.0",
11
- "yaml": "^2.7.0"
12
+ "util-ex": "^2.5.1",
13
+ "yaml": "^2.8.2"
12
14
  },
13
15
  "devDependencies": {
14
- "@eslint/eslintrc": "^3.3.1",
15
- "@eslint/js": "^9.23.0",
16
+ "@eslint/eslintrc": "^3.3.3",
17
+ "@eslint/js": "^9.39.2",
16
18
  "@types/chai": "^5",
17
- "@types/jest": "^29.5.14",
18
- "@types/node": "^18",
19
+ "@types/jest": "^30.0.0",
20
+ "@types/node": "^25",
19
21
  "eslint": "^9",
20
22
  "eslint-config-prettier": "^10",
21
- "shx": "^0.3.3",
22
- "terser": "^5.39.0",
23
- "tsup": "^8.4.0",
24
- "tsx": "^4.19.3",
25
- "typedoc": "^0.28.1",
26
- "typedoc-plugin-markdown": "^4.6.0",
23
+ "shx": "^0.4.0",
24
+ "terser": "^5.46.0",
25
+ "tsup": "^8.5.1",
26
+ "tsx": "^4.21.0",
27
+ "typedoc": "^0.28.16",
28
+ "typedoc-plugin-markdown": "^4.9.0",
27
29
  "typescript": "^5.7.3",
28
- "typescript-eslint": "^8.28.0",
29
- "vite": "^6.2.3",
30
- "vitest": "^3.0.9"
30
+ "typescript-eslint": "^8.54.0",
31
+ "vite": "^7.3.1",
32
+ "vitest": "^4.0.18"
31
33
  },
32
34
  "engines": {
33
35
  "node": ">=18.0.0"