Skip to content

Commit

Permalink
feat: gun-es
Browse files Browse the repository at this point in the history
  • Loading branch information
davay42 committed Apr 27, 2023
1 parent 5f7753c commit c45ecd3
Show file tree
Hide file tree
Showing 11 changed files with 3,611 additions and 415 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
.DS_Store
dist
_dist
!gun-es/dist
dist-ssr
*.local
radata
Expand Down
6 changes: 4 additions & 2 deletions gun-es/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# gun-es

[Edit on StackBlitz ⚡️](https://stackblitz.com/edit/vitejs-vite-63kvno)
## Gun database ESM build

For use of [GUN](https://gun.eco) in `<script type="module"></script>` environments in browser or in ESM first bundlers like Vite.


https://github.com/rollup/plugins/tree/master/packages/commonjs
3,579 changes: 3,579 additions & 0 deletions gun-es/dist/gun-es.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions gun-es/dist/gun-es.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion gun-es/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import {Gun, SEA} from './dist/gun-es.js';
const pair = await SEA.pair();
const gun = Gun();
gun.user().auth(pair, (p) => console.log(gun.user().is));
gun.user().auth(pair, (p) => {
document.getElementById('pubKey').innerText = gun.user().is.pub
});
</script>
</head>

<body>
<h1>Gun Test</h1>
<pre id="pubKey"></pre>
</body>

</html>
21 changes: 12 additions & 9 deletions gun-es/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@

import Gun from 'gun';
import "gun/lib/then";
import "gun/lib/radix";
import "gun/lib/radisk";
import "gun/lib/rindexed";
import "gun/lib/webrtc";

const window = window || { Gun }
self.Gun = globalThis.Gun = Gun
import { default as SEA } from 'gun/sea.js';


const window = {
crypto: self.crypto,
TextEncoder: self.TextEncoder,
TextDecoder: self.TextDecoder,
WebSocket: self.WebSocket,
Gun,
}
export { Gun, SEA };

export { Gun };
export { default as SEA } from 'gun/sea.js';

Loading

0 comments on commit c45ecd3

Please sign in to comment.