@gesslar/toolkit 0.1.1 → 0.1.2
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/package.json +1 -1
- package/src/index.js +1 -1
- package/src/lib/FS.js +4 -2
- package/src/types/FS.d.ts +9 -15
- package/src/types/index.d.ts +1 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Core file system abstractions
|
|
2
2
|
export {default as FileObject} from "./lib/FileObject.js"
|
|
3
3
|
export {default as DirectoryObject} from "./lib/DirectoryObject.js"
|
|
4
|
-
export {default as FS
|
|
4
|
+
export {default as FS} from "./lib/FS.js"
|
|
5
5
|
|
|
6
6
|
// Utility classes
|
|
7
7
|
export {default as Cache} from "./lib/Cache.js"
|
package/src/lib/FS.js
CHANGED
|
@@ -12,9 +12,11 @@ const fdTypes = Object.freeze(["file", "directory"])
|
|
|
12
12
|
const upperFdTypes = Object.freeze(fdTypes.map(type => type.toUpperCase()))
|
|
13
13
|
const fdType = Object.freeze(await Data.allocateObject(upperFdTypes, fdTypes))
|
|
14
14
|
|
|
15
|
-
export {fdType, upperFdTypes, fdTypes}
|
|
16
|
-
|
|
17
15
|
export default class FS {
|
|
16
|
+
static fdTypes = fdTypes
|
|
17
|
+
static upperFdTypes = upperFdTypes
|
|
18
|
+
static fdType = fdType
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* Fix slashes in a path
|
|
20
22
|
*
|
package/src/types/FS.d.ts
CHANGED
|
@@ -8,6 +8,15 @@ import DirectoryObject from './DirectoryObject.js'
|
|
|
8
8
|
* Base filesystem utilities class. FileObject and DirectoryObject extend this class.
|
|
9
9
|
*/
|
|
10
10
|
export default class FS {
|
|
11
|
+
/** Array of lowercase file descriptor types */
|
|
12
|
+
static readonly fdTypes: readonly ["file", "directory"]
|
|
13
|
+
|
|
14
|
+
/** Array of uppercase file descriptor types */
|
|
15
|
+
static readonly upperFdTypes: readonly ["FILE", "DIRECTORY"]
|
|
16
|
+
|
|
17
|
+
/** Mapping from uppercase to lowercase file descriptor types */
|
|
18
|
+
static readonly fdType: Readonly<Record<"FILE" | "DIRECTORY", "file" | "directory">>
|
|
19
|
+
|
|
11
20
|
/** Fix slashes in a path */
|
|
12
21
|
static fixSlashes(pathName: string): string
|
|
13
22
|
|
|
@@ -29,18 +38,3 @@ export default class FS {
|
|
|
29
38
|
/** Resolve a path relative to another path using various strategies. Handles absolute paths, relative navigation, and overlap-based merging */
|
|
30
39
|
static resolvePath(fromPath: string, toPath: string): string
|
|
31
40
|
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* File descriptor types as lowercase strings
|
|
35
|
-
*/
|
|
36
|
-
export const fdTypes: readonly ["file", "directory"]
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* File descriptor types as uppercase strings
|
|
40
|
-
*/
|
|
41
|
-
export const upperFdTypes: readonly ["FILE", "DIRECTORY"]
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Mapping from uppercase file descriptor types to lowercase
|
|
45
|
-
*/
|
|
46
|
-
export const fdType: Readonly<Record<"FILE" | "DIRECTORY", "file" | "directory">>
|
package/src/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Core file system abstractions
|
|
3
3
|
export { default as FileObject } from './FileObject.js'
|
|
4
4
|
export { default as DirectoryObject } from './DirectoryObject.js'
|
|
5
|
-
export { default as FS
|
|
5
|
+
export { default as FS } from './FS.js'
|
|
6
6
|
|
|
7
7
|
// Utility classes
|
|
8
8
|
export { default as Cache } from './Cache.js'
|