Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fs: make imports esm compatible

Abdullah Atta54de071e8577
diff --git a/packages/streamable-fs/src/filehandle.ts b/packages/streamable-fs/src/filehandle.ts
index 3d8054bd0..a7a835aab 100644
--- a/packages/streamable-fs/src/filehandle.ts
+++ b/packages/streamable-fs/src/filehandle.ts
@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import FileStreamSource from "./filestreamsource";
-import { IFileStorage } from "./interfaces";
-import { File } from "./types";
-import { chunkPrefix } from "./utils";
+import FileStreamSource from "./filestreamsource.js";
+import { IFileStorage } from "./interfaces.js";
+import { File } from "./types.js";
+import { chunkPrefix } from "./utils.js";
export default class FileHandle {
constructor(
diff --git a/packages/streamable-fs/src/filestreamsource.ts b/packages/streamable-fs/src/filestreamsource.ts
index 1b86d8ba3..d3f0ead5c 100644
--- a/packages/streamable-fs/src/filestreamsource.ts
+++ b/packages/streamable-fs/src/filestreamsource.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import { File } from "./types";
-import { IFileStorage } from "./interfaces";
+import { File } from "./types.js";
+import { IFileStorage } from "./interfaces.js";
export default class FileStreamSource {
private index = 0;
diff --git a/packages/streamable-fs/index.ts b/packages/streamable-fs/src/index.ts
similarity index 91%
rename from packages/streamable-fs/index.ts
rename to packages/streamable-fs/src/index.ts
index 100e51535..fc706673c 100644
--- a/packages/streamable-fs/index.ts
+++ b/packages/streamable-fs/src/index.ts
@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import FileHandle from "./src/filehandle";
-import { IFileStorage, IStreamableFS } from "./src/interfaces";
-import { File } from "./src/types";
-import { chunkPrefix } from "./src/utils";
+import FileHandle from "./filehandle.js";
+import { IFileStorage, IStreamableFS } from "./interfaces.js";
+import { File } from "./types.js";
+import { chunkPrefix } from "./utils.js";
export class StreamableFS implements IStreamableFS {
/**
@@ -81,3 +81,5 @@ export class StreamableFS implements IStreamableFS {
await this.storage.clear();
}
}
+
+export type { IFileStorage, File, FileHandle };
diff --git a/packages/streamable-fs/src/interfaces.ts b/packages/streamable-fs/src/interfaces.ts
index 69f7e65f8..4cb71549a 100644
--- a/packages/streamable-fs/src/interfaces.ts
+++ b/packages/streamable-fs/src/interfaces.ts
@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import FileHandle from "./filehandle";
-import { File } from "./types";
+import FileHandle from "./filehandle.js";
+import { File } from "./types.js";
export interface IStreamableFS {
createFile(
diff --git a/packages/streamable-fs/tsconfig.json b/packages/streamable-fs/tsconfig.json
index 44baa1321..468b41ad8 100644
--- a/packages/streamable-fs/tsconfig.json
+++ b/packages/streamable-fs/tsconfig.json
@@ -4,5 +4,5 @@
"lib": ["DOM", "ESNext"],
"outDir": "./dist"
},
- "include": ["./index.ts", "./src/"]
+ "include": ["./src/"]
}