switch to importable-types-web
Release / release (push) Successful in 23s

This commit is contained in:
2026-02-09 07:09:30 -08:00
parent 1cc6906cc9
commit 579c4bf131
7 changed files with 33 additions and 19 deletions
+5 -12
View File
@@ -11,26 +11,19 @@
"mime": "^4.1.0"
},
"devDependencies": {
"@sugoidogo/web-filesystem-types": "^2.0.0",
"@sugoidogo/importable-types-web": "^1.0.0",
"@types/node": "^25.0.9",
"typescript": "^5.9.3"
}
},
"node_modules/@sugoidogo/node-web-globals": {
"node_modules/@sugoidogo/importable-types-web": {
"version": "1.0.0",
"resolved": "https://gitea.sugoidogo.com/api/packages/sugoidogo/npm/%40sugoidogo%2Fnode-web-globals/-/1.0.0/node-web-globals-1.0.0.tgz",
"integrity": "sha512-mE2yB2h2Vg8I+0zkcFHLUZgH+dbpb03e5Zwn+cDeXFRnj/nb/mLCIxXc9OeKUSH06PYyOGtH76XKKwGzey9TnA==",
"dev": true,
"license": "MIT"
},
"node_modules/@sugoidogo/web-filesystem-types": {
"version": "2.0.0",
"resolved": "https://gitea.sugoidogo.com/api/packages/sugoidogo/npm/%40sugoidogo%2Fweb-filesystem-types/-/2.0.0/web-filesystem-types-2.0.0.tgz",
"integrity": "sha512-ET5F+WlqNZnskgbSACG1flLAKftJBehLPiQgRtUotuh2+pSqIGrHHQT5KC2v6b5/3LM47K1Zjm8GFcJpmXEjmw==",
"resolved": "https://gitea.sugoidogo.com/api/packages/sugoidogo/npm/%40sugoidogo%2Fimportable-types-web/-/1.0.0/importable-types-web-1.0.0.tgz",
"integrity": "sha512-MqWkQ/WsllO7GiQjqWiFB3ZzsDwJwGPXIWkyd0E24d3CMcI0FKGgsOn6G/RVjCO9k2d/aRlzxqVmyuPAYOZ8tQ==",
"dev": true,
"license": "Apache-2.0",
"dependencies": {
"@sugoidogo/node-web-globals": "^1.0.0"
"undici-types": "^7.16.0"
}
},
"node_modules/@types/node": {
+1 -1
View File
@@ -16,7 +16,7 @@
"mime": "^4.1.0"
},
"devDependencies": {
"@sugoidogo/web-filesystem-types": "^2.0.0",
"@sugoidogo/importable-types-web": "^1.0.0",
"@types/node": "^25.0.9",
"typescript": "^5.9.3"
}
+8
View File
@@ -3,6 +3,14 @@ import * as asyncfs from 'node:fs/promises';
import * as path from 'node:path';
import NodeFileSystemHandle from './NodeFileSystemHandle.ts';
import NodeFileSystemFileHandle from './NodeFileSystemFileHandle.ts';
import type {
FileSystemDirectoryHandle,
FileSystemGetDirectoryOptions,
FileSystemDirectoryHandleAsyncIterator,
FileSystemGetFileOptions,
FileSystemRemoveOptions,
FileSystemHandle
} from '@sugoidogo/importable-types-web'
export default class NodeFileSystemDirectoryHandle extends NodeFileSystemHandle implements FileSystemDirectoryHandle {
declare kind: "directory";
+9 -2
View File
@@ -4,6 +4,13 @@ import * as path from 'node:path';
import NodeFileSystemHandle from './NodeFileSystemHandle.ts';
import NodeFileSystemWritableFileStream from './NodeFileSystemWriteableFileStream.ts';
import mime from 'mime'
import type {
FileSystemFileHandle,
FileSystemGetFileOptions,
FileSystemCreateWritableOptions,
FileSystemWritableFileStream,
File
} from '@sugoidogo/importable-types-web'
export default class NodeFileSystemFileHandle extends NodeFileSystemHandle implements FileSystemFileHandle {
declare kind: "file";
@@ -20,10 +27,10 @@ export default class NodeFileSystemFileHandle extends NodeFileSystemHandle imple
async getFile(): Promise<File> {
const stats = await asyncfs.stat(this.path)
const type = mime.getType(this.name.split('.').pop())
return asyncfs.readFile(this.path).then(buffer => Object.assign(new Blob([buffer],{type}), {
return asyncfs.readFile(this.path).then(buffer => Object.assign(new Blob([buffer], { type }), {
lastModified: stats.mtimeMs,
name: this.path,
webkitRelativePath: this.path
}))
})) as unknown as File // TODO ArrayBufferView and DataView are incompatible types
}
}
+4
View File
@@ -1,4 +1,8 @@
import * as path from 'node:path'
import type {
FileSystemHandle,
FileSystemHandleKind
} from '@sugoidogo/importable-types-web'
export default class NodeFileSystemHandle implements FileSystemHandle {
kind: FileSystemHandleKind;
+6
View File
@@ -2,6 +2,12 @@ import * as fs from 'node:fs'
import * as asyncfs from 'node:fs/promises'
import * as path from 'node:path'
import { Writable } from 'node:stream'
import type {
FileSystemWritableFileStream,
FileSystemCreateWritableOptions,
FileSystemWriteChunkType,
WriteParams
} from '@sugoidogo/importable-types-web'
export default class NodeFileSystemWritableFileStream extends WritableStream implements FileSystemWritableFileStream {
#seek_position = 0
-4
View File
@@ -3,10 +3,6 @@
"target": "es2022",
"module": "es2022",
"lib": ["ES2022"],
"types": [
"node",
"@sugoidogo/web-filesystem-types"
],
"moduleResolution": "node",
"sourceMap": true,
"declaration": true,