@vue/server-renderer 3.2.45 → 3.2.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -94,7 +94,7 @@ function normalizeClass(value) {
|
|
|
94
94
|
// These tag configs are shared between compiler-dom and runtime-dom, so they
|
|
95
95
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
96
96
|
const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,aside,footer,' +
|
|
97
|
-
'header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
|
97
|
+
'header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,' +
|
|
98
98
|
'figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,' +
|
|
99
99
|
'data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,' +
|
|
100
100
|
'time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,' +
|
|
@@ -106,7 +106,7 @@ const HTML_TAGS = 'html,body,base,head,link,meta,style,title,address,article,asi
|
|
|
106
106
|
const SVG_TAGS = 'svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,' +
|
|
107
107
|
'defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,' +
|
|
108
108
|
'feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,' +
|
|
109
|
-
'
|
|
109
|
+
'feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,' +
|
|
110
110
|
'feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,' +
|
|
111
111
|
'fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,' +
|
|
112
112
|
'foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,' +
|
|
@@ -333,8 +333,8 @@ const remove = (arr, el) => {
|
|
|
333
333
|
arr.splice(i, 1);
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
337
|
-
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
336
|
+
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
337
|
+
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
338
338
|
const isArray = Array.isArray;
|
|
339
339
|
const isMap = (val) => toTypeString(val) === '[object Map]';
|
|
340
340
|
const isSet = (val) => toTypeString(val) === '[object Set]';
|
|
@@ -405,7 +405,11 @@ const def = (obj, key, value) => {
|
|
|
405
405
|
value
|
|
406
406
|
});
|
|
407
407
|
};
|
|
408
|
-
|
|
408
|
+
/**
|
|
409
|
+
* "123-foo" will be parsed to 123
|
|
410
|
+
* This is used for the .number modifier in v-model
|
|
411
|
+
*/
|
|
412
|
+
const looseToNumber = (val) => {
|
|
409
413
|
const n = parseFloat(val);
|
|
410
414
|
return isNaN(n) ? val : n;
|
|
411
415
|
};
|
|
@@ -424,7 +428,7 @@ const getGlobalThis = () => {
|
|
|
424
428
|
: {}));
|
|
425
429
|
};
|
|
426
430
|
|
|
427
|
-
function warn(msg, ...args) {
|
|
431
|
+
function warn$1(msg, ...args) {
|
|
428
432
|
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
429
433
|
}
|
|
430
434
|
|
|
@@ -435,7 +439,7 @@ class EffectScope {
|
|
|
435
439
|
/**
|
|
436
440
|
* @internal
|
|
437
441
|
*/
|
|
438
|
-
this.
|
|
442
|
+
this._active = true;
|
|
439
443
|
/**
|
|
440
444
|
* @internal
|
|
441
445
|
*/
|
|
@@ -450,8 +454,11 @@ class EffectScope {
|
|
|
450
454
|
(activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
451
455
|
}
|
|
452
456
|
}
|
|
457
|
+
get active() {
|
|
458
|
+
return this._active;
|
|
459
|
+
}
|
|
453
460
|
run(fn) {
|
|
454
|
-
if (this.
|
|
461
|
+
if (this._active) {
|
|
455
462
|
const currentEffectScope = activeEffectScope;
|
|
456
463
|
try {
|
|
457
464
|
activeEffectScope = this;
|
|
@@ -462,7 +469,7 @@ class EffectScope {
|
|
|
462
469
|
}
|
|
463
470
|
}
|
|
464
471
|
else {
|
|
465
|
-
warn(`cannot run an inactive effect scope.`);
|
|
472
|
+
warn$1(`cannot run an inactive effect scope.`);
|
|
466
473
|
}
|
|
467
474
|
}
|
|
468
475
|
/**
|
|
@@ -480,7 +487,7 @@ class EffectScope {
|
|
|
480
487
|
activeEffectScope = this.parent;
|
|
481
488
|
}
|
|
482
489
|
stop(fromParent) {
|
|
483
|
-
if (this.
|
|
490
|
+
if (this._active) {
|
|
484
491
|
let i, l;
|
|
485
492
|
for (i = 0, l = this.effects.length; i < l; i++) {
|
|
486
493
|
this.effects[i].stop();
|
|
@@ -503,7 +510,7 @@ class EffectScope {
|
|
|
503
510
|
}
|
|
504
511
|
}
|
|
505
512
|
this.parent = undefined;
|
|
506
|
-
this.
|
|
513
|
+
this._active = false;
|
|
507
514
|
}
|
|
508
515
|
}
|
|
509
516
|
}
|
|
@@ -512,6 +519,9 @@ function recordEffectScope(effect, scope = activeEffectScope) {
|
|
|
512
519
|
scope.effects.push(effect);
|
|
513
520
|
}
|
|
514
521
|
}
|
|
522
|
+
function getCurrentScope() {
|
|
523
|
+
return activeEffectScope;
|
|
524
|
+
}
|
|
515
525
|
|
|
516
526
|
const createDep = (effects) => {
|
|
517
527
|
const dep = new Set(effects);
|
|
@@ -692,7 +702,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
692
702
|
deps = [...depsMap.values()];
|
|
693
703
|
}
|
|
694
704
|
else if (key === 'length' && isArray(target)) {
|
|
695
|
-
const newLength =
|
|
705
|
+
const newLength = Number(newValue);
|
|
696
706
|
depsMap.forEach((dep, key) => {
|
|
697
707
|
if (key === 'length' || key >= newLength) {
|
|
698
708
|
deps.push(dep);
|
|
@@ -792,7 +802,7 @@ Object.getOwnPropertyNames(Symbol)
|
|
|
792
802
|
.filter(key => key !== 'arguments' && key !== 'caller')
|
|
793
803
|
.map(key => Symbol[key])
|
|
794
804
|
.filter(isSymbol));
|
|
795
|
-
const get = /*#__PURE__*/ createGetter();
|
|
805
|
+
const get$1 = /*#__PURE__*/ createGetter();
|
|
796
806
|
const shallowGet = /*#__PURE__*/ createGetter(false, true);
|
|
797
807
|
const readonlyGet = /*#__PURE__*/ createGetter(true);
|
|
798
808
|
const shallowReadonlyGet = /*#__PURE__*/ createGetter(true, true);
|
|
@@ -826,6 +836,11 @@ function createArrayInstrumentations() {
|
|
|
826
836
|
});
|
|
827
837
|
return instrumentations;
|
|
828
838
|
}
|
|
839
|
+
function hasOwnProperty(key) {
|
|
840
|
+
const obj = toRaw(this);
|
|
841
|
+
track(obj, "has" /* TrackOpTypes.HAS */, key);
|
|
842
|
+
return obj.hasOwnProperty(key);
|
|
843
|
+
}
|
|
829
844
|
function createGetter(isReadonly = false, shallow = false) {
|
|
830
845
|
return function get(target, key, receiver) {
|
|
831
846
|
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
@@ -849,8 +864,13 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
849
864
|
return target;
|
|
850
865
|
}
|
|
851
866
|
const targetIsArray = isArray(target);
|
|
852
|
-
if (!isReadonly
|
|
853
|
-
|
|
867
|
+
if (!isReadonly) {
|
|
868
|
+
if (targetIsArray && hasOwn(arrayInstrumentations, key)) {
|
|
869
|
+
return Reflect.get(arrayInstrumentations, key, receiver);
|
|
870
|
+
}
|
|
871
|
+
if (key === 'hasOwnProperty') {
|
|
872
|
+
return hasOwnProperty;
|
|
873
|
+
}
|
|
854
874
|
}
|
|
855
875
|
const res = Reflect.get(target, key, receiver);
|
|
856
876
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
@@ -875,7 +895,7 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
875
895
|
return res;
|
|
876
896
|
};
|
|
877
897
|
}
|
|
878
|
-
const set = /*#__PURE__*/ createSetter();
|
|
898
|
+
const set$1 = /*#__PURE__*/ createSetter();
|
|
879
899
|
const shallowSet = /*#__PURE__*/ createSetter(true);
|
|
880
900
|
function createSetter(shallow = false) {
|
|
881
901
|
return function set(target, key, value, receiver) {
|
|
@@ -918,7 +938,7 @@ function deleteProperty(target, key) {
|
|
|
918
938
|
}
|
|
919
939
|
return result;
|
|
920
940
|
}
|
|
921
|
-
function has(target, key) {
|
|
941
|
+
function has$1(target, key) {
|
|
922
942
|
const result = Reflect.has(target, key);
|
|
923
943
|
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
924
944
|
track(target, "has" /* TrackOpTypes.HAS */, key);
|
|
@@ -930,23 +950,23 @@ function ownKeys(target) {
|
|
|
930
950
|
return Reflect.ownKeys(target);
|
|
931
951
|
}
|
|
932
952
|
const mutableHandlers = {
|
|
933
|
-
get,
|
|
934
|
-
set,
|
|
953
|
+
get: get$1,
|
|
954
|
+
set: set$1,
|
|
935
955
|
deleteProperty,
|
|
936
|
-
has,
|
|
956
|
+
has: has$1,
|
|
937
957
|
ownKeys
|
|
938
958
|
};
|
|
939
959
|
const readonlyHandlers = {
|
|
940
960
|
get: readonlyGet,
|
|
941
961
|
set(target, key) {
|
|
942
962
|
{
|
|
943
|
-
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
963
|
+
warn$1(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
944
964
|
}
|
|
945
965
|
return true;
|
|
946
966
|
},
|
|
947
967
|
deleteProperty(target, key) {
|
|
948
968
|
{
|
|
949
|
-
warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
969
|
+
warn$1(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
950
970
|
}
|
|
951
971
|
return true;
|
|
952
972
|
}
|
|
@@ -964,7 +984,7 @@ const shallowReadonlyHandlers = /*#__PURE__*/ extend({}, readonlyHandlers, {
|
|
|
964
984
|
|
|
965
985
|
const toShallow = (value) => value;
|
|
966
986
|
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
967
|
-
function get
|
|
987
|
+
function get(target, key, isReadonly = false, isShallow = false) {
|
|
968
988
|
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
|
969
989
|
// of the value
|
|
970
990
|
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
@@ -990,7 +1010,7 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
|
990
1010
|
target.get(key);
|
|
991
1011
|
}
|
|
992
1012
|
}
|
|
993
|
-
function has
|
|
1013
|
+
function has(key, isReadonly = false) {
|
|
994
1014
|
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
995
1015
|
const rawTarget = toRaw(target);
|
|
996
1016
|
const rawKey = toRaw(key);
|
|
@@ -1020,7 +1040,7 @@ function add(value) {
|
|
|
1020
1040
|
}
|
|
1021
1041
|
return this;
|
|
1022
1042
|
}
|
|
1023
|
-
function set
|
|
1043
|
+
function set(key, value) {
|
|
1024
1044
|
value = toRaw(value);
|
|
1025
1045
|
const target = toRaw(this);
|
|
1026
1046
|
const { has, get } = getProto(target);
|
|
@@ -1133,41 +1153,41 @@ function createReadonlyMethod(type) {
|
|
|
1133
1153
|
function createInstrumentations() {
|
|
1134
1154
|
const mutableInstrumentations = {
|
|
1135
1155
|
get(key) {
|
|
1136
|
-
return get
|
|
1156
|
+
return get(this, key);
|
|
1137
1157
|
},
|
|
1138
1158
|
get size() {
|
|
1139
1159
|
return size(this);
|
|
1140
1160
|
},
|
|
1141
|
-
has
|
|
1161
|
+
has,
|
|
1142
1162
|
add,
|
|
1143
|
-
set
|
|
1163
|
+
set,
|
|
1144
1164
|
delete: deleteEntry,
|
|
1145
1165
|
clear,
|
|
1146
1166
|
forEach: createForEach(false, false)
|
|
1147
1167
|
};
|
|
1148
1168
|
const shallowInstrumentations = {
|
|
1149
1169
|
get(key) {
|
|
1150
|
-
return get
|
|
1170
|
+
return get(this, key, false, true);
|
|
1151
1171
|
},
|
|
1152
1172
|
get size() {
|
|
1153
1173
|
return size(this);
|
|
1154
1174
|
},
|
|
1155
|
-
has
|
|
1175
|
+
has,
|
|
1156
1176
|
add,
|
|
1157
|
-
set
|
|
1177
|
+
set,
|
|
1158
1178
|
delete: deleteEntry,
|
|
1159
1179
|
clear,
|
|
1160
1180
|
forEach: createForEach(false, true)
|
|
1161
1181
|
};
|
|
1162
1182
|
const readonlyInstrumentations = {
|
|
1163
1183
|
get(key) {
|
|
1164
|
-
return get
|
|
1184
|
+
return get(this, key, true);
|
|
1165
1185
|
},
|
|
1166
1186
|
get size() {
|
|
1167
1187
|
return size(this, true);
|
|
1168
1188
|
},
|
|
1169
1189
|
has(key) {
|
|
1170
|
-
return has
|
|
1190
|
+
return has.call(this, key, true);
|
|
1171
1191
|
},
|
|
1172
1192
|
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1173
1193
|
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
@@ -1177,13 +1197,13 @@ function createInstrumentations() {
|
|
|
1177
1197
|
};
|
|
1178
1198
|
const shallowReadonlyInstrumentations = {
|
|
1179
1199
|
get(key) {
|
|
1180
|
-
return get
|
|
1200
|
+
return get(this, key, true, true);
|
|
1181
1201
|
},
|
|
1182
1202
|
get size() {
|
|
1183
1203
|
return size(this, true);
|
|
1184
1204
|
},
|
|
1185
1205
|
has(key) {
|
|
1186
|
-
return has
|
|
1206
|
+
return has.call(this, key, true);
|
|
1187
1207
|
},
|
|
1188
1208
|
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1189
1209
|
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
@@ -1374,9 +1394,10 @@ function trackRefValue(ref) {
|
|
|
1374
1394
|
}
|
|
1375
1395
|
function triggerRefValue(ref, newVal) {
|
|
1376
1396
|
ref = toRaw(ref);
|
|
1377
|
-
|
|
1397
|
+
const dep = ref.dep;
|
|
1398
|
+
if (dep) {
|
|
1378
1399
|
{
|
|
1379
|
-
triggerEffects(
|
|
1400
|
+
triggerEffects(dep, {
|
|
1380
1401
|
target: ref,
|
|
1381
1402
|
type: "set" /* TriggerOpTypes.SET */,
|
|
1382
1403
|
key: 'value',
|
|
@@ -1443,7 +1464,7 @@ class ComputedRefImpl {
|
|
|
1443
1464
|
}
|
|
1444
1465
|
}
|
|
1445
1466
|
_a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1446
|
-
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1467
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1447
1468
|
let getter;
|
|
1448
1469
|
let setter;
|
|
1449
1470
|
const onlyGetter = isFunction(getterOrOptions);
|
|
@@ -1473,7 +1494,7 @@ function pushWarningContext(vnode) {
|
|
|
1473
1494
|
function popWarningContext() {
|
|
1474
1495
|
stack.pop();
|
|
1475
1496
|
}
|
|
1476
|
-
function warn
|
|
1497
|
+
function warn(msg, ...args) {
|
|
1477
1498
|
// avoid props formatting or warn handler tracking deps that might be mutated
|
|
1478
1499
|
// during patch, leading to infinite recursion.
|
|
1479
1500
|
pauseTracking();
|
|
@@ -1672,7 +1693,7 @@ function logError(err, type, contextVNode, throwInDev = true) {
|
|
|
1672
1693
|
if (contextVNode) {
|
|
1673
1694
|
pushWarningContext(contextVNode);
|
|
1674
1695
|
}
|
|
1675
|
-
warn
|
|
1696
|
+
warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1676
1697
|
if (contextVNode) {
|
|
1677
1698
|
popWarningContext();
|
|
1678
1699
|
}
|
|
@@ -1868,7 +1889,7 @@ function checkRecursiveUpdates(seen, fn) {
|
|
|
1868
1889
|
if (count > RECURSION_LIMIT) {
|
|
1869
1890
|
const instance = fn.ownerInstance;
|
|
1870
1891
|
const componentName = instance && getComponentName(instance.type);
|
|
1871
|
-
warn
|
|
1892
|
+
warn(`Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. ` +
|
|
1872
1893
|
`This means you have a reactive effect that is mutating its own ` +
|
|
1873
1894
|
`dependencies and thus recursively triggering itself. Possible sources ` +
|
|
1874
1895
|
`include component template, render function, updated hook or ` +
|
|
@@ -2019,7 +2040,7 @@ function tryWrap(fn) {
|
|
|
2019
2040
|
let devtools;
|
|
2020
2041
|
let buffer = [];
|
|
2021
2042
|
let devtoolsNotInstalled = false;
|
|
2022
|
-
function emit(event, ...args) {
|
|
2043
|
+
function emit$1(event, ...args) {
|
|
2023
2044
|
if (devtools) {
|
|
2024
2045
|
devtools.emit(event, ...args);
|
|
2025
2046
|
}
|
|
@@ -2066,7 +2087,7 @@ function setDevtoolsHook(hook, target) {
|
|
|
2066
2087
|
}
|
|
2067
2088
|
}
|
|
2068
2089
|
function devtoolsInitApp(app, version) {
|
|
2069
|
-
emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
|
|
2090
|
+
emit$1("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
|
|
2070
2091
|
Fragment,
|
|
2071
2092
|
Text,
|
|
2072
2093
|
Comment,
|
|
@@ -2074,7 +2095,7 @@ function devtoolsInitApp(app, version) {
|
|
|
2074
2095
|
});
|
|
2075
2096
|
}
|
|
2076
2097
|
function devtoolsUnmountApp(app) {
|
|
2077
|
-
emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
|
|
2098
|
+
emit$1("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
|
|
2078
2099
|
}
|
|
2079
2100
|
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
|
|
2080
2101
|
const devtoolsComponentUpdated =
|
|
@@ -2090,21 +2111,21 @@ const devtoolsComponentRemoved = (component) => {
|
|
|
2090
2111
|
};
|
|
2091
2112
|
function createDevtoolsComponentHook(hook) {
|
|
2092
2113
|
return (component) => {
|
|
2093
|
-
emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
2114
|
+
emit$1(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
2094
2115
|
};
|
|
2095
2116
|
}
|
|
2096
2117
|
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
|
|
2097
2118
|
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
|
|
2098
2119
|
function createDevtoolsPerformanceHook(hook) {
|
|
2099
2120
|
return (component, type, time) => {
|
|
2100
|
-
emit(hook, component.appContext.app, component.uid, component, type, time);
|
|
2121
|
+
emit$1(hook, component.appContext.app, component.uid, component, type, time);
|
|
2101
2122
|
};
|
|
2102
2123
|
}
|
|
2103
2124
|
function devtoolsComponentEmit(component, event, params) {
|
|
2104
|
-
emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2125
|
+
emit$1("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2105
2126
|
}
|
|
2106
2127
|
|
|
2107
|
-
function emit
|
|
2128
|
+
function emit(instance, event, ...rawArgs) {
|
|
2108
2129
|
if (instance.isUnmounted)
|
|
2109
2130
|
return;
|
|
2110
2131
|
const props = instance.vnode.props || EMPTY_OBJ;
|
|
@@ -2114,7 +2135,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2114
2135
|
if (!(event in emitsOptions) &&
|
|
2115
2136
|
!(false )) {
|
|
2116
2137
|
if (!propsOptions || !(toHandlerKey(event) in propsOptions)) {
|
|
2117
|
-
warn
|
|
2138
|
+
warn(`Component emitted event "${event}" but it is neither declared in ` +
|
|
2118
2139
|
`the emits option nor as an "${toHandlerKey(event)}" prop.`);
|
|
2119
2140
|
}
|
|
2120
2141
|
}
|
|
@@ -2123,7 +2144,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2123
2144
|
if (isFunction(validator)) {
|
|
2124
2145
|
const isValid = validator(...rawArgs);
|
|
2125
2146
|
if (!isValid) {
|
|
2126
|
-
warn
|
|
2147
|
+
warn(`Invalid event arguments: event validation failed for event "${event}".`);
|
|
2127
2148
|
}
|
|
2128
2149
|
}
|
|
2129
2150
|
}
|
|
@@ -2140,7 +2161,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2140
2161
|
args = rawArgs.map(a => (isString(a) ? a.trim() : a));
|
|
2141
2162
|
}
|
|
2142
2163
|
if (number) {
|
|
2143
|
-
args = rawArgs.map(
|
|
2164
|
+
args = rawArgs.map(looseToNumber);
|
|
2144
2165
|
}
|
|
2145
2166
|
}
|
|
2146
2167
|
{
|
|
@@ -2149,7 +2170,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2149
2170
|
{
|
|
2150
2171
|
const lowerCaseEvent = event.toLowerCase();
|
|
2151
2172
|
if (lowerCaseEvent !== event && props[toHandlerKey(lowerCaseEvent)]) {
|
|
2152
|
-
warn
|
|
2173
|
+
warn(`Event "${lowerCaseEvent}" is emitted in component ` +
|
|
2153
2174
|
`${formatComponentName(instance, instance.type)} but the handler is registered for "${event}". ` +
|
|
2154
2175
|
`Note that HTML attributes are case-insensitive and you cannot use ` +
|
|
2155
2176
|
`v-on to listen to camelCase events when using in-DOM templates. ` +
|
|
@@ -2254,7 +2275,7 @@ let currentScopeId = null;
|
|
|
2254
2275
|
* setCurrentRenderingInstance(prev)
|
|
2255
2276
|
* ```
|
|
2256
2277
|
*/
|
|
2257
|
-
function setCurrentRenderingInstance(instance) {
|
|
2278
|
+
function setCurrentRenderingInstance$1(instance) {
|
|
2258
2279
|
const prev = currentRenderingInstance;
|
|
2259
2280
|
currentRenderingInstance = instance;
|
|
2260
2281
|
currentScopeId = (instance && instance.type.__scopeId) || null;
|
|
@@ -2281,13 +2302,13 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot // false on
|
|
|
2281
2302
|
if (renderFnWithContext._d) {
|
|
2282
2303
|
setBlockTracking(-1);
|
|
2283
2304
|
}
|
|
2284
|
-
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
2305
|
+
const prevInstance = setCurrentRenderingInstance$1(ctx);
|
|
2285
2306
|
let res;
|
|
2286
2307
|
try {
|
|
2287
2308
|
res = fn(...args);
|
|
2288
2309
|
}
|
|
2289
2310
|
finally {
|
|
2290
|
-
setCurrentRenderingInstance(prevInstance);
|
|
2311
|
+
setCurrentRenderingInstance$1(prevInstance);
|
|
2291
2312
|
if (renderFnWithContext._d) {
|
|
2292
2313
|
setBlockTracking(1);
|
|
2293
2314
|
}
|
|
@@ -2317,11 +2338,11 @@ let accessedAttrs = false;
|
|
|
2317
2338
|
function markAttrsAccessed() {
|
|
2318
2339
|
accessedAttrs = true;
|
|
2319
2340
|
}
|
|
2320
|
-
function renderComponentRoot(instance) {
|
|
2341
|
+
function renderComponentRoot$1(instance) {
|
|
2321
2342
|
const { type: Component, vnode, proxy, withProxy, props, propsOptions: [propsOptions], slots, attrs, emit, render, renderCache, data, setupState, ctx, inheritAttrs } = instance;
|
|
2322
2343
|
let result;
|
|
2323
2344
|
let fallthroughAttrs;
|
|
2324
|
-
const prev = setCurrentRenderingInstance(instance);
|
|
2345
|
+
const prev = setCurrentRenderingInstance$1(instance);
|
|
2325
2346
|
{
|
|
2326
2347
|
accessedAttrs = false;
|
|
2327
2348
|
}
|
|
@@ -2330,7 +2351,7 @@ function renderComponentRoot(instance) {
|
|
|
2330
2351
|
// withProxy is a proxy with a different `has` trap only for
|
|
2331
2352
|
// runtime-compiled render functions using `with` block.
|
|
2332
2353
|
const proxyToUse = withProxy || proxy;
|
|
2333
|
-
result = normalizeVNode(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
|
|
2354
|
+
result = normalizeVNode$1(render.call(proxyToUse, proxyToUse, renderCache, props, setupState, data, ctx));
|
|
2334
2355
|
fallthroughAttrs = attrs;
|
|
2335
2356
|
}
|
|
2336
2357
|
else {
|
|
@@ -2340,7 +2361,7 @@ function renderComponentRoot(instance) {
|
|
|
2340
2361
|
if (true && attrs === props) {
|
|
2341
2362
|
markAttrsAccessed();
|
|
2342
2363
|
}
|
|
2343
|
-
result = normalizeVNode(render.length > 1
|
|
2364
|
+
result = normalizeVNode$1(render.length > 1
|
|
2344
2365
|
? render(props, true
|
|
2345
2366
|
? {
|
|
2346
2367
|
get attrs() {
|
|
@@ -2358,7 +2379,6 @@ function renderComponentRoot(instance) {
|
|
|
2358
2379
|
}
|
|
2359
2380
|
}
|
|
2360
2381
|
catch (err) {
|
|
2361
|
-
blockStack.length = 0;
|
|
2362
2382
|
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
2363
2383
|
result = createVNode(Comment);
|
|
2364
2384
|
}
|
|
@@ -2404,13 +2424,13 @@ function renderComponentRoot(instance) {
|
|
|
2404
2424
|
}
|
|
2405
2425
|
}
|
|
2406
2426
|
if (extraAttrs.length) {
|
|
2407
|
-
warn
|
|
2427
|
+
warn(`Extraneous non-props attributes (` +
|
|
2408
2428
|
`${extraAttrs.join(', ')}) ` +
|
|
2409
2429
|
`were passed to component but could not be automatically inherited ` +
|
|
2410
2430
|
`because component renders fragment or text root nodes.`);
|
|
2411
2431
|
}
|
|
2412
2432
|
if (eventAttrs.length) {
|
|
2413
|
-
warn
|
|
2433
|
+
warn(`Extraneous non-emits event listeners (` +
|
|
2414
2434
|
`${eventAttrs.join(', ')}) ` +
|
|
2415
2435
|
`were passed to component but could not be automatically inherited ` +
|
|
2416
2436
|
`because component renders fragment or text root nodes. ` +
|
|
@@ -2423,7 +2443,7 @@ function renderComponentRoot(instance) {
|
|
|
2423
2443
|
// inherit directives
|
|
2424
2444
|
if (vnode.dirs) {
|
|
2425
2445
|
if (!isElementRoot(root)) {
|
|
2426
|
-
warn
|
|
2446
|
+
warn(`Runtime directive used on component with non-element root node. ` +
|
|
2427
2447
|
`The directives will not function as intended.`);
|
|
2428
2448
|
}
|
|
2429
2449
|
// clone before mutating since the root may be a hoisted vnode
|
|
@@ -2433,7 +2453,7 @@ function renderComponentRoot(instance) {
|
|
|
2433
2453
|
// inherit transition data
|
|
2434
2454
|
if (vnode.transition) {
|
|
2435
2455
|
if (!isElementRoot(root)) {
|
|
2436
|
-
warn
|
|
2456
|
+
warn(`Component inside <Transition> renders non-element root node ` +
|
|
2437
2457
|
`that cannot be animated.`);
|
|
2438
2458
|
}
|
|
2439
2459
|
root.transition = vnode.transition;
|
|
@@ -2444,7 +2464,7 @@ function renderComponentRoot(instance) {
|
|
|
2444
2464
|
else {
|
|
2445
2465
|
result = root;
|
|
2446
2466
|
}
|
|
2447
|
-
setCurrentRenderingInstance(prev);
|
|
2467
|
+
setCurrentRenderingInstance$1(prev);
|
|
2448
2468
|
return result;
|
|
2449
2469
|
}
|
|
2450
2470
|
/**
|
|
@@ -2473,13 +2493,13 @@ const getChildRoot = (vnode) => {
|
|
|
2473
2493
|
}
|
|
2474
2494
|
}
|
|
2475
2495
|
};
|
|
2476
|
-
return [normalizeVNode(childRoot), setRoot];
|
|
2496
|
+
return [normalizeVNode$1(childRoot), setRoot];
|
|
2477
2497
|
};
|
|
2478
2498
|
function filterSingleRoot(children) {
|
|
2479
2499
|
let singleRoot;
|
|
2480
2500
|
for (let i = 0; i < children.length; i++) {
|
|
2481
2501
|
const child = children[i];
|
|
2482
|
-
if (isVNode(child)) {
|
|
2502
|
+
if (isVNode$2(child)) {
|
|
2483
2503
|
// ignore user comment
|
|
2484
2504
|
if (child.type !== Comment || child.children === 'v-if') {
|
|
2485
2505
|
if (singleRoot) {
|
|
@@ -2619,7 +2639,7 @@ function queueEffectWithSuspense(fn, suspense) {
|
|
|
2619
2639
|
function provide(key, value) {
|
|
2620
2640
|
if (!currentInstance) {
|
|
2621
2641
|
{
|
|
2622
|
-
warn
|
|
2642
|
+
warn(`provide() can only be used inside setup().`);
|
|
2623
2643
|
}
|
|
2624
2644
|
}
|
|
2625
2645
|
else {
|
|
@@ -2658,11 +2678,11 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
|
2658
2678
|
: defaultValue;
|
|
2659
2679
|
}
|
|
2660
2680
|
else {
|
|
2661
|
-
warn
|
|
2681
|
+
warn(`injection "${String(key)}" not found.`);
|
|
2662
2682
|
}
|
|
2663
2683
|
}
|
|
2664
2684
|
else {
|
|
2665
|
-
warn
|
|
2685
|
+
warn(`inject() can only be used inside setup() or functional components.`);
|
|
2666
2686
|
}
|
|
2667
2687
|
}
|
|
2668
2688
|
|
|
@@ -2671,7 +2691,7 @@ const INITIAL_WATCHER_VALUE = {};
|
|
|
2671
2691
|
// implementation
|
|
2672
2692
|
function watch(source, cb, options) {
|
|
2673
2693
|
if (!isFunction(cb)) {
|
|
2674
|
-
warn
|
|
2694
|
+
warn(`\`watch(fn, options?)\` signature has been moved to a separate API. ` +
|
|
2675
2695
|
`Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` +
|
|
2676
2696
|
`supports \`watch(source, cb, options?) signature.`);
|
|
2677
2697
|
}
|
|
@@ -2680,19 +2700,20 @@ function watch(source, cb, options) {
|
|
|
2680
2700
|
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
2681
2701
|
if (!cb) {
|
|
2682
2702
|
if (immediate !== undefined) {
|
|
2683
|
-
warn
|
|
2703
|
+
warn(`watch() "immediate" option is only respected when using the ` +
|
|
2684
2704
|
`watch(source, callback, options?) signature.`);
|
|
2685
2705
|
}
|
|
2686
2706
|
if (deep !== undefined) {
|
|
2687
|
-
warn
|
|
2707
|
+
warn(`watch() "deep" option is only respected when using the ` +
|
|
2688
2708
|
`watch(source, callback, options?) signature.`);
|
|
2689
2709
|
}
|
|
2690
2710
|
}
|
|
2691
2711
|
const warnInvalidSource = (s) => {
|
|
2692
|
-
warn
|
|
2712
|
+
warn(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, ` +
|
|
2693
2713
|
`a reactive object, or an array of these types.`);
|
|
2694
2714
|
};
|
|
2695
|
-
const instance = currentInstance;
|
|
2715
|
+
const instance = getCurrentScope() === (currentInstance === null || currentInstance === void 0 ? void 0 : currentInstance.scope) ? currentInstance : null;
|
|
2716
|
+
// const instance = currentInstance
|
|
2696
2717
|
let getter;
|
|
2697
2718
|
let forceTrigger = false;
|
|
2698
2719
|
let isMultiSource = false;
|
|
@@ -2803,7 +2824,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2803
2824
|
// pass undefined as the old value when it's changed for the first time
|
|
2804
2825
|
oldValue === INITIAL_WATCHER_VALUE
|
|
2805
2826
|
? undefined
|
|
2806
|
-
:
|
|
2827
|
+
: isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE
|
|
2807
2828
|
? []
|
|
2808
2829
|
: oldValue,
|
|
2809
2830
|
onCleanup
|
|
@@ -3013,7 +3034,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
3013
3034
|
}
|
|
3014
3035
|
else {
|
|
3015
3036
|
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ''));
|
|
3016
|
-
warn
|
|
3037
|
+
warn(`${apiName} is called when there is no active component instance to be ` +
|
|
3017
3038
|
`associated with. ` +
|
|
3018
3039
|
`Lifecycle injection APIs can only be used during execution of setup().` +
|
|
3019
3040
|
(` If you are using async setup(), make sure to register lifecycle ` +
|
|
@@ -3052,7 +3073,7 @@ return withDirectives(h(comp), [
|
|
|
3052
3073
|
*/
|
|
3053
3074
|
function validateDirectiveName(name) {
|
|
3054
3075
|
if (isBuiltInDirective(name)) {
|
|
3055
|
-
warn
|
|
3076
|
+
warn('Do not use built-in directive ids as custom directive id: ' + name);
|
|
3056
3077
|
}
|
|
3057
3078
|
}
|
|
3058
3079
|
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
@@ -3202,11 +3223,11 @@ const PublicInstanceProxyHandlers = {
|
|
|
3202
3223
|
// to infinite warning loop
|
|
3203
3224
|
key.indexOf('__v') !== 0)) {
|
|
3204
3225
|
if (data !== EMPTY_OBJ && isReservedPrefix(key[0]) && hasOwn(data, key)) {
|
|
3205
|
-
warn
|
|
3226
|
+
warn(`Property ${JSON.stringify(key)} must be accessed via $data because it starts with a reserved ` +
|
|
3206
3227
|
`character ("$" or "_") and is not proxied on the render context.`);
|
|
3207
3228
|
}
|
|
3208
3229
|
else if (instance === currentRenderingInstance) {
|
|
3209
|
-
warn
|
|
3230
|
+
warn(`Property ${JSON.stringify(key)} was accessed during render ` +
|
|
3210
3231
|
`but is not defined on instance.`);
|
|
3211
3232
|
}
|
|
3212
3233
|
}
|
|
@@ -3219,7 +3240,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3219
3240
|
}
|
|
3220
3241
|
else if (setupState.__isScriptSetup &&
|
|
3221
3242
|
hasOwn(setupState, key)) {
|
|
3222
|
-
warn
|
|
3243
|
+
warn(`Cannot mutate <script setup> binding "${key}" from Options API.`);
|
|
3223
3244
|
return false;
|
|
3224
3245
|
}
|
|
3225
3246
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
@@ -3227,11 +3248,11 @@ const PublicInstanceProxyHandlers = {
|
|
|
3227
3248
|
return true;
|
|
3228
3249
|
}
|
|
3229
3250
|
else if (hasOwn(instance.props, key)) {
|
|
3230
|
-
warn
|
|
3251
|
+
warn(`Attempting to mutate prop "${key}". Props are readonly.`);
|
|
3231
3252
|
return false;
|
|
3232
3253
|
}
|
|
3233
3254
|
if (key[0] === '$' && key.slice(1) in instance) {
|
|
3234
|
-
warn
|
|
3255
|
+
warn(`Attempting to mutate public property "${key}". ` +
|
|
3235
3256
|
`Properties starting with $ are reserved and readonly.`);
|
|
3236
3257
|
return false;
|
|
3237
3258
|
}
|
|
@@ -3272,7 +3293,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3272
3293
|
};
|
|
3273
3294
|
{
|
|
3274
3295
|
PublicInstanceProxyHandlers.ownKeys = (target) => {
|
|
3275
|
-
warn
|
|
3296
|
+
warn(`Avoid app logic that relies on enumerating keys on a component instance. ` +
|
|
3276
3297
|
`The keys will be empty in production mode to avoid performance overhead.`);
|
|
3277
3298
|
return Reflect.ownKeys(target);
|
|
3278
3299
|
};
|
|
@@ -3322,7 +3343,7 @@ function exposeSetupStateOnRenderContext(instance) {
|
|
|
3322
3343
|
Object.keys(toRaw(setupState)).forEach(key => {
|
|
3323
3344
|
if (!setupState.__isScriptSetup) {
|
|
3324
3345
|
if (isReservedPrefix(key[0])) {
|
|
3325
|
-
warn
|
|
3346
|
+
warn(`setup() return property ${JSON.stringify(key)} should not start with "$" or "_" ` +
|
|
3326
3347
|
`which are reserved prefixes for Vue internals.`);
|
|
3327
3348
|
return;
|
|
3328
3349
|
}
|
|
@@ -3340,7 +3361,7 @@ function createDuplicateChecker() {
|
|
|
3340
3361
|
const cache = Object.create(null);
|
|
3341
3362
|
return (type, key) => {
|
|
3342
3363
|
if (cache[key]) {
|
|
3343
|
-
warn
|
|
3364
|
+
warn(`${type} property "${key}" is already defined in ${cache[key]}.`);
|
|
3344
3365
|
}
|
|
3345
3366
|
else {
|
|
3346
3367
|
cache[key] = type;
|
|
@@ -3407,24 +3428,24 @@ function applyOptions(instance) {
|
|
|
3407
3428
|
}
|
|
3408
3429
|
}
|
|
3409
3430
|
else {
|
|
3410
|
-
warn
|
|
3431
|
+
warn(`Method "${key}" has type "${typeof methodHandler}" in the component definition. ` +
|
|
3411
3432
|
`Did you reference the function correctly?`);
|
|
3412
3433
|
}
|
|
3413
3434
|
}
|
|
3414
3435
|
}
|
|
3415
3436
|
if (dataOptions) {
|
|
3416
3437
|
if (!isFunction(dataOptions)) {
|
|
3417
|
-
warn
|
|
3438
|
+
warn(`The data option must be a function. ` +
|
|
3418
3439
|
`Plain object usage is no longer supported.`);
|
|
3419
3440
|
}
|
|
3420
3441
|
const data = dataOptions.call(publicThis, publicThis);
|
|
3421
3442
|
if (isPromise(data)) {
|
|
3422
|
-
warn
|
|
3443
|
+
warn(`data() returned a Promise - note data() cannot be async; If you ` +
|
|
3423
3444
|
`intend to perform data fetching before component renders, use ` +
|
|
3424
3445
|
`async setup() + <Suspense>.`);
|
|
3425
3446
|
}
|
|
3426
3447
|
if (!isObject(data)) {
|
|
3427
|
-
warn
|
|
3448
|
+
warn(`data() should return an object.`);
|
|
3428
3449
|
}
|
|
3429
3450
|
else {
|
|
3430
3451
|
instance.data = reactive(data);
|
|
@@ -3455,15 +3476,15 @@ function applyOptions(instance) {
|
|
|
3455
3476
|
? opt.get.bind(publicThis, publicThis)
|
|
3456
3477
|
: NOOP;
|
|
3457
3478
|
if (get === NOOP) {
|
|
3458
|
-
warn
|
|
3479
|
+
warn(`Computed property "${key}" has no getter.`);
|
|
3459
3480
|
}
|
|
3460
3481
|
const set = !isFunction(opt) && isFunction(opt.set)
|
|
3461
3482
|
? opt.set.bind(publicThis)
|
|
3462
3483
|
: () => {
|
|
3463
|
-
warn
|
|
3484
|
+
warn(`Write operation failed: computed property "${key}" is readonly.`);
|
|
3464
3485
|
}
|
|
3465
3486
|
;
|
|
3466
|
-
const c = computed
|
|
3487
|
+
const c = computed({
|
|
3467
3488
|
get,
|
|
3468
3489
|
set
|
|
3469
3490
|
});
|
|
@@ -3572,7 +3593,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
3572
3593
|
}
|
|
3573
3594
|
else {
|
|
3574
3595
|
{
|
|
3575
|
-
warn
|
|
3596
|
+
warn(`injected property "${key}" is a ref and will be auto-unwrapped ` +
|
|
3576
3597
|
`and no longer needs \`.value\` in the next minor release. ` +
|
|
3577
3598
|
`To opt-in to the new behavior now, ` +
|
|
3578
3599
|
`set \`app.config.unwrapInjectedRef = true\` (this config is ` +
|
|
@@ -3604,7 +3625,7 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
3604
3625
|
watch(getter, handler);
|
|
3605
3626
|
}
|
|
3606
3627
|
else {
|
|
3607
|
-
warn
|
|
3628
|
+
warn(`Invalid watch handler specified by key "${raw}"`, handler);
|
|
3608
3629
|
}
|
|
3609
3630
|
}
|
|
3610
3631
|
else if (isFunction(raw)) {
|
|
@@ -3622,12 +3643,12 @@ function createWatcher(raw, ctx, publicThis, key) {
|
|
|
3622
3643
|
watch(getter, handler, raw);
|
|
3623
3644
|
}
|
|
3624
3645
|
else {
|
|
3625
|
-
warn
|
|
3646
|
+
warn(`Invalid watch handler specified by key "${raw.handler}"`, handler);
|
|
3626
3647
|
}
|
|
3627
3648
|
}
|
|
3628
3649
|
}
|
|
3629
3650
|
else {
|
|
3630
|
-
warn
|
|
3651
|
+
warn(`Invalid watch option: "${key}"`, raw);
|
|
3631
3652
|
}
|
|
3632
3653
|
}
|
|
3633
3654
|
/**
|
|
@@ -3671,7 +3692,7 @@ function mergeOptions(to, from, strats, asMixin = false) {
|
|
|
3671
3692
|
}
|
|
3672
3693
|
for (const key in from) {
|
|
3673
3694
|
if (asMixin && key === 'expose') {
|
|
3674
|
-
warn
|
|
3695
|
+
warn(`"expose" option is ignored when declared in mixins or extends. ` +
|
|
3675
3696
|
`It should only be declared in the base component itself.`);
|
|
3676
3697
|
}
|
|
3677
3698
|
else {
|
|
@@ -4004,7 +4025,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
4004
4025
|
if (isArray(raw)) {
|
|
4005
4026
|
for (let i = 0; i < raw.length; i++) {
|
|
4006
4027
|
if (!isString(raw[i])) {
|
|
4007
|
-
warn
|
|
4028
|
+
warn(`props must be strings when using array syntax.`, raw[i]);
|
|
4008
4029
|
}
|
|
4009
4030
|
const normalizedKey = camelize(raw[i]);
|
|
4010
4031
|
if (validatePropName(normalizedKey)) {
|
|
@@ -4014,7 +4035,7 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
4014
4035
|
}
|
|
4015
4036
|
else if (raw) {
|
|
4016
4037
|
if (!isObject(raw)) {
|
|
4017
|
-
warn
|
|
4038
|
+
warn(`invalid props options`, raw);
|
|
4018
4039
|
}
|
|
4019
4040
|
for (const key in raw) {
|
|
4020
4041
|
const normalizedKey = camelize(key);
|
|
@@ -4047,15 +4068,15 @@ function validatePropName(key) {
|
|
|
4047
4068
|
return true;
|
|
4048
4069
|
}
|
|
4049
4070
|
else {
|
|
4050
|
-
warn
|
|
4071
|
+
warn(`Invalid prop name: "${key}" is a reserved property.`);
|
|
4051
4072
|
}
|
|
4052
4073
|
return false;
|
|
4053
4074
|
}
|
|
4054
4075
|
// use function string name to check type constructors
|
|
4055
4076
|
// so that it works across vms / iframes.
|
|
4056
4077
|
function getType(ctor) {
|
|
4057
|
-
const match = ctor && ctor.toString().match(/^\s*function (\w+)/);
|
|
4058
|
-
return match ? match[
|
|
4078
|
+
const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/);
|
|
4079
|
+
return match ? match[2] : ctor === null ? 'null' : '';
|
|
4059
4080
|
}
|
|
4060
4081
|
function isSameType(a, b) {
|
|
4061
4082
|
return getType(a) === getType(b);
|
|
@@ -4089,7 +4110,7 @@ function validateProp(name, value, prop, isAbsent) {
|
|
|
4089
4110
|
const { type, required, validator } = prop;
|
|
4090
4111
|
// required!
|
|
4091
4112
|
if (required && isAbsent) {
|
|
4092
|
-
warn
|
|
4113
|
+
warn('Missing required prop: "' + name + '"');
|
|
4093
4114
|
return;
|
|
4094
4115
|
}
|
|
4095
4116
|
// missing but optional
|
|
@@ -4108,13 +4129,13 @@ function validateProp(name, value, prop, isAbsent) {
|
|
|
4108
4129
|
isValid = valid;
|
|
4109
4130
|
}
|
|
4110
4131
|
if (!isValid) {
|
|
4111
|
-
warn
|
|
4132
|
+
warn(getInvalidTypeMessage(name, value, expectedTypes));
|
|
4112
4133
|
return;
|
|
4113
4134
|
}
|
|
4114
4135
|
}
|
|
4115
4136
|
// custom validator
|
|
4116
4137
|
if (validator && !validator(value)) {
|
|
4117
|
-
warn
|
|
4138
|
+
warn('Invalid prop: custom validator check failed for prop "' + name + '".');
|
|
4118
4139
|
}
|
|
4119
4140
|
}
|
|
4120
4141
|
const isSimpleType = /*#__PURE__*/ makeMap('String,Number,Boolean,Function,Symbol,BigInt');
|
|
@@ -4202,8 +4223,8 @@ function isBoolean(...args) {
|
|
|
4202
4223
|
|
|
4203
4224
|
const isInternalKey = (key) => key[0] === '_' || key === '$stable';
|
|
4204
4225
|
const normalizeSlotValue = (value) => isArray(value)
|
|
4205
|
-
? value.map(normalizeVNode)
|
|
4206
|
-
: [normalizeVNode(value)];
|
|
4226
|
+
? value.map(normalizeVNode$1)
|
|
4227
|
+
: [normalizeVNode$1(value)];
|
|
4207
4228
|
const normalizeSlot = (key, rawSlot, ctx) => {
|
|
4208
4229
|
if (rawSlot._n) {
|
|
4209
4230
|
// already normalized - #5353
|
|
@@ -4211,7 +4232,7 @@ const normalizeSlot = (key, rawSlot, ctx) => {
|
|
|
4211
4232
|
}
|
|
4212
4233
|
const normalized = withCtx((...args) => {
|
|
4213
4234
|
if (true && currentInstance) {
|
|
4214
|
-
warn
|
|
4235
|
+
warn(`Slot "${key}" invoked outside of the render function: ` +
|
|
4215
4236
|
`this will not track dependencies used in the slot. ` +
|
|
4216
4237
|
`Invoke the slot function inside the render function instead.`);
|
|
4217
4238
|
}
|
|
@@ -4231,7 +4252,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
|
4231
4252
|
}
|
|
4232
4253
|
else if (value != null) {
|
|
4233
4254
|
{
|
|
4234
|
-
warn
|
|
4255
|
+
warn(`Non-function value encountered for slot "${key}". ` +
|
|
4235
4256
|
`Prefer function slots for better performance.`);
|
|
4236
4257
|
}
|
|
4237
4258
|
const normalized = normalizeSlotValue(value);
|
|
@@ -4242,7 +4263,7 @@ const normalizeObjectSlots = (rawSlots, slots, instance) => {
|
|
|
4242
4263
|
const normalizeVNodeSlots = (instance, children) => {
|
|
4243
4264
|
if (!isKeepAlive(instance.vnode) &&
|
|
4244
4265
|
!(false )) {
|
|
4245
|
-
warn
|
|
4266
|
+
warn(`Non-function value encountered for default slot. ` +
|
|
4246
4267
|
`Prefer function slots for better performance.`);
|
|
4247
4268
|
}
|
|
4248
4269
|
const normalized = normalizeSlotValue(children);
|
|
@@ -4343,21 +4364,21 @@ function createAppContext() {
|
|
|
4343
4364
|
emitsCache: new WeakMap()
|
|
4344
4365
|
};
|
|
4345
4366
|
}
|
|
4346
|
-
let uid = 0;
|
|
4367
|
+
let uid$1 = 0;
|
|
4347
4368
|
function createAppAPI(render, hydrate) {
|
|
4348
4369
|
return function createApp(rootComponent, rootProps = null) {
|
|
4349
4370
|
if (!isFunction(rootComponent)) {
|
|
4350
4371
|
rootComponent = { ...rootComponent };
|
|
4351
4372
|
}
|
|
4352
4373
|
if (rootProps != null && !isObject(rootProps)) {
|
|
4353
|
-
warn
|
|
4374
|
+
warn(`root props passed to app.mount() must be an object.`);
|
|
4354
4375
|
rootProps = null;
|
|
4355
4376
|
}
|
|
4356
4377
|
const context = createAppContext();
|
|
4357
4378
|
const installedPlugins = new Set();
|
|
4358
4379
|
let isMounted = false;
|
|
4359
4380
|
const app = (context.app = {
|
|
4360
|
-
_uid: uid++,
|
|
4381
|
+
_uid: uid$1++,
|
|
4361
4382
|
_component: rootComponent,
|
|
4362
4383
|
_props: rootProps,
|
|
4363
4384
|
_container: null,
|
|
@@ -4369,12 +4390,12 @@ function createAppAPI(render, hydrate) {
|
|
|
4369
4390
|
},
|
|
4370
4391
|
set config(v) {
|
|
4371
4392
|
{
|
|
4372
|
-
warn
|
|
4393
|
+
warn(`app.config cannot be replaced. Modify individual options instead.`);
|
|
4373
4394
|
}
|
|
4374
4395
|
},
|
|
4375
4396
|
use(plugin, ...options) {
|
|
4376
4397
|
if (installedPlugins.has(plugin)) {
|
|
4377
|
-
warn
|
|
4398
|
+
warn(`Plugin has already been applied to target app.`);
|
|
4378
4399
|
}
|
|
4379
4400
|
else if (plugin && isFunction(plugin.install)) {
|
|
4380
4401
|
installedPlugins.add(plugin);
|
|
@@ -4385,7 +4406,7 @@ function createAppAPI(render, hydrate) {
|
|
|
4385
4406
|
plugin(app, ...options);
|
|
4386
4407
|
}
|
|
4387
4408
|
else {
|
|
4388
|
-
warn
|
|
4409
|
+
warn(`A plugin must either be a function or an object with an "install" ` +
|
|
4389
4410
|
`function.`);
|
|
4390
4411
|
}
|
|
4391
4412
|
return app;
|
|
@@ -4396,7 +4417,7 @@ function createAppAPI(render, hydrate) {
|
|
|
4396
4417
|
context.mixins.push(mixin);
|
|
4397
4418
|
}
|
|
4398
4419
|
else {
|
|
4399
|
-
warn
|
|
4420
|
+
warn('Mixin has already been applied to target app' +
|
|
4400
4421
|
(mixin.name ? `: ${mixin.name}` : ''));
|
|
4401
4422
|
}
|
|
4402
4423
|
}
|
|
@@ -4410,7 +4431,7 @@ function createAppAPI(render, hydrate) {
|
|
|
4410
4431
|
return context.components[name];
|
|
4411
4432
|
}
|
|
4412
4433
|
if (context.components[name]) {
|
|
4413
|
-
warn
|
|
4434
|
+
warn(`Component "${name}" has already been registered in target app.`);
|
|
4414
4435
|
}
|
|
4415
4436
|
context.components[name] = component;
|
|
4416
4437
|
return app;
|
|
@@ -4423,7 +4444,7 @@ function createAppAPI(render, hydrate) {
|
|
|
4423
4444
|
return context.directives[name];
|
|
4424
4445
|
}
|
|
4425
4446
|
if (context.directives[name]) {
|
|
4426
|
-
warn
|
|
4447
|
+
warn(`Directive "${name}" has already been registered in target app.`);
|
|
4427
4448
|
}
|
|
4428
4449
|
context.directives[name] = directive;
|
|
4429
4450
|
return app;
|
|
@@ -4432,7 +4453,7 @@ function createAppAPI(render, hydrate) {
|
|
|
4432
4453
|
if (!isMounted) {
|
|
4433
4454
|
// #5571
|
|
4434
4455
|
if (rootContainer.__vue_app__) {
|
|
4435
|
-
warn
|
|
4456
|
+
warn(`There is already an app instance mounted on the host container.\n` +
|
|
4436
4457
|
` If you want to mount another app on the same host container,` +
|
|
4437
4458
|
` you need to unmount the previous app by calling \`app.unmount()\` first.`);
|
|
4438
4459
|
}
|
|
@@ -4462,7 +4483,7 @@ function createAppAPI(render, hydrate) {
|
|
|
4462
4483
|
return getExposeProxy(vnode.component) || vnode.component.proxy;
|
|
4463
4484
|
}
|
|
4464
4485
|
else {
|
|
4465
|
-
warn
|
|
4486
|
+
warn(`App has already been mounted.\n` +
|
|
4466
4487
|
`If you want to remount the same app, move your app creation logic ` +
|
|
4467
4488
|
`into a factory function and create fresh app instances for each ` +
|
|
4468
4489
|
`mount - e.g. \`const createMyApp = () => createApp(App)\``);
|
|
@@ -4478,12 +4499,12 @@ function createAppAPI(render, hydrate) {
|
|
|
4478
4499
|
delete app._container.__vue_app__;
|
|
4479
4500
|
}
|
|
4480
4501
|
else {
|
|
4481
|
-
warn
|
|
4502
|
+
warn(`Cannot unmount an app that is not mounted.`);
|
|
4482
4503
|
}
|
|
4483
4504
|
},
|
|
4484
4505
|
provide(key, value) {
|
|
4485
4506
|
if (key in context.provides) {
|
|
4486
|
-
warn
|
|
4507
|
+
warn(`App already provides property with key "${String(key)}". ` +
|
|
4487
4508
|
`It will be overwritten with the new value.`);
|
|
4488
4509
|
}
|
|
4489
4510
|
context.provides[key] = value;
|
|
@@ -4513,7 +4534,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4513
4534
|
const value = isUnmount ? null : refValue;
|
|
4514
4535
|
const { i: owner, r: ref } = rawRef;
|
|
4515
4536
|
if (!owner) {
|
|
4516
|
-
warn
|
|
4537
|
+
warn(`Missing ref owner context. ref cannot be used on hoisted vnodes. ` +
|
|
4517
4538
|
`A vnode with ref must be created inside the render function.`);
|
|
4518
4539
|
return;
|
|
4519
4540
|
}
|
|
@@ -4580,7 +4601,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4580
4601
|
refs[rawRef.k] = value;
|
|
4581
4602
|
}
|
|
4582
4603
|
else {
|
|
4583
|
-
warn
|
|
4604
|
+
warn('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
4584
4605
|
}
|
|
4585
4606
|
};
|
|
4586
4607
|
if (value) {
|
|
@@ -4592,7 +4613,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4592
4613
|
}
|
|
4593
4614
|
}
|
|
4594
4615
|
else {
|
|
4595
|
-
warn
|
|
4616
|
+
warn('Invalid template ref type:', ref, `(${typeof ref})`);
|
|
4596
4617
|
}
|
|
4597
4618
|
}
|
|
4598
4619
|
}
|
|
@@ -4712,7 +4733,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4712
4733
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
4713
4734
|
}
|
|
4714
4735
|
else {
|
|
4715
|
-
warn
|
|
4736
|
+
warn('Invalid VNode type:', type, `(${typeof type})`);
|
|
4716
4737
|
}
|
|
4717
4738
|
}
|
|
4718
4739
|
// set ref
|
|
@@ -4802,6 +4823,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4802
4823
|
if (dirs) {
|
|
4803
4824
|
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
4804
4825
|
}
|
|
4826
|
+
// scopeId
|
|
4827
|
+
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
4805
4828
|
// props
|
|
4806
4829
|
if (props) {
|
|
4807
4830
|
for (const key in props) {
|
|
@@ -4825,8 +4848,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4825
4848
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4826
4849
|
}
|
|
4827
4850
|
}
|
|
4828
|
-
// scopeId
|
|
4829
|
-
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
4830
4851
|
{
|
|
4831
4852
|
Object.defineProperty(el, '__vnode', {
|
|
4832
4853
|
value: vnode,
|
|
@@ -4885,7 +4906,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4885
4906
|
for (let i = start; i < children.length; i++) {
|
|
4886
4907
|
const child = (children[i] = optimized
|
|
4887
4908
|
? cloneIfMounted(children[i])
|
|
4888
|
-
: normalizeVNode(children[i]));
|
|
4909
|
+
: normalizeVNode$1(children[i]));
|
|
4889
4910
|
patch(null, child, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4890
4911
|
}
|
|
4891
4912
|
};
|
|
@@ -5107,7 +5128,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5107
5128
|
}
|
|
5108
5129
|
};
|
|
5109
5130
|
const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => {
|
|
5110
|
-
const instance = (initialVNode.component = createComponentInstance(initialVNode, parentComponent, parentSuspense));
|
|
5131
|
+
const instance = (initialVNode.component = createComponentInstance$1(initialVNode, parentComponent, parentSuspense));
|
|
5111
5132
|
if (instance.type.__hmrId) {
|
|
5112
5133
|
registerHMR(instance);
|
|
5113
5134
|
}
|
|
@@ -5124,7 +5145,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5124
5145
|
{
|
|
5125
5146
|
startMeasure(instance, `init`);
|
|
5126
5147
|
}
|
|
5127
|
-
setupComponent(instance);
|
|
5148
|
+
setupComponent$1(instance);
|
|
5128
5149
|
{
|
|
5129
5150
|
endMeasure(instance, `init`);
|
|
5130
5151
|
}
|
|
@@ -5203,7 +5224,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5203
5224
|
{
|
|
5204
5225
|
startMeasure(instance, `render`);
|
|
5205
5226
|
}
|
|
5206
|
-
instance.subTree = renderComponentRoot(instance);
|
|
5227
|
+
instance.subTree = renderComponentRoot$1(instance);
|
|
5207
5228
|
{
|
|
5208
5229
|
endMeasure(instance, `render`);
|
|
5209
5230
|
}
|
|
@@ -5231,7 +5252,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5231
5252
|
{
|
|
5232
5253
|
startMeasure(instance, `render`);
|
|
5233
5254
|
}
|
|
5234
|
-
const subTree = (instance.subTree = renderComponentRoot(instance));
|
|
5255
|
+
const subTree = (instance.subTree = renderComponentRoot$1(instance));
|
|
5235
5256
|
{
|
|
5236
5257
|
endMeasure(instance, `render`);
|
|
5237
5258
|
}
|
|
@@ -5302,7 +5323,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5302
5323
|
{
|
|
5303
5324
|
startMeasure(instance, `render`);
|
|
5304
5325
|
}
|
|
5305
|
-
const nextTree = renderComponentRoot(instance);
|
|
5326
|
+
const nextTree = renderComponentRoot$1(instance);
|
|
5306
5327
|
{
|
|
5307
5328
|
endMeasure(instance, `render`);
|
|
5308
5329
|
}
|
|
@@ -5438,7 +5459,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5438
5459
|
for (i = 0; i < commonLength; i++) {
|
|
5439
5460
|
const nextChild = (c2[i] = optimized
|
|
5440
5461
|
? cloneIfMounted(c2[i])
|
|
5441
|
-
: normalizeVNode(c2[i]));
|
|
5462
|
+
: normalizeVNode$1(c2[i]));
|
|
5442
5463
|
patch(c1[i], nextChild, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5443
5464
|
}
|
|
5444
5465
|
if (oldLength > newLength) {
|
|
@@ -5463,7 +5484,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5463
5484
|
const n1 = c1[i];
|
|
5464
5485
|
const n2 = (c2[i] = optimized
|
|
5465
5486
|
? cloneIfMounted(c2[i])
|
|
5466
|
-
: normalizeVNode(c2[i]));
|
|
5487
|
+
: normalizeVNode$1(c2[i]));
|
|
5467
5488
|
if (isSameVNodeType(n1, n2)) {
|
|
5468
5489
|
patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5469
5490
|
}
|
|
@@ -5479,7 +5500,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5479
5500
|
const n1 = c1[e1];
|
|
5480
5501
|
const n2 = (c2[e2] = optimized
|
|
5481
5502
|
? cloneIfMounted(c2[e2])
|
|
5482
|
-
: normalizeVNode(c2[e2]));
|
|
5503
|
+
: normalizeVNode$1(c2[e2]));
|
|
5483
5504
|
if (isSameVNodeType(n1, n2)) {
|
|
5484
5505
|
patch(n1, n2, container, null, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5485
5506
|
}
|
|
@@ -5503,7 +5524,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5503
5524
|
while (i <= e2) {
|
|
5504
5525
|
patch(null, (c2[i] = optimized
|
|
5505
5526
|
? cloneIfMounted(c2[i])
|
|
5506
|
-
: normalizeVNode(c2[i])), container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5527
|
+
: normalizeVNode$1(c2[i])), container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5507
5528
|
i++;
|
|
5508
5529
|
}
|
|
5509
5530
|
}
|
|
@@ -5533,10 +5554,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5533
5554
|
for (i = s2; i <= e2; i++) {
|
|
5534
5555
|
const nextChild = (c2[i] = optimized
|
|
5535
5556
|
? cloneIfMounted(c2[i])
|
|
5536
|
-
: normalizeVNode(c2[i]));
|
|
5557
|
+
: normalizeVNode$1(c2[i]));
|
|
5537
5558
|
if (nextChild.key != null) {
|
|
5538
5559
|
if (keyToNewIndexMap.has(nextChild.key)) {
|
|
5539
|
-
warn
|
|
5560
|
+
warn(`Duplicate keys found during update:`, JSON.stringify(nextChild.key), `Make sure keys are unique.`);
|
|
5540
5561
|
}
|
|
5541
5562
|
keyToNewIndexMap.set(nextChild.key, i);
|
|
5542
5563
|
}
|
|
@@ -5980,12 +6001,6 @@ const Fragment = Symbol('Fragment' );
|
|
|
5980
6001
|
const Text = Symbol('Text' );
|
|
5981
6002
|
const Comment = Symbol('Comment' );
|
|
5982
6003
|
const Static = Symbol('Static' );
|
|
5983
|
-
// Since v-if and v-for are the two possible ways node structure can dynamically
|
|
5984
|
-
// change, once we consider v-if branches and each v-for fragment a block, we
|
|
5985
|
-
// can divide a template into nested blocks, and within each block the node
|
|
5986
|
-
// structure would be stable. This allows us to skip most children diffing
|
|
5987
|
-
// and only worry about the dynamic nodes (indicated by patch flags).
|
|
5988
|
-
const blockStack = [];
|
|
5989
6004
|
let currentBlock = null;
|
|
5990
6005
|
// Whether we should be tracking dynamic child nodes inside a block.
|
|
5991
6006
|
// Only tracks when this value is > 0
|
|
@@ -6011,7 +6026,7 @@ let isBlockTreeEnabled = 1;
|
|
|
6011
6026
|
function setBlockTracking(value) {
|
|
6012
6027
|
isBlockTreeEnabled += value;
|
|
6013
6028
|
}
|
|
6014
|
-
function isVNode(value) {
|
|
6029
|
+
function isVNode$2(value) {
|
|
6015
6030
|
return value ? value.__v_isVNode === true : false;
|
|
6016
6031
|
}
|
|
6017
6032
|
function isSameVNodeType(n1, n2) {
|
|
@@ -6083,7 +6098,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6083
6098
|
}
|
|
6084
6099
|
// validate key
|
|
6085
6100
|
if (vnode.key !== vnode.key) {
|
|
6086
|
-
warn
|
|
6101
|
+
warn(`VNode created with invalid key (NaN). VNode type:`, vnode.type);
|
|
6087
6102
|
}
|
|
6088
6103
|
// track vnode for block tree
|
|
6089
6104
|
if (isBlockTreeEnabled > 0 &&
|
|
@@ -6107,11 +6122,11 @@ const createVNode = (createVNodeWithArgsTransform );
|
|
|
6107
6122
|
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) {
|
|
6108
6123
|
if (!type || type === NULL_DYNAMIC_COMPONENT) {
|
|
6109
6124
|
if (!type) {
|
|
6110
|
-
warn
|
|
6125
|
+
warn(`Invalid vnode type when creating vnode: ${type}.`);
|
|
6111
6126
|
}
|
|
6112
6127
|
type = Comment;
|
|
6113
6128
|
}
|
|
6114
|
-
if (isVNode(type)) {
|
|
6129
|
+
if (isVNode$2(type)) {
|
|
6115
6130
|
// createVNode receiving an existing vnode. This happens in cases like
|
|
6116
6131
|
// <component :is="vnode"/>
|
|
6117
6132
|
// #2078 make sure to merge refs during the clone instead of overwriting it
|
|
@@ -6165,7 +6180,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6165
6180
|
: 0;
|
|
6166
6181
|
if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
6167
6182
|
type = toRaw(type);
|
|
6168
|
-
warn
|
|
6183
|
+
warn(`Vue received a Component which was made a reactive object. This can ` +
|
|
6169
6184
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
6170
6185
|
`marking the component with \`markRaw\` or using \`shallowRef\` ` +
|
|
6171
6186
|
`instead of \`ref\`.`, `\nComponent that was made reactive: `, type);
|
|
@@ -6233,7 +6248,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6233
6248
|
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
|
|
6234
6249
|
el: vnode.el,
|
|
6235
6250
|
anchor: vnode.anchor,
|
|
6236
|
-
ctx: vnode.ctx
|
|
6251
|
+
ctx: vnode.ctx,
|
|
6252
|
+
ce: vnode.ce
|
|
6237
6253
|
};
|
|
6238
6254
|
return cloned;
|
|
6239
6255
|
}
|
|
@@ -6254,7 +6270,7 @@ function deepCloneVNode(vnode) {
|
|
|
6254
6270
|
function createTextVNode(text = ' ', flag = 0) {
|
|
6255
6271
|
return createVNode(Text, null, text, flag);
|
|
6256
6272
|
}
|
|
6257
|
-
function normalizeVNode(child) {
|
|
6273
|
+
function normalizeVNode$1(child) {
|
|
6258
6274
|
if (child == null || typeof child === 'boolean') {
|
|
6259
6275
|
// empty placeholder
|
|
6260
6276
|
return createVNode(Comment);
|
|
@@ -6379,13 +6395,13 @@ function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
|
6379
6395
|
}
|
|
6380
6396
|
|
|
6381
6397
|
const emptyAppContext = createAppContext();
|
|
6382
|
-
let uid
|
|
6383
|
-
function createComponentInstance(vnode, parent, suspense) {
|
|
6398
|
+
let uid = 0;
|
|
6399
|
+
function createComponentInstance$1(vnode, parent, suspense) {
|
|
6384
6400
|
const type = vnode.type;
|
|
6385
6401
|
// inherit parent app context - or - if root, adopt from root vnode
|
|
6386
6402
|
const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext;
|
|
6387
6403
|
const instance = {
|
|
6388
|
-
uid: uid
|
|
6404
|
+
uid: uid++,
|
|
6389
6405
|
vnode,
|
|
6390
6406
|
type,
|
|
6391
6407
|
parent,
|
|
@@ -6455,7 +6471,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
6455
6471
|
instance.ctx = createDevRenderContext(instance);
|
|
6456
6472
|
}
|
|
6457
6473
|
instance.root = parent ? parent.root : instance;
|
|
6458
|
-
instance.emit = emit
|
|
6474
|
+
instance.emit = emit.bind(null, instance);
|
|
6459
6475
|
// apply custom element special handling
|
|
6460
6476
|
if (vnode.ce) {
|
|
6461
6477
|
vnode.ce(instance);
|
|
@@ -6475,14 +6491,14 @@ const isBuiltInTag = /*#__PURE__*/ makeMap('slot,component');
|
|
|
6475
6491
|
function validateComponentName(name, config) {
|
|
6476
6492
|
const appIsNativeTag = config.isNativeTag || NO;
|
|
6477
6493
|
if (isBuiltInTag(name) || appIsNativeTag(name)) {
|
|
6478
|
-
warn
|
|
6494
|
+
warn('Do not use built-in or reserved HTML elements as component id: ' + name);
|
|
6479
6495
|
}
|
|
6480
6496
|
}
|
|
6481
6497
|
function isStatefulComponent(instance) {
|
|
6482
6498
|
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
6483
6499
|
}
|
|
6484
6500
|
let isInSSRComponentSetup = false;
|
|
6485
|
-
function setupComponent(instance, isSSR = false) {
|
|
6501
|
+
function setupComponent$1(instance, isSSR = false) {
|
|
6486
6502
|
isInSSRComponentSetup = isSSR;
|
|
6487
6503
|
const { props, children } = instance.vnode;
|
|
6488
6504
|
const isStateful = isStatefulComponent(instance);
|
|
@@ -6514,7 +6530,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6514
6530
|
}
|
|
6515
6531
|
}
|
|
6516
6532
|
if (Component.compilerOptions && isRuntimeOnly()) {
|
|
6517
|
-
warn
|
|
6533
|
+
warn(`"compilerOptions" is only supported when using a build of Vue that ` +
|
|
6518
6534
|
`includes the runtime compiler. Since you are using a runtime-only ` +
|
|
6519
6535
|
`build, the options should be passed via your build tool config instead.`);
|
|
6520
6536
|
}
|
|
@@ -6555,7 +6571,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6555
6571
|
instance.asyncDep = setupResult;
|
|
6556
6572
|
if (!instance.suspense) {
|
|
6557
6573
|
const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
|
|
6558
|
-
warn
|
|
6574
|
+
warn(`Component <${name}>: setup function returned a promise, but no ` +
|
|
6559
6575
|
`<Suspense> boundary was found in the parent component tree. ` +
|
|
6560
6576
|
`A component with async setup() must be nested in a <Suspense> ` +
|
|
6561
6577
|
`in order to be rendered.`);
|
|
@@ -6583,8 +6599,8 @@ function handleSetupResult(instance, setupResult, isSSR) {
|
|
|
6583
6599
|
}
|
|
6584
6600
|
}
|
|
6585
6601
|
else if (isObject(setupResult)) {
|
|
6586
|
-
if (isVNode(setupResult)) {
|
|
6587
|
-
warn
|
|
6602
|
+
if (isVNode$2(setupResult)) {
|
|
6603
|
+
warn(`setup() should not return VNodes directly - ` +
|
|
6588
6604
|
`return a render function instead.`);
|
|
6589
6605
|
}
|
|
6590
6606
|
// setup returned bindings.
|
|
@@ -6598,7 +6614,7 @@ function handleSetupResult(instance, setupResult, isSSR) {
|
|
|
6598
6614
|
}
|
|
6599
6615
|
}
|
|
6600
6616
|
else if (setupResult !== undefined) {
|
|
6601
|
-
warn
|
|
6617
|
+
warn(`setup() should return an object. Received: ${setupResult === null ? 'null' : typeof setupResult}`);
|
|
6602
6618
|
}
|
|
6603
6619
|
finishComponentSetup(instance, isSSR);
|
|
6604
6620
|
}
|
|
@@ -6621,11 +6637,11 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
6621
6637
|
}
|
|
6622
6638
|
const { isCustomElement, compilerOptions } = instance.appContext.config;
|
|
6623
6639
|
const { delimiters, compilerOptions: componentCompilerOptions } = Component;
|
|
6624
|
-
extend(extend({
|
|
6640
|
+
const finalCompilerOptions = extend(extend({
|
|
6625
6641
|
isCustomElement,
|
|
6626
6642
|
delimiters
|
|
6627
6643
|
}, compilerOptions), componentCompilerOptions);
|
|
6628
|
-
Component.render = compile();
|
|
6644
|
+
Component.render = compile(template, finalCompilerOptions);
|
|
6629
6645
|
{
|
|
6630
6646
|
endMeasure(instance, `compile`);
|
|
6631
6647
|
}
|
|
@@ -6646,13 +6662,13 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
6646
6662
|
if (!Component.render && instance.render === NOOP && !isSSR) {
|
|
6647
6663
|
/* istanbul ignore if */
|
|
6648
6664
|
if (Component.template) {
|
|
6649
|
-
warn
|
|
6665
|
+
warn(`Component provided template option but ` +
|
|
6650
6666
|
`runtime compilation is not supported in this build of Vue.` +
|
|
6651
6667
|
(` Use "vue.esm-browser.js" instead.`
|
|
6652
6668
|
) /* should not happen */);
|
|
6653
6669
|
}
|
|
6654
6670
|
else {
|
|
6655
|
-
warn
|
|
6671
|
+
warn(`Component is missing template or render function.`);
|
|
6656
6672
|
}
|
|
6657
6673
|
}
|
|
6658
6674
|
}
|
|
@@ -6664,11 +6680,11 @@ function createAttrsProxy(instance) {
|
|
|
6664
6680
|
return target[key];
|
|
6665
6681
|
},
|
|
6666
6682
|
set() {
|
|
6667
|
-
warn
|
|
6683
|
+
warn(`setupContext.attrs is readonly.`);
|
|
6668
6684
|
return false;
|
|
6669
6685
|
},
|
|
6670
6686
|
deleteProperty() {
|
|
6671
|
-
warn
|
|
6687
|
+
warn(`setupContext.attrs is readonly.`);
|
|
6672
6688
|
return false;
|
|
6673
6689
|
}
|
|
6674
6690
|
}
|
|
@@ -6676,8 +6692,24 @@ function createAttrsProxy(instance) {
|
|
|
6676
6692
|
}
|
|
6677
6693
|
function createSetupContext(instance) {
|
|
6678
6694
|
const expose = exposed => {
|
|
6679
|
-
|
|
6680
|
-
|
|
6695
|
+
{
|
|
6696
|
+
if (instance.exposed) {
|
|
6697
|
+
warn(`expose() should be called only once per setup().`);
|
|
6698
|
+
}
|
|
6699
|
+
if (exposed != null) {
|
|
6700
|
+
let exposedType = typeof exposed;
|
|
6701
|
+
if (exposedType === 'object') {
|
|
6702
|
+
if (isArray(exposed)) {
|
|
6703
|
+
exposedType = 'array';
|
|
6704
|
+
}
|
|
6705
|
+
else if (isRef(exposed)) {
|
|
6706
|
+
exposedType = 'ref';
|
|
6707
|
+
}
|
|
6708
|
+
}
|
|
6709
|
+
if (exposedType !== 'object') {
|
|
6710
|
+
warn(`expose() should be passed a plain object, received ${exposedType}.`);
|
|
6711
|
+
}
|
|
6712
|
+
}
|
|
6681
6713
|
}
|
|
6682
6714
|
instance.exposed = exposed || {};
|
|
6683
6715
|
};
|
|
@@ -6752,9 +6784,9 @@ function isClassComponent(value) {
|
|
|
6752
6784
|
return isFunction(value) && '__vccOpts' in value;
|
|
6753
6785
|
}
|
|
6754
6786
|
|
|
6755
|
-
const computed
|
|
6787
|
+
const computed = ((getterOrOptions, debugOptions) => {
|
|
6756
6788
|
// @ts-ignore
|
|
6757
|
-
return computed(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
6789
|
+
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
6758
6790
|
});
|
|
6759
6791
|
|
|
6760
6792
|
const ssrContextKey = Symbol(`ssrContext` );
|
|
@@ -6762,7 +6794,7 @@ const useSSRContext = () => {
|
|
|
6762
6794
|
{
|
|
6763
6795
|
const ctx = inject(ssrContextKey);
|
|
6764
6796
|
if (!ctx) {
|
|
6765
|
-
warn
|
|
6797
|
+
warn(`Server rendering context not provided. Make sure to only call ` +
|
|
6766
6798
|
`useSSRContext() conditionally in the server build.`);
|
|
6767
6799
|
}
|
|
6768
6800
|
return ctx;
|
|
@@ -6770,14 +6802,14 @@ const useSSRContext = () => {
|
|
|
6770
6802
|
};
|
|
6771
6803
|
|
|
6772
6804
|
// Core API ------------------------------------------------------------------
|
|
6773
|
-
const version = "3.2.
|
|
6805
|
+
const version = "3.2.46";
|
|
6774
6806
|
const _ssrUtils = {
|
|
6775
|
-
createComponentInstance,
|
|
6776
|
-
setupComponent,
|
|
6777
|
-
renderComponentRoot,
|
|
6778
|
-
setCurrentRenderingInstance,
|
|
6779
|
-
isVNode,
|
|
6780
|
-
normalizeVNode
|
|
6807
|
+
createComponentInstance: createComponentInstance$1,
|
|
6808
|
+
setupComponent: setupComponent$1,
|
|
6809
|
+
renderComponentRoot: renderComponentRoot$1,
|
|
6810
|
+
setCurrentRenderingInstance: setCurrentRenderingInstance$1,
|
|
6811
|
+
isVNode: isVNode$2,
|
|
6812
|
+
normalizeVNode: normalizeVNode$1
|
|
6781
6813
|
};
|
|
6782
6814
|
/**
|
|
6783
6815
|
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
|
|
@@ -6887,9 +6919,6 @@ function patchStyle(el, prev, next) {
|
|
|
6887
6919
|
const style = el.style;
|
|
6888
6920
|
const isCssString = isString(next);
|
|
6889
6921
|
if (next && !isCssString) {
|
|
6890
|
-
for (const key in next) {
|
|
6891
|
-
setStyle(style, key, next[key]);
|
|
6892
|
-
}
|
|
6893
6922
|
if (prev && !isString(prev)) {
|
|
6894
6923
|
for (const key in prev) {
|
|
6895
6924
|
if (next[key] == null) {
|
|
@@ -6897,6 +6926,9 @@ function patchStyle(el, prev, next) {
|
|
|
6897
6926
|
}
|
|
6898
6927
|
}
|
|
6899
6928
|
}
|
|
6929
|
+
for (const key in next) {
|
|
6930
|
+
setStyle(style, key, next[key]);
|
|
6931
|
+
}
|
|
6900
6932
|
}
|
|
6901
6933
|
else {
|
|
6902
6934
|
const currentDisplay = style.display;
|
|
@@ -6927,7 +6959,7 @@ function setStyle(style, name, val) {
|
|
|
6927
6959
|
val = '';
|
|
6928
6960
|
{
|
|
6929
6961
|
if (semicolonRE.test(val)) {
|
|
6930
|
-
warn
|
|
6962
|
+
warn(`Unexpected semicolon at the end of '${name}' style value: '${val}'`);
|
|
6931
6963
|
}
|
|
6932
6964
|
}
|
|
6933
6965
|
if (name.startsWith('--')) {
|
|
@@ -7051,7 +7083,7 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
7051
7083
|
catch (e) {
|
|
7052
7084
|
// do not warn if value is auto-coerced from nullish values
|
|
7053
7085
|
if (!needRemove) {
|
|
7054
|
-
warn
|
|
7086
|
+
warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
|
|
7055
7087
|
`value ${value} is invalid.`, e);
|
|
7056
7088
|
}
|
|
7057
7089
|
}
|
|
@@ -7222,6 +7254,138 @@ function shouldSetAsProp(el, key, value, isSVG) {
|
|
|
7222
7254
|
return key in el;
|
|
7223
7255
|
}
|
|
7224
7256
|
|
|
7257
|
+
const getModelAssigner = (vnode) => {
|
|
7258
|
+
const fn = vnode.props['onUpdate:modelValue'] ||
|
|
7259
|
+
(false );
|
|
7260
|
+
return isArray(fn) ? value => invokeArrayFns(fn, value) : fn;
|
|
7261
|
+
};
|
|
7262
|
+
function onCompositionStart(e) {
|
|
7263
|
+
e.target.composing = true;
|
|
7264
|
+
}
|
|
7265
|
+
function onCompositionEnd(e) {
|
|
7266
|
+
const target = e.target;
|
|
7267
|
+
if (target.composing) {
|
|
7268
|
+
target.composing = false;
|
|
7269
|
+
target.dispatchEvent(new Event('input'));
|
|
7270
|
+
}
|
|
7271
|
+
}
|
|
7272
|
+
// We are exporting the v-model runtime directly as vnode hooks so that it can
|
|
7273
|
+
// be tree-shaken in case v-model is never used.
|
|
7274
|
+
const vModelText = {
|
|
7275
|
+
created(el, { modifiers: { lazy, trim, number } }, vnode) {
|
|
7276
|
+
el._assign = getModelAssigner(vnode);
|
|
7277
|
+
const castToNumber = number || (vnode.props && vnode.props.type === 'number');
|
|
7278
|
+
addEventListener(el, lazy ? 'change' : 'input', e => {
|
|
7279
|
+
if (e.target.composing)
|
|
7280
|
+
return;
|
|
7281
|
+
let domValue = el.value;
|
|
7282
|
+
if (trim) {
|
|
7283
|
+
domValue = domValue.trim();
|
|
7284
|
+
}
|
|
7285
|
+
if (castToNumber) {
|
|
7286
|
+
domValue = looseToNumber(domValue);
|
|
7287
|
+
}
|
|
7288
|
+
el._assign(domValue);
|
|
7289
|
+
});
|
|
7290
|
+
if (trim) {
|
|
7291
|
+
addEventListener(el, 'change', () => {
|
|
7292
|
+
el.value = el.value.trim();
|
|
7293
|
+
});
|
|
7294
|
+
}
|
|
7295
|
+
if (!lazy) {
|
|
7296
|
+
addEventListener(el, 'compositionstart', onCompositionStart);
|
|
7297
|
+
addEventListener(el, 'compositionend', onCompositionEnd);
|
|
7298
|
+
// Safari < 10.2 & UIWebView doesn't fire compositionend when
|
|
7299
|
+
// switching focus before confirming composition choice
|
|
7300
|
+
// this also fixes the issue where some browsers e.g. iOS Chrome
|
|
7301
|
+
// fires "change" instead of "input" on autocomplete.
|
|
7302
|
+
addEventListener(el, 'change', onCompositionEnd);
|
|
7303
|
+
}
|
|
7304
|
+
},
|
|
7305
|
+
// set value on mounted so it's after min/max for type="range"
|
|
7306
|
+
mounted(el, { value }) {
|
|
7307
|
+
el.value = value == null ? '' : value;
|
|
7308
|
+
},
|
|
7309
|
+
beforeUpdate(el, { value, modifiers: { lazy, trim, number } }, vnode) {
|
|
7310
|
+
el._assign = getModelAssigner(vnode);
|
|
7311
|
+
// avoid clearing unresolved text. #2302
|
|
7312
|
+
if (el.composing)
|
|
7313
|
+
return;
|
|
7314
|
+
if (document.activeElement === el && el.type !== 'range') {
|
|
7315
|
+
if (lazy) {
|
|
7316
|
+
return;
|
|
7317
|
+
}
|
|
7318
|
+
if (trim && el.value.trim() === value) {
|
|
7319
|
+
return;
|
|
7320
|
+
}
|
|
7321
|
+
if ((number || el.type === 'number') &&
|
|
7322
|
+
looseToNumber(el.value) === value) {
|
|
7323
|
+
return;
|
|
7324
|
+
}
|
|
7325
|
+
}
|
|
7326
|
+
const newValue = value == null ? '' : value;
|
|
7327
|
+
if (el.value !== newValue) {
|
|
7328
|
+
el.value = newValue;
|
|
7329
|
+
}
|
|
7330
|
+
}
|
|
7331
|
+
};
|
|
7332
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
7333
|
+
// function in SSR
|
|
7334
|
+
function initVModelForSSR() {
|
|
7335
|
+
vModelText.getSSRProps = ({ value }) => ({ value });
|
|
7336
|
+
}
|
|
7337
|
+
|
|
7338
|
+
const vShow = {
|
|
7339
|
+
beforeMount(el, { value }, { transition }) {
|
|
7340
|
+
el._vod = el.style.display === 'none' ? '' : el.style.display;
|
|
7341
|
+
if (transition && value) {
|
|
7342
|
+
transition.beforeEnter(el);
|
|
7343
|
+
}
|
|
7344
|
+
else {
|
|
7345
|
+
setDisplay(el, value);
|
|
7346
|
+
}
|
|
7347
|
+
},
|
|
7348
|
+
mounted(el, { value }, { transition }) {
|
|
7349
|
+
if (transition && value) {
|
|
7350
|
+
transition.enter(el);
|
|
7351
|
+
}
|
|
7352
|
+
},
|
|
7353
|
+
updated(el, { value, oldValue }, { transition }) {
|
|
7354
|
+
if (!value === !oldValue)
|
|
7355
|
+
return;
|
|
7356
|
+
if (transition) {
|
|
7357
|
+
if (value) {
|
|
7358
|
+
transition.beforeEnter(el);
|
|
7359
|
+
setDisplay(el, true);
|
|
7360
|
+
transition.enter(el);
|
|
7361
|
+
}
|
|
7362
|
+
else {
|
|
7363
|
+
transition.leave(el, () => {
|
|
7364
|
+
setDisplay(el, false);
|
|
7365
|
+
});
|
|
7366
|
+
}
|
|
7367
|
+
}
|
|
7368
|
+
else {
|
|
7369
|
+
setDisplay(el, value);
|
|
7370
|
+
}
|
|
7371
|
+
},
|
|
7372
|
+
beforeUnmount(el, { value }) {
|
|
7373
|
+
setDisplay(el, value);
|
|
7374
|
+
}
|
|
7375
|
+
};
|
|
7376
|
+
function setDisplay(el, value) {
|
|
7377
|
+
el.style.display = value ? el._vod : 'none';
|
|
7378
|
+
}
|
|
7379
|
+
// SSR vnode transforms, only used when user includes client-oriented render
|
|
7380
|
+
// function in SSR
|
|
7381
|
+
function initVShowForSSR() {
|
|
7382
|
+
vShow.getSSRProps = ({ value }) => {
|
|
7383
|
+
if (!value) {
|
|
7384
|
+
return { style: { display: 'none' } };
|
|
7385
|
+
}
|
|
7386
|
+
};
|
|
7387
|
+
}
|
|
7388
|
+
|
|
7225
7389
|
const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
|
|
7226
7390
|
// lazy create the renderer - this makes core renderer logic tree-shakable
|
|
7227
7391
|
// in case the user only imports reactivity utilities from Vue.
|
|
@@ -7277,7 +7441,7 @@ function injectCompilerOptionsCheck(app) {
|
|
|
7277
7441
|
return isCustomElement;
|
|
7278
7442
|
},
|
|
7279
7443
|
set() {
|
|
7280
|
-
warn
|
|
7444
|
+
warn(`The \`isCustomElement\` config option is deprecated. Use ` +
|
|
7281
7445
|
`\`compilerOptions.isCustomElement\` instead.`);
|
|
7282
7446
|
}
|
|
7283
7447
|
});
|
|
@@ -7291,11 +7455,11 @@ function injectCompilerOptionsCheck(app) {
|
|
|
7291
7455
|
`- For vite: pass it via @vitejs/plugin-vue options. See https://github.com/vitejs/vite/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-dom`;
|
|
7292
7456
|
Object.defineProperty(app.config, 'compilerOptions', {
|
|
7293
7457
|
get() {
|
|
7294
|
-
warn
|
|
7458
|
+
warn(msg);
|
|
7295
7459
|
return compilerOptions;
|
|
7296
7460
|
},
|
|
7297
7461
|
set() {
|
|
7298
|
-
warn
|
|
7462
|
+
warn(msg);
|
|
7299
7463
|
}
|
|
7300
7464
|
});
|
|
7301
7465
|
}
|
|
@@ -7304,17 +7468,29 @@ function normalizeContainer(container) {
|
|
|
7304
7468
|
if (isString(container)) {
|
|
7305
7469
|
const res = document.querySelector(container);
|
|
7306
7470
|
if (!res) {
|
|
7307
|
-
warn
|
|
7471
|
+
warn(`Failed to mount app: mount target selector "${container}" returned null.`);
|
|
7308
7472
|
}
|
|
7309
7473
|
return res;
|
|
7310
7474
|
}
|
|
7311
7475
|
if (window.ShadowRoot &&
|
|
7312
7476
|
container instanceof window.ShadowRoot &&
|
|
7313
7477
|
container.mode === 'closed') {
|
|
7314
|
-
warn
|
|
7478
|
+
warn(`mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`);
|
|
7315
7479
|
}
|
|
7316
7480
|
return container;
|
|
7317
7481
|
}
|
|
7482
|
+
let ssrDirectiveInitialized = false;
|
|
7483
|
+
/**
|
|
7484
|
+
* @internal
|
|
7485
|
+
*/
|
|
7486
|
+
const initDirectivesForSSR = () => {
|
|
7487
|
+
if (!ssrDirectiveInitialized) {
|
|
7488
|
+
ssrDirectiveInitialized = true;
|
|
7489
|
+
initVModelForSSR();
|
|
7490
|
+
initVShowForSSR();
|
|
7491
|
+
}
|
|
7492
|
+
}
|
|
7493
|
+
;
|
|
7318
7494
|
|
|
7319
7495
|
// leading comma for empty string ""
|
|
7320
7496
|
const shouldIgnoreProp = makeMap(`,key,ref,innerHTML,textContent,ref_key,ref_for`);
|
|
@@ -7387,13 +7563,69 @@ function ssrRenderStyle(raw) {
|
|
|
7387
7563
|
return escapeHtml(stringifyStyle(styles));
|
|
7388
7564
|
}
|
|
7389
7565
|
|
|
7390
|
-
function
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7566
|
+
function ssrRenderComponent(comp, props = null, children = null, parentComponent = null, slotScopeId) {
|
|
7567
|
+
return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
|
|
7568
|
+
}
|
|
7569
|
+
|
|
7570
|
+
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
7571
|
+
// template-compiled slots are always rendered as fragments
|
|
7572
|
+
push(`<!--[-->`);
|
|
7573
|
+
ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
|
|
7574
|
+
push(`<!--]-->`);
|
|
7575
|
+
}
|
|
7576
|
+
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId, transition) {
|
|
7577
|
+
const slotFn = slots[slotName];
|
|
7578
|
+
if (slotFn) {
|
|
7579
|
+
const slotBuffer = [];
|
|
7580
|
+
const bufferedPush = (item) => {
|
|
7581
|
+
slotBuffer.push(item);
|
|
7582
|
+
};
|
|
7583
|
+
const ret = slotFn(slotProps, bufferedPush, parentComponent, slotScopeId ? ' ' + slotScopeId : '');
|
|
7584
|
+
if (isArray(ret)) {
|
|
7585
|
+
// normal slot
|
|
7586
|
+
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
|
|
7587
|
+
}
|
|
7588
|
+
else {
|
|
7589
|
+
// ssr slot.
|
|
7590
|
+
// check if the slot renders all comments, in which case use the fallback
|
|
7591
|
+
let isEmptySlot = true;
|
|
7592
|
+
if (transition) {
|
|
7593
|
+
isEmptySlot = false;
|
|
7594
|
+
}
|
|
7595
|
+
else {
|
|
7596
|
+
for (let i = 0; i < slotBuffer.length; i++) {
|
|
7597
|
+
if (!isComment(slotBuffer[i])) {
|
|
7598
|
+
isEmptySlot = false;
|
|
7599
|
+
break;
|
|
7600
|
+
}
|
|
7601
|
+
}
|
|
7602
|
+
}
|
|
7603
|
+
if (isEmptySlot) {
|
|
7604
|
+
if (fallbackRenderFn) {
|
|
7605
|
+
fallbackRenderFn();
|
|
7606
|
+
}
|
|
7607
|
+
}
|
|
7608
|
+
else {
|
|
7609
|
+
for (let i = 0; i < slotBuffer.length; i++) {
|
|
7610
|
+
push(slotBuffer[i]);
|
|
7611
|
+
}
|
|
7612
|
+
}
|
|
7613
|
+
}
|
|
7614
|
+
}
|
|
7615
|
+
else if (fallbackRenderFn) {
|
|
7616
|
+
fallbackRenderFn();
|
|
7395
7617
|
}
|
|
7396
7618
|
}
|
|
7619
|
+
const commentTestRE = /^<!--.*-->$/s;
|
|
7620
|
+
const commentRE = /<!--[^]*?-->/gm;
|
|
7621
|
+
function isComment(item) {
|
|
7622
|
+
if (typeof item !== 'string' || !commentTestRE.test(item))
|
|
7623
|
+
return false;
|
|
7624
|
+
// if item is '<!---->' or '<!--[-->' or '<!--]-->', return true directly
|
|
7625
|
+
if (item.length <= 8)
|
|
7626
|
+
return true;
|
|
7627
|
+
return !item.replace(commentRE, '').trim();
|
|
7628
|
+
}
|
|
7397
7629
|
|
|
7398
7630
|
function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parentComponent) {
|
|
7399
7631
|
parentPush('<!--teleport start-->');
|
|
@@ -7418,7 +7650,109 @@ function ssrRenderTeleport(parentPush, contentRenderFn, target, disabled, parent
|
|
|
7418
7650
|
parentPush('<!--teleport end-->');
|
|
7419
7651
|
}
|
|
7420
7652
|
|
|
7421
|
-
|
|
7653
|
+
function ssrInterpolate(value) {
|
|
7654
|
+
return escapeHtml(toDisplayString(value));
|
|
7655
|
+
}
|
|
7656
|
+
|
|
7657
|
+
function ssrRenderList(source, renderItem) {
|
|
7658
|
+
if (isArray(source) || isString(source)) {
|
|
7659
|
+
for (let i = 0, l = source.length; i < l; i++) {
|
|
7660
|
+
renderItem(source[i], i);
|
|
7661
|
+
}
|
|
7662
|
+
}
|
|
7663
|
+
else if (typeof source === 'number') {
|
|
7664
|
+
if (!Number.isInteger(source)) {
|
|
7665
|
+
warn(`The v-for range expect an integer value but got ${source}.`);
|
|
7666
|
+
return;
|
|
7667
|
+
}
|
|
7668
|
+
for (let i = 0; i < source; i++) {
|
|
7669
|
+
renderItem(i + 1, i);
|
|
7670
|
+
}
|
|
7671
|
+
}
|
|
7672
|
+
else if (isObject(source)) {
|
|
7673
|
+
if (source[Symbol.iterator]) {
|
|
7674
|
+
const arr = Array.from(source);
|
|
7675
|
+
for (let i = 0, l = arr.length; i < l; i++) {
|
|
7676
|
+
renderItem(arr[i], i);
|
|
7677
|
+
}
|
|
7678
|
+
}
|
|
7679
|
+
else {
|
|
7680
|
+
const keys = Object.keys(source);
|
|
7681
|
+
for (let i = 0, l = keys.length; i < l; i++) {
|
|
7682
|
+
const key = keys[i];
|
|
7683
|
+
renderItem(source[key], key, i);
|
|
7684
|
+
}
|
|
7685
|
+
}
|
|
7686
|
+
}
|
|
7687
|
+
}
|
|
7688
|
+
|
|
7689
|
+
async function ssrRenderSuspense(push, { default: renderContent }) {
|
|
7690
|
+
if (renderContent) {
|
|
7691
|
+
renderContent();
|
|
7692
|
+
}
|
|
7693
|
+
else {
|
|
7694
|
+
push(`<!---->`);
|
|
7695
|
+
}
|
|
7696
|
+
}
|
|
7697
|
+
|
|
7698
|
+
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
7699
|
+
if (typeof dir !== 'function' && dir.getSSRProps) {
|
|
7700
|
+
return (dir.getSSRProps({
|
|
7701
|
+
dir,
|
|
7702
|
+
instance,
|
|
7703
|
+
value,
|
|
7704
|
+
oldValue: undefined,
|
|
7705
|
+
arg,
|
|
7706
|
+
modifiers
|
|
7707
|
+
}, null) || {});
|
|
7708
|
+
}
|
|
7709
|
+
return {};
|
|
7710
|
+
}
|
|
7711
|
+
|
|
7712
|
+
const ssrLooseEqual = looseEqual;
|
|
7713
|
+
function ssrLooseContain(arr, value) {
|
|
7714
|
+
return looseIndexOf(arr, value) > -1;
|
|
7715
|
+
}
|
|
7716
|
+
// for <input :type="type" v-model="model" value="value">
|
|
7717
|
+
function ssrRenderDynamicModel(type, model, value) {
|
|
7718
|
+
switch (type) {
|
|
7719
|
+
case 'radio':
|
|
7720
|
+
return looseEqual(model, value) ? ' checked' : '';
|
|
7721
|
+
case 'checkbox':
|
|
7722
|
+
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
|
7723
|
+
? ' checked'
|
|
7724
|
+
: '';
|
|
7725
|
+
default:
|
|
7726
|
+
// text types
|
|
7727
|
+
return ssrRenderAttr('value', model);
|
|
7728
|
+
}
|
|
7729
|
+
}
|
|
7730
|
+
// for <input v-bind="obj" v-model="model">
|
|
7731
|
+
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
|
7732
|
+
const { type, value } = existingProps;
|
|
7733
|
+
switch (type) {
|
|
7734
|
+
case 'radio':
|
|
7735
|
+
return looseEqual(model, value) ? { checked: true } : null;
|
|
7736
|
+
case 'checkbox':
|
|
7737
|
+
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
|
7738
|
+
? { checked: true }
|
|
7739
|
+
: null;
|
|
7740
|
+
default:
|
|
7741
|
+
// text types
|
|
7742
|
+
return { value: model };
|
|
7743
|
+
}
|
|
7744
|
+
}
|
|
7745
|
+
|
|
7746
|
+
function ssrCompile(template, instance) {
|
|
7747
|
+
// TODO: this branch should now work in ESM builds, enable it in a minor
|
|
7748
|
+
{
|
|
7749
|
+
throw new Error(`On-the-fly template compilation is not supported in the ESM build of ` +
|
|
7750
|
+
`@vue/server-renderer. All templates must be pre-compiled into ` +
|
|
7751
|
+
`render functions.`);
|
|
7752
|
+
}
|
|
7753
|
+
}
|
|
7754
|
+
|
|
7755
|
+
const { createComponentInstance, setCurrentRenderingInstance, setupComponent, renderComponentRoot, normalizeVNode } = ssrUtils;
|
|
7422
7756
|
// Each component has a buffer array.
|
|
7423
7757
|
// A buffer array can contain one of the following:
|
|
7424
7758
|
// - plain string
|
|
@@ -7451,8 +7785,8 @@ function createBuffer() {
|
|
|
7451
7785
|
};
|
|
7452
7786
|
}
|
|
7453
7787
|
function renderComponentVNode(vnode, parentComponent = null, slotScopeId) {
|
|
7454
|
-
const instance = createComponentInstance
|
|
7455
|
-
const res = setupComponent
|
|
7788
|
+
const instance = createComponentInstance(vnode, parentComponent, null);
|
|
7789
|
+
const res = setupComponent(instance, true /* isSSR */);
|
|
7456
7790
|
const hasAsyncSetup = isPromise(res);
|
|
7457
7791
|
const prefetches = instance.sp; /* LifecycleHooks.SERVER_PREFETCH */
|
|
7458
7792
|
if (hasAsyncSetup || prefetches) {
|
|
@@ -7475,7 +7809,7 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
7475
7809
|
const comp = instance.type;
|
|
7476
7810
|
const { getBuffer, push } = createBuffer();
|
|
7477
7811
|
if (isFunction(comp)) {
|
|
7478
|
-
let root = renderComponentRoot
|
|
7812
|
+
let root = renderComponentRoot(instance);
|
|
7479
7813
|
// #5817 scope ID attrs not falling through if functional component doesn't
|
|
7480
7814
|
// have props
|
|
7481
7815
|
if (!comp.props) {
|
|
@@ -7532,22 +7866,22 @@ function renderComponentSubTree(instance, slotScopeId) {
|
|
|
7532
7866
|
attrs[slotScopeId.trim()] = '';
|
|
7533
7867
|
}
|
|
7534
7868
|
// set current rendering instance for asset resolution
|
|
7535
|
-
const prev = setCurrentRenderingInstance
|
|
7869
|
+
const prev = setCurrentRenderingInstance(instance);
|
|
7536
7870
|
try {
|
|
7537
7871
|
ssrRender(instance.proxy, push, instance, attrs,
|
|
7538
7872
|
// compiler-optimized bindings
|
|
7539
7873
|
instance.props, instance.setupState, instance.data, instance.ctx);
|
|
7540
7874
|
}
|
|
7541
7875
|
finally {
|
|
7542
|
-
setCurrentRenderingInstance
|
|
7876
|
+
setCurrentRenderingInstance(prev);
|
|
7543
7877
|
}
|
|
7544
7878
|
}
|
|
7545
7879
|
else if (instance.render && instance.render !== NOOP) {
|
|
7546
|
-
renderVNode(push, (instance.subTree = renderComponentRoot
|
|
7880
|
+
renderVNode(push, (instance.subTree = renderComponentRoot(instance)), instance, slotScopeId);
|
|
7547
7881
|
}
|
|
7548
7882
|
else {
|
|
7549
7883
|
const componentName = comp.name || comp.__file || `<Anonymous>`;
|
|
7550
|
-
warn
|
|
7884
|
+
warn(`Component ${componentName} is missing template or render function.`);
|
|
7551
7885
|
push(`<!---->`);
|
|
7552
7886
|
}
|
|
7553
7887
|
}
|
|
@@ -7588,13 +7922,13 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
7588
7922
|
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
|
|
7589
7923
|
}
|
|
7590
7924
|
else {
|
|
7591
|
-
warn
|
|
7925
|
+
warn('[@vue/server-renderer] Invalid VNode type:', type, `(${typeof type})`);
|
|
7592
7926
|
}
|
|
7593
7927
|
}
|
|
7594
7928
|
}
|
|
7595
7929
|
function renderVNodeChildren(push, children, parentComponent, slotScopeId) {
|
|
7596
7930
|
for (let i = 0; i < children.length; i++) {
|
|
7597
|
-
renderVNode(push, normalizeVNode
|
|
7931
|
+
renderVNode(push, normalizeVNode(children[i]), parentComponent, slotScopeId);
|
|
7598
7932
|
}
|
|
7599
7933
|
}
|
|
7600
7934
|
function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
|
@@ -7669,12 +8003,12 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
7669
8003
|
const disabled = vnode.props && vnode.props.disabled;
|
|
7670
8004
|
if (!target) {
|
|
7671
8005
|
if (!disabled) {
|
|
7672
|
-
warn
|
|
8006
|
+
warn(`[@vue/server-renderer] Teleport is missing target prop.`);
|
|
7673
8007
|
}
|
|
7674
8008
|
return [];
|
|
7675
8009
|
}
|
|
7676
8010
|
if (!isString(target)) {
|
|
7677
|
-
warn
|
|
8011
|
+
warn(`[@vue/server-renderer] Teleport target must be a query selector string.`);
|
|
7678
8012
|
return [];
|
|
7679
8013
|
}
|
|
7680
8014
|
ssrRenderTeleport(push, push => {
|
|
@@ -7683,7 +8017,7 @@ function renderTeleportVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
7683
8017
|
}
|
|
7684
8018
|
|
|
7685
8019
|
const { isVNode: isVNode$1 } = ssrUtils;
|
|
7686
|
-
async function unrollBuffer(buffer) {
|
|
8020
|
+
async function unrollBuffer$1(buffer) {
|
|
7687
8021
|
if (buffer.hasAsync) {
|
|
7688
8022
|
let ret = '';
|
|
7689
8023
|
for (let i = 0; i < buffer.length; i++) {
|
|
@@ -7695,7 +8029,7 @@ async function unrollBuffer(buffer) {
|
|
|
7695
8029
|
ret += item;
|
|
7696
8030
|
}
|
|
7697
8031
|
else {
|
|
7698
|
-
ret += await unrollBuffer(item);
|
|
8032
|
+
ret += await unrollBuffer$1(item);
|
|
7699
8033
|
}
|
|
7700
8034
|
}
|
|
7701
8035
|
return ret;
|
|
@@ -7703,10 +8037,10 @@ async function unrollBuffer(buffer) {
|
|
|
7703
8037
|
else {
|
|
7704
8038
|
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
7705
8039
|
// ticks
|
|
7706
|
-
return unrollBufferSync(buffer);
|
|
8040
|
+
return unrollBufferSync$1(buffer);
|
|
7707
8041
|
}
|
|
7708
8042
|
}
|
|
7709
|
-
function unrollBufferSync(buffer) {
|
|
8043
|
+
function unrollBufferSync$1(buffer) {
|
|
7710
8044
|
let ret = '';
|
|
7711
8045
|
for (let i = 0; i < buffer.length; i++) {
|
|
7712
8046
|
let item = buffer[i];
|
|
@@ -7715,7 +8049,7 @@ function unrollBufferSync(buffer) {
|
|
|
7715
8049
|
}
|
|
7716
8050
|
else {
|
|
7717
8051
|
// since this is a sync buffer, child buffers are never promises
|
|
7718
|
-
ret += unrollBufferSync(item);
|
|
8052
|
+
ret += unrollBufferSync$1(item);
|
|
7719
8053
|
}
|
|
7720
8054
|
}
|
|
7721
8055
|
return ret;
|
|
@@ -7731,7 +8065,7 @@ async function renderToString(input, context = {}) {
|
|
|
7731
8065
|
// provide the ssr context to the tree
|
|
7732
8066
|
input.provide(ssrContextKey, context);
|
|
7733
8067
|
const buffer = await renderComponentVNode(vnode);
|
|
7734
|
-
const result = await unrollBuffer(buffer);
|
|
8068
|
+
const result = await unrollBuffer$1(buffer);
|
|
7735
8069
|
await resolveTeleports(context);
|
|
7736
8070
|
if (context.__watcherHandles) {
|
|
7737
8071
|
for (const unwatch of context.__watcherHandles) {
|
|
@@ -7746,13 +8080,13 @@ async function resolveTeleports(context) {
|
|
|
7746
8080
|
for (const key in context.__teleportBuffers) {
|
|
7747
8081
|
// note: it's OK to await sequentially here because the Promises were
|
|
7748
8082
|
// created eagerly in parallel.
|
|
7749
|
-
context.teleports[key] = await unrollBuffer(await Promise.all([context.__teleportBuffers[key]]));
|
|
8083
|
+
context.teleports[key] = await unrollBuffer$1(await Promise.all([context.__teleportBuffers[key]]));
|
|
7750
8084
|
}
|
|
7751
8085
|
}
|
|
7752
8086
|
}
|
|
7753
8087
|
|
|
7754
|
-
const { isVNode
|
|
7755
|
-
async function unrollBuffer
|
|
8088
|
+
const { isVNode } = ssrUtils;
|
|
8089
|
+
async function unrollBuffer(buffer, stream) {
|
|
7756
8090
|
if (buffer.hasAsync) {
|
|
7757
8091
|
for (let i = 0; i < buffer.length; i++) {
|
|
7758
8092
|
let item = buffer[i];
|
|
@@ -7763,17 +8097,17 @@ async function unrollBuffer$1(buffer, stream) {
|
|
|
7763
8097
|
stream.push(item);
|
|
7764
8098
|
}
|
|
7765
8099
|
else {
|
|
7766
|
-
await unrollBuffer
|
|
8100
|
+
await unrollBuffer(item, stream);
|
|
7767
8101
|
}
|
|
7768
8102
|
}
|
|
7769
8103
|
}
|
|
7770
8104
|
else {
|
|
7771
8105
|
// sync buffer can be more efficiently unrolled without unnecessary await
|
|
7772
8106
|
// ticks
|
|
7773
|
-
unrollBufferSync
|
|
8107
|
+
unrollBufferSync(buffer, stream);
|
|
7774
8108
|
}
|
|
7775
8109
|
}
|
|
7776
|
-
function unrollBufferSync
|
|
8110
|
+
function unrollBufferSync(buffer, stream) {
|
|
7777
8111
|
for (let i = 0; i < buffer.length; i++) {
|
|
7778
8112
|
let item = buffer[i];
|
|
7779
8113
|
if (isString(item)) {
|
|
@@ -7781,12 +8115,12 @@ function unrollBufferSync$1(buffer, stream) {
|
|
|
7781
8115
|
}
|
|
7782
8116
|
else {
|
|
7783
8117
|
// since this is a sync buffer, child buffers are never promises
|
|
7784
|
-
unrollBufferSync
|
|
8118
|
+
unrollBufferSync(item, stream);
|
|
7785
8119
|
}
|
|
7786
8120
|
}
|
|
7787
8121
|
}
|
|
7788
8122
|
function renderToSimpleStream(input, context, stream) {
|
|
7789
|
-
if (isVNode
|
|
8123
|
+
if (isVNode(input)) {
|
|
7790
8124
|
// raw vnode, wrap with app (for context)
|
|
7791
8125
|
return renderToSimpleStream(createApp({ render: () => input }), context, stream);
|
|
7792
8126
|
}
|
|
@@ -7796,7 +8130,7 @@ function renderToSimpleStream(input, context, stream) {
|
|
|
7796
8130
|
// provide the ssr context to the tree
|
|
7797
8131
|
input.provide(ssrContextKey, context);
|
|
7798
8132
|
Promise.resolve(renderComponentVNode(vnode))
|
|
7799
|
-
.then(buffer => unrollBuffer
|
|
8133
|
+
.then(buffer => unrollBuffer(buffer, stream))
|
|
7800
8134
|
.then(() => resolveTeleports(context))
|
|
7801
8135
|
.then(() => {
|
|
7802
8136
|
if (context.__watcherHandles) {
|
|
@@ -7819,7 +8153,6 @@ function renderToStream(input, context = {}) {
|
|
|
7819
8153
|
return renderToNodeStream(input, context);
|
|
7820
8154
|
}
|
|
7821
8155
|
function renderToNodeStream(input, context = {}) {
|
|
7822
|
-
const stream = null;
|
|
7823
8156
|
{
|
|
7824
8157
|
throw new Error(`ESM build of renderToStream() does not support renderToNodeStream(). ` +
|
|
7825
8158
|
`Use pipeToNodeWritable() with an existing Node.js Writable stream ` +
|
|
@@ -7901,161 +8234,6 @@ function pipeToWebWritable(input, context = {}, writable) {
|
|
|
7901
8234
|
});
|
|
7902
8235
|
}
|
|
7903
8236
|
|
|
7904
|
-
|
|
7905
|
-
return renderComponentVNode(createVNode(comp, props, children), parentComponent, slotScopeId);
|
|
7906
|
-
}
|
|
7907
|
-
|
|
7908
|
-
function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId) {
|
|
7909
|
-
// template-compiled slots are always rendered as fragments
|
|
7910
|
-
push(`<!--[-->`);
|
|
7911
|
-
ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId);
|
|
7912
|
-
push(`<!--]-->`);
|
|
7913
|
-
}
|
|
7914
|
-
function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent, slotScopeId, transition) {
|
|
7915
|
-
const slotFn = slots[slotName];
|
|
7916
|
-
if (slotFn) {
|
|
7917
|
-
const slotBuffer = [];
|
|
7918
|
-
const bufferedPush = (item) => {
|
|
7919
|
-
slotBuffer.push(item);
|
|
7920
|
-
};
|
|
7921
|
-
const ret = slotFn(slotProps, bufferedPush, parentComponent, slotScopeId ? ' ' + slotScopeId : '');
|
|
7922
|
-
if (isArray(ret)) {
|
|
7923
|
-
// normal slot
|
|
7924
|
-
renderVNodeChildren(push, ret, parentComponent, slotScopeId);
|
|
7925
|
-
}
|
|
7926
|
-
else {
|
|
7927
|
-
// ssr slot.
|
|
7928
|
-
// check if the slot renders all comments, in which case use the fallback
|
|
7929
|
-
let isEmptySlot = true;
|
|
7930
|
-
if (transition) {
|
|
7931
|
-
isEmptySlot = false;
|
|
7932
|
-
}
|
|
7933
|
-
else {
|
|
7934
|
-
for (let i = 0; i < slotBuffer.length; i++) {
|
|
7935
|
-
if (!isComment(slotBuffer[i])) {
|
|
7936
|
-
isEmptySlot = false;
|
|
7937
|
-
break;
|
|
7938
|
-
}
|
|
7939
|
-
}
|
|
7940
|
-
}
|
|
7941
|
-
if (isEmptySlot) {
|
|
7942
|
-
if (fallbackRenderFn) {
|
|
7943
|
-
fallbackRenderFn();
|
|
7944
|
-
}
|
|
7945
|
-
}
|
|
7946
|
-
else {
|
|
7947
|
-
for (let i = 0; i < slotBuffer.length; i++) {
|
|
7948
|
-
push(slotBuffer[i]);
|
|
7949
|
-
}
|
|
7950
|
-
}
|
|
7951
|
-
}
|
|
7952
|
-
}
|
|
7953
|
-
else if (fallbackRenderFn) {
|
|
7954
|
-
fallbackRenderFn();
|
|
7955
|
-
}
|
|
7956
|
-
}
|
|
7957
|
-
const commentTestRE = /^<!--.*-->$/s;
|
|
7958
|
-
const commentRE = /<!--[^]*?-->/gm;
|
|
7959
|
-
function isComment(item) {
|
|
7960
|
-
if (typeof item !== 'string' || !commentTestRE.test(item))
|
|
7961
|
-
return false;
|
|
7962
|
-
// if item is '<!---->' or '<!--[-->' or '<!--]-->', return true directly
|
|
7963
|
-
if (item.length <= 8)
|
|
7964
|
-
return true;
|
|
7965
|
-
return !item.replace(commentRE, '').trim();
|
|
7966
|
-
}
|
|
7967
|
-
|
|
7968
|
-
function ssrInterpolate(value) {
|
|
7969
|
-
return escapeHtml(toDisplayString(value));
|
|
7970
|
-
}
|
|
7971
|
-
|
|
7972
|
-
function ssrRenderList(source, renderItem) {
|
|
7973
|
-
if (isArray(source) || isString(source)) {
|
|
7974
|
-
for (let i = 0, l = source.length; i < l; i++) {
|
|
7975
|
-
renderItem(source[i], i);
|
|
7976
|
-
}
|
|
7977
|
-
}
|
|
7978
|
-
else if (typeof source === 'number') {
|
|
7979
|
-
if (!Number.isInteger(source)) {
|
|
7980
|
-
warn$1(`The v-for range expect an integer value but got ${source}.`);
|
|
7981
|
-
return;
|
|
7982
|
-
}
|
|
7983
|
-
for (let i = 0; i < source; i++) {
|
|
7984
|
-
renderItem(i + 1, i);
|
|
7985
|
-
}
|
|
7986
|
-
}
|
|
7987
|
-
else if (isObject(source)) {
|
|
7988
|
-
if (source[Symbol.iterator]) {
|
|
7989
|
-
const arr = Array.from(source);
|
|
7990
|
-
for (let i = 0, l = arr.length; i < l; i++) {
|
|
7991
|
-
renderItem(arr[i], i);
|
|
7992
|
-
}
|
|
7993
|
-
}
|
|
7994
|
-
else {
|
|
7995
|
-
const keys = Object.keys(source);
|
|
7996
|
-
for (let i = 0, l = keys.length; i < l; i++) {
|
|
7997
|
-
const key = keys[i];
|
|
7998
|
-
renderItem(source[key], key, i);
|
|
7999
|
-
}
|
|
8000
|
-
}
|
|
8001
|
-
}
|
|
8002
|
-
}
|
|
8003
|
-
|
|
8004
|
-
async function ssrRenderSuspense(push, { default: renderContent }) {
|
|
8005
|
-
if (renderContent) {
|
|
8006
|
-
renderContent();
|
|
8007
|
-
}
|
|
8008
|
-
else {
|
|
8009
|
-
push(`<!---->`);
|
|
8010
|
-
}
|
|
8011
|
-
}
|
|
8012
|
-
|
|
8013
|
-
function ssrGetDirectiveProps(instance, dir, value, arg, modifiers = {}) {
|
|
8014
|
-
if (typeof dir !== 'function' && dir.getSSRProps) {
|
|
8015
|
-
return (dir.getSSRProps({
|
|
8016
|
-
dir,
|
|
8017
|
-
instance,
|
|
8018
|
-
value,
|
|
8019
|
-
oldValue: undefined,
|
|
8020
|
-
arg,
|
|
8021
|
-
modifiers
|
|
8022
|
-
}, null) || {});
|
|
8023
|
-
}
|
|
8024
|
-
return {};
|
|
8025
|
-
}
|
|
8026
|
-
|
|
8027
|
-
const ssrLooseEqual = looseEqual;
|
|
8028
|
-
function ssrLooseContain(arr, value) {
|
|
8029
|
-
return looseIndexOf(arr, value) > -1;
|
|
8030
|
-
}
|
|
8031
|
-
// for <input :type="type" v-model="model" value="value">
|
|
8032
|
-
function ssrRenderDynamicModel(type, model, value) {
|
|
8033
|
-
switch (type) {
|
|
8034
|
-
case 'radio':
|
|
8035
|
-
return looseEqual(model, value) ? ' checked' : '';
|
|
8036
|
-
case 'checkbox':
|
|
8037
|
-
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
|
8038
|
-
? ' checked'
|
|
8039
|
-
: '';
|
|
8040
|
-
default:
|
|
8041
|
-
// text types
|
|
8042
|
-
return ssrRenderAttr('value', model);
|
|
8043
|
-
}
|
|
8044
|
-
}
|
|
8045
|
-
// for <input v-bind="obj" v-model="model">
|
|
8046
|
-
function ssrGetDynamicModelProps(existingProps = {}, model) {
|
|
8047
|
-
const { type, value } = existingProps;
|
|
8048
|
-
switch (type) {
|
|
8049
|
-
case 'radio':
|
|
8050
|
-
return looseEqual(model, value) ? { checked: true } : null;
|
|
8051
|
-
case 'checkbox':
|
|
8052
|
-
return (isArray(model) ? ssrLooseContain(model, value) : model)
|
|
8053
|
-
? { checked: true }
|
|
8054
|
-
: null;
|
|
8055
|
-
default:
|
|
8056
|
-
// text types
|
|
8057
|
-
return { value: model };
|
|
8058
|
-
}
|
|
8059
|
-
}
|
|
8237
|
+
initDirectivesForSSR();
|
|
8060
8238
|
|
|
8061
8239
|
export { pipeToNodeWritable, pipeToWebWritable, renderToNodeStream, renderToSimpleStream, renderToStream, renderToString, renderToWebStream, ssrGetDirectiveProps, ssrGetDynamicModelProps, includeBooleanAttr as ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderDynamicAttr, ssrRenderDynamicModel, ssrRenderList, ssrRenderSlot, ssrRenderSlotInner, ssrRenderStyle, ssrRenderSuspense, ssrRenderTeleport, renderVNode as ssrRenderVNode };
|