From 8c13d01109efeb3d4dd6d6e13b67e267f0575062 Mon Sep 17 00:00:00 2001 From: Vortex Date: Fri, 15 Mar 2024 14:38:55 -0500 Subject: [PATCH] Removed FileSystem.Name Added public modifer to FileSystem members Changed SyncFileSystem, AsyncFileSystem, ReadonlySyncFileSystem, and ReadonlyAsyncFileSystem to mixins --- package-lock.json | 382 ++++++++++++++++++------------------ src/FileIndex.ts | 6 +- src/backends/AsyncMirror.ts | 15 +- src/backends/AsyncStore.ts | 4 +- src/backends/SyncStore.ts | 5 +- src/file.ts | 8 +- src/filesystem.ts | 276 +++++++++++++------------- 7 files changed, 348 insertions(+), 348 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1028cbbc0..8578b1320 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,12 +45,13 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" @@ -140,12 +141,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.21.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.1.tgz", - "integrity": "sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dev": true, "dependencies": { - "@babel/types": "^7.21.0", + "@babel/types": "^7.23.6", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -212,34 +213,34 @@ "dev": true }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", - "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "dependencies": { - "@babel/template": "^7.20.7", - "@babel/types": "^7.21.0" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" @@ -298,30 +299,30 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true, "engines": { "node": ">=6.9.0" @@ -351,29 +352,23 @@ } }, "node_modules/@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/highlight/node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, "node_modules/@babel/parser": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.2.tgz", - "integrity": "sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", + "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -560,34 +555,34 @@ } }, "node_modules/@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.2.tgz", - "integrity": "sha512-ts5FFU/dSUPS13tv8XiEObDu9K+iagEKME9kAbaP7r0Y9KtZJZ+NGndDvWoRAYNpeWafbpFeki3q9QoMD6gxyw==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.21.1", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.21.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.2", - "@babel/types": "^7.21.2", - "debug": "^4.1.0", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.0.tgz", + "integrity": "sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -618,13 +613,13 @@ "dev": true }, "node_modules/@babel/types": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.2.tgz", - "integrity": "sha512-3wRZSs7jiFaB8AjxiiD+VqN5DTG2iRvJGQ+qYFrs/654lg6kGTQWIOFjlBo5RaXuAZjBmP3+OQH4dmhqiiyYxw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -2886,27 +2881,6 @@ "node": ">=4" } }, - "node_modules/chalk/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/char-regex": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", @@ -2954,18 +2928,18 @@ "dev": true }, "node_modules/color-convert": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", - "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "dependencies": { - "color-name": "1.1.1" + "color-name": "1.1.3" } }, "node_modules/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-KueG6e1jnj4enh6KzhXxA51awXK/yB4z1gUNPuH81hLDdmvmiQU4EDL1mZPB4m9rxEJkZ+kqmd51Ml9rSz2B3g==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "node_modules/concat-map": { @@ -4097,6 +4071,15 @@ "node": ">= 0.4.0" } }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -6048,6 +6031,12 @@ "url": "https://opencollective.com/js-sdsl" } }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -6834,6 +6823,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -7263,12 +7264,13 @@ } }, "@babel/code-frame": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", - "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dev": true, "requires": { - "@babel/highlight": "^7.18.6" + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" } }, "@babel/compat-data": { @@ -7330,12 +7332,12 @@ } }, "@babel/generator": { - "version": "7.21.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.1.tgz", - "integrity": "sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dev": true, "requires": { - "@babel/types": "^7.21.0", + "@babel/types": "^7.23.6", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -7391,28 +7393,28 @@ } }, "@babel/helper-environment-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", - "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "dev": true }, "@babel/helper-function-name": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz", - "integrity": "sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, "requires": { - "@babel/template": "^7.20.7", - "@babel/types": "^7.21.0" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" } }, "@babel/helper-hoist-variables": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", - "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, "@babel/helper-module-imports": { @@ -7456,24 +7458,24 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", - "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.22.5" } }, "@babel/helper-string-parser": { - "version": "7.19.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", - "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", "dev": true }, "@babel/helper-validator-identifier": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", - "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true }, "@babel/helper-validator-option": { @@ -7494,28 +7496,20 @@ } }, "@babel/highlight": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", - "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.18.6", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" - }, - "dependencies": { - "js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - } } }, "@babel/parser": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.2.tgz", - "integrity": "sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", + "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", "dev": true }, "@babel/plugin-syntax-async-generators": { @@ -7645,31 +7639,31 @@ } }, "@babel/template": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", - "integrity": "sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7" + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" } }, "@babel/traverse": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.2.tgz", - "integrity": "sha512-ts5FFU/dSUPS13tv8XiEObDu9K+iagEKME9kAbaP7r0Y9KtZJZ+NGndDvWoRAYNpeWafbpFeki3q9QoMD6gxyw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.21.1", - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-function-name": "^7.21.0", - "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.2", - "@babel/types": "^7.21.2", - "debug": "^4.1.0", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.0.tgz", + "integrity": "sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", + "debug": "^4.3.1", "globals": "^11.1.0" }, "dependencies": { @@ -7691,13 +7685,13 @@ } }, "@babel/types": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.2.tgz", - "integrity": "sha512-3wRZSs7jiFaB8AjxiiD+VqN5DTG2iRvJGQ+qYFrs/654lg6kGTQWIOFjlBo5RaXuAZjBmP3+OQH4dmhqiiyYxw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "requires": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" } }, @@ -9252,23 +9246,6 @@ "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" - }, - "dependencies": { - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true - }, - "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } } }, "char-regex": { @@ -9302,18 +9279,18 @@ "dev": true }, "color-convert": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", - "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, "requires": { - "color-name": "1.1.1" + "color-name": "1.1.3" } }, "color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-KueG6e1jnj4enh6KzhXxA51awXK/yB4z1gUNPuH81hLDdmvmiQU4EDL1mZPB4m9rxEJkZ+kqmd51Ml9rSz2B3g==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "concat-map": { @@ -10154,6 +10131,12 @@ "function-bind": "^1.1.1" } }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, "html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", @@ -11591,6 +11574,12 @@ "integrity": "sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==", "dev": true }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", @@ -12160,6 +12149,15 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", diff --git a/src/FileIndex.ts b/src/FileIndex.ts index 5a634021e..dae54370c 100644 --- a/src/FileIndex.ts +++ b/src/FileIndex.ts @@ -2,7 +2,7 @@ import { ApiError, ErrorCode } from './ApiError.js'; import type { Cred } from './cred.js'; import * as path from './emulation/path.js'; import { NoSyncFile, type FileFlag } from './file.js'; -import { ReadonlyAsyncFileSystem, ReadonlySyncFileSystem } from './filesystem.js'; +import { FileSystem, Sync, Async, Readonly } from './filesystem.js'; import { FileType, Stats } from './stats.js'; /** @@ -369,7 +369,7 @@ export function isIndexDirInode(inode?: IndexInode): inode is IndexDirInod return inode?.isDir(); } -export abstract class SyncFileIndexFS extends ReadonlySyncFileSystem { +export abstract class SyncFileIndexFS extends Readonly(Sync(FileSystem)) { protected _index: FileIndex; protected loadIndex(index: ListingTree): void { @@ -437,7 +437,7 @@ export abstract class SyncFileIndexFS extends ReadonlySyncFileSystem { } } -export abstract class AsyncFileIndexFS extends ReadonlyAsyncFileSystem { +export abstract class AsyncFileIndexFS extends Readonly(Async(FileSystem)) { protected _index: FileIndex; protected loadIndex(index: ListingTree): void { diff --git a/src/backends/AsyncMirror.ts b/src/backends/AsyncMirror.ts index f536e5544..86c0a9f15 100644 --- a/src/backends/AsyncMirror.ts +++ b/src/backends/AsyncMirror.ts @@ -1,4 +1,4 @@ -import { type FileSystem, SyncFileSystem, FileSystemMetadata } from '../filesystem.js'; +import { FileSystem, Sync, FileSystemMetadata } from '../filesystem.js'; import { ApiError, ErrorCode } from '../ApiError.js'; import { File, FileFlag, PreloadFile } from '../file.js'; import { Stats } from '../stats.js'; @@ -80,7 +80,7 @@ export namespace AsyncMirror { * in-memory filesystem with an asynchronous backing store. * */ -export class AsyncMirrorFS extends SyncFileSystem { +export class AsyncMirrorFS extends Sync(FileSystem) { /** * Queue of pending asynchronous operations. */ @@ -111,6 +111,7 @@ export class AsyncMirrorFS extends SyncFileSystem { this._ready = this._initialize(); } + // @ts-expect-error 2611 public get metadata(): FileSystemMetadata { return { ...super.metadata, @@ -120,16 +121,6 @@ export class AsyncMirrorFS extends SyncFileSystem { }; } - /*public _syncSync(file: PreloadFile, cred: Cred) { - const sync = this._sync.openFileSync(file.path, FileFlag.FromString('w'), cred); - sync.writeSync(file.buffer); - - this.enqueue({ - apiMethod: 'writeFile', - arguments: [file.path, file.buffer, file.flag, file.stats.mode, cred], - }); - }*/ - public syncSync(path: string, data: Uint8Array, stats: Readonly): void { this._sync.syncSync(path, data, stats); diff --git a/src/backends/AsyncStore.ts b/src/backends/AsyncStore.ts index 9a58d797f..4485884f4 100644 --- a/src/backends/AsyncStore.ts +++ b/src/backends/AsyncStore.ts @@ -3,7 +3,7 @@ import { ApiError, ErrorCode } from '../ApiError.js'; import { Cred } from '../cred.js'; import { W_OK, R_OK } from '../emulation/constants.js'; import { PreloadFile, File, FileFlag } from '../file.js'; -import { AsyncFileSystem, type FileSystemMetadata } from '../filesystem.js'; +import { Async, FileSystem, type FileSystemMetadata } from '../filesystem.js'; import { randomIno, type Ino, Inode } from '../inode.js'; import { Stats, FileType } from '../stats.js'; import { encode, decodeDirListing, encodeDirListing } from '../utils.js'; @@ -162,7 +162,7 @@ export interface AsyncStoreFileSystemOptions { * An "Asynchronous key-value file system". Stores data to/retrieves data from * an underlying asynchronous key-value store. */ -export class AsyncStoreFileSystem extends AsyncFileSystem { +export class AsyncStoreFileSystem extends Async(FileSystem) { protected store: AsyncStore; private _cache?: LRUCache; diff --git a/src/backends/SyncStore.ts b/src/backends/SyncStore.ts index 70f6ad215..2778c57a8 100644 --- a/src/backends/SyncStore.ts +++ b/src/backends/SyncStore.ts @@ -3,7 +3,7 @@ import { ApiError, ErrorCode } from '../ApiError.js'; import { Cred } from '../cred.js'; import { W_OK, R_OK } from '../emulation/constants.js'; import { FileFlag, PreloadFile } from '../file.js'; -import { SyncFileSystem, type FileSystemMetadata } from '../filesystem.js'; +import { type FileSystemMetadata, FileSystem, Sync } from '../filesystem.js'; import { randomIno, type Ino, Inode } from '../inode.js'; import { Stats, FileType } from '../stats.js'; import { decodeDirListing, encode, encodeDirListing } from '../utils.js'; @@ -199,7 +199,7 @@ export class SyncStoreFile extends PreloadFile { * @todo Introduce Node ID caching. * @todo Check modes. */ -export class SyncStoreFileSystem extends SyncFileSystem { +export class SyncStoreFileSystem extends Sync(FileSystem) { protected store: SyncStore; constructor(options: SyncStoreFileSystemOptions) { @@ -209,6 +209,7 @@ export class SyncStoreFileSystem extends SyncFileSystem { this.makeRootDirectory(); } + // @ts-expect-error 2611 public get metadata(): FileSystemMetadata { return { ...super.metadata, diff --git a/src/file.ts b/src/file.ts index e3c69ed34..f75d08417 100644 --- a/src/file.ts +++ b/src/file.ts @@ -1,8 +1,8 @@ import { ApiError, ErrorCode } from './ApiError.js'; -import { Stats, type FileType } from './stats.js'; -import { FileSystem, type SyncFileSystem } from './filesystem.js'; -import { O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_TRUNC, O_APPEND, O_SYNC, S_IFMT } from './emulation/constants.js'; +import { O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_SYNC, O_TRUNC, O_WRONLY, S_IFMT } from './emulation/constants.js'; +import type { FileSystem } from './filesystem.js'; import { size_max } from './inode.js'; +import { Stats, type FileType } from './stats.js'; /* Typescript does not include a type declaration for resizable array buffers. @@ -723,7 +723,7 @@ export abstract class PreloadFile extends File { /** * For synchronous file systems */ -export class SyncFile extends PreloadFile { +export class SyncFile extends PreloadFile { constructor(_fs: FS, _path: string, _flag: FileFlag, _stat: Stats, contents?: Uint8Array) { super(_fs, _path, _flag, _stat, contents); } diff --git a/src/filesystem.ts b/src/filesystem.ts index a1bece130..31cf4c71d 100644 --- a/src/filesystem.ts +++ b/src/filesystem.ts @@ -60,10 +60,6 @@ export interface FileSystemMetadata { * - All arguments are present. Any optional arguments at the Node API level have been passed in with their default values. */ export abstract class FileSystem { - public static get Name(): string { - return this.name; - } - public get metadata(): FileSystemMetadata { return { name: this.constructor.name, @@ -75,31 +71,31 @@ export abstract class FileSystem { }; } - constructor(options?: object) { + public constructor(options?: object) { // unused } - abstract ready(): Promise; + public abstract ready(): Promise; /** * Asynchronous rename. No arguments other than a possible exception * are given to the completion callback. */ - abstract rename(oldPath: string, newPath: string, cred: Cred): Promise; + public abstract rename(oldPath: string, newPath: string, cred: Cred): Promise; /** * Synchronous rename. */ - abstract renameSync(oldPath: string, newPath: string, cred: Cred): void; + public abstract renameSync(oldPath: string, newPath: string, cred: Cred): void; /** * Asynchronous `stat`. */ - abstract stat(path: string, cred: Cred): Promise; + public abstract stat(path: string, cred: Cred): Promise; /** * Synchronous `stat`. */ - abstract statSync(path: string, cred: Cred): Stats; + public abstract statSync(path: string, cred: Cred): Stats; /** * Opens the file at path p with the given flag. The file must exist. @@ -131,43 +127,43 @@ export abstract class FileSystem { /** * Asynchronous `unlink`. */ - abstract unlink(path: string, cred: Cred): Promise; + public abstract unlink(path: string, cred: Cred): Promise; /** * Synchronous `unlink`. */ - abstract unlinkSync(path: string, cred: Cred): void; + public abstract unlinkSync(path: string, cred: Cred): void; // Directory operations /** * Asynchronous `rmdir`. */ - abstract rmdir(path: string, cred: Cred): Promise; + public abstract rmdir(path: string, cred: Cred): Promise; /** * Synchronous `rmdir`. */ - abstract rmdirSync(path: string, cred: Cred): void; + public abstract rmdirSync(path: string, cred: Cred): void; /** * Asynchronous `mkdir`. * @param mode Mode to make the directory using. Can be ignored if * the filesystem doesn't support permissions. */ - abstract mkdir(path: string, mode: number, cred: Cred): Promise; + public abstract mkdir(path: string, mode: number, cred: Cred): Promise; /** * Synchronous `mkdir`. * @param mode Mode to make the directory using. Can be ignored if * the filesystem doesn't support permissions. */ - abstract mkdirSync(path: string, mode: number, cred: Cred): void; + public abstract mkdirSync(path: string, mode: number, cred: Cred): void; /** * Asynchronous `readdir`. Reads the contents of a directory. * * The callback gets two arguments `(err, files)` where `files` is an array of * the names of the files in the directory excluding `'.'` and `'..'`. */ - abstract readdir(path: string, cred: Cred): Promise; + public abstract readdir(path: string, cred: Cred): Promise; /** * Synchronous `readdir`. Reads the contents of a directory. */ - abstract readdirSync(path: string, cred: Cred): string[]; + public abstract readdirSync(path: string, cred: Cred): string[]; /** * Test whether or not the given path exists by checking with the file system. @@ -216,159 +212,173 @@ export abstract class FileSystem { /** * Implements the asynchronous API in terms of the synchronous API. + * + * @example ```ts + * class SyncFS extends Sync(FileSystem) {} + * ``` */ -export abstract class SyncFileSystem extends FileSystem { - public get metadata(): FileSystemMetadata { - return { ...super.metadata, synchronous: true }; - } +export function Sync FileSystem>(FS: T) { + /** + * Implements the asynchronous API in terms of the synchronous API. + */ + abstract class SyncFileSystem extends FS { + public get metadata(): FileSystemMetadata { + return { ...super.metadata, synchronous: true }; + } - public async ready(): Promise { - return this; - } + public async ready(): Promise { + return this; + } - public async rename(oldPath: string, newPath: string, cred: Cred): Promise { - return this.renameSync(oldPath, newPath, cred); - } + public async exists(path: string, cred: Cred): Promise { + return this.existsSync(path, cred); + } - public async stat(path: string, cred: Cred): Promise { - return this.statSync(path, cred); - } + public async rename(oldPath: string, newPath: string, cred: Cred): Promise { + return this.renameSync(oldPath, newPath, cred); + } - public async createFile(path: string, flag: FileFlag, mode: number, cred: Cred): Promise { - return this.createFileSync(path, flag, mode, cred); - } + public async stat(path: string, cred: Cred): Promise { + return this.statSync(path, cred); + } - public async openFile(path: string, flag: FileFlag, cred: Cred): Promise { - return this.openFileSync(path, flag, cred); - } + public async createFile(path: string, flag: FileFlag, mode: number, cred: Cred): Promise { + return this.createFileSync(path, flag, mode, cred); + } - public async unlink(path: string, cred: Cred): Promise { - return this.unlinkSync(path, cred); - } + public async openFile(path: string, flag: FileFlag, cred: Cred): Promise { + return this.openFileSync(path, flag, cred); + } - public async rmdir(path: string, cred: Cred): Promise { - return this.rmdirSync(path, cred); - } + public async unlink(path: string, cred: Cred): Promise { + return this.unlinkSync(path, cred); + } - public async mkdir(path: string, mode: number, cred: Cred): Promise { - return this.mkdirSync(path, mode, cred); - } + public async rmdir(path: string, cred: Cred): Promise { + return this.rmdirSync(path, cred); + } - public async readdir(path: string, cred: Cred): Promise { - return this.readdirSync(path, cred); - } + public async mkdir(path: string, mode: number, cred: Cred): Promise { + return this.mkdirSync(path, mode, cred); + } - public async link(srcpath: string, dstpath: string, cred: Cred): Promise { - return this.linkSync(srcpath, dstpath, cred); - } + public async readdir(path: string, cred: Cred): Promise { + return this.readdirSync(path, cred); + } - public async sync(path: string, data: Uint8Array, stats: Readonly): Promise { - return this.syncSync(path, data, stats); - } -} + public async link(srcpath: string, dstpath: string, cred: Cred): Promise { + return this.linkSync(srcpath, dstpath, cred); + } -export abstract class ReadonlySyncFileSystem extends SyncFileSystem { - public renameSync(oldPath: string, newPath: string, cred: Cred): void { - throw new ApiError(ErrorCode.EROFS); + public async sync(path: string, data: Uint8Array, stats: Readonly): Promise { + return this.syncSync(path, data, stats); + } } + return SyncFileSystem; +} - public createFileSync(path: string, flag: FileFlag, mode: number, cred: Cred): File { - throw new ApiError(ErrorCode.EROFS); - } +export function Async FileSystem>(FS: T) { + abstract class AsyncFileSystem extends FS { + public renameSync(oldPath: string, newPath: string, cred: Cred): void { + throw new ApiError(ErrorCode.ENOTSUP); + } - public unlinkSync(path: string, cred: Cred): void { - throw new ApiError(ErrorCode.EROFS); - } + public statSync(path: string, cred: Cred): Stats { + throw new ApiError(ErrorCode.ENOTSUP); + } - public rmdirSync(path: string, cred: Cred): void { - throw new ApiError(ErrorCode.EROFS); - } + public createFileSync(path: string, flag: FileFlag, mode: number, cred: Cred): File { + throw new ApiError(ErrorCode.ENOTSUP); + } - public mkdirSync(path: string, mode: number, cred: Cred): void { - throw new ApiError(ErrorCode.EROFS); - } + public openFileSync(path: string, flag: FileFlag, cred: Cred): File { + throw new ApiError(ErrorCode.ENOTSUP); + } - public linkSync(srcpath: string, dstpath: string, cred: Cred): void { - throw new ApiError(ErrorCode.EROFS); - } + public unlinkSync(path: string, cred: Cred): void { + throw new ApiError(ErrorCode.ENOTSUP); + } - public syncSync(path: string, data: Uint8Array, stats: Readonly): void { - throw new ApiError(ErrorCode.EROFS); - } -} + public rmdirSync(path: string, cred: Cred): void { + throw new ApiError(ErrorCode.ENOTSUP); + } -export abstract class AsyncFileSystem extends FileSystem { - public renameSync(oldPath: string, newPath: string, cred: Cred): void { - throw new ApiError(ErrorCode.ENOTSUP); - } + public mkdirSync(path: string, mode: number, cred: Cred): void { + throw new ApiError(ErrorCode.ENOTSUP); + } - public statSync(path: string, cred: Cred): Stats { - throw new ApiError(ErrorCode.ENOTSUP); - } + public readdirSync(path: string, cred: Cred): string[] { + throw new ApiError(ErrorCode.ENOTSUP); + } - public createFileSync(path: string, flag: FileFlag, mode: number, cred: Cred): File { - throw new ApiError(ErrorCode.ENOTSUP); - } + public linkSync(srcpath: string, dstpath: string, cred: Cred): void { + throw new ApiError(ErrorCode.ENOTSUP); + } - public openSync(path: string, flags: FileFlag, mode: number, cred: Cred): File { - throw new ApiError(ErrorCode.ENOTSUP); + public syncSync(path: string, data: Uint8Array, stats: Readonly): void { + throw new ApiError(ErrorCode.ENOTSUP); + } } + return AsyncFileSystem; +} - public openFileSync(path: string, flag: FileFlag, cred: Cred): File { - throw new ApiError(ErrorCode.ENOTSUP); - } +export function Readonly FileSystem>(FS: T) { + abstract class ReadonlyFileSystem extends FS { + public async rename(oldPath: string, newPath: string, cred: Cred): Promise { + throw new ApiError(ErrorCode.EROFS); + } - public unlinkSync(path: string, cred: Cred): void { - throw new ApiError(ErrorCode.ENOTSUP); - } + public renameSync(oldPath: string, newPath: string, cred: Cred): void { + throw new ApiError(ErrorCode.EROFS); + } - public rmdirSync(path: string, cred: Cred): void { - throw new ApiError(ErrorCode.ENOTSUP); - } + public async createFile(path: string, flag: FileFlag, mode: number, cred: Cred): Promise { + throw new ApiError(ErrorCode.EROFS); + } - public mkdirSync(path: string, mode: number, cred: Cred): void { - throw new ApiError(ErrorCode.ENOTSUP); - } + public createFileSync(path: string, flag: FileFlag, mode: number, cred: Cred): File { + throw new ApiError(ErrorCode.EROFS); + } - public readdirSync(path: string, cred: Cred): string[] { - throw new ApiError(ErrorCode.ENOTSUP); - } + public async unlink(path: string, cred: Cred): Promise { + throw new ApiError(ErrorCode.EROFS); + } - public linkSync(srcpath: string, dstpath: string, cred: Cred): void { - throw new ApiError(ErrorCode.ENOTSUP); - } + public unlinkSync(path: string, cred: Cred): void { + throw new ApiError(ErrorCode.EROFS); + } - public syncSync(path: string, data: Uint8Array, stats: Readonly): void { - throw new ApiError(ErrorCode.ENOTSUP); - } -} + public async rmdir(path: string, cred: Cred): Promise { + throw new ApiError(ErrorCode.EROFS); + } -export abstract class ReadonlyAsyncFileSystem extends AsyncFileSystem { - public async rename(oldPath: string, newPath: string, cred: Cred): Promise { - throw new ApiError(ErrorCode.EROFS); - } + public rmdirSync(path: string, cred: Cred): void { + throw new ApiError(ErrorCode.EROFS); + } - public async createFile(path: string, flag: FileFlag, mode: number, cred: Cred): Promise { - throw new ApiError(ErrorCode.EROFS); - } + public async mkdir(path: string, mode: number, cred: Cred): Promise { + throw new ApiError(ErrorCode.EROFS); + } - public async unlink(path: string, cred: Cred): Promise { - throw new ApiError(ErrorCode.EROFS); - } + public mkdirSync(path: string, mode: number, cred: Cred): void { + throw new ApiError(ErrorCode.EROFS); + } - public async rmdir(path: string, cred: Cred): Promise { - throw new ApiError(ErrorCode.EROFS); - } + public async link(srcpath: string, dstpath: string, cred: Cred): Promise { + throw new ApiError(ErrorCode.EROFS); + } - public async mkdir(path: string, mode: number, cred: Cred): Promise { - throw new ApiError(ErrorCode.EROFS); - } + public linkSync(srcpath: string, dstpath: string, cred: Cred): void { + throw new ApiError(ErrorCode.EROFS); + } - public async link(srcpath: string, dstpath: string, cred: Cred): Promise { - throw new ApiError(ErrorCode.EROFS); - } + public async sync(path: string, data: Uint8Array, stats: Readonly): Promise { + throw new ApiError(ErrorCode.EROFS); + } - public async sync(path: string, data: Uint8Array, stats: Readonly): Promise { - throw new ApiError(ErrorCode.EROFS); + public syncSync(path: string, data: Uint8Array, stats: Readonly): void { + throw new ApiError(ErrorCode.EROFS); + } } + return ReadonlyFileSystem; }