uniswap-v2-loader 5.0.4 → 5.0.5

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.
@@ -27,12 +27,15 @@ jobs:
27
27
  - name: CLI Load first 4 pairs from Uniswap V2 using 2 workers
28
28
  run: uniswap-v2-loader --to=4 --multicall_size=2 --workers=2
29
29
 
30
+ - name: Run ESM tests
31
+ run: npm run test-esm
32
+
30
33
  - name: Run tests with coverage
31
34
  run: |
32
35
  node --experimental-test-coverage \
33
36
  --test-reporter=spec --test-reporter-destination=stdout \
34
37
  --test-reporter=lcov --test-reporter-destination=lcov.info \
35
- --test
38
+ test.js
36
39
 
37
40
  - name: Upload to Coveralls
38
41
  uses: coverallsapp/github-action@v2
package/index.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import pkg from './index.js'
2
+ export const { load, subscribe } = pkg
3
+ export default pkg
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniswap-v2-loader",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "description": "Uniswap v2 protocol loader",
5
5
  "keywords": [
6
6
  "uniswap-v2",
@@ -27,9 +27,17 @@
27
27
  "author": "Vladimir Spirin (spirin.vladimir@gmail.com)",
28
28
  "type": "commonjs",
29
29
  "main": "index.js",
30
+ "exports": {
31
+ ".": {
32
+ "import": "./index.mjs",
33
+ "require": "./index.js",
34
+ "types": "./index.d.ts"
35
+ }
36
+ },
30
37
  "types": "index.d.ts",
31
38
  "scripts": {
32
- "test": "node --test test.js"
39
+ "test": "node --test test.js",
40
+ "test-esm": "node --test test-esm.mjs"
33
41
  },
34
42
  "bin": {
35
43
  "uniswap-v2-loader": "./bin/uniswap-v2-loader"
package/test-esm.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import { load, subscribe } from './index.mjs'
2
+ import assert from 'node:assert/strict'
3
+ import { describe, it } from 'node:test'
4
+
5
+ describe('ESM Support', () => {
6
+ it('should import load and subscribe', () => {
7
+ assert.equal(typeof load, 'function')
8
+ assert.equal(typeof subscribe, 'function')
9
+ })
10
+
11
+ it('should load first pair', () =>
12
+ load({ to: 1 })
13
+ .then(pairs => {
14
+ assert.equal(pairs.length, 1)
15
+ assert.equal(pairs[0].id, 0)
16
+ })
17
+ )
18
+ })