Improve cross-platform support

Signed-off-by: James Zuccon <zuccon@gmail.com>
This commit is contained in:
James Zuccon
2024-09-14 10:31:14 +10:00
parent 7f99895562
commit 59fc4df4b2
4 changed files with 21 additions and 13 deletions
+9 -7
View File
@@ -7,13 +7,15 @@
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"browser": {
"types": "./dist/index.browser.d.ts",
"default": "./dist/index.browser.js"
},
"node": {
"types": "./dist/index.node.d.ts",
"default": "./dist/index.node.js"
".": {
"browser": {
"types": "./dist/index.browser.d.ts",
"default": "./dist/index.browser.js"
},
"node": {
"types": "./dist/index.node.d.ts",
"default": "./dist/index.node.js"
}
}
},
"files": [
+4 -1
View File
@@ -2,4 +2,7 @@
export * from './index.js';
// These exports will only work in a browser environment.
export * from './storage/storage-idb.js';
// NOTE: We import and export with a common alias to better support any leveraging libraries.
import { StorageIDB } from './storage/storage-idb.js';
export { StorageIDB };
export { StorageIDB as StorageLocal };
+4 -1
View File
@@ -2,4 +2,7 @@
export * from './index.js';
// These exports will only work in a NodeJS (backend) environment.
export * from './storage/storage-sqlite.js';
// NOTE: We import and export each module with a common alias so that any leveraging libraries can use the common name and maintain cross-platform compatibility.
import { StorageSQLite } from './storage/storage-sqlite.js';
export { StorageSQLite };
export { StorageSQLite as StorageLocal };