changed to eslint and updated babel deps

This commit is contained in:
pikax 2021-04-06 17:17:25 +01:00
parent 5f4763e598
commit 6c86065307
16 changed files with 1796 additions and 1371 deletions

View File

@ -1,29 +1,29 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
parser: require.resolve('babel-eslint'),
ecmaVersion: 2018,
sourceType: 'module'
// parser: "@typescript-eslint/parser",
// ecmaVersion: 2018,
sourceType: "module",
},
env: {
es6: true,
node: true,
browser: true
browser: true,
},
plugins: [
"flowtype"
],
// plugins: ["flowtype"],
extends: [
"eslint:recommended",
"plugin:flowtype/recommended"
"plugin:@typescript-eslint/eslint-recommended",
],
globals: {
"__WEEX__": true,
"WXEnvironment": true
__WEEX__: true,
WXEnvironment: true,
},
rules: {
'no-console': process.env.NODE_ENV !== 'production' ? 0 : 2,
'no-useless-escape': 0,
'no-empty': 0
}
}
"no-console": process.env.NODE_ENV !== "production" ? 0 : 2,
"no-useless-escape": 0,
"no-empty": 0,
},
};

View File

@ -5,7 +5,6 @@
*/
'use strict';
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -326,7 +325,6 @@ var LIFECYCLE_HOOKS = [
'errorCaptured',
'serverPrefetch' ];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -405,7 +403,6 @@ var config = {
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -449,7 +446,6 @@ function parsePath(path) {
};
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -540,7 +536,6 @@ else {
}());
}
/* @flow */
var warn$2 = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
@ -1033,7 +1028,6 @@ function dependArray(value) {
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1412,7 +1406,6 @@ function resolveAsset(options, type, id, warnMissing) {
return res;
}
/* @flow */
function validateProp(key, propOptions, propsData, vm) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
@ -1688,7 +1681,7 @@ function logError(err, vm, info) {
}
}
/* @flow */
/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
@ -1891,7 +1884,6 @@ var initProxy;
};
}
/* @flow */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
@ -1994,7 +1986,6 @@ function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
}
}
/* @flow */
function mergeVNodeHook(def, hookKey, hook) {
if (def instanceof VNode) {
def = def.data.hook || (def.data.hook = {});
@ -2027,7 +2018,6 @@ function mergeVNodeHook(def, hookKey, hook) {
def[hookKey] = invoker;
}
/* @flow */
function extractPropsFromVNodeData(data, Ctor, tag) {
// we are only extracting raw values here.
// validation and default values are handled in the child
@ -2080,7 +2070,6 @@ function checkProp(res, hash, key, altKey, preserve) {
return false;
}
/* @flow */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
@ -2167,7 +2156,6 @@ function normalizeArrayChildren(children, nestedIndex) {
return res;
}
/* @flow */
function initProvide(vm) {
var provide = vm.$options.provide;
if (provide) {
@ -2233,7 +2221,6 @@ function resolveInject(inject, vm) {
}
}
/* @flow */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2279,7 +2266,6 @@ function isWhitespace(node) {
return (node.isComment && !node.asyncFactory) || node.text === ' ';
}
/* @flow */
function normalizeScopedSlots(slots, normalSlots, prevSlots) {
var res;
var hasNormalSlots = Object.keys(normalSlots).length > 0;
@ -2432,7 +2418,6 @@ function resolveFilter(id) {
return resolveAsset(this.$options, 'filters', id, true) || identity;
}
/* @flow */
function isKeyNotMatch(expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1;
@ -2459,7 +2444,6 @@ function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInK
}
}
/* @flow */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
@ -2547,7 +2531,6 @@ function markStaticNode(node, key, isOnce) {
node.isOnce = isOnce;
}
/* @flow */
function bindObjectListeners(data, value) {
if (value) {
if (!isPlainObject(value)) {
@ -2590,7 +2573,7 @@ hasDynamicKeys, contentHashKey) {
return res;
}
/* @flow */
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -2612,7 +2595,6 @@ function prependModifier(value, symbol) {
return typeof value === 'string' ? symbol + value : value;
}
/* @flow */
function installRenderHelpers(target) {
target._o = markOnce;
target._n = toNumber;
@ -2633,7 +2615,6 @@ function installRenderHelpers(target) {
target._p = prependModifier;
}
/* @flow */
function FunctionalRenderContext(data, props, children, parent, Ctor) {
var _this = this;
var options = Ctor.options;
@ -2748,7 +2729,6 @@ function mergeProps(to, from) {
}
}
/* @flow */
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function (vnode, hydrating) {
@ -2942,7 +2922,6 @@ function transformModel(options, data) {
}
}
/* @flow */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
@ -3065,7 +3044,6 @@ function registerDeepBindings(data) {
}
}
/* @flow */
function initRender(vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null; // v-once cached trees
@ -3161,7 +3139,6 @@ function renderMixin(Vue) {
};
}
/* @flow */
function ensureCtor(comp, base) {
if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
comp = comp.default;
@ -3278,13 +3255,11 @@ function resolveAsyncComponent(factory, baseCtor) {
}
}
/* @flow */
function isAsyncPlaceholder(node) {
// @ts-expect-error not really boolean type
return node.isComment && node.asyncFactory;
}
/* @flow */
function getFirstComponentChild(children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
@ -3296,7 +3271,6 @@ function getFirstComponentChild(children) {
}
}
/* @flow */
function initEvents(vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
@ -3416,7 +3390,6 @@ function eventsMixin(Vue) {
};
}
/* @flow */
var activeInstance = null;
var isUpdatingChildComponent = false;
function setActiveInstance(vm) {
@ -3713,7 +3686,6 @@ function callHook$1(vm, hook) {
popTarget();
}
/* @flow */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
@ -3869,7 +3841,6 @@ function queueWatcher(watcher) {
}
}
/* @flow */
var uid$1 = 0;
/**
* A watcher parses an expression, collects dependencies,
@ -4065,7 +4036,6 @@ var Watcher = /** @class */ (function () {
return Watcher;
}());
/* @flow */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
@ -4352,7 +4322,6 @@ function stateMixin(Vue) {
};
}
/* @flow */
var uid = 0;
function initMixin$1(Vue) {
Vue.prototype._init = function (options) {
@ -4474,7 +4443,6 @@ lifecycleMixin(Vue);
//@ts-ignore
renderMixin(Vue);
/* @flow */
function initUse(Vue) {
Vue.use = function (plugin) {
var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
@ -4495,7 +4463,6 @@ function initUse(Vue) {
};
}
/* @flow */
function initMixin(Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
@ -4503,7 +4470,6 @@ function initMixin(Vue) {
};
}
/* @flow */
function initExtend(Vue) {
/**
* Each instance constructor, including Vue, has a unique
@ -4581,7 +4547,6 @@ function initComputed(Comp) {
}
}
/* @flow */
function initAssetRegisters(Vue) {
/**
* Create asset registration methods.
@ -4612,7 +4577,6 @@ function initAssetRegisters(Vue) {
});
}
// @ts-nocheck
function getComponentName(opts) {
return opts && (opts.Ctor.options.name || opts.tag);
}
@ -4644,6 +4608,7 @@ function pruneCache(keepAliveInstance, filter) {
function pruneCacheEntry(cache, key, keys, current) {
var cached = cache[key];
if (cached && (!current || cached.tag !== current.tag)) {
//@ts-expect-error has void type
cached.componentInstance.$destroy();
}
cache[key] = null;
@ -4723,7 +4688,6 @@ var builtInComponents = {
KeepAlive: KeepAlive,
};
/* @flow */
function initGlobalAPI(Vue) {
// config
var configDef = {};
@ -4781,7 +4745,6 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
});
Vue.version = '2.6.12';
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
@ -4820,7 +4783,6 @@ var isFalsyAttrValue = function (val) {
return val == null || val === false;
};
/* @flow */
function genClassForVnode(vnode) {
var data = vnode.data;
var parentNode = vnode;
@ -4891,7 +4853,6 @@ function stringifyObject(value) {
return res;
}
/* @flow */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML',
@ -4953,7 +4914,6 @@ function isUnknownElement(tag) {
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* @flow */
/**
* Query an element selector if it's not an element already.
*/
@ -4971,7 +4931,6 @@ function query(el) {
}
}
/* @flow */
function createElement(tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
@ -5035,7 +4994,6 @@ var nodeOps = /*#__PURE__*/Object.freeze({
setStyleScope: setStyleScope
});
/* @flow */
var ref = {
create: function (_, vnode) {
registerRef(vnode);
@ -5816,7 +5774,6 @@ function createPatchFunction(backend) {
};
}
/* @flow */
var directives$1 = {
create: updateDirectives,
update: updateDirectives,
@ -5924,7 +5881,6 @@ function callHook(dir, hook, vnode, oldVnode, isDestroy) {
var baseModules = [ref, directives$1];
/* @flow */
function updateAttrs(oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
@ -6028,7 +5984,6 @@ var attrs = {
update: updateAttrs,
};
/* @flow */
function updateClass(oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
@ -6056,7 +6011,6 @@ var klass$1 = {
update: updateClass,
};
/* @flow */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function parseFilters(exp) {
var inSingle = false;
@ -6180,7 +6134,6 @@ function wrapFilter(exp, filter) {
}
}
/* @flow */
/* eslint-disable no-unused-vars */
function baseWarn(msg, range) {
console.error("[Vue compiler]: " + msg);
@ -6347,7 +6300,6 @@ function rangeSetItem(item, range) {
return item;
}
/* @flow */
/**
* Cross-platform code generation for component v-model
*/
@ -6473,7 +6425,6 @@ function parseString(chr) {
}
}
/* @flow */
var warn$1;
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
@ -6596,7 +6547,6 @@ function genDefaultModel(el, value, modifiers) {
}
}
/* @flow */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
@ -6685,7 +6635,6 @@ var events = {
update: updateDOMListeners,
};
/* @flow */
var svgContainer;
function updateDOMProps(oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
@ -6797,7 +6746,6 @@ var domProps = {
update: updateDOMProps,
};
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -6857,7 +6805,6 @@ function getStyle(vnode, checkChild) {
return res;
}
/* @flow */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
@ -6938,7 +6885,6 @@ var style$1 = {
update: updateStyle,
};
/* @flow */
var whitespaceRE$1 = /\s+/;
/**
* Add class with compatibility for SVG since classList is not supported on
@ -7168,7 +7114,6 @@ function toMs(s) {
return Number(s.slice(0, -1).replace(',', '.')) * 1000;
}
/* @flow */
function enter(vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
@ -7421,7 +7366,6 @@ var transition = inBrowser
var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
/* @flow */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules$1 = platformModules.concat(baseModules);
@ -7559,7 +7503,6 @@ function trigger(el, type) {
el.dispatchEvent(e);
}
/* @flow */
// recursively search for possible transition defined inside the component root
function locateNode(vnode) {
// @ts-expect-error
@ -7620,7 +7563,7 @@ var platformDirectives = {
show: show,
};
/* @flow */
// Provides transition support for a single element/component.
var transitionProps = {
name: String,
appear: Boolean,
@ -8002,7 +7945,6 @@ if (inBrowser) {
}, 0);
}
/* @flow */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
@ -8043,7 +7985,6 @@ function parseText(text, delimiters) {
};
}
/* @flow */
function transformNode$1(el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
@ -8080,7 +8021,6 @@ var klass = {
genData: genData$2,
};
/* @flow */
function transformNode(el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
@ -8118,7 +8058,6 @@ var style = {
genData: genData$1,
};
/* @flow */
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
'link,meta,param,source,track,wbr');
// Elements that you can, intentionally, leave open
@ -8419,7 +8358,6 @@ function parseHTML(html, options) {
}
}
/* @flow */
var he = require('he');
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^#/;
@ -9218,7 +9156,15 @@ function checkForAliasModel(el, value) {
}
}
/* @flow */
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -9286,14 +9232,12 @@ var model = {
var modules = [klass, style, model];
/* @flow */
function text(el, dir) {
if (dir.value) {
addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
}
}
/* @flow */
function html(el, dir) {
if (dir.value) {
addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
@ -9306,7 +9250,6 @@ var directives = {
html: html,
};
/* @flow */
var baseOptions = {
expectHTML: true,
modules: modules,
@ -9321,7 +9264,6 @@ var baseOptions = {
staticKeys: genStaticKeys$1(modules),
};
/* @flow */
var isStaticKey;
var isPlatformReservedTag;
var genStaticKeysCached = cached(genStaticKeys);
@ -9439,7 +9381,6 @@ function isDirectChildOfTemplateFor(node) {
return false;
}
/* @flow */
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnInvokeRE = /\([^)]*?\);*$/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
@ -9591,7 +9532,6 @@ function genFilterCode(key) {
")");
}
/* @flow */
function on(el, dir) {
if (dir.modifiers) {
warn$2("v-on without argument does not support modifiers.");
@ -9599,21 +9539,18 @@ function on(el, dir) {
el.wrapListeners = function (code) { return "_g(" + code + "," + dir.value + ")"; };
}
/* @flow */
function bind(el, dir) {
el.wrapData = function (code) {
return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
};
}
/* @flow */
var baseDirectives = {
on: on,
bind: bind,
cloak: noop,
};
/* @flow */
var CodegenState = /** @class */ (function () {
function CodegenState(options) {
this.options = options;
@ -10094,7 +10031,6 @@ function transformSpecialNewlines(text) {
return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
}
/* @flow */
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
var prohibitedKeywordRE = new RegExp('\\b' +
@ -10203,7 +10139,6 @@ function checkFunctionParameterExpression(exp, text, warn, range) {
}
}
/* @flow */
var range = 2;
function generateCodeFrame(source, start, end) {
if (start === void 0) { start = 0; }
@ -10254,7 +10189,6 @@ function repeat(str, n) {
return result;
}
/* @flow */
function createFunction(code, errors) {
try {
return new Function(code);
@ -10345,7 +10279,6 @@ function createCompileToFunctionFn(compile) {
};
}
/* @flow */
function createCompilerCreator(baseCompile) {
return function createCompiler(baseOptions) {
function compile(template, options) {
@ -10403,7 +10336,6 @@ function createCompilerCreator(baseCompile) {
};
}
/* @flow */
// `createCompilerCreator` allows creating compilers that use alternative
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
// Here we just export a default compiler using the default parts.
@ -10420,10 +10352,8 @@ var createCompiler = createCompilerCreator(function baseCompile(template, option
};
});
/* @flow */
var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
/* @flow */
// check whether current browser encodes a char inside attribute values
var div;
function getShouldDecode(href) {
@ -10438,7 +10368,6 @@ var shouldDecodeNewlinesForHref = inBrowser
? getShouldDecode(true)
: false;
/* @flow */
var idToTemplate = cached(function (id) {
var el = query(id);
return el && el.innerHTML;

View File

@ -3,7 +3,6 @@
* (c) 2014-2021 Evan You
* Released under the MIT License.
*/
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -325,7 +324,6 @@ var LIFECYCLE_HOOKS = [
'serverPrefetch',
];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -404,7 +402,6 @@ var config = {
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -448,7 +445,6 @@ function parsePath(path) {
};
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -539,7 +535,6 @@ else {
}());
}
/* @flow */
var warn$2 = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
@ -1031,7 +1026,6 @@ function dependArray(value) {
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1410,7 +1404,6 @@ function resolveAsset(options, type, id, warnMissing) {
return res;
}
/* @flow */
function validateProp(key, propOptions, propsData, vm) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
@ -1684,7 +1677,7 @@ function logError(err, vm, info) {
}
}
/* @flow */
/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
@ -1887,7 +1880,6 @@ var initProxy;
};
}
/* @flow */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
@ -1988,7 +1980,6 @@ function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
}
}
/* @flow */
function mergeVNodeHook(def, hookKey, hook) {
if (def instanceof VNode) {
def = def.data.hook || (def.data.hook = {});
@ -2021,7 +2012,6 @@ function mergeVNodeHook(def, hookKey, hook) {
def[hookKey] = invoker;
}
/* @flow */
function extractPropsFromVNodeData(data, Ctor, tag) {
// we are only extracting raw values here.
// validation and default values are handled in the child
@ -2074,7 +2064,6 @@ function checkProp(res, hash, key, altKey, preserve) {
return false;
}
/* @flow */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
@ -2161,7 +2150,6 @@ function normalizeArrayChildren(children, nestedIndex) {
return res;
}
/* @flow */
function initProvide(vm) {
var provide = vm.$options.provide;
if (provide) {
@ -2227,7 +2215,6 @@ function resolveInject(inject, vm) {
}
}
/* @flow */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2273,7 +2260,6 @@ function isWhitespace(node) {
return (node.isComment && !node.asyncFactory) || node.text === ' ';
}
/* @flow */
function normalizeScopedSlots(slots, normalSlots, prevSlots) {
var res;
var hasNormalSlots = Object.keys(normalSlots).length > 0;
@ -2426,7 +2412,6 @@ function resolveFilter(id) {
return resolveAsset(this.$options, 'filters', id, true) || identity;
}
/* @flow */
function isKeyNotMatch(expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1;
@ -2453,7 +2438,6 @@ function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInK
}
}
/* @flow */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
@ -2541,7 +2525,6 @@ function markStaticNode(node, key, isOnce) {
node.isOnce = isOnce;
}
/* @flow */
function bindObjectListeners(data, value) {
if (value) {
if (!isPlainObject(value)) {
@ -2584,7 +2567,7 @@ hasDynamicKeys, contentHashKey) {
return res;
}
/* @flow */
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -2606,7 +2589,6 @@ function prependModifier(value, symbol) {
return typeof value === 'string' ? symbol + value : value;
}
/* @flow */
function installRenderHelpers(target) {
target._o = markOnce;
target._n = toNumber;
@ -2627,7 +2609,6 @@ function installRenderHelpers(target) {
target._p = prependModifier;
}
/* @flow */
function FunctionalRenderContext(data, props, children, parent, Ctor) {
var _this = this;
var options = Ctor.options;
@ -2742,7 +2723,6 @@ function mergeProps(to, from) {
}
}
/* @flow */
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function (vnode, hydrating) {
@ -2936,7 +2916,6 @@ function transformModel(options, data) {
}
}
/* @flow */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
@ -3059,7 +3038,6 @@ function registerDeepBindings(data) {
}
}
/* @flow */
function initRender(vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null; // v-once cached trees
@ -3155,7 +3133,6 @@ function renderMixin(Vue) {
};
}
/* @flow */
function ensureCtor(comp, base) {
if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
comp = comp.default;
@ -3272,13 +3249,11 @@ function resolveAsyncComponent(factory, baseCtor) {
}
}
/* @flow */
function isAsyncPlaceholder(node) {
// @ts-expect-error not really boolean type
return node.isComment && node.asyncFactory;
}
/* @flow */
function getFirstComponentChild(children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
@ -3290,7 +3265,6 @@ function getFirstComponentChild(children) {
}
}
/* @flow */
function initEvents(vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
@ -3410,7 +3384,6 @@ function eventsMixin(Vue) {
};
}
/* @flow */
var activeInstance = null;
var isUpdatingChildComponent = false;
function setActiveInstance(vm) {
@ -3707,7 +3680,6 @@ function callHook$1(vm, hook) {
popTarget();
}
/* @flow */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
@ -3863,7 +3835,6 @@ function queueWatcher(watcher) {
}
}
/* @flow */
var uid$1 = 0;
/**
* A watcher parses an expression, collects dependencies,
@ -4059,7 +4030,6 @@ var Watcher = /** @class */ (function () {
return Watcher;
}());
/* @flow */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
@ -4346,7 +4316,6 @@ function stateMixin(Vue) {
};
}
/* @flow */
var uid = 0;
function initMixin$1(Vue) {
Vue.prototype._init = function (options) {
@ -4468,7 +4437,6 @@ lifecycleMixin(Vue);
//@ts-ignore
renderMixin(Vue);
/* @flow */
function initUse(Vue) {
Vue.use = function (plugin) {
var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
@ -4489,7 +4457,6 @@ function initUse(Vue) {
};
}
/* @flow */
function initMixin(Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
@ -4497,7 +4464,6 @@ function initMixin(Vue) {
};
}
/* @flow */
function initExtend(Vue) {
/**
* Each instance constructor, including Vue, has a unique
@ -4575,7 +4541,6 @@ function initComputed(Comp) {
}
}
/* @flow */
function initAssetRegisters(Vue) {
/**
* Create asset registration methods.
@ -4606,7 +4571,6 @@ function initAssetRegisters(Vue) {
});
}
// @ts-nocheck
function getComponentName(opts) {
return opts && (opts.Ctor.options.name || opts.tag);
}
@ -4638,6 +4602,7 @@ function pruneCache(keepAliveInstance, filter) {
function pruneCacheEntry(cache, key, keys, current) {
var cached = cache[key];
if (cached && (!current || cached.tag !== current.tag)) {
//@ts-expect-error has void type
cached.componentInstance.$destroy();
}
cache[key] = null;
@ -4717,7 +4682,6 @@ var builtInComponents = {
KeepAlive: KeepAlive,
};
/* @flow */
function initGlobalAPI(Vue) {
// config
var configDef = {};
@ -4775,7 +4739,6 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
});
Vue.version = '2.6.12';
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
@ -4814,7 +4777,6 @@ var isFalsyAttrValue = function (val) {
return val == null || val === false;
};
/* @flow */
function genClassForVnode(vnode) {
var data = vnode.data;
var parentNode = vnode;
@ -4885,7 +4847,6 @@ function stringifyObject(value) {
return res;
}
/* @flow */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML',
@ -4947,7 +4908,6 @@ function isUnknownElement(tag) {
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* @flow */
/**
* Query an element selector if it's not an element already.
*/
@ -4965,7 +4925,6 @@ function query(el) {
}
}
/* @flow */
function createElement(tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
@ -5029,7 +4988,6 @@ var nodeOps = /*#__PURE__*/Object.freeze({
setStyleScope: setStyleScope
});
/* @flow */
var ref = {
create: function (_, vnode) {
registerRef(vnode);
@ -5810,7 +5768,6 @@ function createPatchFunction(backend) {
};
}
/* @flow */
var directives$1 = {
create: updateDirectives,
update: updateDirectives,
@ -5918,7 +5875,6 @@ function callHook(dir, hook, vnode, oldVnode, isDestroy) {
var baseModules = [ref, directives$1];
/* @flow */
function updateAttrs(oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
@ -6022,7 +5978,6 @@ var attrs = {
update: updateAttrs,
};
/* @flow */
function updateClass(oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
@ -6050,7 +6005,6 @@ var klass$1 = {
update: updateClass,
};
/* @flow */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function parseFilters(exp) {
var inSingle = false;
@ -6174,7 +6128,6 @@ function wrapFilter(exp, filter) {
}
}
/* @flow */
/* eslint-disable no-unused-vars */
function baseWarn(msg, range) {
console.error("[Vue compiler]: " + msg);
@ -6341,7 +6294,6 @@ function rangeSetItem(item, range) {
return item;
}
/* @flow */
/**
* Cross-platform code generation for component v-model
*/
@ -6467,7 +6419,6 @@ function parseString(chr) {
}
}
/* @flow */
var warn$1;
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
@ -6590,7 +6541,6 @@ function genDefaultModel(el, value, modifiers) {
}
}
/* @flow */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
@ -6679,7 +6629,6 @@ var events = {
update: updateDOMListeners,
};
/* @flow */
var svgContainer;
function updateDOMProps(oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
@ -6791,7 +6740,6 @@ var domProps = {
update: updateDOMProps,
};
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -6851,7 +6799,6 @@ function getStyle(vnode, checkChild) {
return res;
}
/* @flow */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
@ -6932,7 +6879,6 @@ var style$1 = {
update: updateStyle,
};
/* @flow */
var whitespaceRE$1 = /\s+/;
/**
* Add class with compatibility for SVG since classList is not supported on
@ -7162,7 +7108,6 @@ function toMs(s) {
return Number(s.slice(0, -1).replace(',', '.')) * 1000;
}
/* @flow */
function enter(vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
@ -7415,7 +7360,6 @@ var transition = inBrowser
var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
/* @flow */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules$1 = platformModules.concat(baseModules);
@ -7553,7 +7497,6 @@ function trigger(el, type) {
el.dispatchEvent(e);
}
/* @flow */
// recursively search for possible transition defined inside the component root
function locateNode(vnode) {
// @ts-expect-error
@ -7614,7 +7557,7 @@ var platformDirectives = {
show: show,
};
/* @flow */
// Provides transition support for a single element/component.
var transitionProps = {
name: String,
appear: Boolean,
@ -7996,7 +7939,6 @@ if (inBrowser) {
}, 0);
}
/* @flow */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
@ -8037,7 +7979,6 @@ function parseText(text, delimiters) {
};
}
/* @flow */
function transformNode$1(el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
@ -8074,7 +8015,6 @@ var klass = {
genData: genData$2,
};
/* @flow */
function transformNode(el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
@ -8112,7 +8052,6 @@ var style = {
genData: genData$1,
};
/* @flow */
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
'link,meta,param,source,track,wbr');
// Elements that you can, intentionally, leave open
@ -8413,7 +8352,6 @@ function parseHTML(html, options) {
}
}
/* @flow */
var he = require('he');
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^#/;
@ -9212,7 +9150,15 @@ function checkForAliasModel(el, value) {
}
}
/* @flow */
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -9280,14 +9226,12 @@ var model = {
var modules = [klass, style, model];
/* @flow */
function text(el, dir) {
if (dir.value) {
addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
}
}
/* @flow */
function html(el, dir) {
if (dir.value) {
addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
@ -9300,7 +9244,6 @@ var directives = {
html: html,
};
/* @flow */
var baseOptions = {
expectHTML: true,
modules: modules,
@ -9315,7 +9258,6 @@ var baseOptions = {
staticKeys: genStaticKeys$1(modules),
};
/* @flow */
var isStaticKey;
var isPlatformReservedTag;
var genStaticKeysCached = cached(genStaticKeys);
@ -9433,7 +9375,6 @@ function isDirectChildOfTemplateFor(node) {
return false;
}
/* @flow */
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnInvokeRE = /\([^)]*?\);*$/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
@ -9585,7 +9526,6 @@ function genFilterCode(key) {
")");
}
/* @flow */
function on(el, dir) {
if (dir.modifiers) {
warn$2("v-on without argument does not support modifiers.");
@ -9593,21 +9533,18 @@ function on(el, dir) {
el.wrapListeners = function (code) { return "_g(" + code + "," + dir.value + ")"; };
}
/* @flow */
function bind(el, dir) {
el.wrapData = function (code) {
return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
};
}
/* @flow */
var baseDirectives = {
on: on,
bind: bind,
cloak: noop,
};
/* @flow */
var CodegenState = /** @class */ (function () {
function CodegenState(options) {
this.options = options;
@ -10088,7 +10025,6 @@ function transformSpecialNewlines(text) {
return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
}
/* @flow */
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
var prohibitedKeywordRE = new RegExp('\\b' +
@ -10197,7 +10133,6 @@ function checkFunctionParameterExpression(exp, text, warn, range) {
}
}
/* @flow */
var range = 2;
function generateCodeFrame(source, start, end) {
if (start === void 0) { start = 0; }
@ -10248,7 +10183,6 @@ function repeat(str, n) {
return result;
}
/* @flow */
function createFunction(code, errors) {
try {
return new Function(code);
@ -10339,7 +10273,6 @@ function createCompileToFunctionFn(compile) {
};
}
/* @flow */
function createCompilerCreator(baseCompile) {
return function createCompiler(baseOptions) {
function compile(template, options) {
@ -10397,7 +10330,6 @@ function createCompilerCreator(baseCompile) {
};
}
/* @flow */
// `createCompilerCreator` allows creating compilers that use alternative
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
// Here we just export a default compiler using the default parts.
@ -10414,10 +10346,8 @@ var createCompiler = createCompilerCreator(function baseCompile(template, option
};
});
/* @flow */
var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
/* @flow */
// check whether current browser encodes a char inside attribute values
var div;
function getShouldDecode(href) {
@ -10432,7 +10362,6 @@ var shouldDecodeNewlinesForHref = inBrowser
? getShouldDecode(true)
: false;
/* @flow */
var idToTemplate = cached(function (id) {
var el = query(id);
return el && el.innerHTML;

97
dist/vue.esm.js vendored
View File

@ -3,7 +3,6 @@
* (c) 2014-2021 Evan You
* Released under the MIT License.
*/
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -324,7 +323,6 @@ var LIFECYCLE_HOOKS = [
'errorCaptured',
'serverPrefetch' ];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -403,7 +401,6 @@ var config = {
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -447,7 +444,6 @@ function parsePath(path) {
};
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -538,7 +534,6 @@ else {
}());
}
/* @flow */
var warn$2 = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
@ -1035,7 +1030,6 @@ function dependArray(value) {
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1415,7 +1409,6 @@ function resolveAsset(options, type, id, warnMissing) {
return res;
}
/* @flow */
function validateProp(key, propOptions, propsData, vm) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
@ -1693,7 +1686,7 @@ function logError(err, vm, info) {
}
}
/* @flow */
/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
@ -1896,7 +1889,6 @@ if (process.env.NODE_ENV !== 'production') {
};
}
/* @flow */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
@ -2000,7 +1992,6 @@ function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
}
}
/* @flow */
function mergeVNodeHook(def, hookKey, hook) {
if (def instanceof VNode) {
def = def.data.hook || (def.data.hook = {});
@ -2033,7 +2024,6 @@ function mergeVNodeHook(def, hookKey, hook) {
def[hookKey] = invoker;
}
/* @flow */
function extractPropsFromVNodeData(data, Ctor, tag) {
// we are only extracting raw values here.
// validation and default values are handled in the child
@ -2086,7 +2076,6 @@ function checkProp(res, hash, key, altKey, preserve) {
return false;
}
/* @flow */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
@ -2173,7 +2162,6 @@ function normalizeArrayChildren(children, nestedIndex) {
return res;
}
/* @flow */
function initProvide(vm) {
var provide = vm.$options.provide;
if (provide) {
@ -2242,7 +2230,6 @@ function resolveInject(inject, vm) {
}
}
/* @flow */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2288,7 +2275,6 @@ function isWhitespace(node) {
return (node.isComment && !node.asyncFactory) || node.text === ' ';
}
/* @flow */
function normalizeScopedSlots(slots, normalSlots, prevSlots) {
var res;
var hasNormalSlots = Object.keys(normalSlots).length > 0;
@ -2441,7 +2427,6 @@ function resolveFilter(id) {
return resolveAsset(this.$options, 'filters', id, true) || identity;
}
/* @flow */
function isKeyNotMatch(expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1;
@ -2468,7 +2453,6 @@ function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInK
}
}
/* @flow */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
@ -2557,7 +2541,6 @@ function markStaticNode(node, key, isOnce) {
node.isOnce = isOnce;
}
/* @flow */
function bindObjectListeners(data, value) {
if (value) {
if (!isPlainObject(value)) {
@ -2601,7 +2584,7 @@ hasDynamicKeys, contentHashKey) {
return res;
}
/* @flow */
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -2624,7 +2607,6 @@ function prependModifier(value, symbol) {
return typeof value === 'string' ? symbol + value : value;
}
/* @flow */
function installRenderHelpers(target) {
target._o = markOnce;
target._n = toNumber;
@ -2645,7 +2627,6 @@ function installRenderHelpers(target) {
target._p = prependModifier;
}
/* @flow */
function FunctionalRenderContext(data, props, children, parent, Ctor) {
var _this = this;
var options = Ctor.options;
@ -2760,7 +2741,6 @@ function mergeProps(to, from) {
}
}
/* @flow */
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function (vnode, hydrating) {
@ -2954,7 +2934,6 @@ function transformModel(options, data) {
}
}
/* @flow */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
@ -3080,7 +3059,6 @@ function registerDeepBindings(data) {
}
}
/* @flow */
function initRender(vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null; // v-once cached trees
@ -3180,7 +3158,6 @@ function renderMixin(Vue) {
};
}
/* @flow */
function ensureCtor(comp, base) {
if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
comp = comp.default;
@ -3299,13 +3276,11 @@ function resolveAsyncComponent(factory, baseCtor) {
}
}
/* @flow */
function isAsyncPlaceholder(node) {
// @ts-expect-error not really boolean type
return node.isComment && node.asyncFactory;
}
/* @flow */
function getFirstComponentChild(children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
@ -3317,7 +3292,6 @@ function getFirstComponentChild(children) {
}
}
/* @flow */
function initEvents(vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
@ -3437,7 +3411,6 @@ function eventsMixin(Vue) {
};
}
/* @flow */
var activeInstance = null;
var isUpdatingChildComponent = false;
function setActiveInstance(vm) {
@ -3734,7 +3707,6 @@ function callHook$1(vm, hook) {
popTarget();
}
/* @flow */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
@ -3890,7 +3862,6 @@ function queueWatcher(watcher) {
}
}
/* @flow */
var uid$1 = 0;
/**
* A watcher parses an expression, collects dependencies,
@ -4087,7 +4058,6 @@ var Watcher = /** @class */ (function () {
return Watcher;
}());
/* @flow */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
@ -4380,7 +4350,6 @@ function stateMixin(Vue) {
};
}
/* @flow */
var uid = 0;
function initMixin$1(Vue) {
Vue.prototype._init = function (options) {
@ -4505,7 +4474,6 @@ lifecycleMixin(Vue);
//@ts-ignore
renderMixin(Vue);
/* @flow */
function initUse(Vue) {
Vue.use = function (plugin) {
var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
@ -4526,7 +4494,6 @@ function initUse(Vue) {
};
}
/* @flow */
function initMixin(Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
@ -4534,7 +4501,6 @@ function initMixin(Vue) {
};
}
/* @flow */
function initExtend(Vue) {
/**
* Each instance constructor, including Vue, has a unique
@ -4612,7 +4578,6 @@ function initComputed(Comp) {
}
}
/* @flow */
function initAssetRegisters(Vue) {
/**
* Create asset registration methods.
@ -4643,7 +4608,6 @@ function initAssetRegisters(Vue) {
});
}
// @ts-nocheck
function getComponentName(opts) {
return opts && (opts.Ctor.options.name || opts.tag);
}
@ -4675,6 +4639,7 @@ function pruneCache(keepAliveInstance, filter) {
function pruneCacheEntry(cache, key, keys, current) {
var cached = cache[key];
if (cached && (!current || cached.tag !== current.tag)) {
//@ts-expect-error has void type
cached.componentInstance.$destroy();
}
cache[key] = null;
@ -4754,7 +4719,6 @@ var builtInComponents = {
KeepAlive: KeepAlive,
};
/* @flow */
function initGlobalAPI(Vue) {
// config
var configDef = {};
@ -4812,7 +4776,6 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
});
Vue.version = '2.6.12';
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
@ -4851,7 +4814,6 @@ var isFalsyAttrValue = function (val) {
return val == null || val === false;
};
/* @flow */
function genClassForVnode(vnode) {
var data = vnode.data;
var parentNode = vnode;
@ -4922,7 +4884,6 @@ function stringifyObject(value) {
return res;
}
/* @flow */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML',
@ -4984,7 +4945,6 @@ function isUnknownElement(tag) {
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* @flow */
/**
* Query an element selector if it's not an element already.
*/
@ -5003,7 +4963,6 @@ function query(el) {
}
}
/* @flow */
function createElement(tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
@ -5067,7 +5026,6 @@ var nodeOps = /*#__PURE__*/Object.freeze({
setStyleScope: setStyleScope
});
/* @flow */
var ref = {
create: function (_, vnode) {
registerRef(vnode);
@ -5850,7 +5808,6 @@ function createPatchFunction(backend) {
};
}
/* @flow */
var directives$1 = {
create: updateDirectives,
update: updateDirectives,
@ -5958,7 +5915,6 @@ function callHook(dir, hook, vnode, oldVnode, isDestroy) {
var baseModules = [ref, directives$1];
/* @flow */
function updateAttrs(oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
@ -6062,7 +6018,6 @@ var attrs = {
update: updateAttrs,
};
/* @flow */
function updateClass(oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
@ -6090,7 +6045,6 @@ var klass$1 = {
update: updateClass,
};
/* @flow */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function parseFilters(exp) {
var inSingle = false;
@ -6214,7 +6168,6 @@ function wrapFilter(exp, filter) {
}
}
/* @flow */
/* eslint-disable no-unused-vars */
function baseWarn(msg, range) {
console.error("[Vue compiler]: " + msg);
@ -6382,7 +6335,6 @@ function rangeSetItem(item, range) {
return item;
}
/* @flow */
/**
* Cross-platform code generation for component v-model
*/
@ -6508,7 +6460,6 @@ function parseString(chr) {
}
}
/* @flow */
var warn$1;
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
@ -6631,7 +6582,6 @@ function genDefaultModel(el, value, modifiers) {
}
}
/* @flow */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
@ -6720,7 +6670,6 @@ var events = {
update: updateDOMListeners,
};
/* @flow */
var svgContainer;
function updateDOMProps(oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
@ -6832,7 +6781,6 @@ var domProps = {
update: updateDOMProps,
};
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -6892,7 +6840,6 @@ function getStyle(vnode, checkChild) {
return res;
}
/* @flow */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
@ -6973,7 +6920,6 @@ var style$1 = {
update: updateStyle,
};
/* @flow */
var whitespaceRE$1 = /\s+/;
/**
* Add class with compatibility for SVG since classList is not supported on
@ -7203,7 +7149,6 @@ function toMs(s) {
return Number(s.slice(0, -1).replace(',', '.')) * 1000;
}
/* @flow */
function enter(vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
@ -7456,7 +7401,6 @@ var transition = inBrowser
var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
/* @flow */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules$1 = platformModules.concat(baseModules);
@ -7595,7 +7539,6 @@ function trigger(el, type) {
el.dispatchEvent(e);
}
/* @flow */
// recursively search for possible transition defined inside the component root
function locateNode(vnode) {
// @ts-expect-error
@ -7656,7 +7599,7 @@ var platformDirectives = {
show: show,
};
/* @flow */
// Provides transition support for a single element/component.
var transitionProps = {
name: String,
appear: Boolean,
@ -8042,7 +7985,6 @@ if (inBrowser) {
}, 0);
}
/* @flow */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
@ -8083,7 +8025,6 @@ function parseText(text, delimiters) {
};
}
/* @flow */
function transformNode$1(el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
@ -8120,7 +8061,6 @@ var klass = {
genData: genData$2,
};
/* @flow */
function transformNode(el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
@ -8158,7 +8098,6 @@ var style = {
genData: genData$1,
};
/* @flow */
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
'link,meta,param,source,track,wbr');
// Elements that you can, intentionally, leave open
@ -8461,7 +8400,6 @@ function parseHTML(html, options) {
}
}
/* @flow */
var he = require('he');
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^#/;
@ -9265,7 +9203,15 @@ function checkForAliasModel(el, value) {
}
}
/* @flow */
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -9333,14 +9279,12 @@ var model = {
var modules = [klass, style, model];
/* @flow */
function text(el, dir) {
if (dir.value) {
addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
}
}
/* @flow */
function html(el, dir) {
if (dir.value) {
addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
@ -9353,7 +9297,6 @@ var directives = {
html: html,
};
/* @flow */
var baseOptions = {
expectHTML: true,
modules: modules,
@ -9368,7 +9311,6 @@ var baseOptions = {
staticKeys: genStaticKeys$1(modules),
};
/* @flow */
var isStaticKey;
var isPlatformReservedTag;
var genStaticKeysCached = cached(genStaticKeys);
@ -9486,7 +9428,6 @@ function isDirectChildOfTemplateFor(node) {
return false;
}
/* @flow */
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnInvokeRE = /\([^)]*?\);*$/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
@ -9638,7 +9579,6 @@ function genFilterCode(key) {
")");
}
/* @flow */
function on(el, dir) {
if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
warn$2("v-on without argument does not support modifiers.");
@ -9646,21 +9586,18 @@ function on(el, dir) {
el.wrapListeners = function (code) { return "_g(" + code + "," + dir.value + ")"; };
}
/* @flow */
function bind(el, dir) {
el.wrapData = function (code) {
return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
};
}
/* @flow */
var baseDirectives = {
on: on,
bind: bind,
cloak: noop,
};
/* @flow */
var CodegenState = /** @class */ (function () {
function CodegenState(options) {
this.options = options;
@ -10144,7 +10081,6 @@ function transformSpecialNewlines(text) {
return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
}
/* @flow */
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
var prohibitedKeywordRE = new RegExp('\\b' +
@ -10253,7 +10189,6 @@ function checkFunctionParameterExpression(exp, text, warn, range) {
}
}
/* @flow */
var range = 2;
function generateCodeFrame(source, start, end) {
if (start === void 0) { start = 0; }
@ -10304,7 +10239,6 @@ function repeat(str, n) {
return result;
}
/* @flow */
function createFunction(code, errors) {
try {
return new Function(code);
@ -10395,7 +10329,6 @@ function createCompileToFunctionFn(compile) {
};
}
/* @flow */
function createCompilerCreator(baseCompile) {
return function createCompiler(baseOptions) {
function compile(template, options) {
@ -10454,7 +10387,6 @@ function createCompilerCreator(baseCompile) {
};
}
/* @flow */
// `createCompilerCreator` allows creating compilers that use alternative
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
// Here we just export a default compiler using the default parts.
@ -10471,10 +10403,8 @@ var createCompiler = createCompilerCreator(function baseCompile(template, option
};
});
/* @flow */
var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
/* @flow */
// check whether current browser encodes a char inside attribute values
var div;
function getShouldDecode(href) {
@ -10489,7 +10419,6 @@ var shouldDecodeNewlinesForHref = inBrowser
? getShouldDecode(true)
: false;
/* @flow */
var idToTemplate = cached(function (id) {
var el = query(id);
return el && el.innerHTML;

97
dist/vue.js vendored
View File

@ -9,7 +9,6 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Vue = factory());
}(this, (function () { 'use strict';
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -330,7 +329,6 @@
'errorCaptured',
'serverPrefetch' ];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -409,7 +407,6 @@
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -453,7 +450,6 @@
};
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -544,7 +540,6 @@
}());
}
/* @flow */
var warn$2 = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
@ -1037,7 +1032,6 @@
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1416,7 +1410,6 @@
return res;
}
/* @flow */
function validateProp(key, propOptions, propsData, vm) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
@ -1692,7 +1685,7 @@
}
}
/* @flow */
/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
@ -1895,7 +1888,6 @@
};
}
/* @flow */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
@ -1998,7 +1990,6 @@
}
}
/* @flow */
function mergeVNodeHook(def, hookKey, hook) {
if (def instanceof VNode) {
def = def.data.hook || (def.data.hook = {});
@ -2031,7 +2022,6 @@
def[hookKey] = invoker;
}
/* @flow */
function extractPropsFromVNodeData(data, Ctor, tag) {
// we are only extracting raw values here.
// validation and default values are handled in the child
@ -2084,7 +2074,6 @@
return false;
}
/* @flow */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
@ -2171,7 +2160,6 @@
return res;
}
/* @flow */
function initProvide(vm) {
var provide = vm.$options.provide;
if (provide) {
@ -2237,7 +2225,6 @@
}
}
/* @flow */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2283,7 +2270,6 @@
return (node.isComment && !node.asyncFactory) || node.text === ' ';
}
/* @flow */
function normalizeScopedSlots(slots, normalSlots, prevSlots) {
var res;
var hasNormalSlots = Object.keys(normalSlots).length > 0;
@ -2436,7 +2422,6 @@
return resolveAsset(this.$options, 'filters', id, true) || identity;
}
/* @flow */
function isKeyNotMatch(expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1;
@ -2463,7 +2448,6 @@
}
}
/* @flow */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
@ -2551,7 +2535,6 @@
node.isOnce = isOnce;
}
/* @flow */
function bindObjectListeners(data, value) {
if (value) {
if (!isPlainObject(value)) {
@ -2594,7 +2577,7 @@
return res;
}
/* @flow */
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -2616,7 +2599,6 @@
return typeof value === 'string' ? symbol + value : value;
}
/* @flow */
function installRenderHelpers(target) {
target._o = markOnce;
target._n = toNumber;
@ -2637,7 +2619,6 @@
target._p = prependModifier;
}
/* @flow */
function FunctionalRenderContext(data, props, children, parent, Ctor) {
var _this = this;
var options = Ctor.options;
@ -2752,7 +2733,6 @@
}
}
/* @flow */
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function (vnode, hydrating) {
@ -2946,7 +2926,6 @@
}
}
/* @flow */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
@ -3069,7 +3048,6 @@
}
}
/* @flow */
function initRender(vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null; // v-once cached trees
@ -3165,7 +3143,6 @@
};
}
/* @flow */
function ensureCtor(comp, base) {
if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
comp = comp.default;
@ -3282,13 +3259,11 @@
}
}
/* @flow */
function isAsyncPlaceholder(node) {
// @ts-expect-error not really boolean type
return node.isComment && node.asyncFactory;
}
/* @flow */
function getFirstComponentChild(children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
@ -3300,7 +3275,6 @@
}
}
/* @flow */
function initEvents(vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
@ -3420,7 +3394,6 @@
};
}
/* @flow */
var activeInstance = null;
var isUpdatingChildComponent = false;
function setActiveInstance(vm) {
@ -3717,7 +3690,6 @@
popTarget();
}
/* @flow */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
@ -3873,7 +3845,6 @@
}
}
/* @flow */
var uid$1 = 0;
/**
* A watcher parses an expression, collects dependencies,
@ -4069,7 +4040,6 @@
return Watcher;
}());
/* @flow */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
@ -4356,7 +4326,6 @@
};
}
/* @flow */
var uid = 0;
function initMixin$1(Vue) {
Vue.prototype._init = function (options) {
@ -4478,7 +4447,6 @@
//@ts-ignore
renderMixin(Vue);
/* @flow */
function initUse(Vue) {
Vue.use = function (plugin) {
var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
@ -4499,7 +4467,6 @@
};
}
/* @flow */
function initMixin(Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
@ -4507,7 +4474,6 @@
};
}
/* @flow */
function initExtend(Vue) {
/**
* Each instance constructor, including Vue, has a unique
@ -4585,7 +4551,6 @@
}
}
/* @flow */
function initAssetRegisters(Vue) {
/**
* Create asset registration methods.
@ -4616,7 +4581,6 @@
});
}
// @ts-nocheck
function getComponentName(opts) {
return opts && (opts.Ctor.options.name || opts.tag);
}
@ -4648,6 +4612,7 @@
function pruneCacheEntry(cache, key, keys, current) {
var cached = cache[key];
if (cached && (!current || cached.tag !== current.tag)) {
//@ts-expect-error has void type
cached.componentInstance.$destroy();
}
cache[key] = null;
@ -4727,7 +4692,6 @@
KeepAlive: KeepAlive,
};
/* @flow */
function initGlobalAPI(Vue) {
// config
var configDef = {};
@ -4785,7 +4749,6 @@
});
Vue.version = '2.6.12';
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
@ -4824,7 +4787,6 @@
return val == null || val === false;
};
/* @flow */
function genClassForVnode(vnode) {
var data = vnode.data;
var parentNode = vnode;
@ -4895,7 +4857,6 @@
return res;
}
/* @flow */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML',
@ -4957,7 +4918,6 @@
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* @flow */
/**
* Query an element selector if it's not an element already.
*/
@ -4975,7 +4935,6 @@
}
}
/* @flow */
function createElement(tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
@ -5039,7 +4998,6 @@
setStyleScope: setStyleScope
});
/* @flow */
var ref = {
create: function (_, vnode) {
registerRef(vnode);
@ -5820,7 +5778,6 @@
};
}
/* @flow */
var directives$1 = {
create: updateDirectives,
update: updateDirectives,
@ -5928,7 +5885,6 @@
var baseModules = [ref, directives$1];
/* @flow */
function updateAttrs(oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
@ -6032,7 +5988,6 @@
update: updateAttrs,
};
/* @flow */
function updateClass(oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
@ -6060,7 +6015,6 @@
update: updateClass,
};
/* @flow */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function parseFilters(exp) {
var inSingle = false;
@ -6184,7 +6138,6 @@
}
}
/* @flow */
/* eslint-disable no-unused-vars */
function baseWarn(msg, range) {
console.error("[Vue compiler]: " + msg);
@ -6351,7 +6304,6 @@
return item;
}
/* @flow */
/**
* Cross-platform code generation for component v-model
*/
@ -6477,7 +6429,6 @@
}
}
/* @flow */
var warn$1;
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
@ -6600,7 +6551,6 @@
}
}
/* @flow */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
@ -6689,7 +6639,6 @@
update: updateDOMListeners,
};
/* @flow */
var svgContainer;
function updateDOMProps(oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
@ -6801,7 +6750,6 @@
update: updateDOMProps,
};
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -6861,7 +6809,6 @@
return res;
}
/* @flow */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
@ -6942,7 +6889,6 @@
update: updateStyle,
};
/* @flow */
var whitespaceRE$1 = /\s+/;
/**
* Add class with compatibility for SVG since classList is not supported on
@ -7172,7 +7118,6 @@
return Number(s.slice(0, -1).replace(',', '.')) * 1000;
}
/* @flow */
function enter(vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
@ -7425,7 +7370,6 @@
var platformModules = [attrs, klass$1, events, domProps, style$1, transition];
/* @flow */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules$1 = platformModules.concat(baseModules);
@ -7563,7 +7507,6 @@
el.dispatchEvent(e);
}
/* @flow */
// recursively search for possible transition defined inside the component root
function locateNode(vnode) {
// @ts-expect-error
@ -7624,7 +7567,7 @@
show: show,
};
/* @flow */
// Provides transition support for a single element/component.
var transitionProps = {
name: String,
appear: Boolean,
@ -8006,7 +7949,6 @@
}, 0);
}
/* @flow */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
@ -8047,7 +7989,6 @@
};
}
/* @flow */
function transformNode$1(el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
@ -8084,7 +8025,6 @@
genData: genData$2,
};
/* @flow */
function transformNode(el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
@ -8122,7 +8062,6 @@
genData: genData$1,
};
/* @flow */
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
'link,meta,param,source,track,wbr');
// Elements that you can, intentionally, leave open
@ -8423,7 +8362,6 @@
}
}
/* @flow */
var he = require('he');
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^#/;
@ -9222,7 +9160,15 @@
}
}
/* @flow */
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -9290,14 +9236,12 @@
var modules = [klass, style, model];
/* @flow */
function text(el, dir) {
if (dir.value) {
addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
}
}
/* @flow */
function html(el, dir) {
if (dir.value) {
addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
@ -9310,7 +9254,6 @@
html: html,
};
/* @flow */
var baseOptions = {
expectHTML: true,
modules: modules,
@ -9325,7 +9268,6 @@
staticKeys: genStaticKeys$1(modules),
};
/* @flow */
var isStaticKey;
var isPlatformReservedTag;
var genStaticKeysCached = cached(genStaticKeys);
@ -9443,7 +9385,6 @@
return false;
}
/* @flow */
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnInvokeRE = /\([^)]*?\);*$/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
@ -9595,7 +9536,6 @@
")");
}
/* @flow */
function on(el, dir) {
if (dir.modifiers) {
warn$2("v-on without argument does not support modifiers.");
@ -9603,21 +9543,18 @@
el.wrapListeners = function (code) { return "_g(" + code + "," + dir.value + ")"; };
}
/* @flow */
function bind(el, dir) {
el.wrapData = function (code) {
return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
};
}
/* @flow */
var baseDirectives = {
on: on,
bind: bind,
cloak: noop,
};
/* @flow */
var CodegenState = /** @class */ (function () {
function CodegenState(options) {
this.options = options;
@ -10098,7 +10035,6 @@
return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
}
/* @flow */
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
var prohibitedKeywordRE = new RegExp('\\b' +
@ -10207,7 +10143,6 @@
}
}
/* @flow */
var range = 2;
function generateCodeFrame(source, start, end) {
if (start === void 0) { start = 0; }
@ -10258,7 +10193,6 @@
return result;
}
/* @flow */
function createFunction(code, errors) {
try {
return new Function(code);
@ -10349,7 +10283,6 @@
};
}
/* @flow */
function createCompilerCreator(baseCompile) {
return function createCompiler(baseOptions) {
function compile(template, options) {
@ -10407,7 +10340,6 @@
};
}
/* @flow */
// `createCompilerCreator` allows creating compilers that use alternative
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
// Here we just export a default compiler using the default parts.
@ -10424,10 +10356,8 @@
};
});
/* @flow */
var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
/* @flow */
// check whether current browser encodes a char inside attribute values
var div;
function getShouldDecode(href) {
@ -10442,7 +10372,6 @@
? getShouldDecode(true)
: false;
/* @flow */
var idToTemplate = cached(function (id) {
var el = query(id);
return el && el.innerHTML;

View File

@ -1671,6 +1671,7 @@ function logError(err, vm, info) {
}
}
/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
@ -2562,6 +2563,7 @@ hasDynamicKeys, contentHashKey) {
return res;
}
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -4565,7 +4567,6 @@ function initAssetRegisters(Vue) {
});
}
// @ts-nocheck
function getComponentName(opts) {
return opts && (opts.Ctor.options.name || opts.tag);
}
@ -4597,6 +4598,7 @@ function pruneCache(keepAliveInstance, filter) {
function pruneCacheEntry(cache, key, keys, current) {
var cached = cache[key];
if (cached && (!current || cached.tag !== current.tag)) {
//@ts-expect-error has void type
cached.componentInstance.$destroy();
}
cache[key] = null;
@ -7019,6 +7021,7 @@ var platformDirectives = {
show: show,
};
// Provides transition support for a single element/component.
var transitionProps = {
name: String,
appear: Boolean,
@ -7400,5 +7403,4 @@ if (inBrowser) {
}, 0);
}
module.exports = Vue;

View File

@ -3,7 +3,6 @@
* (c) 2014-2021 Evan You
* Released under the MIT License.
*/
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -314,7 +313,6 @@ var LIFECYCLE_HOOKS = [
'errorCaptured',
'serverPrefetch' ];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -393,7 +391,6 @@ var config = {
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -437,7 +434,6 @@ function parsePath(path) {
};
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -528,7 +524,6 @@ else {
}());
}
/* @flow */
var warn = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
@ -1025,7 +1020,6 @@ function dependArray(value) {
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1405,7 +1399,6 @@ function resolveAsset(options, type, id, warnMissing) {
return res;
}
/* @flow */
function validateProp(key, propOptions, propsData, vm) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
@ -1683,7 +1676,7 @@ function logError(err, vm, info) {
}
}
/* @flow */
/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
@ -1866,7 +1859,6 @@ if (process.env.NODE_ENV !== 'production') {
};
}
/* @flow */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
@ -1990,7 +1982,6 @@ function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
}
}
/* @flow */
function mergeVNodeHook(def, hookKey, hook) {
if (def instanceof VNode) {
def = def.data.hook || (def.data.hook = {});
@ -2023,7 +2014,6 @@ function mergeVNodeHook(def, hookKey, hook) {
def[hookKey] = invoker;
}
/* @flow */
function extractPropsFromVNodeData(data, Ctor, tag) {
// we are only extracting raw values here.
// validation and default values are handled in the child
@ -2076,7 +2066,6 @@ function checkProp(res, hash, key, altKey, preserve) {
return false;
}
/* @flow */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
@ -2163,7 +2152,6 @@ function normalizeArrayChildren(children, nestedIndex) {
return res;
}
/* @flow */
function initProvide(vm) {
var provide = vm.$options.provide;
if (provide) {
@ -2232,7 +2220,6 @@ function resolveInject(inject, vm) {
}
}
/* @flow */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2278,7 +2265,6 @@ function isWhitespace(node) {
return (node.isComment && !node.asyncFactory) || node.text === ' ';
}
/* @flow */
function normalizeScopedSlots(slots, normalSlots, prevSlots) {
var res;
var hasNormalSlots = Object.keys(normalSlots).length > 0;
@ -2431,7 +2417,6 @@ function resolveFilter(id) {
return resolveAsset(this.$options, 'filters', id, true) || identity;
}
/* @flow */
function isKeyNotMatch(expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1;
@ -2458,7 +2443,6 @@ function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInK
}
}
/* @flow */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
@ -2547,7 +2531,6 @@ function markStaticNode(node, key, isOnce) {
node.isOnce = isOnce;
}
/* @flow */
function bindObjectListeners(data, value) {
if (value) {
if (!isPlainObject(value)) {
@ -2591,7 +2574,7 @@ hasDynamicKeys, contentHashKey) {
return res;
}
/* @flow */
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -2614,7 +2597,6 @@ function prependModifier(value, symbol) {
return typeof value === 'string' ? symbol + value : value;
}
/* @flow */
function installRenderHelpers(target) {
target._o = markOnce;
target._n = toNumber;
@ -2635,7 +2617,6 @@ function installRenderHelpers(target) {
target._p = prependModifier;
}
/* @flow */
function FunctionalRenderContext(data, props, children, parent, Ctor) {
var _this = this;
var options = Ctor.options;
@ -2750,7 +2731,6 @@ function mergeProps(to, from) {
}
}
/* @flow */
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function (vnode, hydrating) {
@ -2944,7 +2924,6 @@ function transformModel(options, data) {
}
}
/* @flow */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
@ -3070,7 +3049,6 @@ function registerDeepBindings(data) {
}
}
/* @flow */
function initRender(vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null; // v-once cached trees
@ -3170,7 +3148,6 @@ function renderMixin(Vue) {
};
}
/* @flow */
function ensureCtor(comp, base) {
if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
comp = comp.default;
@ -3289,13 +3266,11 @@ function resolveAsyncComponent(factory, baseCtor) {
}
}
/* @flow */
function isAsyncPlaceholder(node) {
// @ts-expect-error not really boolean type
return node.isComment && node.asyncFactory;
}
/* @flow */
function getFirstComponentChild(children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
@ -3307,7 +3282,6 @@ function getFirstComponentChild(children) {
}
}
/* @flow */
function initEvents(vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
@ -3427,7 +3401,6 @@ function eventsMixin(Vue) {
};
}
/* @flow */
var activeInstance = null;
var isUpdatingChildComponent = false;
function setActiveInstance(vm) {
@ -3724,7 +3697,6 @@ function callHook$1(vm, hook) {
popTarget();
}
/* @flow */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
@ -3880,7 +3852,6 @@ function queueWatcher(watcher) {
}
}
/* @flow */
var uid$1 = 0;
/**
* A watcher parses an expression, collects dependencies,
@ -4077,7 +4048,6 @@ var Watcher = /** @class */ (function () {
return Watcher;
}());
/* @flow */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
@ -4370,7 +4340,6 @@ function stateMixin(Vue) {
};
}
/* @flow */
var uid = 0;
function initMixin$1(Vue) {
Vue.prototype._init = function (options) {
@ -4495,7 +4464,6 @@ lifecycleMixin(Vue);
//@ts-ignore
renderMixin(Vue);
/* @flow */
function initUse(Vue) {
Vue.use = function (plugin) {
var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
@ -4516,7 +4484,6 @@ function initUse(Vue) {
};
}
/* @flow */
function initMixin(Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
@ -4524,7 +4491,6 @@ function initMixin(Vue) {
};
}
/* @flow */
function initExtend(Vue) {
/**
* Each instance constructor, including Vue, has a unique
@ -4602,7 +4568,6 @@ function initComputed(Comp) {
}
}
/* @flow */
function initAssetRegisters(Vue) {
/**
* Create asset registration methods.
@ -4633,7 +4598,6 @@ function initAssetRegisters(Vue) {
});
}
// @ts-nocheck
function getComponentName(opts) {
return opts && (opts.Ctor.options.name || opts.tag);
}
@ -4665,6 +4629,7 @@ function pruneCache(keepAliveInstance, filter) {
function pruneCacheEntry(cache, key, keys, current) {
var cached = cache[key];
if (cached && (!current || cached.tag !== current.tag)) {
//@ts-expect-error has void type
cached.componentInstance.$destroy();
}
cache[key] = null;
@ -4744,7 +4709,6 @@ var builtInComponents = {
KeepAlive: KeepAlive,
};
/* @flow */
function initGlobalAPI(Vue) {
// config
var configDef = {};
@ -4802,7 +4766,6 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
});
Vue.version = '2.6.12';
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
@ -4841,7 +4804,6 @@ var isFalsyAttrValue = function (val) {
return val == null || val === false;
};
/* @flow */
function genClassForVnode(vnode) {
var data = vnode.data;
var parentNode = vnode;
@ -4912,7 +4874,6 @@ function stringifyObject(value) {
return res;
}
/* @flow */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML',
@ -4973,7 +4934,6 @@ function isUnknownElement(tag) {
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* @flow */
/**
* Query an element selector if it's not an element already.
*/
@ -4992,7 +4952,6 @@ function query(el) {
}
}
/* @flow */
function createElement(tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
@ -5056,7 +5015,6 @@ var nodeOps = /*#__PURE__*/Object.freeze({
setStyleScope: setStyleScope
});
/* @flow */
var ref = {
create: function (_, vnode) {
registerRef(vnode);
@ -5839,7 +5797,6 @@ function createPatchFunction(backend) {
};
}
/* @flow */
var directives = {
create: updateDirectives,
update: updateDirectives,
@ -5947,7 +5904,6 @@ function callHook(dir, hook, vnode, oldVnode, isDestroy) {
var baseModules = [ref, directives];
/* @flow */
function updateAttrs(oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
@ -6051,7 +6007,6 @@ var attrs = {
update: updateAttrs,
};
/* @flow */
function updateClass(oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
@ -6079,13 +6034,11 @@ var klass = {
update: updateClass,
};
/* @flow */
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';
/* @flow */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
@ -6174,7 +6127,6 @@ var events = {
update: updateDOMListeners,
};
/* @flow */
var svgContainer;
function updateDOMProps(oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
@ -6286,7 +6238,6 @@ var domProps = {
update: updateDOMProps,
};
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -6346,7 +6297,6 @@ function getStyle(vnode, checkChild) {
return res;
}
/* @flow */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
@ -6427,7 +6377,6 @@ var style = {
update: updateStyle,
};
/* @flow */
var whitespaceRE = /\s+/;
/**
* Add class with compatibility for SVG since classList is not supported on
@ -6657,7 +6606,6 @@ function toMs(s) {
return Number(s.slice(0, -1).replace(',', '.')) * 1000;
}
/* @flow */
function enter(vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
@ -6910,7 +6858,6 @@ var transition = inBrowser
var platformModules = [attrs, klass, events, domProps, style, transition];
/* @flow */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);
@ -7049,7 +6996,6 @@ function trigger(el, type) {
el.dispatchEvent(e);
}
/* @flow */
// recursively search for possible transition defined inside the component root
function locateNode(vnode) {
// @ts-expect-error
@ -7110,7 +7056,7 @@ var platformDirectives = {
show: show,
};
/* @flow */
// Provides transition support for a single element/component.
var transitionProps = {
name: String,
appear: Boolean,
@ -7496,6 +7442,4 @@ if (inBrowser) {
}, 0);
}
/* @flow */
export default Vue;

64
dist/vue.runtime.js vendored
View File

@ -9,7 +9,6 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Vue = factory());
}(this, (function () { 'use strict';
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -320,7 +319,6 @@
'errorCaptured',
'serverPrefetch' ];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -399,7 +397,6 @@
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -443,7 +440,6 @@
};
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -534,7 +530,6 @@
}());
}
/* @flow */
var warn = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
@ -1027,7 +1022,6 @@
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1406,7 +1400,6 @@
return res;
}
/* @flow */
function validateProp(key, propOptions, propsData, vm) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
@ -1682,7 +1675,7 @@
}
}
/* @flow */
/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
@ -1865,7 +1858,6 @@
};
}
/* @flow */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
@ -1988,7 +1980,6 @@
}
}
/* @flow */
function mergeVNodeHook(def, hookKey, hook) {
if (def instanceof VNode) {
def = def.data.hook || (def.data.hook = {});
@ -2021,7 +2012,6 @@
def[hookKey] = invoker;
}
/* @flow */
function extractPropsFromVNodeData(data, Ctor, tag) {
// we are only extracting raw values here.
// validation and default values are handled in the child
@ -2074,7 +2064,6 @@
return false;
}
/* @flow */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
@ -2161,7 +2150,6 @@
return res;
}
/* @flow */
function initProvide(vm) {
var provide = vm.$options.provide;
if (provide) {
@ -2227,7 +2215,6 @@
}
}
/* @flow */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -2273,7 +2260,6 @@
return (node.isComment && !node.asyncFactory) || node.text === ' ';
}
/* @flow */
function normalizeScopedSlots(slots, normalSlots, prevSlots) {
var res;
var hasNormalSlots = Object.keys(normalSlots).length > 0;
@ -2426,7 +2412,6 @@
return resolveAsset(this.$options, 'filters', id, true) || identity;
}
/* @flow */
function isKeyNotMatch(expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1;
@ -2453,7 +2438,6 @@
}
}
/* @flow */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
@ -2541,7 +2525,6 @@
node.isOnce = isOnce;
}
/* @flow */
function bindObjectListeners(data, value) {
if (value) {
if (!isPlainObject(value)) {
@ -2584,7 +2567,7 @@
return res;
}
/* @flow */
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -2606,7 +2589,6 @@
return typeof value === 'string' ? symbol + value : value;
}
/* @flow */
function installRenderHelpers(target) {
target._o = markOnce;
target._n = toNumber;
@ -2627,7 +2609,6 @@
target._p = prependModifier;
}
/* @flow */
function FunctionalRenderContext(data, props, children, parent, Ctor) {
var _this = this;
var options = Ctor.options;
@ -2742,7 +2723,6 @@
}
}
/* @flow */
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function (vnode, hydrating) {
@ -2936,7 +2916,6 @@
}
}
/* @flow */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
@ -3059,7 +3038,6 @@
}
}
/* @flow */
function initRender(vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null; // v-once cached trees
@ -3155,7 +3133,6 @@
};
}
/* @flow */
function ensureCtor(comp, base) {
if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
comp = comp.default;
@ -3272,13 +3249,11 @@
}
}
/* @flow */
function isAsyncPlaceholder(node) {
// @ts-expect-error not really boolean type
return node.isComment && node.asyncFactory;
}
/* @flow */
function getFirstComponentChild(children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
@ -3290,7 +3265,6 @@
}
}
/* @flow */
function initEvents(vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
@ -3410,7 +3384,6 @@
};
}
/* @flow */
var activeInstance = null;
var isUpdatingChildComponent = false;
function setActiveInstance(vm) {
@ -3707,7 +3680,6 @@
popTarget();
}
/* @flow */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
@ -3863,7 +3835,6 @@
}
}
/* @flow */
var uid$1 = 0;
/**
* A watcher parses an expression, collects dependencies,
@ -4059,7 +4030,6 @@
return Watcher;
}());
/* @flow */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
@ -4346,7 +4316,6 @@
};
}
/* @flow */
var uid = 0;
function initMixin$1(Vue) {
Vue.prototype._init = function (options) {
@ -4468,7 +4437,6 @@
//@ts-ignore
renderMixin(Vue);
/* @flow */
function initUse(Vue) {
Vue.use = function (plugin) {
var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
@ -4489,7 +4457,6 @@
};
}
/* @flow */
function initMixin(Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
@ -4497,7 +4464,6 @@
};
}
/* @flow */
function initExtend(Vue) {
/**
* Each instance constructor, including Vue, has a unique
@ -4575,7 +4541,6 @@
}
}
/* @flow */
function initAssetRegisters(Vue) {
/**
* Create asset registration methods.
@ -4606,7 +4571,6 @@
});
}
// @ts-nocheck
function getComponentName(opts) {
return opts && (opts.Ctor.options.name || opts.tag);
}
@ -4638,6 +4602,7 @@
function pruneCacheEntry(cache, key, keys, current) {
var cached = cache[key];
if (cached && (!current || cached.tag !== current.tag)) {
//@ts-expect-error has void type
cached.componentInstance.$destroy();
}
cache[key] = null;
@ -4717,7 +4682,6 @@
KeepAlive: KeepAlive,
};
/* @flow */
function initGlobalAPI(Vue) {
// config
var configDef = {};
@ -4775,7 +4739,6 @@
});
Vue.version = '2.6.12';
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
@ -4814,7 +4777,6 @@
return val == null || val === false;
};
/* @flow */
function genClassForVnode(vnode) {
var data = vnode.data;
var parentNode = vnode;
@ -4885,7 +4847,6 @@
return res;
}
/* @flow */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML',
@ -4946,7 +4907,6 @@
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* @flow */
/**
* Query an element selector if it's not an element already.
*/
@ -4964,7 +4924,6 @@
}
}
/* @flow */
function createElement(tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
@ -5028,7 +4987,6 @@
setStyleScope: setStyleScope
});
/* @flow */
var ref = {
create: function (_, vnode) {
registerRef(vnode);
@ -5809,7 +5767,6 @@
};
}
/* @flow */
var directives = {
create: updateDirectives,
update: updateDirectives,
@ -5917,7 +5874,6 @@
var baseModules = [ref, directives];
/* @flow */
function updateAttrs(oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
@ -6021,7 +5977,6 @@
update: updateAttrs,
};
/* @flow */
function updateClass(oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
@ -6049,13 +6004,11 @@
update: updateClass,
};
/* @flow */
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';
/* @flow */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
@ -6144,7 +6097,6 @@
update: updateDOMListeners,
};
/* @flow */
var svgContainer;
function updateDOMProps(oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
@ -6256,7 +6208,6 @@
update: updateDOMProps,
};
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -6316,7 +6267,6 @@
return res;
}
/* @flow */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
@ -6397,7 +6347,6 @@
update: updateStyle,
};
/* @flow */
var whitespaceRE = /\s+/;
/**
* Add class with compatibility for SVG since classList is not supported on
@ -6627,7 +6576,6 @@
return Number(s.slice(0, -1).replace(',', '.')) * 1000;
}
/* @flow */
function enter(vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
@ -6880,7 +6828,6 @@
var platformModules = [attrs, klass, events, domProps, style, transition];
/* @flow */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);
@ -7018,7 +6965,6 @@
el.dispatchEvent(e);
}
/* @flow */
// recursively search for possible transition defined inside the component root
function locateNode(vnode) {
// @ts-expect-error
@ -7079,7 +7025,7 @@
show: show,
};
/* @flow */
// Provides transition support for a single element/component.
var transitionProps = {
name: String,
appear: Boolean,
@ -7461,8 +7407,6 @@
}, 0);
}
/* @flow */
return Vue;
})));

View File

@ -68,13 +68,13 @@
},
"homepage": "https://github.com/vuejs/vue#readme",
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-jsx": "^7.0.0",
"@babel/plugin-transform-flow-strip-types": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/core": "^7.13.14",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-jsx": "^7.12.13",
"@babel/plugin-transform-flow-strip-types": "^7.13.0",
"@babel/preset-env": "^7.13.12",
"@babel/register": "^7.13.14",
"@rollup/plugin-alias": "^3.1.2",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-buble": "^0.21.3",
@ -85,6 +85,8 @@
"@types/mocha": "^8.2.2",
"@types/node": "^12.12.0",
"@types/webpack": "^4.4.22",
"@typescript-eslint/eslint-plugin": "^4.21.0",
"@typescript-eslint/parser": "^4.21.0",
"acorn": "^5.2.1",
"babel-eslint": "^10.0.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
@ -103,7 +105,7 @@
"de-indent": "^1.0.2",
"es6-promise": "^4.1.0",
"escodegen": "^1.8.1",
"eslint": "^5.7.0",
"eslint": "^7.23.0",
"eslint-plugin-flowtype": "^2.34.0",
"eslint-plugin-jasmine": "^2.8.4",
"file-loader": "^3.0.1",

View File

@ -4,7 +4,6 @@
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.renderVueComponentToString = factory());
}(this, (function () { 'use strict';
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -257,7 +256,6 @@
return -1;
}
/* @flow */
var isAttr = makeMap('accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
'checked,cite,class,code,codebase,color,cols,colspan,content,' +
@ -342,7 +340,6 @@
'stroke-width': true,
};
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
makeMap('style,class');
@ -374,7 +371,6 @@
return val == null || val === false;
};
/* @flow */
function renderAttrs$1(node) {
var attrs = node.data.attrs;
var res = '';
@ -494,7 +490,6 @@
return cloned;
}
/* @flow */
function renderDOMProps$1(node) {
var props = node.data.domProps;
var res = '';
@ -537,7 +532,6 @@
node.children = [child];
}
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -556,7 +550,6 @@
});
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -660,7 +653,6 @@
'errorCaptured',
'serverPrefetch' ];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -739,7 +731,6 @@
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
var warn$2 = noop$1;
var tip = noop$1;
var generateComponentTrace; // work around flow check
@ -1125,7 +1116,6 @@
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1504,7 +1494,6 @@
return res;
}
/* @flow */
function validateProp(key, propOptions, propsData, vm) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
@ -1768,7 +1757,7 @@
}
}
/* @flow */
/* globals MutationObserver */
var callbacks = [];
function flushCallbacks() {
var copies = callbacks.slice(0);
@ -1803,7 +1792,6 @@
else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
else ;
/* @flow */
function genClassForVnode(vnode) {
var data = vnode.data;
var parentNode = vnode;
@ -1874,7 +1862,6 @@
return res;
}
/* @flow */
var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
@ -1907,7 +1894,6 @@
}
makeMap('text,number,password,search,email,tel,url');
/* @flow */
function renderClass(node) {
var classList = genClassForVnode(node);
if (classList !== '') {
@ -1915,7 +1901,6 @@
}
}
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -1975,7 +1960,6 @@
return res;
}
/* @flow */
function genStyle(style) {
var styleText = '';
for (var key in style) {
@ -2012,7 +1996,6 @@
var modules$1 = [renderAttrs$1, renderDOMProps$1, renderClass, renderStyle];
/* @flow */
function show(node, dir) {
if (!dir.value) {
var style = node.data.style || (node.data.style = {});
@ -2025,7 +2008,6 @@
}
}
/* @flow */
// this is only applied for <select v-model> because it is the only edge case
// that must be done at runtime instead of compile time.
function model$2(node, dir) {
@ -2068,7 +2050,6 @@
model: model$2,
};
/* @flow */
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
'link,meta,param,source,track,wbr');
// Elements that you can, intentionally, leave open
@ -2082,7 +2063,6 @@
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
'title,tr,track');
/* @flow */
var MAX_STACK_DEPTH = 800;
var noop = function (_) { return _; };
var defer = typeof process !== 'undefined' && process.nextTick
@ -2128,7 +2108,6 @@
return cachedWrite;
}
/* @flow */
var RenderContext = /** @class */ (function () {
function RenderContext(options) {
this.userContext = options.userContext;
@ -2226,7 +2205,6 @@
}
}
/* @flow */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function parseFilters(exp) {
var inSingle = false;
@ -2350,7 +2328,6 @@
}
}
/* @flow */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
@ -2391,7 +2368,6 @@
};
}
/* @flow */
/* eslint-disable no-unused-vars */
function baseWarn(msg, range) {
console.error("[Vue compiler]: " + msg);
@ -2558,7 +2534,6 @@
return item;
}
/* @flow */
function transformNode$1(el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
@ -2595,7 +2570,6 @@
genData: genData$2,
};
/* @flow */
function transformNode(el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
@ -2920,7 +2894,6 @@
}
}
/* @flow */
/**
* Cross-platform code generation for component v-model
*/
@ -3046,7 +3019,6 @@
}
}
/* @flow */
var he = require('he');
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^#/;
@ -3845,7 +3817,15 @@
}
}
/* @flow */
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -3913,7 +3893,6 @@
var modules = [klass, style, model$1];
/* @flow */
var warn;
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
@ -4029,14 +4008,12 @@
}
}
/* @flow */
function text(el, dir) {
if (dir.value) {
addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
}
}
/* @flow */
function html(el, dir) {
if (dir.value) {
addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
@ -4049,7 +4026,6 @@
html: html,
};
/* @flow */
var baseOptions = {
expectHTML: true,
modules: modules,
@ -4064,7 +4040,6 @@
staticKeys: genStaticKeys(modules),
};
/* @flow */
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnInvokeRE = /\([^)]*?\);*$/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
@ -4216,7 +4191,6 @@
")");
}
/* @flow */
function on(el, dir) {
if (dir.modifiers) {
warn$2("v-on without argument does not support modifiers.");
@ -4224,21 +4198,18 @@
el.wrapListeners = function (code) { return "_g(" + code + "," + dir.value + ")"; };
}
/* @flow */
function bind(el, dir) {
el.wrapData = function (code) {
return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
};
}
/* @flow */
var baseDirectives = {
on: on,
bind: bind,
cloak: noop$1,
};
/* @flow */
var CodegenState = /** @class */ (function () {
function CodegenState(options) {
this.options = options;
@ -4719,7 +4690,6 @@
return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
}
/* @flow */
var plainStringRE = /^"(?:[^"\\]|\\.)*"$|^'(?:[^'\\]|\\.)*'$/;
// let the model AST transform translate v-model into appropriate
// props bindings
@ -4807,7 +4777,15 @@
}
}
/* @flow */
/**
* In SSR, the vdom tree is generated only once and never patched, so
* we can optimize most element / trees into plain string render functions.
* The SSR optimizer walks the AST tree to detect optimizable elements and trees.
*
* The criteria for SSR optimizability is quite a bit looser than static tree
* detection (which is designed for client re-render). In SSR we bail only for
* components/slots/custom directives.
*/
// optimizability constants
var optimizability = {
FALSE: 0,
@ -4925,7 +4903,7 @@
node.directives.some(function (d) { return d.name === 'model'; }));
}
/* @flow */
// The SSR codegen is essentially extending the default codegen to handle
// segment types
var RAW = 0;
var INTERPOLATION = 1;
@ -5120,7 +5098,6 @@
return mergedSegments.join('+');
}
/* @flow */
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
var prohibitedKeywordRE = new RegExp('\\b' +
@ -5229,7 +5206,6 @@
}
}
/* @flow */
var range = 2;
function generateCodeFrame(source, start, end) {
if (start === void 0) { start = 0; }
@ -5280,7 +5256,6 @@
return result;
}
/* @flow */
function createFunction(code, errors) {
try {
return new Function(code);
@ -5371,7 +5346,6 @@
};
}
/* @flow */
function createCompilerCreator(baseCompile) {
return function createCompiler(baseOptions) {
function compile(template, options) {
@ -5429,7 +5403,6 @@
};
}
/* @flow */
var createCompiler = createCompilerCreator(function baseCompile(template, options) {
var ast = parse(template.trim(), options);
optimize(ast, options);
@ -5441,10 +5414,8 @@
};
});
/* @flow */
var _a = createCompiler(baseOptions), compileToFunctions = _a.compileToFunctions;
/* @flow */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
@ -5531,7 +5502,6 @@
return res;
}
/* @flow */
var ssrHelpers = {
_ssrEscape: escape,
_ssrNode: renderStringNode$1,
@ -5664,7 +5634,6 @@
}
}
/* @flow */
var seenObjects = new _Set();
/**
* Recursively traverse an object to evoke all converted
@ -5777,7 +5746,6 @@
}
}
/* @flow */
function extractPropsFromVNodeData(data, Ctor, tag) {
// we are only extracting raw values here.
// validation and default values are handled in the child
@ -5830,7 +5798,6 @@
return false;
}
/* @flow */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
@ -6023,7 +5990,6 @@
return resolveAsset(this.$options, 'filters', id, true) || identity;
}
/* @flow */
function isKeyNotMatch(expect, actual) {
if (Array.isArray(expect)) {
return expect.indexOf(actual) === -1;
@ -6050,7 +6016,6 @@
}
}
/* @flow */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
@ -6138,7 +6103,6 @@
node.isOnce = isOnce;
}
/* @flow */
function bindObjectListeners(data, value) {
if (value) {
if (!isPlainObject(value)) {
@ -6181,7 +6145,7 @@
return res;
}
/* @flow */
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -6203,7 +6167,6 @@
return typeof value === 'string' ? symbol + value : value;
}
/* @flow */
function installRenderHelpers(target) {
target._o = markOnce;
target._n = toNumber;
@ -6224,7 +6187,6 @@
target._p = prependModifier;
}
/* @flow */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
@ -6270,7 +6232,6 @@
return (node.isComment && !node.asyncFactory) || node.text === ' ';
}
/* @flow */
function normalizeScopedSlots(slots, normalSlots, prevSlots) {
var res;
var hasNormalSlots = Object.keys(normalSlots).length > 0;
@ -6344,7 +6305,6 @@
return function () { return slots[key]; };
}
/* @flow */
function createAsyncPlaceholder(factory, data, context, children, tag) {
var node = createEmptyVNode();
node.asyncFactory = factory;
@ -6363,7 +6323,6 @@
}
}
/* @flow */
var target;
function add(event, fn) {
target.$on(event, fn);
@ -6386,7 +6345,6 @@
target = undefined;
}
/* @flow */
var activeInstance = null;
function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
// determine whether component has slot children
@ -6502,7 +6460,6 @@
popTarget();
}
/* @flow */
// Async edge case fix requires storing an event listener's attach timestamp.
var getNow = Date.now;
// Determine what event timestamp the browser is using. Annoyingly, the
@ -6533,7 +6490,6 @@
vm._inactive = false;
}
/* @flow */
function resolveInject(inject, vm) {
if (inject) {
// inject is :any because flow is not smart enough to figure out cached
@ -6572,7 +6528,6 @@
}
}
/* @flow */
function resolveConstructorOptions(Ctor) {
var options = Ctor.options;
if (Ctor.super) {
@ -6610,7 +6565,6 @@
return modified;
}
/* @flow */
function FunctionalRenderContext(data, props, children, parent, Ctor) {
var _this = this;
var options = Ctor.options;
@ -6725,7 +6679,6 @@
}
}
/* @flow */
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function (vnode, hydrating) {
@ -6919,7 +6872,6 @@
}
}
/* @flow */
var warned = Object.create(null);
var warnOnce = function (msg) {
if (!warned[msg]) {
@ -7305,7 +7257,6 @@
};
}
/* @flow */
function createBasicRenderer(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.modules, modules = _c === void 0 ? [] : _c, _d = _b.directives, directives = _d === void 0 ? {} : _d, _e = _b.isUnaryTag, isUnaryTag = _e === void 0 ? function () { return false; } : _e, cache = _b.cache;
var render = createRenderFunction(modules, directives, isUnaryTag, cache);
@ -7331,7 +7282,6 @@
};
}
/* @flow */
var entryServerBasicRenderer = createBasicRenderer({
// @ts-expect-error
modules: modules$1,

View File

@ -1757,6 +1757,7 @@ function logError(err, vm, info) {
}
}
/* globals MutationObserver */
var callbacks = [];
function flushCallbacks() {
var copies = callbacks.slice(0);
@ -2138,6 +2139,13 @@ function createWriteFunction(write, onError) {
return cachedWrite;
}
/**
* Original RenderStream implementation by Sasha Aickin (@aickin)
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Modified by Evan You (@yyx990803)
*/
var RenderStream = /** @class */ (function (_super) {
__extends(RenderStream, _super);
function RenderStream(render) {
@ -3921,6 +3929,15 @@ function checkForAliasModel(el, value) {
}
}
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -4872,6 +4889,15 @@ function genStyleSegments(staticStyle, parsedStaticStyle, styleBinding, vShowExp
}
}
/**
* In SSR, the vdom tree is generated only once and never patched, so
* we can optimize most element / trees into plain string render functions.
* The SSR optimizer walks the AST tree to detect optimizable elements and trees.
*
* The criteria for SSR optimizability is quite a bit looser than static tree
* detection (which is designed for client re-render). In SSR we bail only for
* components/slots/custom directives.
*/
// optimizability constants
var optimizability = {
FALSE: 0,
@ -4989,6 +5015,7 @@ function isSelectWithModel(node) {
node.directives.some(function (d) { return d.name === 'model'; }));
}
// The SSR codegen is essentially extending the default codegen to handle
// segment types
var RAW = 0;
var INTERPOLATION = 1;
@ -6230,6 +6257,7 @@ hasDynamicKeys, contentHashKey) {
return res;
}
// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
for (var i = 0; i < values.length; i += 2) {
var key = values[i];
@ -7445,6 +7473,11 @@ function parseTemplate(template, contentPlaceholder) {
};
}
/**
* Creates a mapper that maps components used during a server-side render
* to async chunk files in the client-side build, so that we can inline them
* directly in the rendered HTML to avoid waterfall requests.
*/
function createMapper(clientManifest) {
var map = createMap(clientManifest);
// map server-side moduleIds to client-side files

View File

@ -1,6 +1,5 @@
'use strict';
/* @flow */
var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); };
var isCSS = function (file) { return /\.css(\?[^.]+)?$/.test(file); };

View File

@ -1,6 +1,5 @@
'use strict';
/* @flow */
var isJS = function (file) { return /\.js(\?[^.]+)?$/.test(file); };
var _a = require('chalk'), red = _a.red, yellow = _a.yellow;

View File

@ -50,7 +50,7 @@
return i
}
var emptyObject = Object.freeze({});
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
function isUndef(v) {
@ -193,7 +193,7 @@
.join(',');
}
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
'link,meta,param,source,track,wbr');
// Elements that you can, intentionally, leave open
// (and which close themselves)
@ -206,7 +206,7 @@
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
'title,tr,track');
/**
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
@ -511,7 +511,7 @@
}
}
var splitRE = /\r?\n/g;
var splitRE = /\r?\n/g;
var replaceRE = /./g;
var isSpecialTag = makeMap('script,style,template', true);
/**
@ -627,7 +627,7 @@
return sfc;
}
// can we use __proto__?
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
@ -725,7 +725,7 @@
'errorCaptured',
'serverPrefetch' ];
var config = {
var config = {
/**
* Option merge strategies (used in core/util/options)
*/
@ -803,7 +803,7 @@
_lifecycleHooks: LIFECYCLE_HOOKS,
};
var warn$2 = noop;
var warn$2 = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
var formatComponentName;
@ -1208,7 +1208,7 @@
}
}
/**
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
* value into the final value.
@ -1417,7 +1417,8 @@
}
}
var callbacks = [];
/* globals MutationObserver */
var callbacks = [];
function flushCallbacks() {
var copies = callbacks.slice(0);
callbacks.length = 0;
@ -1451,7 +1452,7 @@
else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
else ;
// these are reserved for web because they are directly compiled away
// these are reserved for web because they are directly compiled away
// during template compilation
makeMap('style,class');
// attributes that should be using props for binding
@ -1471,7 +1472,7 @@
'required,reversed,scoped,seamless,selected,sortable,' +
'truespeed,typemustmatch,visible');
var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
@ -1503,7 +1504,7 @@
}
makeMap('text,number,password,search,email,tel,url');
var validDivisionCharRE = /[\w).+\-_$\]]/;
var validDivisionCharRE = /[\w).+\-_$\]]/;
function parseFilters(exp) {
var inSingle = false;
var inDouble = false;
@ -1626,7 +1627,7 @@
}
}
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
@ -1666,7 +1667,7 @@
};
}
/* eslint-disable no-unused-vars */
/* eslint-disable no-unused-vars */
function baseWarn(msg, range) {
console.error("[Vue compiler]: " + msg);
}
@ -1832,7 +1833,7 @@
return item;
}
function transformNode$1(el, options) {
function transformNode$1(el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
if (staticClass) {
@ -1868,7 +1869,7 @@
genData: genData$2,
};
var parseStyleText = cached(function (cssText) {
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
var propertyDelimiter = /:(.+)/;
@ -1881,7 +1882,7 @@
return res;
});
function transformNode(el, options) {
function transformNode(el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
if (staticStyle) {
@ -1918,7 +1919,7 @@
genData: genData$1,
};
/**
/**
* Cross-platform code generation for component v-model
*/
function genComponentModel(el, value, modifiers) {
@ -2043,7 +2044,7 @@
}
}
var he = require('he');
var he = require('he');
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^#/;
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
@ -2841,7 +2842,16 @@
}
}
function preTransformNode(el, options) {
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
if (!map['v-model']) {
@ -2908,7 +2918,7 @@
var modules = [klass, style, model$1];
var warn;
var warn;
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
@ -3023,13 +3033,13 @@
}
}
function text(el, dir) {
function text(el, dir) {
if (dir.value) {
addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
}
}
function html(el, dir) {
function html(el, dir) {
if (dir.value) {
addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
}
@ -3041,7 +3051,7 @@
html: html,
};
var baseOptions = {
var baseOptions = {
expectHTML: true,
modules: modules,
directives: directives,
@ -3055,7 +3065,7 @@
staticKeys: genStaticKeys$1(modules),
};
var isStaticKey;
var isStaticKey;
var isPlatformReservedTag$1;
var genStaticKeysCached = cached(genStaticKeys);
/**
@ -3172,7 +3182,7 @@
return false;
}
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnInvokeRE = /\([^)]*?\);*$/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
// KeyboardEvent.keyCode aliases
@ -3323,26 +3333,26 @@
")");
}
function on(el, dir) {
function on(el, dir) {
if (dir.modifiers) {
warn$2("v-on without argument does not support modifiers.");
}
el.wrapListeners = function (code) { return "_g(" + code + "," + dir.value + ")"; };
}
function bind(el, dir) {
function bind(el, dir) {
el.wrapData = function (code) {
return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
};
}
var baseDirectives = {
var baseDirectives = {
on: on,
bind: bind,
cloak: noop,
};
var CodegenState = /** @class */ (function () {
var CodegenState = /** @class */ (function () {
function CodegenState(options) {
this.options = options;
this.warn = options.warn || baseWarn;
@ -3822,7 +3832,7 @@
return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
}
// these keywords should not appear inside expressions, but operators like
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
var prohibitedKeywordRE = new RegExp('\\b' +
('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
@ -3930,7 +3940,7 @@
}
}
var range = 2;
var range = 2;
function generateCodeFrame(source, start, end) {
if (start === void 0) { start = 0; }
if (end === void 0) { end = source.length; }
@ -3980,7 +3990,7 @@
return result;
}
function createFunction(code, errors) {
function createFunction(code, errors) {
try {
return new Function(code);
}
@ -4070,7 +4080,7 @@
};
}
function createCompilerCreator(baseCompile) {
function createCompilerCreator(baseCompile) {
return function createCompiler(baseOptions) {
function compile(template, options) {
var finalOptions = Object.create(baseOptions);
@ -4127,7 +4137,7 @@
};
}
// `createCompilerCreator` allows creating compilers that use alternative
// `createCompilerCreator` allows creating compilers that use alternative
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
// Here we just export a default compiler using the default parts.
var createCompiler$1 = createCompilerCreator(function baseCompile(template, options) {
@ -4143,9 +4153,9 @@
};
});
var _a$1 = createCompiler$1(baseOptions), compile$1 = _a$1.compile, compileToFunctions$1 = _a$1.compileToFunctions;
var _a$1 = createCompiler$1(baseOptions), compile$1 = _a$1.compile, compileToFunctions$1 = _a$1.compileToFunctions;
var isAttr = makeMap('accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
var isAttr = makeMap('accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
'checked,cite,class,code,codebase,color,cols,colspan,content,' +
'contenteditable,contextmenu,controls,coords,data,datetime,default,' +
@ -4181,7 +4191,7 @@
return ESC[a] || a;
}
var plainStringRE = /^"(?:[^"\\]|\\.)*"$|^'(?:[^'\\]|\\.)*'$/;
var plainStringRE = /^"(?:[^"\\]|\\.)*"$|^'(?:[^'\\]|\\.)*'$/;
// let the model AST transform translate v-model into appropriate
// props bindings
function applyModelTransform(el, state) {
@ -4268,7 +4278,16 @@
}
}
// optimizability constants
/**
* In SSR, the vdom tree is generated only once and never patched, so
* we can optimize most element / trees into plain string render functions.
* The SSR optimizer walks the AST tree to detect optimizable elements and trees.
*
* The criteria for SSR optimizability is quite a bit looser than static tree
* detection (which is designed for client re-render). In SSR we bail only for
* components/slots/custom directives.
*/
// optimizability constants
var optimizability = {
FALSE: 0,
FULL: 1,
@ -4385,7 +4404,8 @@
node.directives.some(function (d) { return d.name === 'model'; }));
}
// segment types
// The SSR codegen is essentially extending the default codegen to handle
// segment types
var RAW = 0;
var INTERPOLATION = 1;
var EXPRESSION = 2;
@ -4579,7 +4599,7 @@
return mergedSegments.join('+');
}
var createCompiler = createCompilerCreator(function baseCompile(template, options) {
var createCompiler = createCompilerCreator(function baseCompile(template, options) {
var ast = parse(template.trim(), options);
optimize(ast, options);
var code = generate(ast, options);
@ -4590,7 +4610,7 @@
};
});
var _a = createCompiler(baseOptions), compile = _a.compile, compileToFunctions = _a.compileToFunctions;
var _a = createCompiler(baseOptions), compile = _a.compile, compileToFunctions = _a.compileToFunctions;
exports.compile = compile$1;
exports.compileToFunctions = compileToFunctions$1;

View File

@ -8,7 +8,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
var deindent__default = /*#__PURE__*/_interopDefaultLegacy(deindent);
/* @flow */
var emptyObject = Object.freeze({});
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
@ -152,7 +151,6 @@ function genStaticKeys$1(modules) {
.join(',');
}
/* @flow */
var isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
'link,meta,param,source,track,wbr');
// Elements that you can, intentionally, leave open
@ -166,7 +164,6 @@ var isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,capti
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
'title,tr,track');
/* @flow */
/**
* unicode letters used for parsing html tags, component names and property paths.
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
@ -474,7 +471,6 @@ function parseHTML(html, options) {
}
}
/* @flow */
var splitRE = /\r?\n/g;
var replaceRE = /./g;
var isSpecialTag = makeMap('script,style,template', true);
@ -591,7 +587,6 @@ function parseComponent(content, options) {
return sfc;
}
/* @flow */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
@ -690,7 +685,6 @@ var LIFECYCLE_HOOKS = [
'errorCaptured',
'serverPrefetch' ];
/* @flow */
var config = {
/**
* Option merge strategies (used in core/util/options)
@ -769,7 +763,6 @@ var config = {
_lifecycleHooks: LIFECYCLE_HOOKS,
};
/* @flow */
var warn$2 = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
@ -1183,7 +1176,6 @@ function dependArray(value) {
}
}
/* @flow */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
@ -1394,7 +1386,7 @@ function assertObjectType(name, value, vm) {
}
}
/* @flow */
/* globals MutationObserver */
var callbacks = [];
function flushCallbacks() {
var copies = callbacks.slice(0);
@ -1429,7 +1421,6 @@ else if (!isIE &&
else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) ;
else ;
/* @flow */
// these are reserved for web because they are directly compiled away
// during template compilation
makeMap('style,class');
@ -1450,7 +1441,6 @@ var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,co
'required,reversed,scoped,seamless,selected,sortable,' +
'truespeed,typemustmatch,visible');
/* @flow */
var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
@ -1483,7 +1473,6 @@ function getTagNamespace(tag) {
}
makeMap('text,number,password,search,email,tel,url');
/* @flow */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function parseFilters(exp) {
var inSingle = false;
@ -1607,7 +1596,6 @@ function wrapFilter(exp, filter) {
}
}
/* @flow */
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
var buildRegex = cached(function (delimiters) {
@ -1648,7 +1636,6 @@ function parseText(text, delimiters) {
};
}
/* @flow */
/* eslint-disable no-unused-vars */
function baseWarn(msg, range) {
console.error("[Vue compiler]: " + msg);
@ -1816,7 +1803,6 @@ function rangeSetItem(item, range) {
return item;
}
/* @flow */
function transformNode$1(el, options) {
var warn = options.warn || baseWarn;
var staticClass = getAndRemoveAttr(el, 'class');
@ -1853,7 +1839,6 @@ var klass = {
genData: genData$2,
};
/* @flow */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
@ -1867,7 +1852,6 @@ var parseStyleText = cached(function (cssText) {
return res;
});
/* @flow */
function transformNode(el, options) {
var warn = options.warn || baseWarn;
var staticStyle = getAndRemoveAttr(el, 'style');
@ -1905,7 +1889,6 @@ var style = {
genData: genData$1,
};
/* @flow */
/**
* Cross-platform code generation for component v-model
*/
@ -2031,7 +2014,6 @@ function parseString(chr) {
}
}
/* @flow */
var he = require('he');
var onRE = /^@|^v-on:/;
var dirRE = /^v-|^@|^:|^#/;
@ -2835,7 +2817,15 @@ function checkForAliasModel(el, value) {
}
}
/* @flow */
/**
* Expand input[v-model] with dynamic type bindings into v-if-else chains
* Turn this:
* <input v-model="data[type]" :type="type">
* into this:
* <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
* <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
* <input v-else :type="type" v-model="data[type]">
*/
function preTransformNode(el, options) {
if (el.tag === 'input') {
var map = el.attrsMap;
@ -2903,7 +2893,6 @@ var model$1 = {
var modules = [klass, style, model$1];
/* @flow */
var warn;
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
@ -3019,14 +3008,12 @@ function genDefaultModel(el, value, modifiers) {
}
}
/* @flow */
function text(el, dir) {
if (dir.value) {
addProp(el, 'textContent', "_s(" + dir.value + ")", dir);
}
}
/* @flow */
function html(el, dir) {
if (dir.value) {
addProp(el, 'innerHTML', "_s(" + dir.value + ")", dir);
@ -3039,7 +3026,6 @@ var directives = {
html: html,
};
/* @flow */
var baseOptions = {
expectHTML: true,
modules: modules,
@ -3054,7 +3040,6 @@ var baseOptions = {
staticKeys: genStaticKeys$1(modules),
};
/* @flow */
var isStaticKey;
var isPlatformReservedTag$1;
var genStaticKeysCached = cached(genStaticKeys);
@ -3172,7 +3157,6 @@ function isDirectChildOfTemplateFor(node) {
return false;
}
/* @flow */
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
var fnInvokeRE = /\([^)]*?\);*$/;
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
@ -3324,7 +3308,6 @@ function genFilterCode(key) {
")");
}
/* @flow */
function on(el, dir) {
if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
warn$2("v-on without argument does not support modifiers.");
@ -3332,21 +3315,18 @@ function on(el, dir) {
el.wrapListeners = function (code) { return "_g(" + code + "," + dir.value + ")"; };
}
/* @flow */
function bind(el, dir) {
el.wrapData = function (code) {
return "_b(" + code + ",'" + el.tag + "'," + dir.value + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")";
};
}
/* @flow */
var baseDirectives = {
on: on,
bind: bind,
cloak: noop,
};
/* @flow */
var CodegenState = /** @class */ (function () {
function CodegenState(options) {
this.options = options;
@ -3830,7 +3810,6 @@ function transformSpecialNewlines(text) {
return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029');
}
/* @flow */
// these keywords should not appear inside expressions, but operators like
// typeof, instanceof and in are allowed
var prohibitedKeywordRE = new RegExp('\\b' +
@ -3939,7 +3918,6 @@ function checkFunctionParameterExpression(exp, text, warn, range) {
}
}
/* @flow */
var range = 2;
function generateCodeFrame(source, start, end) {
if (start === void 0) { start = 0; }
@ -3990,7 +3968,6 @@ function repeat(str, n) {
return result;
}
/* @flow */
function createFunction(code, errors) {
try {
return new Function(code);
@ -4081,7 +4058,6 @@ function createCompileToFunctionFn(compile) {
};
}
/* @flow */
function createCompilerCreator(baseCompile) {
return function createCompiler(baseOptions) {
function compile(template, options) {
@ -4140,7 +4116,6 @@ function createCompilerCreator(baseCompile) {
};
}
/* @flow */
// `createCompilerCreator` allows creating compilers that use alternative
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
// Here we just export a default compiler using the default parts.
@ -4157,10 +4132,8 @@ var createCompiler$1 = createCompilerCreator(function baseCompile(template, opti
};
});
/* @flow */
var _a$1 = createCompiler$1(baseOptions), compile$1 = _a$1.compile, compileToFunctions$1 = _a$1.compileToFunctions;
/* @flow */
var isAttr = makeMap('accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
'checked,cite,class,code,codebase,color,cols,colspan,content,' +
@ -4197,7 +4170,6 @@ function escapeChar(a) {
return ESC[a] || a;
}
/* @flow */
var plainStringRE = /^"(?:[^"\\]|\\.)*"$|^'(?:[^'\\]|\\.)*'$/;
// let the model AST transform translate v-model into appropriate
// props bindings
@ -4285,7 +4257,15 @@ function genStyleSegments(staticStyle, parsedStaticStyle, styleBinding, vShowExp
}
}
/* @flow */
/**
* In SSR, the vdom tree is generated only once and never patched, so
* we can optimize most element / trees into plain string render functions.
* The SSR optimizer walks the AST tree to detect optimizable elements and trees.
*
* The criteria for SSR optimizability is quite a bit looser than static tree
* detection (which is designed for client re-render). In SSR we bail only for
* components/slots/custom directives.
*/
// optimizability constants
var optimizability = {
FALSE: 0,
@ -4403,7 +4383,7 @@ function isSelectWithModel(node) {
node.directives.some(function (d) { return d.name === 'model'; }));
}
/* @flow */
// The SSR codegen is essentially extending the default codegen to handle
// segment types
var RAW = 0;
var INTERPOLATION = 1;
@ -4598,7 +4578,6 @@ function flattenSegments(segments) {
return mergedSegments.join('+');
}
/* @flow */
var createCompiler = createCompilerCreator(function baseCompile(template, options) {
var ast = parse(template.trim(), options);
optimize(ast, options);
@ -4610,7 +4589,6 @@ var createCompiler = createCompilerCreator(function baseCompile(template, option
};
});
/* @flow */
var _a = createCompiler(baseOptions), compile = _a.compile, compileToFunctions = _a.compileToFunctions;
exports.compile = compile$1;

2304
yarn.lock

File diff suppressed because it is too large Load Diff