refactor
Release / release (push) Successful in 24s

This commit is contained in:
2026-02-16 15:57:22 -08:00
parent e99fc35e25
commit 8bc2c7d70c
5 changed files with 78 additions and 72 deletions
+11 -8
View File
@@ -1,19 +1,22 @@
import * as path from 'node:path'
import * as Path from 'node:path'
import type {
FileSystemHandle,
FileSystemHandleKind
} from '@sugoidogo/importable-types-web'
import type NodeFileSystemDirectoryHandle from './NodeFileSystemDirectoryHandle';
export default class NodeFileSystemHandle implements FileSystemHandle {
kind: FileSystemHandleKind;
path: string;
get name() { return path.basename(this.path) }
origin: NodeFileSystemDirectoryHandle
get name() { return Path.basename(this.path) }
constructor(path: string, options: { origin?: NodeFileSystemDirectoryHandle } = {}) {
if (!Path.isAbsolute(path)) path = Path.resolve(path)
this.path = path
this.origin = options.origin
}
async isSameEntry(other: FileSystemHandle): Promise<boolean> {
if (typeof other != typeof this) return false
let thisName = this.name
let otherName = other.name
if (!path.isAbsolute(this.name)) thisName = path.join(process.cwd(), this.name)
if (!path.isAbsolute(other.name)) otherName = path.join(process.cwd(), other.name)
return thisName === otherName
if (!(other instanceof NodeFileSystemHandle)) return false
return this.path === other.path
}
}