@leofcoin/launch-chain 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -1
- package/exports/launch.js +4 -2
- package/package.json +1 -1
- package/test.js +6 -0
package/README.md
CHANGED
|
@@ -39,4 +39,23 @@ stars: [] // note that disabling stars results in no peer discovery
|
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
##
|
|
42
|
+
## build for browser
|
|
43
|
+
no prebuild are provided since the esm switch, everything is written with the browser in mind so some simple ignores are enough to build.
|
|
44
|
+
|
|
45
|
+
### rollup
|
|
46
|
+
```js
|
|
47
|
+
external: [
|
|
48
|
+
'@koush/wrtc',
|
|
49
|
+
'@leofcoin/endpoints/ws',
|
|
50
|
+
'@leofcoin/endpoints/http'
|
|
51
|
+
]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### webpack
|
|
55
|
+
```js
|
|
56
|
+
externals: {
|
|
57
|
+
'@koush/wrtc': false,
|
|
58
|
+
'@leofcoin/endpoints/ws': false,
|
|
59
|
+
'@leofcoin/endpoints/http': false
|
|
60
|
+
}
|
|
61
|
+
```
|
package/exports/launch.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import Node from '@leofcoin/chain/node'
|
|
2
2
|
import Chain from '@leofcoin/chain/chain'
|
|
3
3
|
import nodeConfig from '@leofcoin/lib/node-config'
|
|
4
|
-
import wsServer from '@leofcoin/endpoints/ws'
|
|
5
|
-
import httpServer from '@leofcoin/endpoints/http'
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
*
|
|
@@ -95,10 +93,14 @@ const launch = async (options = {}) => {
|
|
|
95
93
|
chain = await new Chain()
|
|
96
94
|
|
|
97
95
|
if (options.ws) {
|
|
96
|
+
const importee = await import('@leofcoin/endpoints/ws')
|
|
97
|
+
const wsServer = importee.default
|
|
98
98
|
await wsServer(chain, options.ws.port, options.networkVersion)
|
|
99
99
|
endpoints.ws = options.ws.url
|
|
100
100
|
}
|
|
101
101
|
if (options.http) {
|
|
102
|
+
const importee = await import('@leofcoin/endpoints/http')
|
|
103
|
+
const httpServer = importee.default
|
|
102
104
|
await httpServer(chain, options.http.port, options.networkVersion)
|
|
103
105
|
endpoints.http = options.http.url
|
|
104
106
|
}
|
package/package.json
CHANGED