Skip to content

Commit

Permalink
fix: allow import memory store in the browser (storacha#1276)
Browse files Browse the repository at this point in the history
`stores.js` was importing code that uses nodejs modules and is not
bundleable....

refs
storacha#1274 (comment)
  • Loading branch information
Alan Shaw authored Jan 24, 2024
1 parent 26ce41b commit 301e0fc
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/w3up-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ import * as Signer from '@ucanto/principal/ed25519' // Agents on Node should use
import { importDAG } from '@ucanto/core/delegation'
import { CarReader } from '@ipld/car'
import * as Client from '@web3-storage/w3up-client'
import { StoreMemory } from '@web3-storage/w3up-client/stores'
import { StoreMemory } from '@web3-storage/w3up-client/stores/memory'

async function main () {
// from "bring your own Agent" example in `Creating a client object" section`
Expand Down
16 changes: 14 additions & 2 deletions packages/w3up-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,20 @@
"import": "./dist/src/capability/usage.js"
},
"./stores": {
"types": "./dist/src/stores.d.ts",
"import": "./dist/src/stores.js"
"types": "./dist/src/stores/index.d.ts",
"import": "./dist/src/stores/index.js"
},
"./stores/conf": {
"types": "./dist/src/stores/conf.d.ts",
"import": "./dist/src/stores/conf.js"
},
"./stores/indexeddb": {
"types": "./dist/src/stores/indexeddb.d.ts",
"import": "./dist/src/stores/indexeddb.js"
},
"./stores/memory": {
"types": "./dist/src/stores/memory.d.ts",
"import": "./dist/src/stores/memory.js"
},
"./types": "./dist/src/types.js"
},
Expand Down
5 changes: 0 additions & 5 deletions packages/w3up-client/src/stores.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/w3up-client/src/stores/conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { StoreConf } from '@web3-storage/access/stores/store-conf'
5 changes: 5 additions & 0 deletions packages/w3up-client/src/stores/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { StoreMemory } from './memory.js'
import { StoreIndexedDB } from './indexeddb.js'
import { StoreConf } from './conf.js'

export { StoreConf, StoreIndexedDB, StoreMemory }
1 change: 1 addition & 0 deletions packages/w3up-client/src/stores/indexeddb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { StoreIndexedDB } from '@web3-storage/access/stores/store-indexeddb'
1 change: 1 addition & 0 deletions packages/w3up-client/src/stores/memory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { StoreMemory } from '@web3-storage/access/stores/store-memory'

0 comments on commit 301e0fc

Please sign in to comment.