From fbf930cac860a696e440582ba9259253890dad49 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 25 May 2021 10:54:11 +0800 Subject: [PATCH] build(deps): bump vue from 3.1.0-beta.3 to 3.1.0-beta.4 --- packages/uni-h5-vue/dist/vue.runtime.cjs.js | 66 ++++++++++++----- .../uni-h5-vue/dist/vue.runtime.compat.cjs.js | 74 +++++++++++++------ .../uni-h5-vue/dist/vue.runtime.compat.esm.js | 74 +++++++++++++------ packages/uni-h5-vue/dist/vue.runtime.esm.js | 66 ++++++++++++----- 4 files changed, 202 insertions(+), 78 deletions(-) diff --git a/packages/uni-h5-vue/dist/vue.runtime.cjs.js b/packages/uni-h5-vue/dist/vue.runtime.cjs.js index 7b789d5b4..6d48c310b 100644 --- a/packages/uni-h5-vue/dist/vue.runtime.cjs.js +++ b/packages/uni-h5-vue/dist/vue.runtime.cjs.js @@ -1460,6 +1460,15 @@ function createDevtoolsComponentHook(hook) { exports.devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); }; } +const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); +const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); +function createDevtoolsPerformanceHook(hook) { + return (component, type, time) => { + if (!exports.devtools) + return; + exports.devtools.emit(hook, component.appContext.app, component.uid, component, type, time); + }; +} function devtoolsComponentEmit(component, event, params) { if (!exports.devtools) return; @@ -2029,12 +2038,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on if (!isRenderingCompiledSlot) { closeBlock(); } + { + devtoolsComponentUpdated(ctx); + } return res; }; // mark this as a compiled slot function. // this is used in vnode.ts -> normalizeChildren() to set the slot // rendering flag. - renderFnWithContext._c = true; + // also used to cache the normalized results to avoid repeated normalization + renderFnWithContext._c = renderFnWithContext; return renderFnWithContext; } @@ -3880,7 +3893,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], instance.render = render; } // fixed by xxxxxx - const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; + const customApplyOptions = instance.appContext.config.globalProperties + .$applyOptions; if (customApplyOptions) { customApplyOptions(options, instance, publicThis); } @@ -4284,7 +4298,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { } else { const camelizedKey = shared.camelize(key); - props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); + props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */); } } else { @@ -4317,7 +4331,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { (rawPrevProps[key] !== undefined || // for kebab-case rawPrevProps[kebabKey] !== undefined)) { - props[key] = resolvePropValue(options, rawProps || shared.EMPTY_OBJ, key, undefined, instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */); } } else { @@ -4347,6 +4361,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { function setFullProps(instance, rawProps, props, attrs) { const [options, needCastKeys] = instance.propsOptions; let hasAttrsChanged = false; + let rawCastValues; if (rawProps) { for (let key in rawProps) { // key, ref are reserved and never passed down @@ -4358,7 +4373,12 @@ function setFullProps(instance, rawProps, props, attrs) { // kebab -> camel conversion here we need to camelize the key. let camelKey; if (options && shared.hasOwn(options, (camelKey = shared.camelize(key)))) { - props[camelKey] = value; + if (!needCastKeys || !needCastKeys.includes(camelKey)) { + props[camelKey] = value; + } + else { + (rawCastValues || (rawCastValues = {}))[camelKey] = value; + } } else if (!isEmitListener(instance.emitsOptions, key)) { if (value !== attrs[key]) { @@ -4370,14 +4390,15 @@ function setFullProps(instance, rawProps, props, attrs) { } if (needCastKeys) { const rawCurrentProps = toRaw(props); + const castValues = rawCastValues || shared.EMPTY_OBJ; for (let i = 0; i < needCastKeys.length; i++) { const key = needCastKeys[i]; - props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !shared.hasOwn(castValues, key)); } } return hasAttrsChanged; } -function resolvePropValue(options, props, key, value, instance) { +function resolvePropValue(options, props, key, value, instance, isAbsent) { const opt = options[key]; if (opt != null) { const hasDefault = shared.hasOwn(opt, 'default'); @@ -4401,7 +4422,7 @@ function resolvePropValue(options, props, key, value, instance) { } // boolean casting if (opt[0 /* shouldCast */]) { - if (!shared.hasOwn(props, key) && !hasDefault) { + if (isAbsent && !hasDefault) { value = false; } else if (opt[1 /* shouldCastTrue */] && @@ -4638,14 +4659,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; -const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { - if (currentInstance) { - warn(`Slot "${key}" invoked outside of the render function: ` + - `this will not track dependencies used in the slot. ` + - `Invoke the slot function inside the render function instead.`); - } - return normalizeSlotValue(rawSlot(props)); -}, ctx); +const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c || + withCtx((props) => { + if (currentInstance) { + warn(`Slot "${key}" invoked outside of the render function: ` + + `this will not track dependencies used in the slot. ` + + `Invoke the slot function inside the render function instead.`); + } + return normalizeSlotValue(rawSlot(props)); + }, ctx); const normalizeObjectSlots = (rawSlots, slots, instance) => { const ctx = rawSlots._ctx; for (const key in rawSlots) { @@ -4678,7 +4700,9 @@ const initSlots = (instance, children) => { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { const type = children._; if (type) { - instance.slots = children; + // users can get the shallow readonly version of the slots object through `this.$slots`, + // we should avoid the proxy object polluting the slots of the internal instance + instance.slots = toRaw(children); // make compiler marker non-enumerable shared.def(children, '_', type); } @@ -5282,6 +5306,9 @@ function startMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { perf.mark(`vue-${type}-${instance.uid}`); } + { + devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now()); + } } function endMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { @@ -5292,6 +5319,9 @@ function endMeasure(instance, type) { perf.clearMarks(startTag); perf.clearMarks(endTag); } + { + devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now()); + } } function isSupported() { if (supported !== undefined) { @@ -8388,7 +8418,7 @@ function initCustomFormatter() { } // Core API ------------------------------------------------------------------ -const version = "3.1.0-beta.3"; +const version = "3.1.0-beta.4"; const _ssrUtils = { createComponentInstance, setupComponent, diff --git a/packages/uni-h5-vue/dist/vue.runtime.compat.cjs.js b/packages/uni-h5-vue/dist/vue.runtime.compat.cjs.js index b4959aae6..b725f496e 100644 --- a/packages/uni-h5-vue/dist/vue.runtime.compat.cjs.js +++ b/packages/uni-h5-vue/dist/vue.runtime.compat.cjs.js @@ -1759,6 +1759,15 @@ function createDevtoolsComponentHook(hook) { devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); }; } +const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); +const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); +function createDevtoolsPerformanceHook(hook) { + return (component, type, time) => { + if (!devtools) + return; + devtools.emit(hook, component.appContext.app, component.uid, component, type, time); + }; +} function devtoolsComponentEmit(component, event, params) { if (!devtools) return; @@ -2250,8 +2259,10 @@ function convertLegacyVModelProps(vnode) { // modelValue -> value // onUpdate:modelValue -> onModelCompat:input const { prop = 'value', event = 'input' } = type.model || {}; - props[prop] = props.modelValue; - delete props.modelValue; + if (prop !== 'modelValue') { + props[prop] = props.modelValue; + delete props.modelValue; + } // important: update dynamic props if (dynamicProps) { dynamicProps[dynamicProps.indexOf('modelValue')] = prop; @@ -2517,12 +2528,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // true onl if (!isRenderingCompiledSlot) { closeBlock(); } + { + devtoolsComponentUpdated(ctx); + } return res; }; // mark this as a compiled slot function. // this is used in vnode.ts -> normalizeChildren() to set the slot // rendering flag. - renderFnWithContext._c = true; + // also used to cache the normalized results to avoid repeated normalization + renderFnWithContext._c = renderFnWithContext; if (isNonScopedSlot) { renderFnWithContext._nonScoped = true; } @@ -4437,7 +4452,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], instance.render = render; } // fixed by xxxxxx - const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; + const customApplyOptions = instance.appContext.config.globalProperties + .$applyOptions; if (customApplyOptions) { customApplyOptions(options, instance, publicThis); } @@ -4912,7 +4928,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { } else { const camelizedKey = camelize(key); - props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); + props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */); } } else { @@ -4953,7 +4969,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { (rawPrevProps[key] !== undefined || // for kebab-case rawPrevProps[kebabKey] !== undefined)) { - props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */); } } else { @@ -4983,6 +4999,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { function setFullProps(instance, rawProps, props, attrs) { const [options, needCastKeys] = instance.propsOptions; let hasAttrsChanged = false; + let rawCastValues; if (rawProps) { for (let key in rawProps) { // key, ref are reserved and never passed down @@ -5002,7 +5019,12 @@ function setFullProps(instance, rawProps, props, attrs) { // kebab -> camel conversion here we need to camelize the key. let camelKey; if (options && hasOwn(options, (camelKey = camelize(key)))) { - props[camelKey] = value; + if (!needCastKeys || !needCastKeys.includes(camelKey)) { + props[camelKey] = value; + } + else { + (rawCastValues || (rawCastValues = {}))[camelKey] = value; + } } else if (!isEmitListener(instance.emitsOptions, key)) { // Any non-declared (either as a prop or an emitted event) props are put @@ -5025,14 +5047,15 @@ function setFullProps(instance, rawProps, props, attrs) { } if (needCastKeys) { const rawCurrentProps = toRaw(props); + const castValues = rawCastValues || EMPTY_OBJ; for (let i = 0; i < needCastKeys.length; i++) { const key = needCastKeys[i]; - props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key)); } } return hasAttrsChanged; } -function resolvePropValue(options, props, key, value, instance) { +function resolvePropValue(options, props, key, value, instance, isAbsent) { const opt = options[key]; if (opt != null) { const hasDefault = hasOwn(opt, 'default'); @@ -5058,7 +5081,7 @@ function resolvePropValue(options, props, key, value, instance) { } // boolean casting if (opt[0 /* shouldCast */]) { - if (!hasOwn(props, key) && !hasDefault) { + if (isAbsent && !hasDefault) { value = false; } else if (opt[1 /* shouldCastTrue */] && @@ -5298,14 +5321,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; -const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { - if (currentInstance) { - warn(`Slot "${key}" invoked outside of the render function: ` + - `this will not track dependencies used in the slot. ` + - `Invoke the slot function inside the render function instead.`); - } - return normalizeSlotValue(rawSlot(props)); -}, ctx); +const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c || + withCtx((props) => { + if (currentInstance) { + warn(`Slot "${key}" invoked outside of the render function: ` + + `this will not track dependencies used in the slot. ` + + `Invoke the slot function inside the render function instead.`); + } + return normalizeSlotValue(rawSlot(props)); + }, ctx); const normalizeObjectSlots = (rawSlots, slots, instance) => { const ctx = rawSlots._ctx; for (const key in rawSlots) { @@ -5338,7 +5362,9 @@ const initSlots = (instance, children) => { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { const type = children._; if (type) { - instance.slots = children; + // users can get the shallow readonly version of the slots object through `this.$slots`, + // we should avoid the proxy object polluting the slots of the internal instance + instance.slots = toRaw(children); // make compiler marker non-enumerable def(children, '_', type); } @@ -5612,7 +5638,7 @@ function createCompatVue(createApp, createSingletonApp) { return vm; } } - Vue.version = "3.1.0-beta.3"; + Vue.version = "3.1.0-beta.4"; Vue.config = singletonApp.config; Vue.use = (p, ...options) => { if (p && isFunction(p.install)) { @@ -6487,6 +6513,9 @@ function startMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { perf.mark(`vue-${type}-${instance.uid}`); } + { + devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now()); + } } function endMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { @@ -6497,6 +6526,9 @@ function endMeasure(instance, type) { perf.clearMarks(startTag); perf.clearMarks(endTag); } + { + devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now()); + } } function isSupported() { if (supported !== undefined) { @@ -10262,7 +10294,7 @@ function initCustomFormatter() { } // Core API ------------------------------------------------------------------ -const version = "3.1.0-beta.3"; +const version = "3.1.0-beta.4"; const _ssrUtils = { createComponentInstance, setupComponent, diff --git a/packages/uni-h5-vue/dist/vue.runtime.compat.esm.js b/packages/uni-h5-vue/dist/vue.runtime.compat.esm.js index 66f948244..18c1c515c 100644 --- a/packages/uni-h5-vue/dist/vue.runtime.compat.esm.js +++ b/packages/uni-h5-vue/dist/vue.runtime.compat.esm.js @@ -1766,6 +1766,15 @@ function createDevtoolsComponentHook(hook) { devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); }; } +const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); +const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); +function createDevtoolsPerformanceHook(hook) { + return (component, type, time) => { + if (!devtools) + return; + devtools.emit(hook, component.appContext.app, component.uid, component, type, time); + }; +} function devtoolsComponentEmit(component, event, params) { if (!devtools) return; @@ -2260,8 +2269,10 @@ function convertLegacyVModelProps(vnode) { // modelValue -> value // onUpdate:modelValue -> onModelCompat:input const { prop = 'value', event = 'input' } = type.model || {}; - props[prop] = props.modelValue; - delete props.modelValue; + if (prop !== 'modelValue') { + props[prop] = props.modelValue; + delete props.modelValue; + } // important: update dynamic props if (dynamicProps) { dynamicProps[dynamicProps.indexOf('modelValue')] = prop; @@ -2527,12 +2538,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // true onl if (!isRenderingCompiledSlot) { closeBlock(); } + if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) { + devtoolsComponentUpdated(ctx); + } return res; }; // mark this as a compiled slot function. // this is used in vnode.ts -> normalizeChildren() to set the slot // rendering flag. - renderFnWithContext._c = true; + // also used to cache the normalized results to avoid repeated normalization + renderFnWithContext._c = renderFnWithContext; if (isNonScopedSlot) { renderFnWithContext._nonScoped = true; } @@ -4431,7 +4446,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], instance.render = render; } // fixed by xxxxxx - const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; + const customApplyOptions = instance.appContext.config.globalProperties + .$applyOptions; if (customApplyOptions) { customApplyOptions(options, instance, publicThis); } @@ -4912,7 +4928,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { } else { const camelizedKey = camelize(key); - props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); + props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */); } } else { @@ -4953,7 +4969,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { (rawPrevProps[key] !== undefined || // for kebab-case rawPrevProps[kebabKey] !== undefined)) { - props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */); } } else { @@ -4983,6 +4999,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { function setFullProps(instance, rawProps, props, attrs) { const [options, needCastKeys] = instance.propsOptions; let hasAttrsChanged = false; + let rawCastValues; if (rawProps) { for (let key in rawProps) { // key, ref are reserved and never passed down @@ -5002,7 +5019,12 @@ function setFullProps(instance, rawProps, props, attrs) { // kebab -> camel conversion here we need to camelize the key. let camelKey; if (options && hasOwn(options, (camelKey = camelize(key)))) { - props[camelKey] = value; + if (!needCastKeys || !needCastKeys.includes(camelKey)) { + props[camelKey] = value; + } + else { + (rawCastValues || (rawCastValues = {}))[camelKey] = value; + } } else if (!isEmitListener(instance.emitsOptions, key)) { // Any non-declared (either as a prop or an emitted event) props are put @@ -5025,14 +5047,15 @@ function setFullProps(instance, rawProps, props, attrs) { } if (needCastKeys) { const rawCurrentProps = toRaw(props); + const castValues = rawCastValues || EMPTY_OBJ; for (let i = 0; i < needCastKeys.length; i++) { const key = needCastKeys[i]; - props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key)); } } return hasAttrsChanged; } -function resolvePropValue(options, props, key, value, instance) { +function resolvePropValue(options, props, key, value, instance, isAbsent) { const opt = options[key]; if (opt != null) { const hasDefault = hasOwn(opt, 'default'); @@ -5058,7 +5081,7 @@ function resolvePropValue(options, props, key, value, instance) { } // boolean casting if (opt[0 /* shouldCast */]) { - if (!hasOwn(props, key) && !hasDefault) { + if (isAbsent && !hasDefault) { value = false; } else if (opt[1 /* shouldCastTrue */] && @@ -5298,14 +5321,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; -const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { - if ((process.env.NODE_ENV !== 'production') && currentInstance) { - warn(`Slot "${key}" invoked outside of the render function: ` + - `this will not track dependencies used in the slot. ` + - `Invoke the slot function inside the render function instead.`); - } - return normalizeSlotValue(rawSlot(props)); -}, ctx); +const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c || + withCtx((props) => { + if ((process.env.NODE_ENV !== 'production') && currentInstance) { + warn(`Slot "${key}" invoked outside of the render function: ` + + `this will not track dependencies used in the slot. ` + + `Invoke the slot function inside the render function instead.`); + } + return normalizeSlotValue(rawSlot(props)); + }, ctx); const normalizeObjectSlots = (rawSlots, slots, instance) => { const ctx = rawSlots._ctx; for (const key in rawSlots) { @@ -5340,7 +5364,9 @@ const initSlots = (instance, children) => { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { const type = children._; if (type) { - instance.slots = children; + // users can get the shallow readonly version of the slots object through `this.$slots`, + // we should avoid the proxy object polluting the slots of the internal instance + instance.slots = toRaw(children); // make compiler marker non-enumerable def(children, '_', type); } @@ -5614,7 +5640,7 @@ function createCompatVue(createApp, createSingletonApp) { return vm; } } - Vue.version = "3.1.0-beta.3"; + Vue.version = "3.1.0-beta.4"; Vue.config = singletonApp.config; Vue.use = (p, ...options) => { if (p && isFunction(p.install)) { @@ -6497,6 +6523,9 @@ function startMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { perf.mark(`vue-${type}-${instance.uid}`); } + if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) { + devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now()); + } } function endMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { @@ -6507,6 +6536,9 @@ function endMeasure(instance, type) { perf.clearMarks(startTag); perf.clearMarks(endTag); } + if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) { + devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now()); + } } function isSupported() { if (supported !== undefined) { @@ -10323,7 +10355,7 @@ function initCustomFormatter() { } // Core API ------------------------------------------------------------------ -const version = "3.1.0-beta.3"; +const version = "3.1.0-beta.4"; /** * SSR utils for \@vue/server-renderer. Only exposed in cjs builds. * @internal diff --git a/packages/uni-h5-vue/dist/vue.runtime.esm.js b/packages/uni-h5-vue/dist/vue.runtime.esm.js index 8d06cb93d..281ede188 100644 --- a/packages/uni-h5-vue/dist/vue.runtime.esm.js +++ b/packages/uni-h5-vue/dist/vue.runtime.esm.js @@ -1466,6 +1466,15 @@ function createDevtoolsComponentHook(hook) { devtools.emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component); }; } +const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */); +const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */); +function createDevtoolsPerformanceHook(hook) { + return (component, type, time) => { + if (!devtools) + return; + devtools.emit(hook, component.appContext.app, component.uid, component, type, time); + }; +} function devtoolsComponentEmit(component, event, params) { if (!devtools) return; @@ -2038,12 +2047,16 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on if (!isRenderingCompiledSlot) { closeBlock(); } + if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) { + devtoolsComponentUpdated(ctx); + } return res; }; // mark this as a compiled slot function. // this is used in vnode.ts -> normalizeChildren() to set the slot // rendering flag. - renderFnWithContext._c = true; + // also used to cache the normalized results to avoid repeated normalization + renderFnWithContext._c = renderFnWithContext; return renderFnWithContext; } @@ -3872,7 +3885,8 @@ function applyOptions(instance, options, deferredData = [], deferredWatch = [], instance.render = render; } // fixed by xxxxxx - const customApplyOptions = instance.appContext.config.globalProperties.$applyOptions; + const customApplyOptions = instance.appContext.config.globalProperties + .$applyOptions; if (customApplyOptions) { customApplyOptions(options, instance, publicThis); } @@ -4281,7 +4295,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { } else { const camelizedKey = camelize(key); - props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance); + props[camelizedKey] = resolvePropValue(options, rawCurrentProps, camelizedKey, value, instance, false /* isAbsent */); } } else { @@ -4314,7 +4328,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { (rawPrevProps[key] !== undefined || // for kebab-case rawPrevProps[kebabKey] !== undefined)) { - props[key] = resolvePropValue(options, rawProps || EMPTY_OBJ, key, undefined, instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, undefined, instance, true /* isAbsent */); } } else { @@ -4344,6 +4358,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) { function setFullProps(instance, rawProps, props, attrs) { const [options, needCastKeys] = instance.propsOptions; let hasAttrsChanged = false; + let rawCastValues; if (rawProps) { for (let key in rawProps) { // key, ref are reserved and never passed down @@ -4355,7 +4370,12 @@ function setFullProps(instance, rawProps, props, attrs) { // kebab -> camel conversion here we need to camelize the key. let camelKey; if (options && hasOwn(options, (camelKey = camelize(key)))) { - props[camelKey] = value; + if (!needCastKeys || !needCastKeys.includes(camelKey)) { + props[camelKey] = value; + } + else { + (rawCastValues || (rawCastValues = {}))[camelKey] = value; + } } else if (!isEmitListener(instance.emitsOptions, key)) { if (value !== attrs[key]) { @@ -4367,14 +4387,15 @@ function setFullProps(instance, rawProps, props, attrs) { } if (needCastKeys) { const rawCurrentProps = toRaw(props); + const castValues = rawCastValues || EMPTY_OBJ; for (let i = 0; i < needCastKeys.length; i++) { const key = needCastKeys[i]; - props[key] = resolvePropValue(options, rawCurrentProps, key, rawCurrentProps[key], instance); + props[key] = resolvePropValue(options, rawCurrentProps, key, castValues[key], instance, !hasOwn(castValues, key)); } } return hasAttrsChanged; } -function resolvePropValue(options, props, key, value, instance) { +function resolvePropValue(options, props, key, value, instance, isAbsent) { const opt = options[key]; if (opt != null) { const hasDefault = hasOwn(opt, 'default'); @@ -4398,7 +4419,7 @@ function resolvePropValue(options, props, key, value, instance) { } // boolean casting if (opt[0 /* shouldCast */]) { - if (!hasOwn(props, key) && !hasDefault) { + if (isAbsent && !hasDefault) { value = false; } else if (opt[1 /* shouldCastTrue */] && @@ -4635,14 +4656,15 @@ const isInternalKey = (key) => key[0] === '_' || key === '$stable'; const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; -const normalizeSlot = (key, rawSlot, ctx) => withCtx((props) => { - if ((process.env.NODE_ENV !== 'production') && currentInstance) { - warn(`Slot "${key}" invoked outside of the render function: ` + - `this will not track dependencies used in the slot. ` + - `Invoke the slot function inside the render function instead.`); - } - return normalizeSlotValue(rawSlot(props)); -}, ctx); +const normalizeSlot = (key, rawSlot, ctx) => rawSlot._c || + withCtx((props) => { + if ((process.env.NODE_ENV !== 'production') && currentInstance) { + warn(`Slot "${key}" invoked outside of the render function: ` + + `this will not track dependencies used in the slot. ` + + `Invoke the slot function inside the render function instead.`); + } + return normalizeSlotValue(rawSlot(props)); + }, ctx); const normalizeObjectSlots = (rawSlots, slots, instance) => { const ctx = rawSlots._ctx; for (const key in rawSlots) { @@ -4677,7 +4699,9 @@ const initSlots = (instance, children) => { if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) { const type = children._; if (type) { - instance.slots = children; + // users can get the shallow readonly version of the slots object through `this.$slots`, + // we should avoid the proxy object polluting the slots of the internal instance + instance.slots = toRaw(children); // make compiler marker non-enumerable def(children, '_', type); } @@ -5287,6 +5311,9 @@ function startMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { perf.mark(`vue-${type}-${instance.uid}`); } + if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) { + devtoolsPerfStart(instance, type, supported ? perf.now() : Date.now()); + } } function endMeasure(instance, type) { if (instance.appContext.config.performance && isSupported()) { @@ -5297,6 +5324,9 @@ function endMeasure(instance, type) { perf.clearMarks(startTag); perf.clearMarks(endTag); } + if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) { + devtoolsPerfEnd(instance, type, supported ? perf.now() : Date.now()); + } } function isSupported() { if (supported !== undefined) { @@ -8444,7 +8474,7 @@ function initCustomFormatter() { } // Core API ------------------------------------------------------------------ -const version = "3.1.0-beta.3"; +const version = "3.1.0-beta.4"; /** * SSR utils for \@vue/server-renderer. Only exposed in cjs builds. * @internal -- GitLab