@poe-platform/safe-fs 0.1.804 → 0.1.806
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 +5 -5
- package/dist/safe-fs/bridge/filesystem.d.ts +1 -0
- package/dist/safe-fs/bridge/filesystem.js +3 -0
- package/dist/safe-fs/bridge/index.d.ts +1 -0
- package/dist/safe-fs/bridge/index.js +1 -0
- package/dist/safe-fs/config/registry.d.ts +2 -0
- package/dist/safe-fs/config/registry.js +15 -0
- package/dist/safe-fs/config.node.js +3 -14
- package/dist/safe-fs/config.portable.d.ts +3 -0
- package/dist/safe-fs/config.portable.js +9 -0
- package/dist/safe-fs/contracts/errors.d.ts +1 -0
- package/dist/safe-fs/contracts/errors.js +12 -0
- package/dist/safe-fs/contracts/filesystem.d.ts +12 -0
- package/dist/safe-fs/contracts/index.d.ts +1 -0
- package/dist/safe-fs/contracts/index.js +1 -0
- package/dist/safe-fs/contracts/io.js +1 -1
- package/dist/safe-fs/core.d.ts +5 -14
- package/dist/safe-fs/core.js +4 -11
- package/dist/safe-fs/fs/devices/index.d.ts +8 -2
- package/dist/safe-fs/fs/devices/index.js +79 -23
- package/dist/safe-fs/fs/devices/path.js +1 -1
- package/dist/safe-fs/fs/memory/atomic-view.d.ts +3 -0
- package/dist/safe-fs/fs/memory/atomic-view.js +5 -0
- package/dist/safe-fs/fs/memory/index.d.ts +7 -4
- package/dist/safe-fs/fs/memory/index.js +211 -160
- package/dist/safe-fs/fs/memory/ledger.d.ts +0 -4
- package/dist/safe-fs/fs/memory/ledger.js +0 -15
- package/dist/safe-fs/fs/memory/limits.js +3 -0
- package/dist/safe-fs/fs/mount/comparison.js +3 -3
- package/dist/safe-fs/fs/mount/identity.d.ts +4 -0
- package/dist/safe-fs/fs/mount/identity.js +8 -0
- package/dist/safe-fs/fs/mount/index.d.ts +1 -0
- package/dist/safe-fs/fs/mount/index.js +31 -0
- package/dist/safe-fs/fs/object-publication/index.d.ts +3 -0
- package/dist/safe-fs/fs/object-publication/index.js +3 -2
- package/dist/safe-fs/fs/quota/index.js +1 -1
- package/dist/safe-fs/fs/readonly/index.js +1 -1
- package/dist/safe-fs/fs/s3/filesystem.js +1 -1
- package/dist/safe-fs/fs/s3/http/transport.js +1 -1
- package/dist/safe-fs/fs/s3/http/xml.js +2 -2
- package/dist/safe-fs/fs/scoped.js +32 -2
- package/dist/safe-fs/fs/webdav/webdav.js +1 -1
- package/dist/safe-fs/index.d.ts +2 -0
- package/dist/safe-fs/index.js +2 -0
- package/dist/safe-fs/node/filesystem.d.ts +2 -1
- package/dist/safe-fs/node/filesystem.js +1 -5
- package/dist/safe-fs/runtime-core.d.ts +27 -0
- package/dist/safe-fs/runtime-core.js +57 -0
- package/package.json +9 -1
|
@@ -15,6 +15,7 @@ export interface ObjectFilePublicationOptions extends FsOptions {
|
|
|
15
15
|
readonly mode: number;
|
|
16
16
|
}
|
|
17
17
|
export interface ObjectFileAcquireOptions extends FsOptions {
|
|
18
|
+
readonly noFollow?: boolean;
|
|
18
19
|
readonly access: OpenFileOptions["access"];
|
|
19
20
|
}
|
|
20
21
|
export interface ObjectFileStaging {
|
|
@@ -28,6 +29,8 @@ export interface ObjectFileStagingOptions extends FsOptions {
|
|
|
28
29
|
readonly maxFileBytes: number;
|
|
29
30
|
}
|
|
30
31
|
export interface ObjectFilePublicationStore {
|
|
32
|
+
/** Certifies acquire can reject symbolic links when noFollow is requested. */
|
|
33
|
+
readonly noFollow?: boolean;
|
|
31
34
|
acquire(path: string, options: ObjectFileAcquireOptions): Promise<ObjectFileVersion | undefined>;
|
|
32
35
|
publish?(path: string, expectedRevision: string | null, source: ByteSource, options: ObjectFilePublicationOptions): Promise<ObjectFileVersion>;
|
|
33
36
|
createStaging?(path: string, options: ObjectFileStagingOptions): Promise<ObjectFileStaging>;
|
|
@@ -11,6 +11,7 @@ export function withObjectFileDescriptors(filesystem, store, options = {}) {
|
|
|
11
11
|
const maxOpenFiles = options.maxOpenFiles ?? Infinity;
|
|
12
12
|
if (!Number.isSafeInteger(chunkBytes) || chunkBytes < 1
|
|
13
13
|
|| ![maxStagedBytes, maxStagedPages, maxFileBytes, maxOpenFiles].every(value => value === Infinity || Number.isSafeInteger(value) && value > 0)
|
|
14
|
+
|| store.noFollow !== undefined && typeof store.noFollow !== "boolean"
|
|
14
15
|
|| typeof store.acquire !== "function"
|
|
15
16
|
|| store.publish !== undefined && typeof store.publish !== "function"
|
|
16
17
|
|| store.createStaging !== undefined && typeof store.createStaging !== "function")
|
|
@@ -68,7 +69,7 @@ export function withObjectFileDescriptors(filesystem, store, options = {}) {
|
|
|
68
69
|
state.pages.clear();
|
|
69
70
|
};
|
|
70
71
|
const open = (path, openOptions) => openFileDescriptor(path, openOptions, {
|
|
71
|
-
publication: "conditional", position: true, positionedRead: true, positionedWrite: true,
|
|
72
|
+
publication: "conditional", position: true, positionedRead: true, positionedWrite: true, noFollow: store.noFollow === true,
|
|
72
73
|
truncate: true, synchronization: "storage",
|
|
73
74
|
}, async (admitted) => {
|
|
74
75
|
validatePath(path);
|
|
@@ -233,7 +234,7 @@ export function withObjectFileDescriptors(filesystem, store, options = {}) {
|
|
|
233
234
|
throw new FsError("ENOTSUP", { path, message: "Object writes require authoritative conditional publication" });
|
|
234
235
|
if (admitted.access !== "write" && capabilities.read === false)
|
|
235
236
|
throw new FsError("EACCES", { path });
|
|
236
|
-
const acquired = await store.acquire(path, { access: admitted.access, ...(admitted.signal ? { signal: admitted.signal } : {}) });
|
|
237
|
+
const acquired = await store.acquire(path, { access: admitted.access, ...(admitted.noFollow ? { noFollow: true } : {}), ...(admitted.signal ? { signal: admitted.signal } : {}) });
|
|
237
238
|
if (acquired) {
|
|
238
239
|
try {
|
|
239
240
|
state.head = version(acquired);
|
|
@@ -499,7 +499,7 @@ export function withFileSystemQuota(fs, options) {
|
|
|
499
499
|
// capabilities and methods without violating invariants on own properties.
|
|
500
500
|
return new Proxy(Object.create(fs), {
|
|
501
501
|
get(_target, property) {
|
|
502
|
-
if (property === "prepareStagingResolution" || property === "prepareDirectoryAncestry" || property === "publishFileConditional" || property === "removeEntryConditional" || property === "writeFileConditional" || property === "removeFileConditional" || property === "resizeFile" || property === "canonicalizeMissingTarget" || property === "createStagedFile" || property === "publishStagedFile" || property === "removeStagedFile" || property === "prepareDirectory")
|
|
502
|
+
if (property === "publishStagedFileSet" || property === "prepareStagingResolution" || property === "prepareDirectoryAncestry" || property === "publishFileConditional" || property === "removeEntryConditional" || property === "writeFileConditional" || property === "removeFileConditional" || property === "resizeFile" || property === "canonicalizeMissingTarget" || property === "createStagedFile" || property === "publishStagedFile" || property === "removeStagedFile" || property === "prepareDirectory")
|
|
503
503
|
return undefined;
|
|
504
504
|
if (property === "capabilities")
|
|
505
505
|
return quotaCapabilities({ ...retainedResizeCapabilities(fs, retainedReadCapabilities(fs)), ...(typeof fs.open === "function" ? {} : { open: false }) });
|
|
@@ -202,7 +202,7 @@ export class ReadOnlyFileSystem {
|
|
|
202
202
|
readOnly("openResizeFile", path);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
const readOnlyImplementation = Object.getOwnPropertyDescriptors(ReadOnlyFileSystem.prototype);
|
|
205
|
+
const readOnlyImplementation = /* @__PURE__ */ Object.getOwnPropertyDescriptors(ReadOnlyFileSystem.prototype);
|
|
206
206
|
export function createReadOnlyFileSystem(filesystem) {
|
|
207
207
|
return new ReadOnlyFileSystem(filesystem);
|
|
208
208
|
}
|
|
@@ -22,7 +22,7 @@ function utf8ByteLength(value) {
|
|
|
22
22
|
return bytes;
|
|
23
23
|
}
|
|
24
24
|
function limit(value, fallback, name, maximum = Number.MAX_SAFE_INTEGER) {
|
|
25
|
-
if (value === undefined)
|
|
25
|
+
if (value === undefined || value === Infinity && fallback === Infinity)
|
|
26
26
|
return fallback;
|
|
27
27
|
const result = value;
|
|
28
28
|
if (!Number.isSafeInteger(result) || result < 1 || result > maximum)
|
|
@@ -37,8 +37,8 @@ function decodeEntities(text) {
|
|
|
37
37
|
}
|
|
38
38
|
export function parseXml(bytes, limits = {}) {
|
|
39
39
|
for (const limit of [limits.maxNodes, limits.maxDepth]) {
|
|
40
|
-
if (limit !== undefined && (!Number.isSafeInteger(limit) || limit < 1))
|
|
41
|
-
throw new RangeError("XML limits must be positive safe integers");
|
|
40
|
+
if (limit !== undefined && limit !== Infinity && (!Number.isSafeInteger(limit) || limit < 1))
|
|
41
|
+
throw new RangeError("XML limits must be positive safe integers or Infinity");
|
|
42
42
|
}
|
|
43
43
|
let xml;
|
|
44
44
|
try {
|
|
@@ -18,7 +18,7 @@ export function retargetScopedFileSystem(scoped, charge, signal, cleanupCharge =
|
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
const operations = new Set([
|
|
21
|
-
"prepareDirectoryAncestry", "prepareStagingResolution",
|
|
21
|
+
"prepareDirectoryAncestry", "prepareStagingResolution", "publishStagedFileSet",
|
|
22
22
|
"publishFileConditional", "removeEntryConditional", "removeTreeConditional", "writeFileConditional", "removeFileConditional", "createStagedFile", "publishStagedFile", "removeStagedFile", "prepareDirectory",
|
|
23
23
|
"confineExtraction", "access", "appendFile", "canonicalizeMissingTarget", "capabilitiesFor", "chmod", "compareEntry",
|
|
24
24
|
"copyFile", "link", "lstat", "mkdir", "openReadFile", "openResizeFile", "readFile", "readStream", "readdir",
|
|
@@ -262,7 +262,7 @@ export function scopeFileSystem(filesystem, charge, signal, cleanupCharge = char
|
|
|
262
262
|
if (property === "removeEntryConditional")
|
|
263
263
|
args[1] = resizeOptions({ ...args[1] });
|
|
264
264
|
let stagingSignal;
|
|
265
|
-
if (property === "createStagedFile" || property === "publishStagedFile") {
|
|
265
|
+
if (property === "createStagedFile" || property === "publishStagedFile" || property === "publishStagedFileSet") {
|
|
266
266
|
signal.throwIfAborted();
|
|
267
267
|
if (property === "createStagedFile")
|
|
268
268
|
args[3] = snapshotStagingCreation(args[3], args[0]);
|
|
@@ -281,6 +281,36 @@ export function scopeFileSystem(filesystem, charge, signal, cleanupCharge = char
|
|
|
281
281
|
if (property === "symlink" && typeof args[1] === "string")
|
|
282
282
|
validatePath(args[1], maxPathComponents);
|
|
283
283
|
}
|
|
284
|
+
if (property === "publishStagedFileSet") {
|
|
285
|
+
if (original.capabilities.readOnly === true)
|
|
286
|
+
throw new FsError("EROFS", { path: args[1] });
|
|
287
|
+
const supplied = args[2];
|
|
288
|
+
const callerGuard = supplied.commitGuard;
|
|
289
|
+
const entry = (value) => ({ path: value.path, stat: { ...value.stat } });
|
|
290
|
+
const input = args[0];
|
|
291
|
+
const staging = { ...input, parent: entry(input.parent), directory: entry(input.directory), file: entry(input.file) };
|
|
292
|
+
const controls = {
|
|
293
|
+
...supplied,
|
|
294
|
+
signal: stagingSignal,
|
|
295
|
+
parent: { ...supplied.parent },
|
|
296
|
+
destination: supplied.destination === null ? null : { ...supplied.destination },
|
|
297
|
+
companions: supplied.companions.map(value => ({ ...value, expected: value.expected === null ? null : { ...value.expected } })),
|
|
298
|
+
...(supplied.ancestors === undefined ? {} : { ancestors: snapshotDirectoryAncestry(supplied.ancestors) }),
|
|
299
|
+
commitGuard: () => {
|
|
300
|
+
assertOpen({ signal: stagingSignal });
|
|
301
|
+
if (callerGuard !== undefined)
|
|
302
|
+
runStagingGuard(callerGuard);
|
|
303
|
+
assertOpen({ signal: stagingSignal });
|
|
304
|
+
return true;
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
for (const path of [staging.parent.path, staging.directory.path, staging.file.path, args[1],
|
|
308
|
+
...controls.companions.map(value => value.path), ...(controls.ancestors ?? []).map(value => value.path)]) {
|
|
309
|
+
validatePath(path, maxPathComponents);
|
|
310
|
+
}
|
|
311
|
+
assertOpen(controls);
|
|
312
|
+
return Reflect.apply(method, original, [staging, args[1], controls]);
|
|
313
|
+
}
|
|
284
314
|
if (["writeFile", "appendFile", "writeStream", "mkdir"].includes(String(property))) {
|
|
285
315
|
const index = property === "mkdir" ? 1 : 2;
|
|
286
316
|
args[index] = creationOptions((args[index] ?? {}), property === "mkdir");
|
|
@@ -1374,4 +1374,4 @@ export class WebDavFileSystem {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
async truncate(path, _length, _options = {}) { this.unsupported("truncate", path); }
|
|
1376
1376
|
}
|
|
1377
|
-
const originalWebDavComparison = WebDavFileSystem.prototype.compareEntry;
|
|
1377
|
+
const originalWebDavComparison = /* @__PURE__ */ (() => WebDavFileSystem.prototype.compareEntry)();
|
package/dist/safe-fs/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./contracts/index.js";
|
|
2
|
+
export * from "./bridge/index.js";
|
|
2
3
|
export { ObjectAuthority } from "./fs/object-authority.js";
|
|
3
4
|
export * from "./python/index.js";
|
|
4
5
|
export { openFileDescriptor } from "./fs/descriptor.js";
|
|
@@ -21,3 +22,4 @@ export * from "./node/index.js";
|
|
|
21
22
|
export { createFileSystem, readConfigRecord, validateFileSystemConfig } from "./config.js";
|
|
22
23
|
export type { FileSystemConfig, FileSystemAdapterDescriptor, FileSystemAdapterRegistry } from "./config.js";
|
|
23
24
|
export { createNodeFileSystemAdapterRegistry } from "./config.node.js";
|
|
25
|
+
export { createPortableFileSystemAdapterRegistry } from "./config.portable.js";
|
package/dist/safe-fs/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./contracts/index.js";
|
|
2
|
+
export * from "./bridge/index.js";
|
|
2
3
|
export { ObjectAuthority } from "./fs/object-authority.js";
|
|
3
4
|
export * from "./python/index.js";
|
|
4
5
|
export { openFileDescriptor } from "./fs/descriptor.js";
|
|
@@ -17,3 +18,4 @@ export { scopeFileSystem, retainFileSystemCleanup } from "./fs/scoped.js";
|
|
|
17
18
|
export * from "./node/index.js";
|
|
18
19
|
export { createFileSystem, readConfigRecord, validateFileSystemConfig } from "./config.js";
|
|
19
20
|
export { createNodeFileSystemAdapterRegistry } from "./config.node.js";
|
|
21
|
+
export { createPortableFileSystemAdapterRegistry } from "./config.portable.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type * as FsPromises from "node:fs/promises";
|
|
2
2
|
import type { FileSystem, FsOptions } from "../contracts/filesystem.js";
|
|
3
|
+
import { FileSystemBridge } from "../bridge/filesystem.js";
|
|
3
4
|
export type NodeFsImplementation = Pick<typeof FsPromises, "access" | "appendFile" | "chmod" | "copyFile" | "cp" | "link" | "lstat" | "mkdir" | "mkdtemp" | "readFile" | "readdir" | "readlink" | "realpath" | "unlink" | "rename" | "rm" | "rmdir" | "stat" | "symlink" | "truncate" | "utimes" | "writeFile">;
|
|
4
5
|
export interface NodeFsBridgeOptions {
|
|
5
6
|
readonly cwd?: string;
|
|
@@ -14,5 +15,5 @@ export interface NodeFsBridgeOptions {
|
|
|
14
15
|
export interface NodeFsBridgeFileSystem extends FileSystem {
|
|
15
16
|
rmdir?(path: string, options?: FsOptions): Promise<void>;
|
|
16
17
|
}
|
|
17
|
-
export declare
|
|
18
|
+
export declare const getNodeFsBridgeProvider: typeof FileSystemBridge.getProvider;
|
|
18
19
|
export declare function createNodeFsBridge(fs: FileSystem, options?: NodeFsBridgeOptions): NodeFsImplementation;
|
|
@@ -3,10 +3,7 @@ import { randomBytes } from "node:crypto";
|
|
|
3
3
|
import { posix } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { FileSystemBridge } from "../bridge/filesystem.js";
|
|
6
|
-
const
|
|
7
|
-
export function getNodeFsBridgeProvider(bridge) {
|
|
8
|
-
return providers.get(bridge);
|
|
9
|
-
}
|
|
6
|
+
export const getNodeFsBridgeProvider = FileSystemBridge.getProvider;
|
|
10
7
|
export function createNodeFsBridge(fs, options = {}) {
|
|
11
8
|
const bridge = new FileSystemBridge(fs, options, {
|
|
12
9
|
codec: {
|
|
@@ -29,6 +26,5 @@ export function createNodeFsBridge(fs, options = {}) {
|
|
|
29
26
|
randomSuffix() { return randomBytes(6).toString("hex").slice(0, 6); },
|
|
30
27
|
paths: posix
|
|
31
28
|
});
|
|
32
|
-
providers.set(bridge, fs);
|
|
33
29
|
return bridge;
|
|
34
30
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from "./contracts/errors.js";
|
|
2
|
+
export * from "./contracts/filesystem.js";
|
|
3
|
+
export * from "./contracts/io.js";
|
|
4
|
+
export { compareIdentity, compareFileVersion } from "./fs/mount/identity.js";
|
|
5
|
+
export { openFileDescriptor } from "./fs/descriptor.js";
|
|
6
|
+
export type { DescriptorBackend, DescriptorOpenOptions } from "./fs/descriptor.js";
|
|
7
|
+
export { assertPathWithin, isPathWithin, normalizePath, relativePath, resolvePath, validatePath } from "./contracts/virtual-path.js";
|
|
8
|
+
export { basename, dirname, extname, isAbsolutePath, joinPath, posixPath } from "./contracts/portable-path.js";
|
|
9
|
+
import type { FileSystem } from "./contracts/filesystem.js";
|
|
10
|
+
export type { MemoryFileSystem, MemoryFileSystemLimits, MemoryFileSystemOptions, MemoryRedirectHandle } from "./fs/memory/index.js";
|
|
11
|
+
export declare function isUnmodifiedMemoryFileSystem(fs: FileSystem): boolean;
|
|
12
|
+
export declare function isCleanAbsolutePath(p: string): boolean;
|
|
13
|
+
export declare function tryGetMemoryDirectoryEntryNamesSync(fs: FileSystem, path: string): any;
|
|
14
|
+
export declare function tryReadMemoryFileViewSync(fs: FileSystem, path: string, maxBytes?: number, signal?: AbortSignal, captureSourceRef?: boolean, beforeRead?: () => void): Uint8Array | undefined;
|
|
15
|
+
export declare function tryResolveMemoryDevicePath(fs: FileSystem, path: string, followFinal?: boolean): string | undefined;
|
|
16
|
+
export * from "./fs/devices/index.js";
|
|
17
|
+
export { retargetScopedFileSystem, scopeFileSystem, retainFileSystemCleanup } from "./fs/scoped.js";
|
|
18
|
+
export type { RetainedFileSystemCleanupView, RetainedFileSystemCleanupOptions } from "./fs/scoped.js";
|
|
19
|
+
export { compareEntries, registerEntryView } from "./fs/mount/comparison.js";
|
|
20
|
+
export type { EntryViewResolver } from "./fs/mount/comparison.js";
|
|
21
|
+
export type { ConditionalMutationBinding } from "./fs/memory/index.js";
|
|
22
|
+
export declare function bindConditionalMutation<Result>(identityScope: object | symbol | undefined, binding: any, action: () => Promise<Result>): Promise<Result>;
|
|
23
|
+
export declare function tryOpenMemoryRedirectHandleSync(fs: FileSystem, path: string, append: boolean, mode: number, signal?: AbortSignal): any;
|
|
24
|
+
export declare function tryWriteMemoryFileSync(fs: FileSystem, path: string, data: Uint8Array, append: boolean, mode: number, signal?: AbortSignal): boolean;
|
|
25
|
+
export declare function tryMkdirMemorySync(fs: FileSystem, path: string, recursive: boolean, mode: number, signal?: AbortSignal, dirPrefixHint?: string): boolean;
|
|
26
|
+
export declare function tryRmRfMemorySync(fs: FileSystem, path: string, signal?: AbortSignal): boolean;
|
|
27
|
+
export declare function tryWriteMemoryFileInDirSync(fs: FileSystem, dirPrefix: string, name: string, data: Uint8Array, append: boolean, mode: number, signal?: AbortSignal): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export * from "./contracts/errors.js";
|
|
2
|
+
export * from "./contracts/filesystem.js";
|
|
3
|
+
export * from "./contracts/io.js";
|
|
4
|
+
export { compareIdentity, compareFileVersion } from "./fs/mount/identity.js";
|
|
5
|
+
export { openFileDescriptor } from "./fs/descriptor.js";
|
|
6
|
+
export { assertPathWithin, isPathWithin, normalizePath, relativePath, resolvePath, validatePath } from "./contracts/virtual-path.js";
|
|
7
|
+
export { basename, dirname, extname, isAbsolutePath, joinPath, posixPath } from "./contracts/portable-path.js";
|
|
8
|
+
const _getMemHooks = () => globalThis.__safeBashMemHooks;
|
|
9
|
+
export function isUnmodifiedMemoryFileSystem(fs) {
|
|
10
|
+
const proto = Object.getPrototypeOf(fs);
|
|
11
|
+
if (!proto || !_getMemHooks()?.protos?.has(proto))
|
|
12
|
+
return false;
|
|
13
|
+
return Object.getOwnPropertyNames(fs).every(name => {
|
|
14
|
+
const method = Object.getOwnPropertyDescriptor(proto, name)?.value;
|
|
15
|
+
return typeof method !== "function" || Object.getOwnPropertyDescriptor(fs, name)?.value === method;
|
|
16
|
+
}) && Object.getOwnPropertyNames(proto).every(name => {
|
|
17
|
+
const method = Object.getOwnPropertyDescriptor(proto, name)?.value;
|
|
18
|
+
return typeof method !== "function" || Reflect.get(fs, name) === method;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function isCleanAbsolutePath(p) {
|
|
22
|
+
const fn = _getMemHooks()?.isCleanAbsolutePath;
|
|
23
|
+
if (fn)
|
|
24
|
+
return fn(p);
|
|
25
|
+
return p.length > 0 && p.charCodeAt(0) === 47 && !p.includes("//") && !p.includes("/.") && (p.length === 1 || p.charCodeAt(p.length - 1) !== 47);
|
|
26
|
+
}
|
|
27
|
+
export function tryGetMemoryDirectoryEntryNamesSync(fs, path) {
|
|
28
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryGetMemoryDirectoryEntryNamesSync)?.(fs, path);
|
|
29
|
+
}
|
|
30
|
+
export function tryReadMemoryFileViewSync(fs, path, maxBytes, signal, captureSourceRef, beforeRead) {
|
|
31
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryReadMemoryFileViewSync)?.(fs, path, maxBytes, signal, captureSourceRef, beforeRead);
|
|
32
|
+
}
|
|
33
|
+
export function tryResolveMemoryDevicePath(fs, path, followFinal) {
|
|
34
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryResolveMemoryDevicePath)?.(fs, path, followFinal);
|
|
35
|
+
}
|
|
36
|
+
export * from "./fs/devices/index.js";
|
|
37
|
+
export { retargetScopedFileSystem, scopeFileSystem, retainFileSystemCleanup } from "./fs/scoped.js";
|
|
38
|
+
export { compareEntries, registerEntryView } from "./fs/mount/comparison.js";
|
|
39
|
+
export async function bindConditionalMutation(identityScope, binding, action) {
|
|
40
|
+
const fn = _getMemHooks()?.bindConditionalMutation;
|
|
41
|
+
return fn ? fn(identityScope, binding, action) : action();
|
|
42
|
+
}
|
|
43
|
+
export function tryOpenMemoryRedirectHandleSync(fs, path, append, mode, signal) {
|
|
44
|
+
return (fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryOpenMemoryRedirectHandleSync)?.(fs, path, append, mode, signal);
|
|
45
|
+
}
|
|
46
|
+
export function tryWriteMemoryFileSync(fs, path, data, append, mode, signal) {
|
|
47
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryWriteMemoryFileSync)?.(fs, path, data, append, mode, signal));
|
|
48
|
+
}
|
|
49
|
+
export function tryMkdirMemorySync(fs, path, recursive, mode, signal, dirPrefixHint) {
|
|
50
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryMkdirMemorySync)?.(fs, path, recursive, mode, signal, dirPrefixHint));
|
|
51
|
+
}
|
|
52
|
+
export function tryRmRfMemorySync(fs, path, signal) {
|
|
53
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryRmRfMemorySync)?.(fs, path, signal));
|
|
54
|
+
}
|
|
55
|
+
export function tryWriteMemoryFileInDirSync(fs, dirPrefix, name, data, append, mode, signal) {
|
|
56
|
+
return Boolean((fs && _getMemHooks()?.byProto?.get(Object.getPrototypeOf(fs))?.tryWriteMemoryFileInDirSync)?.(fs, dirPrefix, name, data, append, mode, signal));
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-fs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.806",
|
|
4
4
|
"description": "Composable filesystem with a portable core and explicit Node adapters",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -126,6 +126,14 @@
|
|
|
126
126
|
"./contracts/errors": {
|
|
127
127
|
"types": "./dist/safe-fs/contracts/errors.d.ts",
|
|
128
128
|
"import": "./dist/safe-fs/contracts/errors.js"
|
|
129
|
+
},
|
|
130
|
+
"./runtime-core": {
|
|
131
|
+
"types": "./dist/safe-fs/runtime-core.d.ts",
|
|
132
|
+
"import": "./dist/safe-fs/runtime-core.js"
|
|
133
|
+
},
|
|
134
|
+
"./bridge": {
|
|
135
|
+
"types": "./dist/safe-fs/bridge/index.d.ts",
|
|
136
|
+
"import": "./dist/safe-fs/bridge/index.js"
|
|
129
137
|
}
|
|
130
138
|
},
|
|
131
139
|
"repository": {
|