Browse Source

build: update dev dependencies

dev
Evan You 7 years ago
parent
commit
4e00688e4a
  1. 2753
      package-lock.json
  2. 18
      package.json
  3. 2
      src/compiler/codegen/index.js
  4. 10
      src/core/instance/inject.js
  5. 3
      src/core/observer/array.js
  6. 22
      src/platforms/web/compiler/directives/model.js
  7. 5
      src/server/template-renderer/index.js
  8. 2
      src/sfc/parser.js
  9. 11
      test/unit/features/component/component.spec.js
  10. 4
      test/unit/features/debug.spec.js
  11. 4
      test/unit/features/options/delimiters.spec.js
  12. 4
      test/unit/modules/compiler/codegen.spec.js
  13. 84
      test/unit/modules/compiler/compiler-options.spec.js
  14. 8
      test/unit/modules/compiler/parser.spec.js
  15. 12
      test/unit/modules/vdom/patch/edge-cases.spec.js

2753
package-lock.json

File diff suppressed because it is too large

18
package.json

@ -60,7 +60,7 @@
"@types/node": "^8.0.33", "@types/node": "^8.0.33",
"@types/webpack": "^3.0.13", "@types/webpack": "^3.0.13",
"babel-core": "^6.25.0", "babel-core": "^6.25.0",
"babel-eslint": "^7.2.3", "babel-eslint": "^8.0.3",
"babel-helper-vue-jsx-merge-props": "^2.0.2", "babel-helper-vue-jsx-merge-props": "^2.0.2",
"babel-loader": "^7.0.0", "babel-loader": "^7.0.0",
"babel-plugin-istanbul": "^4.1.4", "babel-plugin-istanbul": "^4.1.4",
@ -69,8 +69,8 @@
"babel-plugin-transform-vue-jsx": "^3.4.3", "babel-plugin-transform-vue-jsx": "^3.4.3",
"babel-preset-es2015": "^6.24.1", "babel-preset-es2015": "^6.24.1",
"babel-preset-flow-vue": "^1.0.0", "babel-preset-flow-vue": "^1.0.0",
"buble": "^0.16.0", "buble": "^0.18.0",
"chalk": "^1.1.3", "chalk": "^2.3.0",
"chromedriver": "^2.30.1", "chromedriver": "^2.30.1",
"codecov.io": "^0.1.6", "codecov.io": "^0.1.6",
"commitizen": "^2.9.6", "commitizen": "^2.9.6",
@ -79,12 +79,12 @@
"cz-conventional-changelog": "^2.0.0", "cz-conventional-changelog": "^2.0.0",
"de-indent": "^1.0.2", "de-indent": "^1.0.2",
"es6-promise": "^4.1.0", "es6-promise": "^4.1.0",
"eslint": "^3.0.0", "eslint": "^4.13.1",
"eslint-loader": "^1.7.1", "eslint-loader": "^1.7.1",
"eslint-plugin-flowtype": "^2.34.0", "eslint-plugin-flowtype": "^2.34.0",
"eslint-plugin-jasmine": "^2.8.4", "eslint-plugin-jasmine": "^2.8.4",
"eslint-plugin-vue-libs": "^1.2.0", "eslint-plugin-vue-libs": "^2.0.1",
"file-loader": "^0.11.2", "file-loader": "^1.1.5",
"flow-bin": "^0.54.0", "flow-bin": "^0.54.0",
"hash-sum": "^1.0.2", "hash-sum": "^1.0.2",
"he": "^1.1.1", "he": "^1.1.1",
@ -110,10 +110,10 @@
"nightwatch-helpers": "^1.2.0", "nightwatch-helpers": "^1.2.0",
"phantomjs-prebuilt": "^2.1.14", "phantomjs-prebuilt": "^2.1.14",
"resolve": "^1.3.3", "resolve": "^1.3.3",
"rollup": "^0.50.0", "rollup": "^0.52.1",
"rollup-plugin-alias": "^1.3.1", "rollup-plugin-alias": "^1.3.1",
"rollup-plugin-babel": "^3.0.2", "rollup-plugin-babel": "^3.0.2",
"rollup-plugin-buble": "^0.16.0", "rollup-plugin-buble": "^0.18.0",
"rollup-plugin-commonjs": "^8.0.2", "rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-flow-no-whitespace": "^1.0.0", "rollup-plugin-flow-no-whitespace": "^1.0.0",
"rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-node-resolve": "^3.0.0",
@ -124,7 +124,7 @@
"shelljs": "^0.7.8", "shelljs": "^0.7.8",
"typescript": "^2.6.1", "typescript": "^2.6.1",
"uglify-js": "^3.0.15", "uglify-js": "^3.0.15",
"webpack": "^2.6.1", "webpack": "^3.10.0",
"weex-js-runtime": "^0.23.0", "weex-js-runtime": "^0.23.0",
"weex-styler": "^0.3.0" "weex-styler": "^0.3.0"
}, },

2
src/compiler/codegen/index.js

@ -353,7 +353,7 @@ function genScopedSlot (
? `${el.if}?${genChildren(el, state) || 'undefined'}:undefined` ? `${el.if}?${genChildren(el, state) || 'undefined'}:undefined`
: genChildren(el, state) || 'undefined' : genChildren(el, state) || 'undefined'
: genElement(el, state) : genElement(el, state)
}}` }}`
return `{key:${key},fn:${fn}}` return `{key:${key},fn:${fn}}`
} }

10
src/core/instance/inject.js

@ -41,11 +41,11 @@ export function resolveInject (inject: any, vm: Component): ?Object {
// inject is :any because flow is not smart enough to figure out cached // inject is :any because flow is not smart enough to figure out cached
const result = Object.create(null) const result = Object.create(null)
const keys = hasSymbol const keys = hasSymbol
? Reflect.ownKeys(inject).filter(key => { ? Reflect.ownKeys(inject).filter(key => {
/* istanbul ignore next */ /* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable return Object.getOwnPropertyDescriptor(inject, key).enumerable
}) })
: Object.keys(inject) : Object.keys(inject)
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
const key = keys[i] const key = keys[i]

3
src/core/observer/array.js

@ -19,8 +19,7 @@ export const arrayMethods = Object.create(arrayProto)
'splice', 'splice',
'sort', 'sort',
'reverse' 'reverse'
] ].forEach(function (method) {
.forEach(function (method) {
// cache original method // cache original method
const original = arrayProto[method] const original = arrayProto[method]
def(arrayMethods, method, function mutator (...args) { def(arrayMethods, method, function mutator (...args) {

22
src/platforms/web/compiler/directives/model.js

@ -73,11 +73,11 @@ function genCheckboxModel (
const falseValueBinding = getBindingAttr(el, 'false-value') || 'false' const falseValueBinding = getBindingAttr(el, 'false-value') || 'false'
addProp(el, 'checked', addProp(el, 'checked',
`Array.isArray(${value})` + `Array.isArray(${value})` +
`?_i(${value},${valueBinding})>-1` + ( `?_i(${value},${valueBinding})>-1` + (
trueValueBinding === 'true' trueValueBinding === 'true'
? `:(${value})` ? `:(${value})`
: `:_q(${value},${trueValueBinding})` : `:_q(${value},${trueValueBinding})`
) )
) )
addHandler(el, 'change', addHandler(el, 'change',
`var $$a=${value},` + `var $$a=${value},` +
@ -94,9 +94,9 @@ function genCheckboxModel (
} }
function genRadioModel ( function genRadioModel (
el: ASTElement, el: ASTElement,
value: string, value: string,
modifiers: ?ASTModifiers modifiers: ?ASTModifiers
) { ) {
const number = modifiers && modifiers.number const number = modifiers && modifiers.number
let valueBinding = getBindingAttr(el, 'value') || 'null' let valueBinding = getBindingAttr(el, 'value') || 'null'
@ -106,9 +106,9 @@ function genRadioModel (
} }
function genSelect ( function genSelect (
el: ASTElement, el: ASTElement,
value: string, value: string,
modifiers: ?ASTModifiers modifiers: ?ASTModifiers
) { ) {
const number = modifiers && modifiers.number const number = modifiers && modifiers.number
const selectedVal = `Array.prototype.filter` + const selectedVal = `Array.prototype.filter` +

5
src/server/template-renderer/index.js

@ -191,13 +191,12 @@ export default class TemplateRenderer {
contextKey = 'state', contextKey = 'state',
windowKey = '__INITIAL_STATE__' windowKey = '__INITIAL_STATE__'
} = options || {} } = options || {}
const state = serialize(context[contextKey], { isJSON: true })
const autoRemove = process.env.NODE_ENV === 'production' const autoRemove = process.env.NODE_ENV === 'production'
? ';(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());' ? ';(function(){var s;(s=document.currentScript||document.scripts[document.scripts.length-1]).parentNode.removeChild(s);}());'
: '' : ''
return context[contextKey] return context[contextKey]
? `<script>window.${windowKey}=${ ? `<script>window.${windowKey}=${state}${autoRemove}</script>`
serialize(context[contextKey], { isJSON: true })
}${autoRemove}</script>`
: '' : ''
} }

2
src/sfc/parser.js

@ -19,7 +19,7 @@ type Attribute = {
export function parseComponent ( export function parseComponent (
content: string, content: string,
options?: Object = {} options?: Object = {}
): SFCDescriptor { ): SFCDescriptor {
const sfc: SFCDescriptor = { const sfc: SFCDescriptor = {
template: null, template: null,
script: null, script: null,

11
test/unit/features/component/component.spec.js

@ -106,10 +106,10 @@ describe('Component', () => {
expect(vm.$el.outerHTML).toBe('<div view="view-b">bar b</div>') expect(vm.$el.outerHTML).toBe('<div view="view-b">bar b</div>')
vm.view = '' vm.view = ''
}) })
.then(() => { .then(() => {
expect(vm.$el.nodeType).toBe(8) expect(vm.$el.nodeType).toBe(8)
expect(vm.$el.data).toBe('') expect(vm.$el.data).toBe('')
}).then(done) }).then(done)
}) })
it('dynamic with props', done => { it('dynamic with props', done => {
@ -134,8 +134,7 @@ describe('Component', () => {
waitForUpdate(() => { waitForUpdate(() => {
expect(vm.$el.outerHTML).toBe('<div>bar view-b</div>') expect(vm.$el.outerHTML).toBe('<div>bar view-b</div>')
vm.view = '' vm.view = ''
}) }).then(() => {
.then(() => {
expect(vm.$el.nodeType).toBe(8) expect(vm.$el.nodeType).toBe(8)
expect(vm.$el.data).toBe('') expect(vm.$el.data).toBe('')
}).then(done) }).then(done)

4
test/unit/features/debug.spec.js

@ -41,7 +41,7 @@ describe('Debug utilities', () => {
}).$mount() }).$mount()
expect( expect(
`Failed to mount component: template or render function not defined. `Failed to mount component: template or render function not defined.
found in found in
@ -70,7 +70,7 @@ found in
}).$mount() }).$mount()
expect( expect(
`Failed to mount component: template or render function not defined. `Failed to mount component: template or render function not defined.
found in found in

4
test/unit/features/options/delimiters.spec.js

@ -82,7 +82,7 @@ describe('Delimiters', () => {
}).$mount() }).$mount()
expect(vm.$el.textContent).toEqual('1 - 2') expect(vm.$el.textContent).toEqual('1 - 2')
// restore default options // restore default options
delete Vue.options.delimiters delete Vue.options.delimiters
}) })
@ -110,7 +110,7 @@ describe('Delimiters', () => {
}).$mount() }).$mount()
expect(vm.$el.textContent).toEqual('1 - 2') expect(vm.$el.textContent).toEqual('1 - 2')
// restore default options // restore default options
delete Vue.options.delimiters delete Vue.options.delimiters
}) })
}) })

4
test/unit/modules/compiler/codegen.spec.js

@ -104,8 +104,8 @@ describe('codegen', () => {
it('generate multi v-else-if with v-else directive', () => { it('generate multi v-else-if with v-else directive', () => {
assertCodegen( assertCodegen(
'<div><p v-if="show">hello</p><p v-else-if="hide">world</p><p v-else-if="3">elseif</p><p v-else>bye</p></div>', '<div><p v-if="show">hello</p><p v-else-if="hide">world</p><p v-else-if="3">elseif</p><p v-else>bye</p></div>',
`with(this){return _c('div',[(show)?_c('p',[_v("hello")]):(hide)?_c('p',[_v("world")]):(3)?_c('p',[_v("elseif")]):_c('p',[_v("bye")])])}` `with(this){return _c('div',[(show)?_c('p',[_v("hello")]):(hide)?_c('p',[_v("world")]):(3)?_c('p',[_v("elseif")]):_c('p',[_v("bye")])])}`
) )
}) })

84
test/unit/modules/compiler/compiler-options.spec.js

@ -9,58 +9,58 @@ describe('compile options', () => {
<input type="text" v-model="msg" required max="8" v-validate:field1.group1.group2> <input type="text" v-model="msg" required max="8" v-validate:field1.group1.group2>
</div> </div>
`, { `, {
directives: { directives: {
validate (el, dir) { validate (el, dir) {
if (dir.name === 'validate' && dir.arg) { if (dir.name === 'validate' && dir.arg) {
el.validate = { el.validate = {
field: dir.arg, field: dir.arg,
groups: dir.modifiers ? Object.keys(dir.modifiers) : [] groups: dir.modifiers ? Object.keys(dir.modifiers) : []
}
} }
} }
}
},
modules: [{
transformNode (el) {
el.validators = el.validators || []
const validators = ['required', 'min', 'max', 'pattern', 'maxlength', 'minlength']
validators.forEach(name => {
const rule = getAndRemoveAttr(el, name)
if (rule !== undefined) {
el.validators.push({ name, rule })
}
})
}, },
genData (el) { modules: [{
let data = '' transformNode (el) {
if (el.validate) { el.validators = el.validators || []
data += `validate:${JSON.stringify(el.validate)},` const validators = ['required', 'min', 'max', 'pattern', 'maxlength', 'minlength']
} validators.forEach(name => {
if (el.validators) { const rule = getAndRemoveAttr(el, name)
data += `validators:${JSON.stringify(el.validators)},` if (rule !== undefined) {
} el.validators.push({ name, rule })
return data }
}, })
transformCode (el, code) { },
genData (el) {
let data = ''
if (el.validate) {
data += `validate:${JSON.stringify(el.validate)},`
}
if (el.validators) {
data += `validators:${JSON.stringify(el.validators)},`
}
return data
},
transformCode (el, code) {
// check // check
if (!el.validate || !el.validators) { if (!el.validate || !el.validators) {
return code return code
} }
// setup validation result props // setup validation result props
const result = { dirty: false } // define something other prop const result = { dirty: false } // define something other prop
el.validators.forEach(validator => { el.validators.forEach(validator => {
result[validator.name] = null result[validator.name] = null
}) })
// generate code // generate code
return `_c('validate',{props:{ return `_c('validate',{props:{
field:${JSON.stringify(el.validate.field)}, field:${JSON.stringify(el.validate.field)},
groups:${JSON.stringify(el.validate.groups)}, groups:${JSON.stringify(el.validate.groups)},
validators:${JSON.stringify(el.validators)}, validators:${JSON.stringify(el.validators)},
result:${JSON.stringify(result)}, result:${JSON.stringify(result)},
child:${code}} child:${code}}
})` })`
} }
}] }]
}) })
expect(render).not.toBeUndefined() expect(render).not.toBeUndefined()
expect(staticRenderFns).toEqual([]) expect(staticRenderFns).toEqual([])
expect(errors).toEqual([]) expect(errors).toEqual([])

8
test/unit/modules/compiler/parser.spec.js

@ -123,7 +123,7 @@ describe('parser', () => {
it('not warn 3 root elements with v-if, v-else-if and v-else', () => { it('not warn 3 root elements with v-if, v-else-if and v-else', () => {
parse('<div v-if="1"></div><div v-else-if="2"></div><div v-else></div>', baseOptions) parse('<div v-if="1"></div><div v-else-if="2"></div><div v-else></div>', baseOptions)
expect('Component template should contain exactly one root element') expect('Component template should contain exactly one root element')
.not.toHaveBeenWarned() .not.toHaveBeenWarned()
}) })
it('not warn 2 root elements with v-if and v-else on separate lines', () => { it('not warn 2 root elements with v-if and v-else on separate lines', () => {
@ -142,7 +142,7 @@ describe('parser', () => {
<div v-else></div> <div v-else></div>
`, baseOptions) `, baseOptions)
expect('Component template should contain exactly one root element') expect('Component template should contain exactly one root element')
.not.toHaveBeenWarned() .not.toHaveBeenWarned()
parse(` parse(`
<div v-if="1"></div> <div v-if="1"></div>
@ -152,7 +152,7 @@ describe('parser', () => {
<div v-else></div> <div v-else></div>
`, baseOptions) `, baseOptions)
expect('Component template should contain exactly one root element') expect('Component template should contain exactly one root element')
.not.toHaveBeenWarned() .not.toHaveBeenWarned()
}) })
it('generate correct ast for 2 root elements with v-if and v-else on separate lines', () => { it('generate correct ast for 2 root elements with v-if and v-else on separate lines', () => {
@ -219,7 +219,7 @@ describe('parser', () => {
it('warn 2 root elements with v-if and v-else-if with v-for on 2nd', () => { it('warn 2 root elements with v-if and v-else-if with v-for on 2nd', () => {
parse('<div v-if="1"></div><div v-else-if="2" v-for="i in [1]"></div>', baseOptions) parse('<div v-if="1"></div><div v-else-if="2" v-for="i in [1]"></div>', baseOptions)
expect('Cannot use v-for on stateful component root element because it renders multiple elements') expect('Cannot use v-for on stateful component root element because it renders multiple elements')
.toHaveBeenWarned() .toHaveBeenWarned()
}) })
it('warn <template> as root element', () => { it('warn <template> as root element', () => {

12
test/unit/modules/vdom/patch/edge-cases.spec.js

@ -96,23 +96,19 @@ describe('vdom patch: edge cases', () => {
expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode) expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode)
expect(vm.$el.innerHTML).toBe('<div>row</div><a>atag</a>') expect(vm.$el.innerHTML).toBe('<div>row</div><a>atag</a>')
vm.swap = false vm.swap = false
}) }).then(() => {
.then(() => {
expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode) expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode)
expect(vm.$el.innerHTML).toBe('<a>atag</a><div>row</div>') expect(vm.$el.innerHTML).toBe('<a>atag</a><div>row</div>')
compVm.swap = false compVm.swap = false
}) }).then(() => {
.then(() => {
expect(vm.$el.innerHTML).toBe('<span>span</span><div>row</div>') expect(vm.$el.innerHTML).toBe('<span>span</span><div>row</div>')
expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode) expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode)
vm.swap = true vm.swap = true
}) }).then(() => {
.then(() => {
expect(vm.$el.innerHTML).toBe('<div>row</div><span>span</span>') expect(vm.$el.innerHTML).toBe('<div>row</div><span>span</span>')
expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode) expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode)
vm.swap = true vm.swap = true
}) }).then(done)
.then(done)
}) })
// #4530 // #4530

Loading…
Cancel
Save