@b9g/filesystem 0.1.8 → 0.1.9
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 +6 -1
- package/src/bun-s3.js +4 -2
- package/src/index.js +4 -2
- package/src/memory.js +10 -5
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b9g/filesystem",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Universal File System Access API implementations for all platforms",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/bikeshaving/shovel.git",
|
|
9
|
+
"directory": "packages/filesystem"
|
|
10
|
+
},
|
|
6
11
|
"dependencies": {
|
|
7
12
|
"mime": "^4.0.4"
|
|
8
13
|
},
|
package/src/bun-s3.js
CHANGED
|
@@ -154,7 +154,8 @@ var S3FileSystemBackend = class {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
} catch (error) {
|
|
157
|
-
if (error instanceof DOMException)
|
|
157
|
+
if (error instanceof DOMException)
|
|
158
|
+
throw error;
|
|
158
159
|
throw new DOMException("Entry not found", "NotFoundError");
|
|
159
160
|
}
|
|
160
161
|
}
|
|
@@ -256,7 +257,8 @@ var S3Directory = class _S3Directory {
|
|
|
256
257
|
return this.entries();
|
|
257
258
|
}
|
|
258
259
|
async isSameEntry(other) {
|
|
259
|
-
if (other.kind !== "directory")
|
|
260
|
+
if (other.kind !== "directory")
|
|
261
|
+
return false;
|
|
260
262
|
return other instanceof _S3Directory && other.name === this.name;
|
|
261
263
|
}
|
|
262
264
|
async queryPermission() {
|
package/src/index.js
CHANGED
|
@@ -96,8 +96,10 @@ var ShovelHandle = class _ShovelHandle {
|
|
|
96
96
|
return this.#backend;
|
|
97
97
|
}
|
|
98
98
|
async isSameEntry(other) {
|
|
99
|
-
if (other.kind !== this.kind)
|
|
100
|
-
|
|
99
|
+
if (other.kind !== this.kind)
|
|
100
|
+
return false;
|
|
101
|
+
if (!(other instanceof _ShovelHandle))
|
|
102
|
+
return false;
|
|
101
103
|
return this.path === other.path;
|
|
102
104
|
}
|
|
103
105
|
async queryPermission(_descriptor) {
|
package/src/memory.js
CHANGED
|
@@ -11,7 +11,8 @@ var MemoryFileSystemBackend = class {
|
|
|
11
11
|
}
|
|
12
12
|
async stat(path) {
|
|
13
13
|
const entry = this.#resolvePath(path);
|
|
14
|
-
if (!entry)
|
|
14
|
+
if (!entry)
|
|
15
|
+
return null;
|
|
15
16
|
if ("content" in entry) {
|
|
16
17
|
return { kind: "file" };
|
|
17
18
|
} else {
|
|
@@ -114,14 +115,17 @@ var MemoryFileSystemBackend = class {
|
|
|
114
115
|
let current = this.#root;
|
|
115
116
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
116
117
|
const nextDir = current.directories.get(parts[i]);
|
|
117
|
-
if (!nextDir)
|
|
118
|
+
if (!nextDir)
|
|
119
|
+
return null;
|
|
118
120
|
current = nextDir;
|
|
119
121
|
}
|
|
120
122
|
const finalName = parts[parts.length - 1];
|
|
121
123
|
const file = current.files.get(finalName);
|
|
122
|
-
if (file)
|
|
124
|
+
if (file)
|
|
125
|
+
return file;
|
|
123
126
|
const dir = current.directories.get(finalName);
|
|
124
|
-
if (dir)
|
|
127
|
+
if (dir)
|
|
128
|
+
return dir;
|
|
125
129
|
return null;
|
|
126
130
|
}
|
|
127
131
|
#resolveParent(path) {
|
|
@@ -248,7 +252,8 @@ var MemoryDirectory = class _MemoryDirectory {
|
|
|
248
252
|
return this.entries();
|
|
249
253
|
}
|
|
250
254
|
async isSameEntry(other) {
|
|
251
|
-
if (other.kind !== "directory")
|
|
255
|
+
if (other.kind !== "directory")
|
|
256
|
+
return false;
|
|
252
257
|
return other instanceof _MemoryDirectory && other.name === this.name;
|
|
253
258
|
}
|
|
254
259
|
async queryPermission() {
|