@ucdjs/utils 0.0.0 → 0.2.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +9 -0
- package/package.json +19 -13
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -7
package/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[![npm version][npm-version-src]][npm-version-href]
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![codecov][codecov-src]][codecov-href]
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
A collection of utility functions and filesystem bridge implementations for the UCD project.
|
|
7
8
|
|
|
8
9
|
## Installation
|
|
9
10
|
|
|
@@ -11,6 +12,57 @@ Utilities for working with the Unicode Character Database (UCD).
|
|
|
11
12
|
npm install @ucdjs/utils
|
|
12
13
|
```
|
|
13
14
|
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Path Filtering
|
|
18
|
+
|
|
19
|
+
Creates a filter function that checks if a file path should be included or excluded based on glob patterns.
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { createPathFilter } from "@ucdjs/utils";
|
|
23
|
+
|
|
24
|
+
const filter = createPathFilter(["*.txt", "!*Test*"]);
|
|
25
|
+
filter("Data.txt"); // true
|
|
26
|
+
filter("DataTest.txt"); // false
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### PathFilter Methods
|
|
30
|
+
|
|
31
|
+
The `PathFilter` object provides additional methods:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
const filter = createPathFilter(["*.js"]);
|
|
35
|
+
|
|
36
|
+
// Extend with additional patterns
|
|
37
|
+
filter.extend(["*.ts", "!*.test.*"]);
|
|
38
|
+
|
|
39
|
+
// Get current patterns
|
|
40
|
+
const patterns = filter.patterns(); // ['*.js', '*.ts', '!*.test.*']
|
|
41
|
+
|
|
42
|
+
// Use with extra filters temporarily
|
|
43
|
+
filter("app.js", ["!src/**"]); // Apply extra exclusions
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Preconfigured Filters
|
|
47
|
+
|
|
48
|
+
Pre-defined filter patterns for common exclusions:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { createPathFilter, PRECONFIGURED_FILTERS } from "@ucdjs/utils";
|
|
52
|
+
|
|
53
|
+
const filter = createPathFilter([
|
|
54
|
+
"*.txt",
|
|
55
|
+
PRECONFIGURED_FILTERS.EXCLUDE_TEST_FILES,
|
|
56
|
+
PRECONFIGURED_FILTERS.EXCLUDE_README_FILES,
|
|
57
|
+
PRECONFIGURED_FILTERS.EXCLUDE_HTML_FILES
|
|
58
|
+
]);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Available filters:
|
|
62
|
+
- `EXCLUDE_TEST_FILES`: Excludes files containing "Test" in their name
|
|
63
|
+
- `EXCLUDE_README_FILES`: Excludes ReadMe.txt files
|
|
64
|
+
- `EXCLUDE_HTML_FILES`: Excludes all HTML files
|
|
65
|
+
|
|
14
66
|
## 📄 License
|
|
15
67
|
|
|
16
68
|
Published under [MIT License](./LICENSE).
|
|
@@ -19,3 +71,5 @@ Published under [MIT License](./LICENSE).
|
|
|
19
71
|
[npm-version-href]: https://npmjs.com/package/@ucdjs/utils
|
|
20
72
|
[npm-downloads-src]: https://img.shields.io/npm/dm/@ucdjs/utils?style=flat&colorA=18181B&colorB=4169E1
|
|
21
73
|
[npm-downloads-href]: https://npmjs.com/package/@ucdjs/utils
|
|
74
|
+
[codecov-src]: https://img.shields.io/codecov/c/gh/ucdjs/ucd?style=flat&colorA=18181B&colorB=4169E1
|
|
75
|
+
[codecov-href]: https://codecov.io/gh/ucdjs/ucd
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PRECONFIGURED_FILTERS, PathFilter, PathFilterOptions, createPathFilter, filterTreeStructure } from "@ucdjs-internal/shared";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
declare function internal_bingbong(): void;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { PRECONFIGURED_FILTERS, type PathFilter, type PathFilterOptions, createPathFilter, filterTreeStructure, internal_bingbong };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PRECONFIGURED_FILTERS, createPathFilter, filterTreeStructure } from "@ucdjs-internal/shared";
|
|
2
|
+
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
function internal_bingbong() {
|
|
5
|
+
console.log("Bing Bong");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { PRECONFIGURED_FILTERS, createPathFilter, filterTreeStructure, internal_bingbong };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucdjs/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Lucas Nørgård",
|
|
@@ -18,31 +18,37 @@
|
|
|
18
18
|
"url": "https://github.com/ucdjs/ucd/issues"
|
|
19
19
|
},
|
|
20
20
|
"exports": {
|
|
21
|
-
".": "./dist/index.
|
|
21
|
+
".": "./dist/index.mjs",
|
|
22
22
|
"./package.json": "./package.json"
|
|
23
23
|
},
|
|
24
|
-
"
|
|
25
|
-
"module": "./dist/index.js",
|
|
26
|
-
"types": "./dist/index.d.ts",
|
|
24
|
+
"types": "./dist/index.d.mts",
|
|
27
25
|
"files": [
|
|
28
26
|
"dist"
|
|
29
27
|
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.18"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@ucdjs-internal/shared": "0.1.1-beta.1"
|
|
33
|
+
},
|
|
30
34
|
"devDependencies": {
|
|
31
|
-
"@luxass/eslint-config": "
|
|
32
|
-
"eslint": "
|
|
33
|
-
"publint": "
|
|
34
|
-
"tsdown": "
|
|
35
|
-
"typescript": "
|
|
36
|
-
"vitest-testdirs": "
|
|
35
|
+
"@luxass/eslint-config": "7.2.0",
|
|
36
|
+
"eslint": "10.0.0",
|
|
37
|
+
"publint": "0.3.17",
|
|
38
|
+
"tsdown": "0.20.3",
|
|
39
|
+
"typescript": "5.9.3",
|
|
40
|
+
"vitest-testdirs": "4.4.2",
|
|
41
|
+
"@ucdjs-tooling/tsdown-config": "1.0.0",
|
|
42
|
+
"@ucdjs-tooling/tsconfig": "1.0.0"
|
|
37
43
|
},
|
|
38
44
|
"publishConfig": {
|
|
39
45
|
"access": "public"
|
|
40
46
|
},
|
|
41
47
|
"scripts": {
|
|
42
|
-
"build": "tsdown",
|
|
48
|
+
"build": "tsdown --tsconfig=./tsconfig.build.json",
|
|
43
49
|
"dev": "tsdown --watch",
|
|
44
50
|
"clean": "git clean -xdf dist node_modules",
|
|
45
51
|
"lint": "eslint .",
|
|
46
|
-
"typecheck": "tsc --noEmit"
|
|
52
|
+
"typecheck": "tsc --noEmit -p tsconfig.build.json"
|
|
47
53
|
}
|
|
48
54
|
}
|
package/dist/index.d.ts
DELETED