Improve cross-platform support
Signed-off-by: James Zuccon <zuccon@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
|||||||
BlockchainLocal,
|
BlockchainLocal,
|
||||||
StorageMemory,
|
StorageMemory,
|
||||||
WalletP2PKH,
|
WalletP2PKH,
|
||||||
StorageSQLite,
|
StorageLocal,
|
||||||
} from '@xo/wallet';
|
} from '@xo/wallet';
|
||||||
|
|
||||||
const blockchainLocal = new BlockchainLocal();
|
const blockchainLocal = new BlockchainLocal();
|
||||||
@@ -67,9 +67,9 @@ await storageMemory.set('test', {
|
|||||||
|
|
||||||
console.log(storageMemory.storage);
|
console.log(storageMemory.storage);
|
||||||
|
|
||||||
const storageIDB = new StorageSQLite();
|
const storageLocal = new StorageLocal();
|
||||||
await storageIDB.start();
|
await storageLocal.start();
|
||||||
|
|
||||||
await storageIDB.set('test', {
|
await storageLocal.set('test', {
|
||||||
thisShouldNotWork: true,
|
thisShouldNotWork: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
".": {
|
||||||
"browser": {
|
"browser": {
|
||||||
"types": "./dist/index.browser.d.ts",
|
"types": "./dist/index.browser.d.ts",
|
||||||
"default": "./dist/index.browser.js"
|
"default": "./dist/index.browser.js"
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
"types": "./dist/index.node.d.ts",
|
"types": "./dist/index.node.d.ts",
|
||||||
"default": "./dist/index.node.js"
|
"default": "./dist/index.node.js"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist"
|
"dist"
|
||||||
|
|||||||
@@ -2,4 +2,7 @@
|
|||||||
export * from './index.js';
|
export * from './index.js';
|
||||||
|
|
||||||
// These exports will only work in a browser environment.
|
// 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 };
|
||||||
|
|||||||
@@ -2,4 +2,7 @@
|
|||||||
export * from './index.js';
|
export * from './index.js';
|
||||||
|
|
||||||
// These exports will only work in a NodeJS (backend) environment.
|
// 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 };
|
||||||
|
|||||||
Reference in New Issue
Block a user