Remove lodash to reduce final size (#251)
This commit is contained in:
committed by
Guillaume Chau
parent
937094cfcc
commit
fccb313293
Vendored
+180
-2328
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+180
-2328
File diff suppressed because it is too large
Load Diff
Generated
+6428
File diff suppressed because it is too large
Load Diff
+1
-3
@@ -36,9 +36,7 @@
|
||||
"apollo-client": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"lodash.omit": "^4.5.0",
|
||||
"lodash.throttle": "^4.1.1"
|
||||
"throttle-debounce": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/graphql": "^0.12.3",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import omit from 'lodash.omit'
|
||||
import { VUE_APOLLO_QUERY_KEYWORDS } from './consts'
|
||||
import { getMergedDefinition } from './utils'
|
||||
import { getMergedDefinition, omit } from './utils'
|
||||
|
||||
export class ApolloProvider {
|
||||
constructor (options) {
|
||||
|
||||
+3
-4
@@ -1,10 +1,9 @@
|
||||
import omit from 'lodash.omit'
|
||||
import { DollarApollo } from './dollar-apollo'
|
||||
import { ApolloProvider as apolloProvider } from './apollo-provider'
|
||||
import CApolloQuery from './components/ApolloQuery'
|
||||
import CApolloSubscribeToMore from './components/ApolloSubscribeToMore'
|
||||
import CApolloMutation from './components/ApolloMutation'
|
||||
import { Globals } from './utils'
|
||||
import { Globals, omit } from './utils'
|
||||
|
||||
const keywords = [
|
||||
'$subscribe',
|
||||
@@ -52,8 +51,8 @@ const launch = function launch () {
|
||||
for (let key in apollo) {
|
||||
if (key.charAt(0) !== '$') {
|
||||
let options = apollo[key]
|
||||
if(apollo.$query) {
|
||||
options = Object.assign({}, apollo.$query, options)
|
||||
if (apollo.$query) {
|
||||
options = Object.assign({}, apollo.$query, options)
|
||||
}
|
||||
if (!hasProperty(this, key) && !hasProperty(this.$props, key) && !hasProperty(this.$data, key)) {
|
||||
Object.defineProperty(this, key, {
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
import omit from 'lodash.omit'
|
||||
import { throttle, debounce } from './utils'
|
||||
import { throttle, debounce, omit } from './utils'
|
||||
|
||||
export default class SmartApollo {
|
||||
type = null
|
||||
|
||||
+11
-11
@@ -1,21 +1,15 @@
|
||||
import loThrottle from 'lodash.throttle'
|
||||
import loDebounce from 'lodash.debounce'
|
||||
import oThrottle from 'throttle-debounce/throttle'
|
||||
import oDebounce from 'throttle-debounce/debounce'
|
||||
|
||||
export const Globals = {}
|
||||
|
||||
function factory (action) {
|
||||
return (cb, options) => {
|
||||
if (typeof options === 'number') {
|
||||
return action(cb, options)
|
||||
} else {
|
||||
return action(cb, options.wait, options)
|
||||
}
|
||||
}
|
||||
return (cb, time) => action(time. cb)
|
||||
}
|
||||
|
||||
export const throttle = factory(loThrottle)
|
||||
export const throttle = factory(oThrottle)
|
||||
|
||||
export const debounce = factory(loDebounce)
|
||||
export const debounce = factory(oDebounce)
|
||||
|
||||
export function getMergedDefinition (def) {
|
||||
return Globals.Vue.util.mergeOptions({}, def)
|
||||
@@ -27,3 +21,9 @@ export function reapply (options, context) {
|
||||
}
|
||||
return options
|
||||
}
|
||||
|
||||
export function omit(obj, properties) {
|
||||
return Object.entries(obj)
|
||||
.filter(([key]) => !properties.includes(key))
|
||||
.reduce((c, [key, val]) => (c[key] = val, c), {})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user