Skip to content

Commit 2c2750c

Browse files
committed
Fixed issue exporting modules and preparing release
1 parent 1bf1104 commit 2c2750c

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "dop",
3-
"version": "1.2.0-rc1",
3+
"version": "1.2.0",
44
"main": "dist/dop.js",
55
"browser": "dist/dop.umd.js",
6+
"module": "src/",
67
"license": "MIT",
78
"url": "https://distributedobjectprotocol.org/",
89
"repository": {
@@ -49,7 +50,8 @@
4950
"testing": "npm test -- --watch"
5051
},
5152
"files": [
52-
"dist"
53+
"dist",
54+
"src"
5355
],
5456
"ava": {
5557
"files": [

rollup.config.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,33 @@ export default [
2020
input: 'src/index',
2121
external: ['ms'],
2222
output: [
23-
{ file: pkg.main, format: 'cjs' }
2423
// { file: pkg.module, format: 'es' }
24+
{
25+
file: pkg.main,
26+
format: 'cjs',
27+
exports: 'named',
28+
},
2529
],
26-
plugins: [json(), buble()]
30+
plugins: [json(), buble()],
2731
},
2832

2933
// dop.umd.js
3034
{
3135
input: 'src/index',
32-
output: { name: 'dop', file: pkg.browser, format: 'umd' },
36+
output: {
37+
name: 'dop',
38+
file: pkg.browser,
39+
format: 'umd',
40+
exports: 'named',
41+
},
3342
plugins: [
3443
json(),
3544
buble(),
3645
uglify({
3746
mangle: {
38-
reserved: Object.keys(dop.TYPE)
39-
}
40-
})
41-
]
42-
}
47+
reserved: Object.keys(dop.TYPE),
48+
},
49+
}),
50+
],
51+
},
4352
]

src/index.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,27 @@ function factory() {
5959
}
6060
}
6161

62-
export default factory()
62+
const dop = factory()
63+
const {
64+
encode,
65+
decode,
66+
applyPatch,
67+
createNode,
68+
createStore,
69+
addType,
70+
TYPE,
71+
} = dop
72+
73+
export default dop
74+
export {
75+
version,
76+
factory,
77+
merge,
78+
encode,
79+
decode,
80+
applyPatch,
81+
createNode,
82+
createStore,
83+
addType,
84+
TYPE,
85+
}

0 commit comments

Comments
 (0)