diff --git a/packages/@posva/vuefire-core/src/firestore/index.ts b/packages/@posva/vuefire-core/src/firestore/index.ts index 84b3ad20..9251e787 100644 --- a/packages/@posva/vuefire-core/src/firestore/index.ts +++ b/packages/@posva/vuefire-core/src/firestore/index.ts @@ -170,7 +170,7 @@ export function bindCollection( ) { const options = Object.assign({}, DEFAULT_OPTIONS, extraOptions) // fill default values // TODO support pathes? nested.obj.list (walkSet) - const array = options.wait ? [] : ops.set(vm, key, []) + const array = vm[key] const originalResolve = resolve let isResolved: boolean diff --git a/packages/@posva/vuefire-test-helpers/package.json b/packages/@posva/vuefire-test-helpers/package.json index 1e5460f8..6ca0e78f 100644 --- a/packages/@posva/vuefire-test-helpers/package.json +++ b/packages/@posva/vuefire-test-helpers/package.json @@ -28,7 +28,7 @@ }, "dependencies": { "firebase-mock": "^2.2.10", - "vue": "^2.6.11" + "vue": "3.0.7" }, "gitHead": "e3e2df3624572cec86ed861f2472df4d143f2265" } diff --git a/packages/@posva/vuefire-test-helpers/src/index.ts b/packages/@posva/vuefire-test-helpers/src/index.ts index f0a34198..e110a28f 100644 --- a/packages/@posva/vuefire-test-helpers/src/index.ts +++ b/packages/@posva/vuefire-test-helpers/src/index.ts @@ -1,10 +1,8 @@ -import Vue from 'vue' +import Vue, { nextTick } from 'vue' import { MockFirebase, MockedReference } from 'firebase-mock' import firebase from '../../../../node_modules/firebase/index' import { walkSet } from '@posva/vuefire-core' -Vue.config.productionTip = false -Vue.config.devtools = false export { Vue, MockFirebase, MockedReference } export * from './mock' @@ -62,7 +60,7 @@ export function delayUpdate(ref: firebase.firestore.DocumentReference, time = 0) export function tick() { return new Promise(resolve => { - Vue.nextTick(resolve) + nextTick(resolve) }) } diff --git a/packages/vuexfire/__tests__/firestore.spec.ts b/packages/vuexfire/__tests__/firestore.spec.ts index 30632e60..cf38ee29 100644 --- a/packages/vuexfire/__tests__/firestore.spec.ts +++ b/packages/vuexfire/__tests__/firestore.spec.ts @@ -1,15 +1,13 @@ -import Vuex from 'vuex' +import { createStore } from 'vuex' import { vuexfireMutations, firestoreAction } from '../src' import { db, tick, Vue, delayUpdate } from '@posva/vuefire-test-helpers' import firebase from 'firebase/app' import { FirestoreOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src' -Vue.use(Vuex) - describe('firestoreAction', () => { const item: any = null, items: any[] = [] - const store = new Vuex.Store<{ item: any; items: any[] }>({ + const store = createStore({ state: { item, items }, mutations: vuexfireMutations, actions: { diff --git a/packages/vuexfire/__tests__/options.spec.ts b/packages/vuexfire/__tests__/options.spec.ts index 45be7516..30718e10 100644 --- a/packages/vuexfire/__tests__/options.spec.ts +++ b/packages/vuexfire/__tests__/options.spec.ts @@ -1,15 +1,13 @@ -import Vuex from 'vuex' +import { createStore } from 'vuex' import { vuexfireMutations, firestoreAction } from '../src' import { db, tick, Vue } from '@posva/vuefire-test-helpers' import firebase from 'firebase/app' import { FirestoreOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src' -Vue.use(Vuex) - describe('firestoreAction', () => { const item: any = null, items: any[] = [] - const store = new Vuex.Store<{ item: any; items: any[] }>({ + const store = createStore({ state: { item, items }, mutations: vuexfireMutations, actions: { diff --git a/packages/vuexfire/__tests__/rtdb.spec.ts b/packages/vuexfire/__tests__/rtdb.spec.ts index e2d67ffc..2215424d 100644 --- a/packages/vuexfire/__tests__/rtdb.spec.ts +++ b/packages/vuexfire/__tests__/rtdb.spec.ts @@ -1,18 +1,16 @@ -import Vuex from 'vuex' +import { createStore } from 'vuex' import { firebaseAction, vuexfireMutations } from '../src' import { MockFirebase, tick, Vue } from '@posva/vuefire-test-helpers' import firebase from 'firebase/app' import { RTDBOptions } from '@posva/vuefire-core/dist/packages/@posva/vuefire-core/src' -Vue.use(Vuex) - const db = new MockFirebase().child('data') describe('RTDB: firebaseAction', () => { const item: any = null, items: any[] = [] - const store = new Vuex.Store<{ item: any; items: any[] }>({ + const store = createStore({ state: { items, item }, mutations: vuexfireMutations, actions: { diff --git a/packages/vuexfire/package.json b/packages/vuexfire/package.json index 937fec56..768975af 100644 --- a/packages/vuexfire/package.json +++ b/packages/vuexfire/package.json @@ -1,7 +1,7 @@ { - "name": "vuexfire", + "name": "@xquick-code/vuexfire", "version": "3.2.5", - "description": "Firestore binding for Vuex", + "description": "Fork of vuexfire package - supports vuex@4 and vue@3", "main": "dist/vuexfire.common.js", "module": "dist/vuexfire.esm.js", "unpkg": "dist/vuexfire.js", @@ -11,6 +11,7 @@ "files": [ "src", "dist", + "package.json", "LICENSE" ], "scripts": { @@ -52,7 +53,7 @@ "homepage": "https://github.com/vuejs/vuefire#readme", "devDependencies": { "@posva/vuefire-test-helpers": "^1.2.3", - "vuex": "^3.1.1" + "vuex": "^4.0.0" }, "dependencies": { "@posva/vuefire-core": "^2.3.4" diff --git a/yarn.lock b/yarn.lock index 7854af63..9841e38f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -250,6 +250,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== +"@babel/helper-validator-identifier@^7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" + integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== + "@babel/helper-validator-identifier@^7.9.5": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" @@ -288,6 +293,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.5.tgz#cbf45321619ac12d83363fcf9c94bb67fa646d71" integrity sha512-KNlOe9+/nk4i29g0VXgl8PEXIRms5xKLJeuZ6UptN0fHv+jDiriG+y94X6qAgWTR0h3KaoM1wK5G5h7MHFRSig== +"@babel/parser@^7.12.0": + version "7.13.10" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.10.tgz#8f8f9bf7b3afa3eabd061f7a5bcdf4fec3c48409" + integrity sha512-0s7Mlrw9uTWkYua7xWr99Wpk2bnGa0ANleKfksYAES8LpWH4gW1OUr42vqKNf0us5UQNfru2wPqMqRITzq/SIQ== + "@babel/parser@^7.7.4", "@babel/parser@^7.7.5", "@babel/parser@^7.8.3", "@babel/parser@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8" @@ -860,6 +870,15 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@babel/types@^7.12.0": + version "7.13.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.0.tgz#74424d2816f0171b4100f0ab34e9a374efdf7f80" + integrity sha512-hE+HE8rnG1Z6Wzo+MhaKE5lM5eMx71T4EHJgku2E3xIfaULhDcxiiRxUYgwX8qwP1BBSlag+TdGOt6JAidIZTA== + dependencies: + "@babel/helper-validator-identifier" "^7.12.11" + lodash "^4.17.19" + to-fast-properties "^2.0.0" + "@babel/types@^7.3.3", "@babel/types@^7.8.6": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.9.5.tgz#89231f82915a8a566a703b3b20133f73da6b9444" @@ -2683,6 +2702,25 @@ "@vue/babel-plugin-transform-vue-jsx" "^1.1.2" camelcase "^5.0.0" +"@vue/compiler-core@3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.0.7.tgz#421782a4c67cc3f2b7c30457ef446d74f8524f74" + integrity sha512-JFohgBXoyUc3mdeI2WxlhjQZ5fakfemJkZHX8Gu/nFbEg3+lKVUZmNKWmmnp9aOzJQZKoj77LjmFxiP+P+7lMQ== + dependencies: + "@babel/parser" "^7.12.0" + "@babel/types" "^7.12.0" + "@vue/shared" "3.0.7" + estree-walker "^2.0.1" + source-map "^0.6.1" + +"@vue/compiler-dom@3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.0.7.tgz#54d2e12fb9a7aff53abd19dac2c2679533f0c919" + integrity sha512-VnIH9EbWQm/Tkcp+8dCaNVsVvhm/vxCrIKWRkXY9215hTqOqQOvejT8IMjd2kc++nIsYMsdQk6H9qqBvoLe/Cw== + dependencies: + "@vue/compiler-core" "3.0.7" + "@vue/shared" "3.0.7" + "@vue/component-compiler-utils@^3.1.0": version "3.1.1" resolved "https://registry.yarnpkg.com/@vue/component-compiler-utils/-/component-compiler-utils-3.1.1.tgz#d4ef8f80292674044ad6211e336a302e4d2a6575" @@ -2698,6 +2736,35 @@ source-map "~0.6.1" vue-template-es2015-compiler "^1.9.0" +"@vue/reactivity@3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.0.7.tgz#e6ccc7bef7fc10b0972e4d974bad71679d3b26ad" + integrity sha512-FotWcNNaKhqpFZrdgsUOZ1enlJ5lhTt01CNTtLSyK7jYFgZBTuw8vKsEutZKDYZ1XKotOfoeO8N3pZQqmM6Etw== + dependencies: + "@vue/shared" "3.0.7" + +"@vue/runtime-core@3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.0.7.tgz#d44c0b0a57d7e392912a87362a4430ccf446ecea" + integrity sha512-DBAZAwVvdmMXuyd6/9qqj/kYr/GaLTmn1L2/QLxLwP+UfhIboiTSBc/tUUb8MRk7Bb98GzNeAWkkT6AfooS3dQ== + dependencies: + "@vue/reactivity" "3.0.7" + "@vue/shared" "3.0.7" + +"@vue/runtime-dom@3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.0.7.tgz#b70668d729020bc4ad608c20367223f259576ba6" + integrity sha512-Oij4ruOtnpQpCj+/Q3JPzgpTJ1Q7+N67pA53A8KVITEtxfvKL46NN6dhAZ5NGqwX6RWZpYqWQNewITeF0pHr8g== + dependencies: + "@vue/runtime-core" "3.0.7" + "@vue/shared" "3.0.7" + csstype "^2.6.8" + +"@vue/shared@3.0.7": + version "3.0.7" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.7.tgz#96d52988efc07444c108c7c6803ba7cc93e40045" + integrity sha512-dn5FyfSc4ky424jH4FntiHno7Ss5yLkqKNmM/NXwANRnlkmqu74pnGetexDFVG5phMk9/FhwovUZCWGxsotVKg== + "@vuepress/core@1.8.2": version "1.8.2" resolved "https://registry.yarnpkg.com/@vuepress/core/-/core-1.8.2.tgz#4f5bafc894691bfea4146294a582a129483daf2a" @@ -5183,6 +5250,11 @@ cssstyle@^2.0.0: dependencies: cssom "~0.3.6" +csstype@^2.6.8: + version "2.6.16" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.16.tgz#544d69f547013b85a40d15bff75db38f34fe9c39" + integrity sha512-61FBWoDHp/gRtsoDkq/B1nWrCUG/ok1E3tUrcNbZjsE9Cxd9yzUirjS3+nAATB8U4cTtaQmAHbNndoFz5L6C9Q== + currently-unhandled@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/currently-unhandled/-/currently-unhandled-0.4.1.tgz#988df33feab191ef799a61369dd76c17adf957ea" @@ -14163,7 +14235,16 @@ vue-toasted@^1.1.25: resolved "https://registry.yarnpkg.com/vue-toasted/-/vue-toasted-1.1.27.tgz#ce0a74b875f90c2e4a9e163cce6d5fc37d78a07c" integrity sha512-GVbwInwnqkVxQ4GU/XYeQt1e0dAXL8sF5Hr1H/coCBbYUan5xP0G2mEz/HRDf1lt73rFQAN/bJcLTOKkqiM6tg== -vue@^2.6.10, vue@^2.6.11: +vue@3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/vue/-/vue-3.0.7.tgz#8bcff51f8be570f9e4ce8cc5f52e2ab0fe3c74a1" + integrity sha512-8h4TikD+JabbMK9aRlBO4laG0AtNHRPHynxYgWZ9sq1YUPfzynd9Jeeb27XNyZytC7aCQRX9xe1+TQJuc181Tw== + dependencies: + "@vue/compiler-dom" "3.0.7" + "@vue/runtime-dom" "3.0.7" + "@vue/shared" "3.0.7" + +vue@^2.6.10: version "2.6.12" resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123" integrity sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg== @@ -14207,10 +14288,10 @@ vuepress@^1.1.0: opencollective-postinstall "^2.0.2" update-notifier "^4.0.0" -vuex@^3.1.1: - version "3.6.2" - resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71" - integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw== +vuex@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/vuex/-/vuex-4.0.0.tgz#ac877aa76a9c45368c979471e461b520d38e6cf5" + integrity sha512-56VPujlHscP5q/e7Jlpqc40sja4vOhC4uJD1llBCWolVI8ND4+VzisDVkUMl+z5y0MpIImW6HjhNc+ZvuizgOw== w3c-hr-time@^1.0.1: version "1.0.1"