Skip to content

Commit bd193d5

Browse files
committed
build: update deps + adjust build setup
1 parent 48484a7 commit bd193d5

File tree

9 files changed

+3856
-5501
lines changed

9 files changed

+3856
-5501
lines changed

package-lock.json

Lines changed: 0 additions & 5469 deletions
This file was deleted.

package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "5.0.0",
44
"description": "RxJS bindings for Vue",
55
"main": "dist/vue-rx.js",
6+
"module": "dist/vue-rx.esm.js",
67
"files": [
78
"dist",
89
"types/*.d.ts"
@@ -36,16 +37,17 @@
3637
"prepublishOnly": "npm run build"
3738
},
3839
"devDependencies": {
39-
"buble": "^0.16.0",
40-
"eslint": "^3.0.0",
41-
"eslint-plugin-vue-libs": "^1.2.0",
42-
"jest": "^21.2.1",
43-
"rollup": "^0.50.0",
44-
"rollup-plugin-buble": "^0.16.0",
40+
"buble": "^0.19.3",
41+
"eslint": "^4.19.1",
42+
"eslint-plugin-vue-libs": "^3.0.0",
43+
"jest": "^23.1.0",
44+
"rollup": "^0.59.4",
45+
"rollup-plugin-alias": "^1.4.0",
46+
"rollup-plugin-buble": "^0.19.2",
4547
"rollup-watch": "^4.3.1",
4648
"rxjs": "^6.2.0",
47-
"typescript": "^2.5.2",
48-
"vue": "^2.5.0"
49+
"typescript": "^2.8.2",
50+
"vue": "^2.5.16"
4951
},
5052
"eslintConfig": {
5153
"root": true,

rollup.config.js

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1+
const alias = require('rollup-plugin-alias')
12
const buble = require('rollup-plugin-buble')
23

3-
module.exports = {
4-
input: 'src/index.js',
5-
output: {
6-
file: 'dist/vue-rx.js',
7-
format: 'umd',
8-
name: 'VueRx',
4+
module.exports = [
5+
{
6+
input: 'src/index.js',
7+
output: {
8+
file: 'dist/vue-rx.esm.js',
9+
format: 'es'
10+
},
11+
plugins: [buble()],
12+
external: [
13+
'rxjs',
14+
'rxjs/operators'
15+
]
916
},
10-
plugins: [buble()]
11-
}
17+
{
18+
input: 'src/index.js',
19+
output: {
20+
file: 'dist/vue-rx.js',
21+
format: 'umd',
22+
name: 'VueRx'
23+
},
24+
plugins: [
25+
buble(),
26+
alias({
27+
'rxjs/operators': 'src/umd-aliases/operators.js',
28+
'rxjs': 'src/umd-aliases/rxjs.js'
29+
})
30+
]
31+
}
32+
]

src/directives/stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default {
2727
}
2828

2929
var modifiersExists = Object.keys(modifiersFuncs).filter(
30-
key => modifiers[key]
30+
key => modifiers[key]
3131
)
3232

3333
const subject = handle.subject

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global Vue, Rx */
1+
/* global Vue */
22

33
import { install } from './util'
44
import rxMixin from './mixin'
@@ -9,8 +9,8 @@ import subscribeTo from './methods/subscribeTo'
99
import eventToObservable from './methods/eventToObservable'
1010
import createObservableMethod from './methods/createObservableMethod'
1111

12-
export default function VueRx (Vue, Rx) {
13-
install(Vue, Rx)
12+
export default function VueRx (Vue) {
13+
install(Vue)
1414
Vue.mixin(rxMixin)
1515
Vue.directive('stream', streamDirective)
1616
Vue.prototype.$watchAsObservable = watchAsObservable
@@ -21,6 +21,6 @@ export default function VueRx (Vue, Rx) {
2121
}
2222

2323
// auto install
24-
if (typeof Vue !== 'undefined' && typeof Rx !== 'undefined') {
25-
Vue.use(VueRx, Rx)
24+
if (typeof Vue !== 'undefined') {
25+
Vue.use(VueRx)
2626
}

src/umd-aliases/operators.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const operators = typeof require !== 'undefined'
2+
? require('rxjs/operators')
3+
: typeof window !== 'undefined' && window.rxjs
4+
? window.rxjs.operators
5+
: {}
6+
7+
const { share } = operators
8+
9+
export { share }

src/umd-aliases/rxjs.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const rxjs = typeof require !== 'undefined'
2+
? require('rxjs')
3+
: typeof window !== 'undefined'
4+
? window.rxjs
5+
: null
6+
7+
if (!rxjs) {
8+
throw new Error(`[vue-rx]: RxJS is not found.`)
9+
}
10+
11+
const {
12+
Observable,
13+
Subject,
14+
Subscription,
15+
fromEvent,
16+
NEVER
17+
} = rxjs
18+
19+
export {
20+
Observable,
21+
Subject,
22+
Subscription,
23+
fromEvent,
24+
NEVER
25+
}

test/test.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,11 @@ const Vue = require('vue/dist/vue.js')
66
const VueRx = require('../dist/vue-rx.js')
77

88
// library
9-
const { Observable, Subject, Subscription, fromEvent } = require('rxjs')
9+
const { Observable } = require('rxjs')
1010
const { map, scan, pluck, merge, tap, filter, startWith } = require('rxjs/operators')
1111

12-
Observable.fromEvent = fromEvent
13-
14-
const miniRx = {
15-
Observable,
16-
Subscription,
17-
Subject
18-
}
19-
2012
Vue.config.productionTip = false
21-
Vue.use(VueRx, miniRx)
13+
Vue.use(VueRx)
2214

2315
const nextTick = Vue.nextTick
2416

0 commit comments

Comments
 (0)