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/webpack": "^3.0.13",
"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-loader": "^7.0.0",
"babel-plugin-istanbul": "^4.1.4",
@ -69,8 +69,8 @@
"babel-plugin-transform-vue-jsx": "^3.4.3",
"babel-preset-es2015": "^6.24.1",
"babel-preset-flow-vue": "^1.0.0",
"buble": "^0.16.0",
"chalk": "^1.1.3",
"buble": "^0.18.0",
"chalk": "^2.3.0",
"chromedriver": "^2.30.1",
"codecov.io": "^0.1.6",
"commitizen": "^2.9.6",
@ -79,12 +79,12 @@
"cz-conventional-changelog": "^2.0.0",
"de-indent": "^1.0.2",
"es6-promise": "^4.1.0",
"eslint": "^3.0.0",
"eslint": "^4.13.1",
"eslint-loader": "^1.7.1",
"eslint-plugin-flowtype": "^2.34.0",
"eslint-plugin-jasmine": "^2.8.4",
"eslint-plugin-vue-libs": "^1.2.0",
"file-loader": "^0.11.2",
"eslint-plugin-vue-libs": "^2.0.1",
"file-loader": "^1.1.5",
"flow-bin": "^0.54.0",
"hash-sum": "^1.0.2",
"he": "^1.1.1",
@ -110,10 +110,10 @@
"nightwatch-helpers": "^1.2.0",
"phantomjs-prebuilt": "^2.1.14",
"resolve": "^1.3.3",
"rollup": "^0.50.0",
"rollup": "^0.52.1",
"rollup-plugin-alias": "^1.3.1",
"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-flow-no-whitespace": "^1.0.0",
"rollup-plugin-node-resolve": "^3.0.0",
@ -124,7 +124,7 @@
"shelljs": "^0.7.8",
"typescript": "^2.6.1",
"uglify-js": "^3.0.15",
"webpack": "^2.6.1",
"webpack": "^3.10.0",
"weex-js-runtime": "^0.23.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`
: genChildren(el, state) || 'undefined'
: genElement(el, state)
}}`
}}`
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
const result = Object.create(null)
const keys = hasSymbol
? Reflect.ownKeys(inject).filter(key => {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject)
? Reflect.ownKeys(inject).filter(key => {
/* istanbul ignore next */
return Object.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject)
for (let i = 0; i < keys.length; i++) {
const key = keys[i]

3
src/core/observer/array.js

@ -19,8 +19,7 @@ export const arrayMethods = Object.create(arrayProto)
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
].forEach(function (method) {
// cache original method
const original = arrayProto[method]
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'
addProp(el, 'checked',
`Array.isArray(${value})` +
`?_i(${value},${valueBinding})>-1` + (
trueValueBinding === 'true'
? `:(${value})`
: `:_q(${value},${trueValueBinding})`
)
`?_i(${value},${valueBinding})>-1` + (
trueValueBinding === 'true'
? `:(${value})`
: `:_q(${value},${trueValueBinding})`
)
)
addHandler(el, 'change',
`var $$a=${value},` +
@ -94,9 +94,9 @@ function genCheckboxModel (
}
function genRadioModel (
el: ASTElement,
value: string,
modifiers: ?ASTModifiers
el: ASTElement,
value: string,
modifiers: ?ASTModifiers
) {
const number = modifiers && modifiers.number
let valueBinding = getBindingAttr(el, 'value') || 'null'
@ -106,9 +106,9 @@ function genRadioModel (
}
function genSelect (
el: ASTElement,
value: string,
modifiers: ?ASTModifiers
el: ASTElement,
value: string,
modifiers: ?ASTModifiers
) {
const number = modifiers && modifiers.number
const selectedVal = `Array.prototype.filter` +

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

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

2
src/sfc/parser.js

@ -19,7 +19,7 @@ type Attribute = {
export function parseComponent (
content: string,
options?: Object = {}
): SFCDescriptor {
): SFCDescriptor {
const sfc: SFCDescriptor = {
template: 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>')
vm.view = ''
})
.then(() => {
expect(vm.$el.nodeType).toBe(8)
expect(vm.$el.data).toBe('')
}).then(done)
.then(() => {
expect(vm.$el.nodeType).toBe(8)
expect(vm.$el.data).toBe('')
}).then(done)
})
it('dynamic with props', done => {
@ -134,8 +134,7 @@ describe('Component', () => {
waitForUpdate(() => {
expect(vm.$el.outerHTML).toBe('<div>bar view-b</div>')
vm.view = ''
})
.then(() => {
}).then(() => {
expect(vm.$el.nodeType).toBe(8)
expect(vm.$el.data).toBe('')
}).then(done)

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

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

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

@ -82,7 +82,7 @@ describe('Delimiters', () => {
}).$mount()
expect(vm.$el.textContent).toEqual('1 - 2')
// restore default options
// restore default options
delete Vue.options.delimiters
})
@ -110,7 +110,7 @@ describe('Delimiters', () => {
}).$mount()
expect(vm.$el.textContent).toEqual('1 - 2')
// restore default options
// restore default options
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', () => {
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>',
`with(this){return _c('div',[(show)?_c('p',[_v("hello")]):(hide)?_c('p',[_v("world")]):(3)?_c('p',[_v("elseif")]):_c('p',[_v("bye")])])}`
'<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")])])}`
)
})

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>
</div>
`, {
directives: {
validate (el, dir) {
if (dir.name === 'validate' && dir.arg) {
el.validate = {
field: dir.arg,
groups: dir.modifiers ? Object.keys(dir.modifiers) : []
directives: {
validate (el, dir) {
if (dir.name === 'validate' && dir.arg) {
el.validate = {
field: dir.arg,
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) {
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) {
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) {
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
if (!el.validate || !el.validators) {
return code
}
// setup validation result props
const result = { dirty: false } // define something other prop
el.validators.forEach(validator => {
result[validator.name] = null
})
// generate code
return `_c('validate',{props:{
if (!el.validate || !el.validators) {
return code
}
// setup validation result props
const result = { dirty: false } // define something other prop
el.validators.forEach(validator => {
result[validator.name] = null
})
// generate code
return `_c('validate',{props:{
field:${JSON.stringify(el.validate.field)},
groups:${JSON.stringify(el.validate.groups)},
validators:${JSON.stringify(el.validators)},
result:${JSON.stringify(result)},
child:${code}}
})`
}
}]
})
}
}]
})
expect(render).not.toBeUndefined()
expect(staticRenderFns).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', () => {
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')
.not.toHaveBeenWarned()
.not.toHaveBeenWarned()
})
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>
`, baseOptions)
expect('Component template should contain exactly one root element')
.not.toHaveBeenWarned()
.not.toHaveBeenWarned()
parse(`
<div v-if="1"></div>
@ -152,7 +152,7 @@ describe('parser', () => {
<div v-else></div>
`, baseOptions)
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', () => {
@ -219,7 +219,7 @@ describe('parser', () => {
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)
expect('Cannot use v-for on stateful component root element because it renders multiple elements')
.toHaveBeenWarned()
.toHaveBeenWarned()
})
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(vm.$el.innerHTML).toBe('<div>row</div><a>atag</a>')
vm.swap = false
})
.then(() => {
}).then(() => {
expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode)
expect(vm.$el.innerHTML).toBe('<a>atag</a><div>row</div>')
compVm.swap = false
})
.then(() => {
}).then(() => {
expect(vm.$el.innerHTML).toBe('<span>span</span><div>row</div>')
expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode)
vm.swap = true
})
.then(() => {
}).then(() => {
expect(vm.$el.innerHTML).toBe('<div>row</div><span>span</span>')
expect(compVm.$vnode.parent).toBe(wrapperVm.$vnode)
vm.swap = true
})
.then(done)
}).then(done)
})
// #4530

Loading…
Cancel
Save