@mangos/filepath 1.0.5 → 1.0.7
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 +39 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -2
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -64,7 +64,19 @@ import { allPath, firstPath, resolve, resolvePathObject } from '@mangos/filepath
|
|
|
64
64
|
There are 2 exported classes:
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
|
-
import { ParsedPath, ParsedPathError } from '@mangos/filepath';
|
|
67
|
+
import { ParsedPath, ParsedPathError, PathToken } from '@mangos/filepath';
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
There is 1 exported enum:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { PathTokenEnum } from '@mangos/filepath'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
There is 1 exported type:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import type { InferPathOptions } from '@mangos/filepath'
|
|
68
80
|
```
|
|
69
81
|
|
|
70
82
|
Most of the time you will be using <a href="#fn-resolve"><code>resolve</code></a>, <a href="#fn-first-path"><code>firstPath</code></a>.
|
|
@@ -127,6 +139,32 @@ When a string is parsed it will be evaluated according to path types in the foll
|
|
|
127
139
|
3. `dos` tokanization will be tried third, (if the `dos` boolean is set to true).
|
|
128
140
|
4. `posix` tokanization will be tried forth, (if the `posix` boolean is set to true)
|
|
129
141
|
|
|
142
|
+
<h3 id="path-token-type"><code>PathToken</code> object</h3>
|
|
143
|
+
|
|
144
|
+
You dont create `PathToken`s yourself the api will do it for you.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
class PathToken {
|
|
148
|
+
token: PathTokenValueType;
|
|
149
|
+
value: string; // actual path fragment (directory, seperator, or file)
|
|
150
|
+
start: number; // start location in the original string
|
|
151
|
+
end: number; // end (inclusive) in the original string
|
|
152
|
+
error?: string; // this token has invalid character for the OS selected
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The `PathTokenValueType` match the exported `PathTokenEnum` object
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
export const PathTokenEnum = {
|
|
160
|
+
SEP: '\x01', // path seperator
|
|
161
|
+
ROOT: '\x03', // the root (if it is an absolute path)
|
|
162
|
+
PATHELT: '\x06', // directory, file,
|
|
163
|
+
PARENT: '\x07', // two dots (..) meaning parent directory
|
|
164
|
+
CURRENT: '\x08', // a single dot (.) meaning current directory
|
|
165
|
+
} as const;
|
|
166
|
+
```
|
|
167
|
+
|
|
130
168
|
<h3 id="api-functions">Functions</h3>
|
|
131
169
|
|
|
132
170
|
<h4 id="fn-all-path">function: <code>allPath</code></h4>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { PathTokenEnum } from './constants.js';
|
|
1
2
|
import { ParsedPath } from './ParsedPath.js';
|
|
2
3
|
import { ParsedPathError } from './ParsedPathError.js';
|
|
3
|
-
import { allPath, firstPath, resolve } from './parser.js';
|
|
4
|
+
import { allPath, firstPath, resolve, resolvePathObject } from './parser.js';
|
|
4
5
|
import type { PathToken } from './Token.js';
|
|
5
6
|
import type { PathTokenValueType } from './types/TokenValueType.js';
|
|
6
|
-
export { resolve, firstPath, allPath, ParsedPath, ParsedPathError };
|
|
7
|
+
export { resolve, firstPath, allPath, ParsedPath, ParsedPathError, resolvePathObject, PathTokenEnum };
|
|
7
8
|
export type { PathTokenValueType, PathToken };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { PathTokenEnum } from "./constants.js";
|
|
1
2
|
import { ParsedPath } from "./ParsedPath.js";
|
|
2
3
|
import { ParsedPathError } from "./ParsedPathError.js";
|
|
3
|
-
import { allPath, firstPath, resolve } from "./parser.js";
|
|
4
|
+
import { allPath, firstPath, resolve, resolvePathObject } from "./parser.js";
|
|
4
5
|
export {
|
|
5
6
|
ParsedPath,
|
|
6
7
|
ParsedPathError,
|
|
8
|
+
PathTokenEnum,
|
|
7
9
|
allPath,
|
|
8
10
|
firstPath,
|
|
9
|
-
resolve
|
|
11
|
+
resolve,
|
|
12
|
+
resolvePathObject
|
|
10
13
|
};
|
package/dist/parser.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ declare function resolvePathObject(from: ParsedPath, ...toFragments: string[]):
|
|
|
14
14
|
type InferPathOptions = {
|
|
15
15
|
[key in FileSystem]+?: boolean;
|
|
16
16
|
};
|
|
17
|
-
export { resolve,
|
|
17
|
+
export { resolve, resolvePathObject, firstPath, allPath };
|
package/dist/parser.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mangos/filepath",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"author": "jacob bogers <jkfbogers@gmail.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"main": "./dist/index.js",
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@biomejs/biome": "^2.3.8",
|
|
20
|
-
"@types/node": "^25.0.
|
|
20
|
+
"@types/node": "^25.0.3",
|
|
21
21
|
"@vitest/coverage-v8": "^4.0.15",
|
|
22
22
|
"typescript": "^5.9.3",
|
|
23
23
|
"vite": "^7.2.7",
|