@fgv/ts-json-base 5.1.0-2 → 5.1.0-20
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/dist/index.browser.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/packlets/converters/converters.js.map +1 -0
- package/dist/packlets/converters/index.js.map +1 -0
- package/dist/packlets/file-tree/directoryItem.js.map +1 -0
- package/dist/packlets/file-tree/fileItem.js +11 -4
- package/dist/packlets/file-tree/fileItem.js.map +1 -0
- package/dist/packlets/file-tree/fileTree.js.map +1 -0
- package/dist/packlets/file-tree/fileTreeAccessors.js.map +1 -0
- package/dist/packlets/file-tree/fileTreeHelpers.inMemory.js.map +1 -0
- package/dist/packlets/file-tree/fileTreeHelpers.js.map +1 -0
- package/dist/packlets/file-tree/filterSpec.js.map +1 -0
- package/dist/packlets/file-tree/fsTree.js +44 -13
- package/dist/packlets/file-tree/fsTree.js.map +1 -0
- package/dist/packlets/file-tree/in-memory/inMemoryTree.js +44 -13
- package/dist/packlets/file-tree/in-memory/inMemoryTree.js.map +1 -0
- package/dist/packlets/file-tree/in-memory/index.js.map +1 -0
- package/dist/packlets/file-tree/in-memory/treeBuilder.js.map +1 -0
- package/dist/packlets/file-tree/index.browser.js.map +1 -0
- package/dist/packlets/file-tree/index.js.map +1 -0
- package/dist/packlets/json/common.js.map +1 -0
- package/dist/packlets/json/index.js.map +1 -0
- package/dist/packlets/json-compatible/common.js.map +1 -0
- package/dist/packlets/json-compatible/converters.js.map +1 -0
- package/dist/packlets/json-compatible/index.js.map +1 -0
- package/dist/packlets/json-compatible/validators.js.map +1 -0
- package/dist/packlets/json-file/file.js.map +1 -0
- package/dist/packlets/json-file/index.browser.js.map +1 -0
- package/dist/packlets/json-file/index.js.map +1 -0
- package/dist/packlets/json-file/jsonFsHelper.js.map +1 -0
- package/dist/packlets/json-file/jsonLike.js.map +1 -0
- package/dist/packlets/json-file/jsonTreeHelper.js.map +1 -0
- package/dist/packlets/validators/index.js.map +1 -0
- package/dist/packlets/validators/validators.js.map +1 -0
- package/dist/ts-json-base.d.ts +99 -30
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.browser.d.ts.map +1 -0
- package/lib/index.browser.js.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/packlets/converters/converters.d.ts.map +1 -0
- package/lib/packlets/converters/converters.js.map +1 -0
- package/lib/packlets/converters/index.d.ts.map +1 -0
- package/lib/packlets/converters/index.js.map +1 -0
- package/lib/packlets/file-tree/directoryItem.d.ts.map +1 -0
- package/lib/packlets/file-tree/directoryItem.js.map +1 -0
- package/lib/packlets/file-tree/fileItem.d.ts +11 -4
- package/lib/packlets/file-tree/fileItem.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileItem.js +11 -4
- package/lib/packlets/file-tree/fileItem.js.map +1 -0
- package/lib/packlets/file-tree/fileTree.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTree.js.map +1 -0
- package/lib/packlets/file-tree/fileTreeAccessors.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTreeAccessors.js.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.inMemory.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.inMemory.js.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.js.map +1 -0
- package/lib/packlets/file-tree/filterSpec.d.ts.map +1 -0
- package/lib/packlets/file-tree/filterSpec.js.map +1 -0
- package/lib/packlets/file-tree/fsTree.d.ts +44 -13
- package/lib/packlets/file-tree/fsTree.d.ts.map +1 -0
- package/lib/packlets/file-tree/fsTree.js +44 -13
- package/lib/packlets/file-tree/fsTree.js.map +1 -0
- package/lib/packlets/file-tree/in-memory/inMemoryTree.d.ts +44 -13
- package/lib/packlets/file-tree/in-memory/inMemoryTree.d.ts.map +1 -0
- package/lib/packlets/file-tree/in-memory/inMemoryTree.js +44 -13
- package/lib/packlets/file-tree/in-memory/inMemoryTree.js.map +1 -0
- package/lib/packlets/file-tree/in-memory/index.d.ts.map +1 -0
- package/lib/packlets/file-tree/in-memory/index.js.map +1 -0
- package/lib/packlets/file-tree/in-memory/treeBuilder.d.ts.map +1 -0
- package/lib/packlets/file-tree/in-memory/treeBuilder.js.map +1 -0
- package/lib/packlets/file-tree/index.browser.d.ts.map +1 -0
- package/lib/packlets/file-tree/index.browser.js.map +1 -0
- package/lib/packlets/file-tree/index.d.ts.map +1 -0
- package/lib/packlets/file-tree/index.js.map +1 -0
- package/lib/packlets/json/common.d.ts.map +1 -0
- package/lib/packlets/json/common.js.map +1 -0
- package/lib/packlets/json/index.d.ts.map +1 -0
- package/lib/packlets/json/index.js.map +1 -0
- package/lib/packlets/json-compatible/common.d.ts.map +1 -0
- package/lib/packlets/json-compatible/common.js.map +1 -0
- package/lib/packlets/json-compatible/converters.d.ts.map +1 -0
- package/lib/packlets/json-compatible/converters.js.map +1 -0
- package/lib/packlets/json-compatible/index.d.ts.map +1 -0
- package/lib/packlets/json-compatible/index.js.map +1 -0
- package/lib/packlets/json-compatible/validators.d.ts.map +1 -0
- package/lib/packlets/json-compatible/validators.js.map +1 -0
- package/lib/packlets/json-file/file.d.ts.map +1 -0
- package/lib/packlets/json-file/file.js.map +1 -0
- package/lib/packlets/json-file/index.browser.d.ts.map +1 -0
- package/lib/packlets/json-file/index.browser.js.map +1 -0
- package/lib/packlets/json-file/index.d.ts.map +1 -0
- package/lib/packlets/json-file/index.js.map +1 -0
- package/lib/packlets/json-file/jsonFsHelper.d.ts.map +1 -0
- package/lib/packlets/json-file/jsonFsHelper.js.map +1 -0
- package/lib/packlets/json-file/jsonLike.d.ts.map +1 -0
- package/lib/packlets/json-file/jsonLike.js.map +1 -0
- package/lib/packlets/json-file/jsonTreeHelper.d.ts.map +1 -0
- package/lib/packlets/json-file/jsonTreeHelper.js.map +1 -0
- package/lib/packlets/validators/index.d.ts.map +1 -0
- package/lib/packlets/validators/index.js.map +1 -0
- package/lib/packlets/validators/validators.d.ts.map +1 -0
- package/lib/packlets/validators/validators.js.map +1 -0
- package/package.json +22 -20
- package/dist/test/fixtures/file-tree/config.json +0 -1
- package/dist/test/fixtures/file-tree/data/items.json +0 -1
- package/dist/test/unit/data/file/bad/bad3.json +0 -3
- package/dist/test/unit/data/file/bad/thing1.json +0 -4
- package/dist/test/unit/data/file/bad/thing2.json +0 -3
- package/dist/test/unit/data/file/good/thing1.json +0 -4
- package/dist/test/unit/data/file/good/thing2.json +0 -3
- package/dist/test/unit/json-compatible/helpers.js +0 -32
|
@@ -26,55 +26,86 @@ export declare class FsFileTreeAccessors<TCT extends string = string> implements
|
|
|
26
26
|
*/
|
|
27
27
|
constructor(params?: IFileTreeInitParams<TCT>);
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Resolves paths to an absolute path.
|
|
30
|
+
* @param paths - Paths to resolve.
|
|
31
|
+
* @returns The resolved absolute path.
|
|
30
32
|
*/
|
|
31
33
|
resolveAbsolutePath(...paths: string[]): string;
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* Gets the extension of a path.
|
|
36
|
+
* @param itemPath - Path to get the extension of.
|
|
37
|
+
* @returns The extension of the path.
|
|
34
38
|
*/
|
|
35
39
|
getExtension(itemPath: string): string;
|
|
36
40
|
/**
|
|
37
|
-
*
|
|
41
|
+
* Gets the base name of a path.
|
|
42
|
+
* @param itemPath - Path to get the base name of.
|
|
43
|
+
* @param suffix - Optional suffix to remove from the base name.
|
|
44
|
+
* @returns The base name of the path.
|
|
38
45
|
*/
|
|
39
46
|
getBaseName(itemPath: string, suffix?: string): string;
|
|
40
47
|
/**
|
|
41
|
-
*
|
|
48
|
+
* Joins paths together.
|
|
49
|
+
* @param paths - Paths to join.
|
|
50
|
+
* @returns The joined paths.
|
|
42
51
|
*/
|
|
43
52
|
joinPaths(...paths: string[]): string;
|
|
44
53
|
/**
|
|
45
|
-
*
|
|
54
|
+
* Gets an item from the file tree.
|
|
55
|
+
* @param itemPath - Path of the item to get.
|
|
56
|
+
* @returns The item if it exists.
|
|
46
57
|
*/
|
|
47
58
|
getItem(itemPath: string): Result<FileTreeItem<TCT>>;
|
|
48
59
|
/**
|
|
49
|
-
*
|
|
60
|
+
* Gets the contents of a file in the file tree.
|
|
61
|
+
* @param filePath - Absolute path of the file.
|
|
62
|
+
* @returns The contents of the file.
|
|
50
63
|
*/
|
|
51
64
|
getFileContents(filePath: string): Result<string>;
|
|
52
65
|
/**
|
|
53
|
-
*
|
|
66
|
+
* Gets the content type of a file in the file tree.
|
|
67
|
+
* @param filePath - Absolute path of the file.
|
|
68
|
+
* @param provided - Optional supplied content type.
|
|
69
|
+
* @returns The content type of the file.
|
|
54
70
|
*/
|
|
55
71
|
getFileContentType(filePath: string, provided?: string): Result<TCT | undefined>;
|
|
56
72
|
/**
|
|
57
|
-
*
|
|
73
|
+
* Gets the children of a directory in the file tree.
|
|
74
|
+
* @param dirPath - Path of the directory.
|
|
75
|
+
* @returns The children of the directory.
|
|
58
76
|
*/
|
|
59
77
|
getChildren(dirPath: string): Result<ReadonlyArray<FileTreeItem<TCT>>>;
|
|
60
78
|
/**
|
|
61
|
-
*
|
|
79
|
+
* Checks if a file at the given path can be saved.
|
|
80
|
+
* @param path - The path to check.
|
|
81
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
82
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
62
83
|
*/
|
|
63
84
|
fileIsMutable(path: string): DetailedResult<boolean, SaveDetail>;
|
|
64
85
|
/**
|
|
65
|
-
*
|
|
86
|
+
* Saves the contents to a file at the given path.
|
|
87
|
+
* @param path - The path of the file to save.
|
|
88
|
+
* @param contents - The string contents to save.
|
|
89
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
66
90
|
*/
|
|
67
91
|
saveFileContents(path: string, contents: string): Result<string>;
|
|
68
92
|
/**
|
|
69
|
-
*
|
|
93
|
+
* Deletes a file at the given path.
|
|
94
|
+
* @param path - The path of the file to delete.
|
|
95
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
70
96
|
*/
|
|
71
97
|
deleteFile(path: string): Result<boolean>;
|
|
72
98
|
/**
|
|
73
|
-
*
|
|
99
|
+
* Creates a directory at the given path, including any missing parent directories.
|
|
100
|
+
* @param dirPath - The path of the directory to create.
|
|
101
|
+
* @returns `Success` with the absolute path if created, or `Failure` with an error message.
|
|
74
102
|
*/
|
|
75
103
|
createDirectory(dirPath: string): Result<string>;
|
|
76
104
|
/**
|
|
77
|
-
*
|
|
105
|
+
* Deletes a directory at the given path.
|
|
106
|
+
* The directory must be empty or the operation will fail.
|
|
107
|
+
* @param dirPath - The path of the directory to delete.
|
|
108
|
+
* @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.
|
|
78
109
|
*/
|
|
79
110
|
deleteDirectory(dirPath: string): Result<boolean>;
|
|
80
111
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fsTree.d.ts","sourceRoot":"","sources":["../../../src/packlets/file-tree/fsTree.ts"],"names":[],"mappings":"AAsBA,OAAO,EACL,YAAY,EACZ,mBAAmB,EAEnB,yBAAyB,EACzB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAEL,cAAc,EAGd,MAAM,EAGP,MAAM,eAAe,CAAC;AAKvB;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,CAAE,YAAW,yBAAyB,CAAC,GAAG,CAAC;IACrG;;OAEG;IACH,SAAgB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3C;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;IAEpF;;OAEG;IACH,OAAO,CAAC,QAAQ,CA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,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;CAczD"}
|
|
@@ -50,7 +50,9 @@ class FsFileTreeAccessors {
|
|
|
50
50
|
this._mutable = (_b = params === null || params === void 0 ? void 0 : params.mutable) !== null && _b !== void 0 ? _b : false;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Resolves paths to an absolute path.
|
|
54
|
+
* @param paths - Paths to resolve.
|
|
55
|
+
* @returns The resolved absolute path.
|
|
54
56
|
*/
|
|
55
57
|
resolveAbsolutePath(...paths) {
|
|
56
58
|
if (this.prefix && !path_1.default.isAbsolute(paths[0])) {
|
|
@@ -59,25 +61,34 @@ class FsFileTreeAccessors {
|
|
|
59
61
|
return path_1.default.resolve(...paths);
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
|
-
*
|
|
64
|
+
* Gets the extension of a path.
|
|
65
|
+
* @param itemPath - Path to get the extension of.
|
|
66
|
+
* @returns The extension of the path.
|
|
63
67
|
*/
|
|
64
68
|
getExtension(itemPath) {
|
|
65
69
|
return path_1.default.extname(itemPath);
|
|
66
70
|
}
|
|
67
71
|
/**
|
|
68
|
-
*
|
|
72
|
+
* Gets the base name of a path.
|
|
73
|
+
* @param itemPath - Path to get the base name of.
|
|
74
|
+
* @param suffix - Optional suffix to remove from the base name.
|
|
75
|
+
* @returns The base name of the path.
|
|
69
76
|
*/
|
|
70
77
|
getBaseName(itemPath, suffix) {
|
|
71
78
|
return path_1.default.basename(itemPath, suffix);
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
74
|
-
*
|
|
81
|
+
* Joins paths together.
|
|
82
|
+
* @param paths - Paths to join.
|
|
83
|
+
* @returns The joined paths.
|
|
75
84
|
*/
|
|
76
85
|
joinPaths(...paths) {
|
|
77
86
|
return path_1.default.join(...paths);
|
|
78
87
|
}
|
|
79
88
|
/**
|
|
80
|
-
*
|
|
89
|
+
* Gets an item from the file tree.
|
|
90
|
+
* @param itemPath - Path of the item to get.
|
|
91
|
+
* @returns The item if it exists.
|
|
81
92
|
*/
|
|
82
93
|
getItem(itemPath) {
|
|
83
94
|
return (0, ts_utils_1.captureResult)(() => {
|
|
@@ -93,13 +104,18 @@ class FsFileTreeAccessors {
|
|
|
93
104
|
});
|
|
94
105
|
}
|
|
95
106
|
/**
|
|
96
|
-
*
|
|
107
|
+
* Gets the contents of a file in the file tree.
|
|
108
|
+
* @param filePath - Absolute path of the file.
|
|
109
|
+
* @returns The contents of the file.
|
|
97
110
|
*/
|
|
98
111
|
getFileContents(filePath) {
|
|
99
112
|
return (0, ts_utils_1.captureResult)(() => fs_1.default.readFileSync(this.resolveAbsolutePath(filePath), 'utf8'));
|
|
100
113
|
}
|
|
101
114
|
/**
|
|
102
|
-
*
|
|
115
|
+
* Gets the content type of a file in the file tree.
|
|
116
|
+
* @param filePath - Absolute path of the file.
|
|
117
|
+
* @param provided - Optional supplied content type.
|
|
118
|
+
* @returns The content type of the file.
|
|
103
119
|
*/
|
|
104
120
|
getFileContentType(filePath, provided) {
|
|
105
121
|
if (provided !== undefined) {
|
|
@@ -109,7 +125,9 @@ class FsFileTreeAccessors {
|
|
|
109
125
|
return this._inferContentType(filePath);
|
|
110
126
|
}
|
|
111
127
|
/**
|
|
112
|
-
*
|
|
128
|
+
* Gets the children of a directory in the file tree.
|
|
129
|
+
* @param dirPath - Path of the directory.
|
|
130
|
+
* @returns The children of the directory.
|
|
113
131
|
*/
|
|
114
132
|
getChildren(dirPath) {
|
|
115
133
|
return (0, ts_utils_1.captureResult)(() => {
|
|
@@ -128,7 +146,10 @@ class FsFileTreeAccessors {
|
|
|
128
146
|
});
|
|
129
147
|
}
|
|
130
148
|
/**
|
|
131
|
-
*
|
|
149
|
+
* Checks if a file at the given path can be saved.
|
|
150
|
+
* @param path - The path to check.
|
|
151
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
152
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
132
153
|
*/
|
|
133
154
|
fileIsMutable(path) {
|
|
134
155
|
const absolutePath = this.resolveAbsolutePath(path);
|
|
@@ -161,7 +182,10 @@ class FsFileTreeAccessors {
|
|
|
161
182
|
}
|
|
162
183
|
}
|
|
163
184
|
/**
|
|
164
|
-
*
|
|
185
|
+
* Saves the contents to a file at the given path.
|
|
186
|
+
* @param path - The path of the file to save.
|
|
187
|
+
* @param contents - The string contents to save.
|
|
188
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
165
189
|
*/
|
|
166
190
|
saveFileContents(path, contents) {
|
|
167
191
|
return this.fileIsMutable(path).asResult.onSuccess(() => {
|
|
@@ -173,7 +197,9 @@ class FsFileTreeAccessors {
|
|
|
173
197
|
});
|
|
174
198
|
}
|
|
175
199
|
/**
|
|
176
|
-
*
|
|
200
|
+
* Deletes a file at the given path.
|
|
201
|
+
* @param path - The path of the file to delete.
|
|
202
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
177
203
|
*/
|
|
178
204
|
deleteFile(path) {
|
|
179
205
|
return this.fileIsMutable(path).asResult.onSuccess(() => {
|
|
@@ -189,7 +215,9 @@ class FsFileTreeAccessors {
|
|
|
189
215
|
});
|
|
190
216
|
}
|
|
191
217
|
/**
|
|
192
|
-
*
|
|
218
|
+
* Creates a directory at the given path, including any missing parent directories.
|
|
219
|
+
* @param dirPath - The path of the directory to create.
|
|
220
|
+
* @returns `Success` with the absolute path if created, or `Failure` with an error message.
|
|
193
221
|
*/
|
|
194
222
|
createDirectory(dirPath) {
|
|
195
223
|
const absolutePath = this.resolveAbsolutePath(dirPath);
|
|
@@ -203,7 +231,10 @@ class FsFileTreeAccessors {
|
|
|
203
231
|
});
|
|
204
232
|
}
|
|
205
233
|
/**
|
|
206
|
-
*
|
|
234
|
+
* Deletes a directory at the given path.
|
|
235
|
+
* The directory must be empty or the operation will fail.
|
|
236
|
+
* @param dirPath - The path of the directory to delete.
|
|
237
|
+
* @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.
|
|
207
238
|
*/
|
|
208
239
|
deleteDirectory(dirPath) {
|
|
209
240
|
return this.fileIsMutable(dirPath).asResult.onSuccess(() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fsTree.js","sourceRoot":"","sources":["../../../src/packlets/file-tree/fsTree.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;AASH,gDAAwB;AACxB,4CAAoB;AACpB,4CAQuB;AACvB,mDAAgD;AAChD,yCAAsC;AACtC,6CAA6C;AAE7C;;;;GAIG;AACH,MAAa,mBAAmB;IAiB9B;;;;OAIG;IACH,YAAmB,MAAiC;;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAC;QAC7B,IAAI,CAAC,iBAAiB,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,mCAAI,mBAAQ,CAAC,uBAAuB,CAAC;QACtF,mEAAmE;QACnE,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,KAAK,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,GAAG,KAAe;QAC3C,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,cAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,OAAO,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,cAAI,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,QAAgB;QAClC,OAAO,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAC,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BAAa,EAAC,GAAG,EAAE;gBACxB,MAAM,IAAI,GAAG,YAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;gBACvC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;oBACxB,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,mBAAmB,CAAC,CAAC;gBACtD,CAAC;gBACD,kEAAkE;gBAClE,YAAE,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;gBAC3B,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnPD,kDAmPC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n FileTreeItem,\n IFileTreeInitParams,\n IFilterSpec,\n IMutableFileTreeAccessors,\n SaveDetail\n} from './fileTreeAccessors';\nimport path from 'path';\nimport fs from 'fs';\nimport {\n captureResult,\n DetailedResult,\n fail,\n failWithDetail,\n Result,\n succeed,\n succeedWithDetail\n} from '@fgv/ts-utils';\nimport { DirectoryItem } from './directoryItem';\nimport { FileItem } from './fileItem';\nimport { isPathMutable } from './filterSpec';\n\n/**\n * Implementation of {@link FileTree.IMutableFileTreeAccessors} that uses the\n * file system to access and modify files and directories.\n * @public\n */\nexport class FsFileTreeAccessors<TCT extends string = string> implements IMutableFileTreeAccessors<TCT> {\n /**\n * Optional path prefix to prepend to all paths.\n */\n public readonly prefix: string | undefined;\n\n /**\n * Function to infer the content type of a file.\n * @public\n */\n protected readonly _inferContentType: (filePath: string) => Result<TCT | undefined>;\n\n /**\n * The mutability configuration.\n */\n private readonly _mutable: boolean | IFilterSpec;\n\n /**\n * Construct a new instance of the {@link FileTree.FsFileTreeAccessors | FsFileTreeAccessors} class.\n * @param params - Optional {@link FileTree.IFileTreeInitParams | initialization parameters}.\n * @public\n */\n public constructor(params?: IFileTreeInitParams<TCT>) {\n this.prefix = params?.prefix;\n this._inferContentType = params?.inferContentType ?? FileItem.defaultInferContentType;\n /* c8 ignore next 1 - defensive default when params is undefined */\n this._mutable = params?.mutable ?? false;\n }\n\n /**\n * Resolves paths to an absolute path.\n * @param paths - Paths to resolve.\n * @returns The resolved absolute path.\n */\n public resolveAbsolutePath(...paths: string[]): string {\n if (this.prefix && !path.isAbsolute(paths[0])) {\n return path.resolve(this.prefix, ...paths);\n }\n return path.resolve(...paths);\n }\n\n /**\n * Gets the extension of a path.\n * @param itemPath - Path to get the extension of.\n * @returns The extension of the path.\n */\n public getExtension(itemPath: string): string {\n return path.extname(itemPath);\n }\n\n /**\n * Gets the base name of a path.\n * @param itemPath - Path to get the base name of.\n * @param suffix - Optional suffix to remove from the base name.\n * @returns The base name of the path.\n */\n public getBaseName(itemPath: string, suffix?: string): string {\n return path.basename(itemPath, suffix);\n }\n\n /**\n * Joins paths together.\n * @param paths - Paths to join.\n * @returns The joined paths.\n */\n public joinPaths(...paths: string[]): string {\n return path.join(...paths);\n }\n\n /**\n * Gets an item from the file tree.\n * @param itemPath - Path of the item to get.\n * @returns The item if it exists.\n */\n public getItem(itemPath: string): Result<FileTreeItem<TCT>> {\n return captureResult(() => {\n const stat = fs.statSync(this.resolveAbsolutePath(itemPath));\n if (stat.isDirectory()) {\n return DirectoryItem.create<TCT>(itemPath, this).orThrow();\n } else if (stat.isFile()) {\n return FileItem.create(itemPath, this).orThrow();\n }\n /* c8 ignore next 1 - defensive coding: filesystem items should be file or directory */\n throw new Error(`${itemPath}: not a file or directory`);\n });\n }\n\n /**\n * Gets the contents of a file in the file tree.\n * @param filePath - Absolute path of the file.\n * @returns The contents of the file.\n */\n public getFileContents(filePath: string): Result<string> {\n return captureResult(() => fs.readFileSync(this.resolveAbsolutePath(filePath), 'utf8'));\n }\n\n /**\n * Gets the content type of a file in the file tree.\n * @param filePath - Absolute path of the file.\n * @param provided - Optional supplied content type.\n * @returns The content type of the file.\n */\n public getFileContentType(filePath: string, provided?: string): Result<TCT | undefined> {\n if (provided !== undefined) {\n return succeed(provided as TCT);\n }\n /* c8 ignore next 2 - coverage has intermittent issues in the build - local tests show coverage of this line */\n return this._inferContentType(filePath);\n }\n\n /**\n * Gets the children of a directory in the file tree.\n * @param dirPath - Path of the directory.\n * @returns The children of the directory.\n */\n public getChildren(dirPath: string): Result<ReadonlyArray<FileTreeItem<TCT>>> {\n return captureResult(() => {\n const children: FileTreeItem<TCT>[] = [];\n const files = fs.readdirSync(this.resolveAbsolutePath(dirPath), { withFileTypes: true });\n files.forEach((file) => {\n const fullPath = this.resolveAbsolutePath(dirPath, file.name);\n if (file.isDirectory()) {\n children.push(DirectoryItem.create<TCT>(fullPath, this).orThrow());\n } else if (file.isFile()) {\n children.push(FileItem.create<TCT>(fullPath, this).orThrow());\n }\n });\n return children;\n });\n }\n\n /**\n * Checks if a file at the given path can be saved.\n * @param path - The path to check.\n * @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,\n * or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.\n */\n public fileIsMutable(path: string): DetailedResult<boolean, SaveDetail> {\n const absolutePath = this.resolveAbsolutePath(path);\n\n // Check if mutability is disabled\n if (this._mutable === false) {\n return failWithDetail(`${absolutePath}: mutability is disabled`, 'not-mutable');\n }\n\n // Check if path is excluded by filter\n if (!isPathMutable(absolutePath, this._mutable)) {\n return failWithDetail(`${absolutePath}: path is excluded by filter`, 'path-excluded');\n }\n\n // Check file system permissions\n try {\n // Check if file exists\n if (fs.existsSync(absolutePath)) {\n fs.accessSync(absolutePath, fs.constants.W_OK);\n } else {\n // Check if parent directory is writable\n const parentDir = absolutePath.substring(0, absolutePath.lastIndexOf('/'));\n if (parentDir && fs.existsSync(parentDir)) {\n fs.accessSync(parentDir, fs.constants.W_OK);\n }\n }\n return succeedWithDetail(true, 'persistent');\n /* c8 ignore next 3 - unreachable when running as root (CI), tested in mutableFsTree.test.ts */\n } catch {\n return failWithDetail(`${absolutePath}: permission denied`, 'permission-denied');\n }\n }\n\n /**\n * Saves the contents to a file at the given path.\n * @param path - The path of the file to save.\n * @param contents - The string contents to save.\n * @returns `Success` if the file was saved, or `Failure` with an error message.\n */\n public saveFileContents(path: string, contents: string): Result<string> {\n return this.fileIsMutable(path).asResult.onSuccess(() => {\n const absolutePath = this.resolveAbsolutePath(path);\n return captureResult(() => {\n fs.writeFileSync(absolutePath, contents, 'utf8');\n return contents;\n });\n });\n }\n\n /**\n * Deletes a file at the given path.\n * @param path - The path of the file to delete.\n * @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.\n */\n public deleteFile(path: string): Result<boolean> {\n return this.fileIsMutable(path).asResult.onSuccess(() => {\n const absolutePath = this.resolveAbsolutePath(path);\n return captureResult(() => {\n const stat = fs.statSync(absolutePath);\n if (!stat.isFile()) {\n throw new Error(`${absolutePath}: not a file`);\n }\n fs.unlinkSync(absolutePath);\n return true;\n });\n });\n }\n\n /**\n * Creates a directory at the given path, including any missing parent directories.\n * @param dirPath - The path of the directory to create.\n * @returns `Success` with the absolute path if created, or `Failure` with an error message.\n */\n public createDirectory(dirPath: string): Result<string> {\n const absolutePath = this.resolveAbsolutePath(dirPath);\n\n // Check if mutability is disabled\n if (this._mutable === false) {\n return fail(`${absolutePath}: mutability is disabled`);\n }\n\n return captureResult(() => {\n fs.mkdirSync(absolutePath, { recursive: true });\n return absolutePath;\n });\n }\n\n /**\n * Deletes a directory at the given path.\n * The directory must be empty or the operation will fail.\n * @param dirPath - The path of the directory to delete.\n * @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.\n */\n public deleteDirectory(dirPath: string): Result<boolean> {\n return this.fileIsMutable(dirPath).asResult.onSuccess(() => {\n const absolutePath = this.resolveAbsolutePath(dirPath);\n return captureResult(() => {\n const stat = fs.statSync(absolutePath);\n if (!stat.isDirectory()) {\n throw new Error(`${absolutePath}: not a directory`);\n }\n // fs.rmdirSync fails if directory is non-empty (desired behavior)\n fs.rmdirSync(absolutePath);\n return true;\n });\n });\n }\n}\n"]}
|
|
@@ -51,56 +51,87 @@ export declare class InMemoryTreeAccessors<TCT extends string = string> implemen
|
|
|
51
51
|
*/
|
|
52
52
|
static create<TCT extends string = string>(files: IInMemoryFile<TCT>[], params?: IFileTreeInitParams<TCT>): Result<InMemoryTreeAccessors<TCT>>;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Resolves paths to an absolute path.
|
|
55
|
+
* @param paths - Paths to resolve.
|
|
56
|
+
* @returns The resolved absolute path.
|
|
55
57
|
*/
|
|
56
58
|
resolveAbsolutePath(...paths: string[]): string;
|
|
57
59
|
/**
|
|
58
|
-
*
|
|
60
|
+
* Gets the extension of a path.
|
|
61
|
+
* @param path - Path to get the extension of.
|
|
62
|
+
* @returns The extension of the path.
|
|
59
63
|
*/
|
|
60
64
|
getExtension(path: string): string;
|
|
61
65
|
/**
|
|
62
|
-
*
|
|
66
|
+
* Gets the base name of a path.
|
|
67
|
+
* @param path - Path to get the base name of.
|
|
68
|
+
* @param suffix - Optional suffix to remove from the base name.
|
|
69
|
+
* @returns The base name of the path.
|
|
63
70
|
*/
|
|
64
71
|
getBaseName(path: string, suffix?: string): string;
|
|
65
72
|
/**
|
|
66
|
-
*
|
|
73
|
+
* Joins paths together.
|
|
74
|
+
* @param paths - Paths to join.
|
|
75
|
+
* @returns The joined paths.
|
|
67
76
|
*/
|
|
68
77
|
joinPaths(...paths: string[]): string;
|
|
69
78
|
/**
|
|
70
|
-
*
|
|
79
|
+
* Gets an item from the file tree.
|
|
80
|
+
* @param itemPath - Path of the item to get.
|
|
81
|
+
* @returns The item if it exists.
|
|
71
82
|
*/
|
|
72
83
|
getItem(itemPath: string): Result<FileTreeItem<TCT>>;
|
|
73
84
|
/**
|
|
74
|
-
*
|
|
85
|
+
* Gets the contents of a file in the file tree.
|
|
86
|
+
* @param path - Absolute path of the file.
|
|
87
|
+
* @returns The contents of the file.
|
|
75
88
|
*/
|
|
76
89
|
getFileContents(path: string): Result<string>;
|
|
77
90
|
/**
|
|
78
|
-
*
|
|
91
|
+
* Gets the content type of a file in the file tree.
|
|
92
|
+
* @param path - Absolute path of the file.
|
|
93
|
+
* @param provided - Optional supplied content type.
|
|
94
|
+
* @returns The content type of the file.
|
|
79
95
|
*/
|
|
80
96
|
getFileContentType(path: string, provided?: string): Result<TCT | undefined>;
|
|
81
97
|
/**
|
|
82
|
-
*
|
|
98
|
+
* Gets the children of a directory in the file tree.
|
|
99
|
+
* @param path - Path of the directory.
|
|
100
|
+
* @returns The children of the directory.
|
|
83
101
|
*/
|
|
84
102
|
getChildren(path: string): Result<ReadonlyArray<FileTreeItem<TCT>>>;
|
|
85
103
|
private _addMutableFile;
|
|
86
104
|
/**
|
|
87
|
-
*
|
|
105
|
+
* Creates a directory at the given path, including any missing parent directories.
|
|
106
|
+
* @param dirPath - The path of the directory to create.
|
|
107
|
+
* @returns `Success` with the absolute path if created, or `Failure` with an error message.
|
|
88
108
|
*/
|
|
89
109
|
createDirectory(dirPath: string): Result<string>;
|
|
90
110
|
/**
|
|
91
|
-
*
|
|
111
|
+
* Checks if a file at the given path can be saved.
|
|
112
|
+
* @param path - The path to check.
|
|
113
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
114
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
92
115
|
*/
|
|
93
116
|
fileIsMutable(path: string): DetailedResult<boolean, SaveDetail>;
|
|
94
117
|
/**
|
|
95
|
-
*
|
|
118
|
+
* Deletes a file at the given path.
|
|
119
|
+
* @param path - The path of the file to delete.
|
|
120
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
96
121
|
*/
|
|
97
122
|
deleteFile(path: string): Result<boolean>;
|
|
98
123
|
/**
|
|
99
|
-
*
|
|
124
|
+
* Deletes a directory at the given path.
|
|
125
|
+
* The directory must be empty or the operation will fail.
|
|
126
|
+
* @param path - The path of the directory to delete.
|
|
127
|
+
* @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.
|
|
100
128
|
*/
|
|
101
129
|
deleteDirectory(path: string): Result<boolean>;
|
|
102
130
|
/**
|
|
103
|
-
*
|
|
131
|
+
* Saves the contents to a file at the given path.
|
|
132
|
+
* @param path - The path of the file to save.
|
|
133
|
+
* @param contents - The string contents to save.
|
|
134
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
104
135
|
*/
|
|
105
136
|
saveFileContents(path: string, contents: string): Result<string>;
|
|
106
137
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inMemoryTree.d.ts","sourceRoot":"","sources":["../../../../src/packlets/file-tree/in-memory/inMemoryTree.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,cAAc,EAGd,MAAM,EAGP,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,YAAY,EACZ,mBAAmB,EAEnB,yBAAyB,EACzB,UAAU,EACX,MAAM,sBAAsB,CAAC;AAI9B;;;GAGG;AACH,MAAM,WAAW,aAAa,CAAC,GAAG,SAAS,MAAM,GAAG,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Resolves paths to an absolute path.
|
|
142
|
+
* @param paths - Paths to resolve.
|
|
143
|
+
* @returns The resolved absolute path.
|
|
142
144
|
*/
|
|
143
145
|
resolveAbsolutePath(...paths) {
|
|
144
146
|
const parts = paths[0].startsWith('/') ? paths : [this._tree.prefix, ...paths];
|
|
@@ -146,7 +148,9 @@ class InMemoryTreeAccessors {
|
|
|
146
148
|
return `/${joined}`;
|
|
147
149
|
}
|
|
148
150
|
/**
|
|
149
|
-
*
|
|
151
|
+
* Gets the extension of a path.
|
|
152
|
+
* @param path - Path to get the extension of.
|
|
153
|
+
* @returns The extension of the path.
|
|
150
154
|
*/
|
|
151
155
|
getExtension(path) {
|
|
152
156
|
const parts = path.split('.');
|
|
@@ -156,7 +160,10 @@ class InMemoryTreeAccessors {
|
|
|
156
160
|
return `.${parts.pop()}`;
|
|
157
161
|
}
|
|
158
162
|
/**
|
|
159
|
-
*
|
|
163
|
+
* Gets the base name of a path.
|
|
164
|
+
* @param path - Path to get the base name of.
|
|
165
|
+
* @param suffix - Optional suffix to remove from the base name.
|
|
166
|
+
* @returns The base name of the path.
|
|
160
167
|
*/
|
|
161
168
|
getBaseName(path, suffix) {
|
|
162
169
|
var _a;
|
|
@@ -168,7 +175,9 @@ class InMemoryTreeAccessors {
|
|
|
168
175
|
return base;
|
|
169
176
|
}
|
|
170
177
|
/**
|
|
171
|
-
*
|
|
178
|
+
* Joins paths together.
|
|
179
|
+
* @param paths - Paths to join.
|
|
180
|
+
* @returns The joined paths.
|
|
172
181
|
*/
|
|
173
182
|
joinPaths(...paths) {
|
|
174
183
|
var _a;
|
|
@@ -176,7 +185,9 @@ class InMemoryTreeAccessors {
|
|
|
176
185
|
return ((_a = paths[0]) === null || _a === void 0 ? void 0 : _a.startsWith('/')) ? `/${joined}` : joined;
|
|
177
186
|
}
|
|
178
187
|
/**
|
|
179
|
-
*
|
|
188
|
+
* Gets an item from the file tree.
|
|
189
|
+
* @param itemPath - Path of the item to get.
|
|
190
|
+
* @returns The item if it exists.
|
|
180
191
|
*/
|
|
181
192
|
getItem(itemPath) {
|
|
182
193
|
const existing = this._tree.byAbsolutePath.get(itemPath);
|
|
@@ -191,7 +202,9 @@ class InMemoryTreeAccessors {
|
|
|
191
202
|
return (0, ts_utils_1.fail)(`${itemPath}: not found`);
|
|
192
203
|
}
|
|
193
204
|
/**
|
|
194
|
-
*
|
|
205
|
+
* Gets the contents of a file in the file tree.
|
|
206
|
+
* @param path - Absolute path of the file.
|
|
207
|
+
* @returns The contents of the file.
|
|
195
208
|
*/
|
|
196
209
|
getFileContents(path) {
|
|
197
210
|
const absolutePath = this.resolveAbsolutePath(path);
|
|
@@ -208,7 +221,10 @@ class InMemoryTreeAccessors {
|
|
|
208
221
|
return (0, ts_utils_1.captureResult)(() => JSON.stringify(item.contents));
|
|
209
222
|
}
|
|
210
223
|
/**
|
|
211
|
-
*
|
|
224
|
+
* Gets the content type of a file in the file tree.
|
|
225
|
+
* @param path - Absolute path of the file.
|
|
226
|
+
* @param provided - Optional supplied content type.
|
|
227
|
+
* @returns The content type of the file.
|
|
212
228
|
*/
|
|
213
229
|
getFileContentType(path, provided) {
|
|
214
230
|
// If provided contentType is given, use it directly (highest priority)
|
|
@@ -231,7 +247,9 @@ class InMemoryTreeAccessors {
|
|
|
231
247
|
return this._inferContentType(path);
|
|
232
248
|
}
|
|
233
249
|
/**
|
|
234
|
-
*
|
|
250
|
+
* Gets the children of a directory in the file tree.
|
|
251
|
+
* @param path - Path of the directory.
|
|
252
|
+
* @returns The children of the directory.
|
|
235
253
|
*/
|
|
236
254
|
getChildren(path) {
|
|
237
255
|
const item = this._tree.byAbsolutePath.get(path);
|
|
@@ -281,7 +299,9 @@ class InMemoryTreeAccessors {
|
|
|
281
299
|
});
|
|
282
300
|
}
|
|
283
301
|
/**
|
|
284
|
-
*
|
|
302
|
+
* Creates a directory at the given path, including any missing parent directories.
|
|
303
|
+
* @param dirPath - The path of the directory to create.
|
|
304
|
+
* @returns `Success` with the absolute path if created, or `Failure` with an error message.
|
|
285
305
|
*/
|
|
286
306
|
createDirectory(dirPath) {
|
|
287
307
|
const absolutePath = this.resolveAbsolutePath(dirPath);
|
|
@@ -312,7 +332,10 @@ class InMemoryTreeAccessors {
|
|
|
312
332
|
return (0, ts_utils_1.succeed)(absolutePath);
|
|
313
333
|
}
|
|
314
334
|
/**
|
|
315
|
-
*
|
|
335
|
+
* Checks if a file at the given path can be saved.
|
|
336
|
+
* @param path - The path to check.
|
|
337
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
338
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
316
339
|
*/
|
|
317
340
|
fileIsMutable(path) {
|
|
318
341
|
const absolutePath = this.resolveAbsolutePath(path);
|
|
@@ -327,7 +350,9 @@ class InMemoryTreeAccessors {
|
|
|
327
350
|
return (0, ts_utils_1.succeedWithDetail)(true, 'transient');
|
|
328
351
|
}
|
|
329
352
|
/**
|
|
330
|
-
*
|
|
353
|
+
* Deletes a file at the given path.
|
|
354
|
+
* @param path - The path of the file to delete.
|
|
355
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
331
356
|
*/
|
|
332
357
|
deleteFile(path) {
|
|
333
358
|
const absolutePath = this.resolveAbsolutePath(path);
|
|
@@ -359,7 +384,10 @@ class InMemoryTreeAccessors {
|
|
|
359
384
|
return (0, ts_utils_1.succeed)(true);
|
|
360
385
|
}
|
|
361
386
|
/**
|
|
362
|
-
*
|
|
387
|
+
* Deletes a directory at the given path.
|
|
388
|
+
* The directory must be empty or the operation will fail.
|
|
389
|
+
* @param path - The path of the directory to delete.
|
|
390
|
+
* @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.
|
|
363
391
|
*/
|
|
364
392
|
deleteDirectory(path) {
|
|
365
393
|
const absolutePath = this.resolveAbsolutePath(path);
|
|
@@ -399,7 +427,10 @@ class InMemoryTreeAccessors {
|
|
|
399
427
|
return (0, ts_utils_1.succeed)(true);
|
|
400
428
|
}
|
|
401
429
|
/**
|
|
402
|
-
*
|
|
430
|
+
* Saves the contents to a file at the given path.
|
|
431
|
+
* @param path - The path of the file to save.
|
|
432
|
+
* @param contents - The string contents to save.
|
|
433
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
403
434
|
*/
|
|
404
435
|
saveFileContents(path, contents) {
|
|
405
436
|
const isMutable = this.fileIsMutable(path);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inMemoryTree.js","sourceRoot":"","sources":["../../../../src/packlets/file-tree/in-memory/inMemoryTree.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAQuB;AACvB,oDAAiD;AACjD,0CAAuC;AAQvC,+CAA6E;AAC7E,8CAA8C;AAuB9C;;;GAGG;AACH,MAAM,mBAAmB;IAKvB,YAAmB,YAAoB,EAAE,QAAiB,EAAE,WAAiB;QAC3E,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,WAAW,CAAC,QAAiB;QAClC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC5B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,wBAAwB;IAI5B,+DAA+D;IAC/D,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,YAAmB,YAAoB;QACrC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;IAC7B,CAAC;IAEM,YAAY,CAAC,IAAY;QAC9B,IAAI,IAAI,CAAC,YAAY,KAAK,GAAG,EAAE,CAAC;YAC9B,OAAO,IAAI,IAAI,EA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AAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;YAClD,CAAC;YAED,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApbD,sDAobC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n captureResult,\n DetailedResult,\n fail,\n failWithDetail,\n Result,\n succeed,\n succeedWithDetail\n} from '@fgv/ts-utils';\nimport { DirectoryItem } from '../directoryItem';\nimport { FileItem } from '../fileItem';\nimport {\n FileTreeItem,\n IFileTreeInitParams,\n IFilterSpec,\n IMutableFileTreeAccessors,\n SaveDetail\n} from '../fileTreeAccessors';\nimport { InMemoryDirectory, InMemoryFile, TreeBuilder } from './treeBuilder';\nimport { isPathMutable } from '../filterSpec';\n\n/**\n * Represents a single file in an in-memory {@link FileTree | file tree}.\n * @public\n */\nexport interface IInMemoryFile<TCT extends string = string> {\n /**\n * The absolute path of the file in the tree.\n */\n readonly path: string;\n\n /**\n * The contents of the file\n */\n readonly contents: unknown;\n\n /**\n * The content type of the file.\n */\n readonly contentType?: TCT;\n}\n\n/**\n * A mutable in-memory file that allows updating contents.\n * @internal\n */\nclass MutableInMemoryFile<TCT extends string = string> {\n public readonly absolutePath: string;\n public readonly contentType?: TCT;\n private _contents: unknown;\n\n public constructor(absolutePath: string, contents: unknown, contentType?: TCT) {\n this.absolutePath = absolutePath;\n this._contents = contents;\n this.contentType = contentType;\n }\n\n public get contents(): unknown {\n return this._contents;\n }\n\n public setContents(contents: unknown): void {\n this._contents = contents;\n }\n}\n\n/**\n * A mutable in-memory directory that creates mutable files.\n * @internal\n */\nclass MutableInMemoryDirectory<TCT extends string = string> {\n public readonly absolutePath: string;\n protected _children: Map<string, MutableInMemoryDirectory<TCT> | MutableInMemoryFile<TCT>>;\n\n /* c8 ignore next 3 - internal getter used by tree traversal */\n public get children(): ReadonlyMap<string, MutableInMemoryDirectory<TCT> | MutableInMemoryFile<TCT>> {\n return this._children;\n }\n\n public constructor(absolutePath: string) {\n this.absolutePath = absolutePath;\n this._children = new Map();\n }\n\n public getChildPath(name: string): string {\n if (this.absolutePath === '/') {\n return `/${name}`;\n }\n return [this.absolutePath, name].join('/');\n }\n\n public addFile(name: string, contents: unknown, contentType?: TCT): Result<MutableInMemoryFile<TCT>> {\n /* c8 ignore next 3 - defensive: duplicate detection during construction */\n if (this._children.has(name)) {\n return fail(`${name}: already exists`);\n }\n const child = new MutableInMemoryFile<TCT>(this.getChildPath(name), contents, contentType);\n this._children.set(name, child);\n return succeed(child);\n }\n\n public getOrAddDirectory(name: string): Result<MutableInMemoryDirectory<TCT>> {\n const existing = this._children.get(name);\n if (existing) {\n if (existing instanceof MutableInMemoryDirectory) {\n return succeed(existing);\n }\n return fail(`${name}: not a directory`);\n }\n const child = new MutableInMemoryDirectory<TCT>(this.getChildPath(name));\n this._children.set(name, child);\n return succeed(child);\n }\n\n public updateOrAddFile(\n name: string,\n contents: unknown,\n contentType?: TCT\n ): Result<MutableInMemoryFile<TCT>> {\n const existing = this._children.get(name);\n if (existing) {\n if (existing instanceof MutableInMemoryFile) {\n existing.setContents(contents);\n return succeed(existing);\n }\n return fail(`${name}: not a file`);\n }\n return this.addFile(name, contents, contentType);\n }\n\n public removeChild(name: string): boolean {\n return this._children.delete(name);\n }\n}\n\n/**\n * Implementation of {@link FileTree.IMutableFileTreeAccessors} that uses an in-memory\n * tree to access and modify files and directories.\n * @public\n */\nexport class InMemoryTreeAccessors<TCT extends string = string> implements IMutableFileTreeAccessors<TCT> {\n private readonly _tree: TreeBuilder<TCT>;\n private readonly _inferContentType: (filePath: string) => Result<TCT | undefined>;\n private readonly _mutable: boolean | IFilterSpec;\n private readonly _mutableByPath: Map<string, MutableInMemoryDirectory<TCT> | MutableInMemoryFile<TCT>>;\n private readonly _mutableRoot: MutableInMemoryDirectory<TCT>;\n\n /**\n * Protected constructor for derived classes.\n * @param files - An array of {@link FileTree.IInMemoryFile | in-memory files} to include in the tree.\n * @param params - Optional params for the tree.\n * @public\n */\n protected constructor(files: IInMemoryFile<TCT>[], params?: IFileTreeInitParams<TCT>) {\n this._tree = TreeBuilder.create<TCT>(params?.prefix).orThrow();\n this._inferContentType = params?.inferContentType ?? FileItem.defaultInferContentType;\n this._mutable = params?.mutable ?? false;\n this._mutableByPath = new Map();\n const prefix = params?.prefix ?? '/';\n this._mutableRoot = new MutableInMemoryDirectory<TCT>(\n prefix.endsWith('/') ? prefix.slice(0, -1) || '/' : prefix\n );\n this._mutableByPath.set(this._mutableRoot.absolutePath, this._mutableRoot);\n\n for (const file of files) {\n const contentType = file.contentType ?? this._inferContentType(file.path).orDefault();\n this._tree.addFile(file.path, file.contents, contentType).orThrow();\n this._addMutableFile(file.path, file.contents, contentType);\n }\n }\n\n /**\n * Creates a new {@link FileTree.InMemoryTreeAccessors | InMemoryTreeAccessors} instance with the supplied\n * in-memory files.\n * @param files - An array of {@link FileTree.IInMemoryFile | in-memory files} to include in the tree.\n * @param prefix - Optional prefix for the tree.\n */\n public static create<TCT extends string = string>(\n files: IInMemoryFile<TCT>[],\n prefix?: string\n ): Result<InMemoryTreeAccessors<TCT>>;\n\n /**\n * Creates a new {@link FileTree.InMemoryTreeAccessors | InMemoryTreeAccessors} instance with the supplied\n * in-memory files.\n * @param files - An array of {@link FileTree.IInMemoryFile | in-memory files} to include in the tree.\n * @param params - Optional params for the tree.\n */\n public static create<TCT extends string = string>(\n files: IInMemoryFile<TCT>[],\n params?: IFileTreeInitParams<TCT>\n ): Result<InMemoryTreeAccessors<TCT>>;\n\n /**\n * Creates a new {@link FileTree.InMemoryTreeAccessors | InMemoryTreeAccessors} instance with the supplied\n * in-memory files.\n * @param files - An array of {@link FileTree.IInMemoryFile | in-memory files} to include in the tree.\n * @param params - Optional params for the tree.\n */\n public static create<TCT extends string = string>(\n files: IInMemoryFile<TCT>[],\n params?: IFileTreeInitParams<TCT> | string\n ): Result<InMemoryTreeAccessors<TCT>> {\n /* c8 ignore next 2 - tested but code coverage has intermittent issues */\n params = typeof params === 'string' ? { prefix: params } : params;\n return captureResult(() => new InMemoryTreeAccessors(files, params));\n }\n\n /**\n * Resolves paths to an absolute path.\n * @param paths - Paths to resolve.\n * @returns The resolved absolute path.\n */\n public resolveAbsolutePath(...paths: string[]): string {\n const parts = paths[0].startsWith('/') ? paths : [this._tree.prefix, ...paths];\n const joined = parts.flatMap((p) => p.split('/').filter((s) => s.length > 0)).join('/');\n return `/${joined}`;\n }\n\n /**\n * Gets the extension of a path.\n * @param path - Path to get the extension of.\n * @returns The extension of the path.\n */\n public getExtension(path: string): string {\n const parts = path.split('.');\n if (parts.length === 1) {\n return '';\n }\n return `.${parts.pop()}`;\n }\n\n /**\n * Gets the base name of a path.\n * @param path - Path to get the base name of.\n * @param suffix - Optional suffix to remove from the base name.\n * @returns The base name of the path.\n */\n public getBaseName(path: string, suffix?: string): string {\n /* c8 ignore next 1 - ?? is defense in depth should never happen */\n const base = path.split('/').pop() ?? '';\n if (suffix && base.endsWith(suffix)) {\n return base.slice(0, base.length - suffix.length);\n }\n return base;\n }\n\n /**\n * Joins paths together.\n * @param paths - Paths to join.\n * @returns The joined paths.\n */\n public joinPaths(...paths: string[]): string {\n const joined = paths.flatMap((p) => p.split('/').filter((s) => s.length > 0)).join('/');\n return paths[0]?.startsWith('/') ? `/${joined}` : joined;\n }\n\n /**\n * Gets an item from the file tree.\n * @param itemPath - Path of the item to get.\n * @returns The item if it exists.\n */\n public getItem(itemPath: string): Result<FileTreeItem<TCT>> {\n const existing = this._tree.byAbsolutePath.get(itemPath);\n if (existing) {\n if (existing instanceof InMemoryFile) {\n return FileItem.create<TCT>(existing.absolutePath, this);\n } else if (existing instanceof InMemoryDirectory) {\n return DirectoryItem.create<TCT>(existing.absolutePath, this);\n }\n }\n return fail(`${itemPath}: not found`);\n }\n\n /**\n * Gets the contents of a file in the file tree.\n * @param path - Absolute path of the file.\n * @returns The contents of the file.\n */\n public getFileContents(path: string): Result<string> {\n const absolutePath = this.resolveAbsolutePath(path);\n const item = this._mutableByPath.get(absolutePath);\n if (item === undefined) {\n return fail(`${absolutePath}: not found`);\n }\n if (!(item instanceof MutableInMemoryFile)) {\n return fail(`${absolutePath}: not a file`);\n }\n if (typeof item.contents === 'string') {\n return succeed(item.contents);\n }\n return captureResult(() => JSON.stringify(item.contents));\n }\n\n /**\n * Gets the content type of a file in the file tree.\n * @param path - Absolute path of the file.\n * @param provided - Optional supplied content type.\n * @returns The content type of the file.\n */\n public getFileContentType(path: string, provided?: string): Result<TCT | undefined> {\n // If provided contentType is given, use it directly (highest priority)\n if (provided !== undefined) {\n return succeed(provided as TCT);\n }\n\n const item = this._tree.byAbsolutePath.get(path);\n if (item === undefined) {\n // If file doesn't exist, still try to infer content type from path\n return this._inferContentType(path);\n }\n if (!(item instanceof InMemoryFile)) {\n // For directories, return undefined\n return succeed(undefined);\n }\n // Return stored contentType if it exists, otherwise infer\n if (item.contentType !== undefined) {\n return succeed(item.contentType);\n }\n return this._inferContentType(path);\n }\n\n /**\n * Gets the children of a directory in the file tree.\n * @param path - Path of the directory.\n * @returns The children of the directory.\n */\n public getChildren(path: string): Result<ReadonlyArray<FileTreeItem<TCT>>> {\n const item = this._tree.byAbsolutePath.get(path);\n if (item === undefined) {\n return fail(`${path}: not found`);\n }\n /* c8 ignore next 3 - local coverage is 100% but build coverage has intermittent issues */\n if (!(item instanceof InMemoryDirectory)) {\n return fail(`${path}: not a directory`);\n }\n return captureResult(() => {\n const children: FileTreeItem<TCT>[] = [];\n for (const child of item.children.values()) {\n if (child instanceof InMemoryFile) {\n children.push(FileItem.create<TCT>(child.absolutePath, this).orThrow());\n } else if (child instanceof InMemoryDirectory) {\n children.push(DirectoryItem.create<TCT>(child.absolutePath, this).orThrow());\n }\n }\n return children;\n });\n }\n\n private _addMutableFile(\n path: string,\n contents: unknown,\n contentType?: TCT\n ): Result<MutableInMemoryFile<TCT>> {\n const absolutePath = this.resolveAbsolutePath(path);\n const parts = absolutePath.split('/').filter((p) => p.length > 0);\n /* c8 ignore next 3 - defensive: invalid path detection */\n if (parts.length === 0) {\n return fail(`${absolutePath}: invalid file path`);\n }\n\n let dir: MutableInMemoryDirectory<TCT> = this._mutableRoot;\n while (parts.length > 1) {\n const part = parts.shift()!;\n const result = dir.getOrAddDirectory(part);\n /* c8 ignore next 3 - defensive: directory conflict during construction */\n if (result.isFailure()) {\n return fail(result.message);\n }\n dir = result.value as MutableInMemoryDirectory<TCT>;\n if (!this._mutableByPath.has(dir.absolutePath)) {\n this._mutableByPath.set(dir.absolutePath, dir);\n }\n }\n\n return dir.addFile(parts[0], contents, contentType).onSuccess((file) => {\n this._mutableByPath.set(file.absolutePath, file as MutableInMemoryFile<TCT>);\n return succeed(file as MutableInMemoryFile<TCT>);\n });\n }\n\n /**\n * Creates a directory at the given path, including any missing parent directories.\n * @param dirPath - The path of the directory to create.\n * @returns `Success` with the absolute path if created, or `Failure` with an error message.\n */\n public createDirectory(dirPath: string): Result<string> {\n const absolutePath = this.resolveAbsolutePath(dirPath);\n\n // Check if mutability is disabled\n if (this._mutable === false) {\n return fail(`${absolutePath}: mutability is disabled`);\n }\n\n // Add to the TreeBuilder (read layer)\n const treeResult = this._tree.addDirectory(absolutePath);\n /* c8 ignore next 3 - defensive: read layer failure would indicate internal inconsistency */\n if (treeResult.isFailure()) {\n return fail(treeResult.message);\n }\n\n // Add to the mutable layer\n const parts = absolutePath.split('/').filter((p) => p.length > 0);\n let dir: MutableInMemoryDirectory<TCT> = this._mutableRoot;\n for (const part of parts) {\n const result = dir.getOrAddDirectory(part);\n /* c8 ignore next 3 - defensive: mutable layer should match read layer state */\n if (result.isFailure()) {\n return fail(result.message);\n }\n dir = result.value as MutableInMemoryDirectory<TCT>;\n if (!this._mutableByPath.has(dir.absolutePath)) {\n this._mutableByPath.set(dir.absolutePath, dir);\n }\n }\n\n return succeed(absolutePath);\n }\n\n /**\n * Checks if a file at the given path can be saved.\n * @param path - The path to check.\n * @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,\n * or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.\n */\n public fileIsMutable(path: string): DetailedResult<boolean, SaveDetail> {\n const absolutePath = this.resolveAbsolutePath(path);\n\n // Check if mutability is disabled\n if (this._mutable === false) {\n return failWithDetail(`${absolutePath}: mutability is disabled`, 'not-mutable');\n }\n\n // Check if path is excluded by filter\n if (!isPathMutable(absolutePath, this._mutable)) {\n return failWithDetail(`${absolutePath}: path is excluded by filter`, 'path-excluded');\n }\n\n return succeedWithDetail(true, 'transient');\n }\n\n /**\n * Deletes a file at the given path.\n * @param path - The path of the file to delete.\n * @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.\n */\n public deleteFile(path: string): Result<boolean> {\n const absolutePath = this.resolveAbsolutePath(path);\n const parts = absolutePath.split('/').filter((p) => p.length > 0);\n if (parts.length === 0) {\n return fail(`${absolutePath}: invalid file path`);\n }\n\n const fileName = parts.pop()!;\n\n // Navigate to parent directory\n let dir: MutableInMemoryDirectory<TCT> = this._mutableRoot;\n for (const part of parts) {\n const child = dir.children.get(part);\n if (!child || !(child instanceof MutableInMemoryDirectory)) {\n return fail(`${absolutePath}: parent directory not found`);\n }\n dir = child;\n }\n\n if (!dir.removeChild(fileName)) {\n return fail(`${absolutePath}: file not found`);\n }\n\n // Also remove from the read layer's directory children and path index\n const parentPath = parts.length === 0 ? '/' : '/' + parts.join('/');\n const readParent = this._tree.byAbsolutePath.get(parentPath);\n if (readParent instanceof InMemoryDirectory) {\n readParent.removeChild(fileName);\n }\n this._tree.byAbsolutePath.delete(absolutePath);\n this._mutableByPath.delete(absolutePath);\n\n return succeed(true);\n }\n\n /**\n * Deletes a directory at the given path.\n * The directory must be empty or the operation will fail.\n * @param path - The path of the directory to delete.\n * @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.\n */\n public deleteDirectory(path: string): Result<boolean> {\n const absolutePath = this.resolveAbsolutePath(path);\n const parts = absolutePath.split('/').filter((p) => p.length > 0);\n if (parts.length === 0) {\n return fail(`${absolutePath}: invalid directory path`);\n }\n\n const dirName = parts.pop()!;\n\n // Navigate to parent directory\n let parentDir: MutableInMemoryDirectory<TCT> = this._mutableRoot;\n for (const part of parts) {\n const child = parentDir.children.get(part);\n if (!child || !(child instanceof MutableInMemoryDirectory)) {\n return fail(`${absolutePath}: parent directory not found`);\n }\n parentDir = child;\n }\n\n // Verify target is a directory\n const target = parentDir.children.get(dirName);\n if (!target || !(target instanceof MutableInMemoryDirectory)) {\n return fail(`${absolutePath}: not a directory`);\n }\n\n // Check non-empty\n if (target.children.size > 0) {\n return fail(`${absolutePath}: directory is not empty`);\n }\n\n parentDir.removeChild(dirName);\n\n // Also remove from the read layer\n /* c8 ignore next 1 - defensive: branch for top-level directory deletion */\n const readParentPath = parts.length === 0 ? '/' : '/' + parts.join('/');\n const readParent = this._tree.byAbsolutePath.get(readParentPath);\n if (readParent instanceof InMemoryDirectory) {\n readParent.removeChild(dirName);\n }\n this._tree.byAbsolutePath.delete(absolutePath);\n this._mutableByPath.delete(absolutePath);\n\n return succeed(true);\n }\n\n /**\n * Saves the contents to a file at the given path.\n * @param path - The path of the file to save.\n * @param contents - The string contents to save.\n * @returns `Success` if the file was saved, or `Failure` with an error message.\n */\n public saveFileContents(path: string, contents: string): Result<string> {\n const isMutable = this.fileIsMutable(path);\n if (isMutable.isFailure()) {\n return fail(isMutable.message);\n }\n\n const absolutePath = this.resolveAbsolutePath(path);\n const parts = absolutePath.split('/').filter((p) => p.length > 0);\n if (parts.length === 0) {\n return fail(`${absolutePath}: invalid file path`);\n }\n\n // Navigate to parent directory, creating directories as needed\n let dir: MutableInMemoryDirectory<TCT> = this._mutableRoot;\n while (parts.length > 1) {\n const part = parts.shift()!;\n const result = dir.getOrAddDirectory(part);\n if (result.isFailure()) {\n return fail(result.message);\n }\n dir = result.value as MutableInMemoryDirectory<TCT>;\n if (!this._mutableByPath.has(dir.absolutePath)) {\n this._mutableByPath.set(dir.absolutePath, dir);\n }\n }\n\n // Update or add the file in the mutable layer\n return dir.updateOrAddFile(parts[0], contents).onSuccess((file) => {\n this._mutableByPath.set(file.absolutePath, file as MutableInMemoryFile<TCT>);\n\n // Also register in the read layer so getItem/getChildren can find it\n if (!this._tree.byAbsolutePath.has(file.absolutePath)) {\n this._tree.addFile(file.absolutePath, contents);\n }\n\n return succeed(contents);\n });\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/packlets/file-tree/in-memory/index.ts"],"names":[],"mappings":"AAsBA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/packlets/file-tree/in-memory/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,iDAA+B","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './inMemoryTree';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeBuilder.d.ts","sourceRoot":"","sources":["../../../../src/packlets/file-tree/in-memory/treeBuilder.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAgC,MAAM,eAAe,CAAC;AAErE;;;GAGG;AACH,qBAAa,YAAY,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM;IACnD;;OAEG;IACH,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC;;OAEG;IACH,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,SAAgB,WAAW,CAAC,EAAE,GAAG,CAAC;IAElC;;;;;OAKG;gBACgB,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,GAAG;CAK9E;AAED;;;GAGG;AACH,qBAAa,iBAA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