Skip to content

Commit 3355640

Browse files
authored
Use single entry points (#1302)
* replace @rollup/plugin-multi-entry to each single export path * 8.6.0-alpha.0
1 parent 95e357f commit 3355640

File tree

15 files changed

+99
-79
lines changed

15 files changed

+99
-79
lines changed

lib/ethereum/client/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ export type DevkitClient = {
77
export const client: DevkitClient = {
88
createDetectSTokens,
99
}
10+
11+
export { createDetectSTokens }

lib/index.ts

+44-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,45 @@
1-
import { contractFactory } from './ethereum/contract'
2-
import { addresses } from './addresses'
3-
import { utils } from './common/utils'
4-
import { client } from './ethereum/client'
5-
import {
6-
createSimpleCollectionsContract,
7-
Image,
8-
} from './ethereum/simpleCollection'
1+
export * from './addresses'
2+
export * from './common/erc20'
3+
export * from './common/utils'
4+
export * from './common/option'
5+
export * from './marketAddresses'
6+
export * from './ethereum/contract'
7+
export * from './ethereum/client'
8+
export * from './ethereum/allocator'
9+
export * from './ethereum/dev'
10+
export * from './ethereum/lockup'
11+
export * from './ethereum/market'
12+
export * from './ethereum/market-behavior'
13+
export * from './ethereum/market-factory'
14+
export * from './ethereum/metrics'
15+
// export * from './ethereum/metrics-factory'
16+
export * from './ethereum/metrics-group'
17+
export * from './ethereum/policy'
18+
export * from './ethereum/policy-factory'
19+
export * from './ethereum/policy-group'
20+
export * from './ethereum/property'
21+
export * from './ethereum/property-factory'
22+
export * from './ethereum/registry'
23+
export * from './ethereum/s-tokens'
24+
export * from './ethereum/simpleCollection'
25+
export * from './ethereum/withdraw'
926

10-
export default {
11-
contractFactory,
12-
addresses,
13-
utils,
14-
client,
15-
createSimpleCollectionsContract,
16-
Image,
17-
}
27+
export * from './common/erc20/abi'
28+
export * from './ethereum/allocator/abi'
29+
export * from './ethereum/dev/abi'
30+
export * from './ethereum/lockup/abi'
31+
export * from './ethereum/market/abi'
32+
export * from './ethereum/market-behavior/abi'
33+
export * from './ethereum/market-factory/abi'
34+
export * from './ethereum/metrics/abi'
35+
export * from './ethereum/metrics-factory/abi'
36+
export * from './ethereum/metrics-group/abi'
37+
export * from './ethereum/policy/abi'
38+
export * from './ethereum/policy-factory/abi'
39+
export * from './ethereum/policy-group/abi'
40+
export * from './ethereum/property/abi'
41+
export * from './ethereum/property-factory/abi'
42+
export * from './ethereum/registry/abi'
43+
export * from './ethereum/s-tokens/abi'
44+
export * from './ethereum/simpleCollection/abi'
45+
export * from './ethereum/withdraw/abi'

lib/l2/client/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ export type DevkitClient = {
77
export const client: DevkitClient = {
88
createDetectSTokens,
99
}
10+
11+
export { createDetectSTokens }

lib/l2/dev/abi.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../ethereum/dev/abi'

lib/l2/erc20/abi.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../common/erc20/abi'

lib/l2/index.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
export * from './contract'
2+
export * from './client'
3+
export * from './dev'
4+
export * from './erc20'
5+
export * from './lockup'
6+
export * from './market'
7+
export * from './market-behavior'
8+
export * from './market-factory'
9+
export * from './metrics'
10+
export * from './metrics-factory'
11+
export * from './policy'
12+
export * from './policy-factory'
13+
export * from './property'
14+
export * from './property-factory'
15+
export * from './registry'
16+
export * from './s-tokens'
17+
export * from './withdraw'
18+
19+
export * from './dev/abi'
20+
export * from './erc20/abi'
21+
export * from './lockup/abi'
22+
export * from './market/abi'
23+
export * from './market-behavior/abi'
24+
export * from './market-factory/abi'
25+
export * from './metrics/abi'
26+
export * from './metrics-factory/abi'
27+
export * from './policy/abi'
28+
export * from './policy-factory/abi'
29+
export * from './property/abi'
30+
export * from './property-factory/abi'
31+
export * from './registry/abi'
32+
export * from './s-tokens/abi'
33+
export * from './withdraw/abi'

lib/l2/market-behavior/abi.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../ethereum/market-behavior/abi'

lib/l2/metrics/abi.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../ethereum/metrics/abi'

lib/l2/policy-factory/abi.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../ethereum/policy-factory/abi'

lib/l2/s-tokens/abi.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../ethereum/s-tokens/abi'

lib/l2/withdraw/abi.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from '../../ethereum/withdraw/abi'

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@devprotocol/dev-kit",
33
"type": "module",
4-
"version": "8.5.3",
4+
"version": "8.6.0-alpha.0",
55
"description": "Dev Kit for JavaScript",
66
"author": "abyssparanoia",
77
"license": "Apache-2.0",
@@ -50,7 +50,6 @@
5050
"devDependencies": {
5151
"@babel/preset-env": "7.23.2",
5252
"@rollup/plugin-babel": "6.0.4",
53-
"@rollup/plugin-multi-entry": "6.0.1",
5453
"@rollup/plugin-node-resolve": "15.2.3",
5554
"@types/jest": "29.5.6",
5655
"@types/ramda": "0.29.7",

rollup.config.d.js

+3-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import multi from '@rollup/plugin-multi-entry'
21
import dts from 'rollup-plugin-dts'
32

4-
const plugins = [multi(), dts()]
3+
const plugins = [dts()]
54
const [, , , , _mode] = process.argv
65
const mode =
76
_mode === '--index'
@@ -16,29 +15,12 @@ const mode =
1615

1716
export default [
1817
{
19-
input: [
20-
'dist/lib/*.d.ts',
21-
'dist/lib/ethereum/*.d.ts',
22-
'dist/lib/**/index.d.ts',
23-
'!dist/lib/index.d.ts',
24-
'!**/*.spec.*',
25-
'!dist/lib/l2/**/*',
26-
],
27-
output: [{ file: 'dist/tmp/dev-kit.d.ts', format: 'es' }],
28-
plugins,
29-
},
30-
{
31-
input: ['dist/tmp/dev-kit.d.ts', 'dist/lib/ethereum/**/abi.d.ts'],
18+
input: 'dist/lib/index.d.ts',
3219
output: [{ file: 'dist/dev-kit.d.ts', format: 'es' }],
3320
plugins,
3421
},
3522
{
36-
input: [
37-
'dist/lib/l2/*.d.ts',
38-
'dist/lib/l2/**/index.d.ts',
39-
'dist/lib/l2/**/abi.d.ts',
40-
'!**/*.spec.*',
41-
],
23+
input: 'dist/lib/l2/index.d.ts',
4224
output: [{ file: './l2/index.d.ts', format: 'es' }],
4325
plugins,
4426
},

rollup.config.js

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
import { nodeResolve } from '@rollup/plugin-node-resolve'
2-
import multi from '@rollup/plugin-multi-entry'
32
import { getBabelOutputPlugin } from '@rollup/plugin-babel'
43
import packageJson from './package.json' assert { type: 'json' }
54

6-
const input = [
7-
'dist/lib/**/*.js',
8-
'dist/lib/**/index.js',
9-
'!**/*.spec.*',
10-
'!dist/lib/l2/**/*',
11-
]
12-
const inputL2 = [
13-
'dist/lib/l2/**/*.js',
14-
'dist/lib/l2/**/index.js',
15-
'!**/*.spec.*',
16-
]
17-
const plugins = [multi(), nodeResolve({ modulesOnly: true })]
5+
const plugins = [nodeResolve({ modulesOnly: true })]
186
const pluginsCjs = [
197
...plugins,
208
getBabelOutputPlugin({
@@ -40,7 +28,7 @@ const mode = _mode === '--esm' ? 'es' : _mode === '--cjs' ? 'cjs' : undefined
4028

4129
export default [
4230
{
43-
input,
31+
input: 'dist/lib/index.js',
4432
external,
4533
output: [
4634
{
@@ -51,7 +39,7 @@ export default [
5139
plugins,
5240
},
5341
{
54-
input,
42+
input: 'dist/lib/index.js',
5543
external,
5644
output: [
5745
{
@@ -63,7 +51,7 @@ export default [
6351
},
6452
{
6553
external,
66-
input: inputL2,
54+
input: 'dist/lib/l2/index.js',
6755
output: [
6856
{
6957
file: './l2/index.mjs',
@@ -74,7 +62,7 @@ export default [
7462
},
7563
{
7664
external,
77-
input: inputL2,
65+
input: 'dist/lib/l2/index.js',
7866
output: [
7967
{
8068
file: './l2/index.js',

yarn.lock

+2-23
Original file line numberDiff line numberDiff line change
@@ -1515,14 +1515,6 @@
15151515
"@babel/helper-module-imports" "^7.18.6"
15161516
"@rollup/pluginutils" "^5.0.1"
15171517

1518-
1519-
version "6.0.1"
1520-
resolved "https://registry.yarnpkg.com/@rollup/plugin-multi-entry/-/plugin-multi-entry-6.0.1.tgz#0f969706ea705dc76c4566ee1318251247832549"
1521-
integrity sha512-AXm6toPyTSfbYZWghQGbom1Uh7dHXlrGa+HoiYNhQtDUE3Q7LqoUYdVQx9E1579QWS1uOiu+cZRSE4okO7ySgw==
1522-
dependencies:
1523-
"@rollup/plugin-virtual" "^3.0.0"
1524-
matched "^5.0.1"
1525-
15261518
15271519
version "15.2.3"
15281520
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz#e5e0b059bd85ca57489492f295ce88c2d4b0daf9"
@@ -1535,11 +1527,6 @@
15351527
is-module "^1.0.0"
15361528
resolve "^1.22.1"
15371529

1538-
"@rollup/plugin-virtual@^3.0.0":
1539-
version "3.0.1"
1540-
resolved "https://registry.yarnpkg.com/@rollup/plugin-virtual/-/plugin-virtual-3.0.1.tgz#cea7e489481cc0ca91516c047f8c53c1cfb1adf6"
1541-
integrity sha512-fK8O0IL5+q+GrsMLuACVNk2x21g3yaw+sG2qn16SnUd3IlBsQyvWxLMGHmCmXRMecPjGRSZ/1LmZB4rjQm68og==
1542-
15431530
"@rollup/pluginutils@^5.0.1":
15441531
version "5.0.2"
15451532
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33"
@@ -2925,7 +2912,7 @@ glob@^10.3.7:
29252912
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"
29262913
path-scurry "^1.10.1"
29272914

2928-
glob@^7.1.3, glob@^7.1.4, glob@^7.1.6:
2915+
glob@^7.1.3, glob@^7.1.4:
29292916
version "7.2.3"
29302917
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
29312918
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==
@@ -3971,14 +3958,6 @@ [email protected]:
39713958
dependencies:
39723959
tmpl "1.0.5"
39733960

3974-
matched@^5.0.1:
3975-
version "5.0.1"
3976-
resolved "https://registry.yarnpkg.com/matched/-/matched-5.0.1.tgz#620606d9dac6b7f4e955354b82e02ef4e3a62dc3"
3977-
integrity sha512-E1fhSTPRyhAlNaNvGXAgZQlq1hL0bgYMTk/6bktVlIhzUnX/SZs7296ACdVeNJE8xFNGSuvd9IpI7vSnmcqLvw==
3978-
dependencies:
3979-
glob "^7.1.6"
3980-
picomatch "^2.2.1"
3981-
39823961
memorystream@^0.3.1:
39833962
version "0.3.1"
39843963
resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2"
@@ -4276,7 +4255,7 @@ picocolors@^1.0.0:
42764255
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
42774256
integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==
42784257

4279-
picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1:
4258+
picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1:
42804259
version "2.3.1"
42814260
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
42824261
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==

0 commit comments

Comments
 (0)