@poe-platform/safe-fs 0.1.672 → 0.1.673
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.
|
@@ -119,7 +119,28 @@ export class DeviceFileSystem {
|
|
|
119
119
|
return reserved(resolved) ? resolved : this.#filesystem.canonicalizeMissingTarget?.(path, options);
|
|
120
120
|
}
|
|
121
121
|
async capabilitiesFor(path, options = {}) {
|
|
122
|
-
|
|
122
|
+
let resolved;
|
|
123
|
+
let selected;
|
|
124
|
+
try {
|
|
125
|
+
resolved = await this.#resolve(path, options, true, options.create);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
options.signal?.throwIfAborted();
|
|
129
|
+
if (options.create !== true || !isFsError(error, "ENOENT"))
|
|
130
|
+
throw error;
|
|
131
|
+
// Implicit prefixes need not exist before the authoritative backend opens
|
|
132
|
+
// a new file. Resolve device aliases without creating namespace entries.
|
|
133
|
+
resolved = await this.#resolve(path, options);
|
|
134
|
+
options.signal?.throwIfAborted();
|
|
135
|
+
if (reserved(resolved))
|
|
136
|
+
throw error;
|
|
137
|
+
const query = this.#filesystem.capabilitiesFor;
|
|
138
|
+
options.signal?.throwIfAborted();
|
|
139
|
+
selected = (query === undefined || query === null ? undefined : await Reflect.apply(query, this.#filesystem, [path, options])) ?? this.#filesystem.capabilities;
|
|
140
|
+
options.signal?.throwIfAborted();
|
|
141
|
+
if (selected.implicitDirectories !== true)
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
123
144
|
options.signal?.throwIfAborted();
|
|
124
145
|
if (options.create !== undefined && (resolved === deviceDirectory || resolved === "/"))
|
|
125
146
|
throw new FsError("EISDIR", { syscall: "capabilitiesFor", path });
|
|
@@ -129,9 +150,11 @@ export class DeviceFileSystem {
|
|
|
129
150
|
return { ...deviceCapabilities, open: false, readdir: true, write: false, append: false,
|
|
130
151
|
exclusiveCreate: false, streamingWrite: false, streamingAppend: false, independentWriteStreams: false, descriptorWriteStream: false,
|
|
131
152
|
retainedRead: false, retainedResize: false, streamingRead: false, copy: false, exclusiveCopy: false };
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
153
|
+
if (selected === undefined) {
|
|
154
|
+
const query = this.#filesystem.capabilitiesFor;
|
|
155
|
+
options.signal?.throwIfAborted();
|
|
156
|
+
selected = query === undefined || query === null ? undefined : await Reflect.apply(query, this.#filesystem, [path, options]);
|
|
157
|
+
}
|
|
135
158
|
options.signal?.throwIfAborted();
|
|
136
159
|
const observed = ownedMutationCapabilities(this.#filesystem, selected ?? this.#filesystem.capabilities);
|
|
137
160
|
options.signal?.throwIfAborted();
|