@vue/compat 3.3.9 → 3.4.0-alpha.2
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.
- package/dist/vue.cjs.js +2238 -3746
- package/dist/vue.cjs.prod.js +1942 -3462
- package/dist/vue.esm-browser.js +2118 -1397
- package/dist/vue.esm-browser.prod.js +5 -5
- package/dist/vue.esm-bundler.js +2120 -1407
- package/dist/vue.global.js +2117 -1396
- package/dist/vue.global.prod.js +5 -5
- package/dist/vue.runtime.esm-browser.js +295 -234
- package/dist/vue.runtime.esm-browser.prod.js +5 -5
- package/dist/vue.runtime.esm-bundler.js +296 -243
- package/dist/vue.runtime.global.js +294 -233
- package/dist/vue.runtime.global.prod.js +5 -5
- package/package.json +2 -2
package/dist/vue.esm-bundler.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
function makeMap(str, expectsLowerCase) {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
for (let i = 0; i < list.length; i++) {
|
|
5
|
-
map[list[i]] = true;
|
|
6
|
-
}
|
|
7
|
-
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
2
|
+
const set = new Set(str.split(","));
|
|
3
|
+
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
|
|
8
4
|
}
|
|
9
5
|
|
|
10
6
|
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
@@ -419,117 +415,120 @@ function onScopeDispose(fn) {
|
|
|
419
415
|
}
|
|
420
416
|
}
|
|
421
417
|
|
|
422
|
-
const createDep = (effects) => {
|
|
423
|
-
const dep = new Set(effects);
|
|
424
|
-
dep.w = 0;
|
|
425
|
-
dep.n = 0;
|
|
426
|
-
return dep;
|
|
427
|
-
};
|
|
428
|
-
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
|
429
|
-
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
|
430
|
-
const initDepMarkers = ({ deps }) => {
|
|
431
|
-
if (deps.length) {
|
|
432
|
-
for (let i = 0; i < deps.length; i++) {
|
|
433
|
-
deps[i].w |= trackOpBit;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
const finalizeDepMarkers = (effect) => {
|
|
438
|
-
const { deps } = effect;
|
|
439
|
-
if (deps.length) {
|
|
440
|
-
let ptr = 0;
|
|
441
|
-
for (let i = 0; i < deps.length; i++) {
|
|
442
|
-
const dep = deps[i];
|
|
443
|
-
if (wasTracked(dep) && !newTracked(dep)) {
|
|
444
|
-
dep.delete(effect);
|
|
445
|
-
} else {
|
|
446
|
-
deps[ptr++] = dep;
|
|
447
|
-
}
|
|
448
|
-
dep.w &= ~trackOpBit;
|
|
449
|
-
dep.n &= ~trackOpBit;
|
|
450
|
-
}
|
|
451
|
-
deps.length = ptr;
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
456
|
-
let effectTrackDepth = 0;
|
|
457
|
-
let trackOpBit = 1;
|
|
458
|
-
const maxMarkerBits = 30;
|
|
459
418
|
let activeEffect;
|
|
460
|
-
const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : "");
|
|
461
|
-
const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map key iterate" : "");
|
|
462
419
|
class ReactiveEffect {
|
|
463
|
-
constructor(fn, scheduler
|
|
420
|
+
constructor(fn, trigger, scheduler, scope) {
|
|
464
421
|
this.fn = fn;
|
|
422
|
+
this.trigger = trigger;
|
|
465
423
|
this.scheduler = scheduler;
|
|
466
424
|
this.active = true;
|
|
467
425
|
this.deps = [];
|
|
468
|
-
|
|
426
|
+
/**
|
|
427
|
+
* @internal
|
|
428
|
+
*/
|
|
429
|
+
this._dirtyLevel = 3;
|
|
430
|
+
/**
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
433
|
+
this._trackId = 0;
|
|
434
|
+
/**
|
|
435
|
+
* @internal
|
|
436
|
+
*/
|
|
437
|
+
this._runnings = 0;
|
|
438
|
+
/**
|
|
439
|
+
* @internal
|
|
440
|
+
*/
|
|
441
|
+
this._queryings = 0;
|
|
442
|
+
/**
|
|
443
|
+
* @internal
|
|
444
|
+
*/
|
|
445
|
+
this._depsLength = 0;
|
|
469
446
|
recordEffectScope(this, scope);
|
|
470
447
|
}
|
|
448
|
+
get dirty() {
|
|
449
|
+
if (this._dirtyLevel === 1) {
|
|
450
|
+
this._dirtyLevel = 0;
|
|
451
|
+
this._queryings++;
|
|
452
|
+
pauseTracking();
|
|
453
|
+
for (const dep of this.deps) {
|
|
454
|
+
if (dep.computed) {
|
|
455
|
+
triggerComputed(dep.computed);
|
|
456
|
+
if (this._dirtyLevel >= 2) {
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
resetTracking();
|
|
462
|
+
this._queryings--;
|
|
463
|
+
}
|
|
464
|
+
return this._dirtyLevel >= 2;
|
|
465
|
+
}
|
|
466
|
+
set dirty(v) {
|
|
467
|
+
this._dirtyLevel = v ? 3 : 0;
|
|
468
|
+
}
|
|
471
469
|
run() {
|
|
470
|
+
this._dirtyLevel = 0;
|
|
472
471
|
if (!this.active) {
|
|
473
472
|
return this.fn();
|
|
474
473
|
}
|
|
475
|
-
let parent = activeEffect;
|
|
476
474
|
let lastShouldTrack = shouldTrack;
|
|
477
|
-
|
|
478
|
-
if (parent === this) {
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
parent = parent.parent;
|
|
482
|
-
}
|
|
475
|
+
let lastEffect = activeEffect;
|
|
483
476
|
try {
|
|
484
|
-
this.parent = activeEffect;
|
|
485
|
-
activeEffect = this;
|
|
486
477
|
shouldTrack = true;
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
} else {
|
|
491
|
-
cleanupEffect(this);
|
|
492
|
-
}
|
|
478
|
+
activeEffect = this;
|
|
479
|
+
this._runnings++;
|
|
480
|
+
preCleanupEffect(this);
|
|
493
481
|
return this.fn();
|
|
494
482
|
} finally {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
trackOpBit = 1 << --effectTrackDepth;
|
|
499
|
-
activeEffect = this.parent;
|
|
483
|
+
postCleanupEffect(this);
|
|
484
|
+
this._runnings--;
|
|
485
|
+
activeEffect = lastEffect;
|
|
500
486
|
shouldTrack = lastShouldTrack;
|
|
501
|
-
this.parent = void 0;
|
|
502
|
-
if (this.deferStop) {
|
|
503
|
-
this.stop();
|
|
504
|
-
}
|
|
505
487
|
}
|
|
506
488
|
}
|
|
507
489
|
stop() {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
this.onStop();
|
|
514
|
-
}
|
|
490
|
+
var _a;
|
|
491
|
+
if (this.active) {
|
|
492
|
+
preCleanupEffect(this);
|
|
493
|
+
postCleanupEffect(this);
|
|
494
|
+
(_a = this.onStop) == null ? void 0 : _a.call(this);
|
|
515
495
|
this.active = false;
|
|
516
496
|
}
|
|
517
497
|
}
|
|
518
498
|
}
|
|
519
|
-
function
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
499
|
+
function triggerComputed(computed) {
|
|
500
|
+
return computed.value;
|
|
501
|
+
}
|
|
502
|
+
function preCleanupEffect(effect2) {
|
|
503
|
+
effect2._trackId++;
|
|
504
|
+
effect2._depsLength = 0;
|
|
505
|
+
}
|
|
506
|
+
function postCleanupEffect(effect2) {
|
|
507
|
+
if (effect2.deps && effect2.deps.length > effect2._depsLength) {
|
|
508
|
+
for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
|
|
509
|
+
cleanupDepEffect(effect2.deps[i], effect2);
|
|
510
|
+
}
|
|
511
|
+
effect2.deps.length = effect2._depsLength;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function cleanupDepEffect(dep, effect2) {
|
|
515
|
+
const trackId = dep.get(effect2);
|
|
516
|
+
if (trackId !== void 0 && effect2._trackId !== trackId) {
|
|
517
|
+
dep.delete(effect2);
|
|
518
|
+
if (dep.size === 0) {
|
|
519
|
+
dep.cleanup();
|
|
524
520
|
}
|
|
525
|
-
deps.length = 0;
|
|
526
521
|
}
|
|
527
522
|
}
|
|
528
523
|
function effect(fn, options) {
|
|
529
524
|
if (fn.effect instanceof ReactiveEffect) {
|
|
530
525
|
fn = fn.effect.fn;
|
|
531
526
|
}
|
|
532
|
-
const _effect = new ReactiveEffect(fn)
|
|
527
|
+
const _effect = new ReactiveEffect(fn, NOOP, () => {
|
|
528
|
+
if (_effect.dirty) {
|
|
529
|
+
_effect.run();
|
|
530
|
+
}
|
|
531
|
+
});
|
|
533
532
|
if (options) {
|
|
534
533
|
extend(_effect, options);
|
|
535
534
|
if (options.scope)
|
|
@@ -546,6 +545,7 @@ function stop(runner) {
|
|
|
546
545
|
runner.effect.stop();
|
|
547
546
|
}
|
|
548
547
|
let shouldTrack = true;
|
|
548
|
+
let pauseScheduleStack = 0;
|
|
549
549
|
const trackStack = [];
|
|
550
550
|
function pauseTracking() {
|
|
551
551
|
trackStack.push(shouldTrack);
|
|
@@ -555,6 +555,68 @@ function resetTracking() {
|
|
|
555
555
|
const last = trackStack.pop();
|
|
556
556
|
shouldTrack = last === void 0 ? true : last;
|
|
557
557
|
}
|
|
558
|
+
function pauseScheduling() {
|
|
559
|
+
pauseScheduleStack++;
|
|
560
|
+
}
|
|
561
|
+
function resetScheduling() {
|
|
562
|
+
pauseScheduleStack--;
|
|
563
|
+
while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
|
564
|
+
queueEffectSchedulers.shift()();
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
|
568
|
+
var _a;
|
|
569
|
+
if (dep.get(effect2) !== effect2._trackId) {
|
|
570
|
+
dep.set(effect2, effect2._trackId);
|
|
571
|
+
const oldDep = effect2.deps[effect2._depsLength];
|
|
572
|
+
if (oldDep !== dep) {
|
|
573
|
+
if (oldDep) {
|
|
574
|
+
cleanupDepEffect(oldDep, effect2);
|
|
575
|
+
}
|
|
576
|
+
effect2.deps[effect2._depsLength++] = dep;
|
|
577
|
+
} else {
|
|
578
|
+
effect2._depsLength++;
|
|
579
|
+
}
|
|
580
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
581
|
+
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
const queueEffectSchedulers = [];
|
|
586
|
+
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
|
587
|
+
var _a;
|
|
588
|
+
pauseScheduling();
|
|
589
|
+
for (const effect2 of dep.keys()) {
|
|
590
|
+
if (!effect2.allowRecurse && effect2._runnings) {
|
|
591
|
+
continue;
|
|
592
|
+
}
|
|
593
|
+
if (effect2._dirtyLevel < dirtyLevel && (!effect2._runnings || dirtyLevel !== 2)) {
|
|
594
|
+
const lastDirtyLevel = effect2._dirtyLevel;
|
|
595
|
+
effect2._dirtyLevel = dirtyLevel;
|
|
596
|
+
if (lastDirtyLevel === 0 && (!effect2._queryings || dirtyLevel !== 2)) {
|
|
597
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
598
|
+
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
599
|
+
}
|
|
600
|
+
effect2.trigger();
|
|
601
|
+
if (effect2.scheduler) {
|
|
602
|
+
queueEffectSchedulers.push(effect2.scheduler);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
resetScheduling();
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
const createDep = (cleanup, computed) => {
|
|
611
|
+
const dep = /* @__PURE__ */ new Map();
|
|
612
|
+
dep.cleanup = cleanup;
|
|
613
|
+
dep.computed = computed;
|
|
614
|
+
return dep;
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
618
|
+
const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : "");
|
|
619
|
+
const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map key iterate" : "");
|
|
558
620
|
function track(target, type, key) {
|
|
559
621
|
if (shouldTrack && activeEffect) {
|
|
560
622
|
let depsMap = targetMap.get(target);
|
|
@@ -563,35 +625,17 @@ function track(target, type, key) {
|
|
|
563
625
|
}
|
|
564
626
|
let dep = depsMap.get(key);
|
|
565
627
|
if (!dep) {
|
|
566
|
-
depsMap.set(key, dep = createDep());
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
shouldTrack2 = !wasTracked(dep);
|
|
578
|
-
}
|
|
579
|
-
} else {
|
|
580
|
-
shouldTrack2 = !dep.has(activeEffect);
|
|
581
|
-
}
|
|
582
|
-
if (shouldTrack2) {
|
|
583
|
-
dep.add(activeEffect);
|
|
584
|
-
activeEffect.deps.push(dep);
|
|
585
|
-
if (!!(process.env.NODE_ENV !== "production") && activeEffect.onTrack) {
|
|
586
|
-
activeEffect.onTrack(
|
|
587
|
-
extend(
|
|
588
|
-
{
|
|
589
|
-
effect: activeEffect
|
|
590
|
-
},
|
|
591
|
-
debuggerEventExtraInfo
|
|
592
|
-
)
|
|
593
|
-
);
|
|
594
|
-
}
|
|
628
|
+
depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
|
|
629
|
+
}
|
|
630
|
+
trackEffect(
|
|
631
|
+
activeEffect,
|
|
632
|
+
dep,
|
|
633
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
634
|
+
target,
|
|
635
|
+
type,
|
|
636
|
+
key
|
|
637
|
+
} : void 0
|
|
638
|
+
);
|
|
595
639
|
}
|
|
596
640
|
}
|
|
597
641
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
@@ -639,53 +683,24 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
639
683
|
break;
|
|
640
684
|
}
|
|
641
685
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
if (
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
658
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
659
|
-
triggerEffects(createDep(effects), eventInfo);
|
|
660
|
-
} else {
|
|
661
|
-
triggerEffects(createDep(effects));
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
666
|
-
const effects = isArray(dep) ? dep : [...dep];
|
|
667
|
-
for (const effect2 of effects) {
|
|
668
|
-
if (effect2.computed) {
|
|
669
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
for (const effect2 of effects) {
|
|
673
|
-
if (!effect2.computed) {
|
|
674
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
function triggerEffect(effect2, debuggerEventExtraInfo) {
|
|
679
|
-
if (effect2 !== activeEffect || effect2.allowRecurse) {
|
|
680
|
-
if (!!(process.env.NODE_ENV !== "production") && effect2.onTrigger) {
|
|
681
|
-
effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
682
|
-
}
|
|
683
|
-
if (effect2.scheduler) {
|
|
684
|
-
effect2.scheduler();
|
|
685
|
-
} else {
|
|
686
|
-
effect2.run();
|
|
686
|
+
pauseScheduling();
|
|
687
|
+
for (const dep of deps) {
|
|
688
|
+
if (dep) {
|
|
689
|
+
triggerEffects(
|
|
690
|
+
dep,
|
|
691
|
+
3,
|
|
692
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
693
|
+
target,
|
|
694
|
+
type,
|
|
695
|
+
key,
|
|
696
|
+
newValue,
|
|
697
|
+
oldValue,
|
|
698
|
+
oldTarget
|
|
699
|
+
} : void 0
|
|
700
|
+
);
|
|
687
701
|
}
|
|
688
702
|
}
|
|
703
|
+
resetScheduling();
|
|
689
704
|
}
|
|
690
705
|
function getDepFromReactive(object, key) {
|
|
691
706
|
var _a;
|
|
@@ -716,7 +731,9 @@ function createArrayInstrumentations() {
|
|
|
716
731
|
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
717
732
|
instrumentations[key] = function(...args) {
|
|
718
733
|
pauseTracking();
|
|
734
|
+
pauseScheduling();
|
|
719
735
|
const res = toRaw(this)[key].apply(this, args);
|
|
736
|
+
resetScheduling();
|
|
720
737
|
resetTracking();
|
|
721
738
|
return res;
|
|
722
739
|
};
|
|
@@ -1255,34 +1272,94 @@ function markRaw(value) {
|
|
|
1255
1272
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1256
1273
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1257
1274
|
|
|
1275
|
+
class ComputedRefImpl {
|
|
1276
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1277
|
+
this._setter = _setter;
|
|
1278
|
+
this.dep = void 0;
|
|
1279
|
+
this.__v_isRef = true;
|
|
1280
|
+
this["__v_isReadonly"] = false;
|
|
1281
|
+
this.effect = new ReactiveEffect(
|
|
1282
|
+
() => getter(this._value),
|
|
1283
|
+
() => triggerRefValue(this, 1)
|
|
1284
|
+
);
|
|
1285
|
+
this.effect.computed = this;
|
|
1286
|
+
this.effect.active = this._cacheable = !isSSR;
|
|
1287
|
+
this["__v_isReadonly"] = isReadonly;
|
|
1288
|
+
}
|
|
1289
|
+
get value() {
|
|
1290
|
+
const self = toRaw(this);
|
|
1291
|
+
trackRefValue(self);
|
|
1292
|
+
if (!self._cacheable || self.effect.dirty) {
|
|
1293
|
+
if (hasChanged(self._value, self._value = self.effect.run())) {
|
|
1294
|
+
triggerRefValue(self, 2);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
return self._value;
|
|
1298
|
+
}
|
|
1299
|
+
set value(newValue) {
|
|
1300
|
+
this._setter(newValue);
|
|
1301
|
+
}
|
|
1302
|
+
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1303
|
+
get _dirty() {
|
|
1304
|
+
return this.effect.dirty;
|
|
1305
|
+
}
|
|
1306
|
+
set _dirty(v) {
|
|
1307
|
+
this.effect.dirty = v;
|
|
1308
|
+
}
|
|
1309
|
+
// #endregion
|
|
1310
|
+
}
|
|
1311
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1312
|
+
let getter;
|
|
1313
|
+
let setter;
|
|
1314
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1315
|
+
if (onlyGetter) {
|
|
1316
|
+
getter = getterOrOptions;
|
|
1317
|
+
setter = !!(process.env.NODE_ENV !== "production") ? () => {
|
|
1318
|
+
console.warn("Write operation failed: computed value is readonly");
|
|
1319
|
+
} : NOOP;
|
|
1320
|
+
} else {
|
|
1321
|
+
getter = getterOrOptions.get;
|
|
1322
|
+
setter = getterOrOptions.set;
|
|
1323
|
+
}
|
|
1324
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1325
|
+
if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
|
|
1326
|
+
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1327
|
+
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1328
|
+
}
|
|
1329
|
+
return cRef;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1258
1332
|
function trackRefValue(ref2) {
|
|
1259
1333
|
if (shouldTrack && activeEffect) {
|
|
1260
1334
|
ref2 = toRaw(ref2);
|
|
1261
|
-
|
|
1262
|
-
|
|
1335
|
+
trackEffect(
|
|
1336
|
+
activeEffect,
|
|
1337
|
+
ref2.dep || (ref2.dep = createDep(
|
|
1338
|
+
() => ref2.dep = void 0,
|
|
1339
|
+
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1340
|
+
)),
|
|
1341
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
1263
1342
|
target: ref2,
|
|
1264
1343
|
type: "get",
|
|
1265
1344
|
key: "value"
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
trackEffects(ref2.dep || (ref2.dep = createDep()));
|
|
1269
|
-
}
|
|
1345
|
+
} : void 0
|
|
1346
|
+
);
|
|
1270
1347
|
}
|
|
1271
1348
|
}
|
|
1272
|
-
function triggerRefValue(ref2, newVal) {
|
|
1349
|
+
function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
|
|
1273
1350
|
ref2 = toRaw(ref2);
|
|
1274
1351
|
const dep = ref2.dep;
|
|
1275
1352
|
if (dep) {
|
|
1276
|
-
|
|
1277
|
-
|
|
1353
|
+
triggerEffects(
|
|
1354
|
+
dep,
|
|
1355
|
+
dirtyLevel,
|
|
1356
|
+
!!(process.env.NODE_ENV !== "production") ? {
|
|
1278
1357
|
target: ref2,
|
|
1279
1358
|
type: "set",
|
|
1280
1359
|
key: "value",
|
|
1281
1360
|
newValue: newVal
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
triggerEffects(dep);
|
|
1285
|
-
}
|
|
1361
|
+
} : void 0
|
|
1362
|
+
);
|
|
1286
1363
|
}
|
|
1287
1364
|
}
|
|
1288
1365
|
function isRef(r) {
|
|
@@ -1318,12 +1395,12 @@ class RefImpl {
|
|
|
1318
1395
|
if (hasChanged(newVal, this._rawValue)) {
|
|
1319
1396
|
this._rawValue = newVal;
|
|
1320
1397
|
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1321
|
-
triggerRefValue(this, newVal);
|
|
1398
|
+
triggerRefValue(this, 3, newVal);
|
|
1322
1399
|
}
|
|
1323
1400
|
}
|
|
1324
1401
|
}
|
|
1325
1402
|
function triggerRef(ref2) {
|
|
1326
|
-
triggerRefValue(ref2, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
|
|
1403
|
+
triggerRefValue(ref2, 3, !!(process.env.NODE_ENV !== "production") ? ref2.value : void 0);
|
|
1327
1404
|
}
|
|
1328
1405
|
function unref(ref2) {
|
|
1329
1406
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1421,69 +1498,18 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1421
1498
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1422
1499
|
}
|
|
1423
1500
|
|
|
1424
|
-
|
|
1425
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1426
|
-
this._setter = _setter;
|
|
1427
|
-
this.dep = void 0;
|
|
1428
|
-
this.__v_isRef = true;
|
|
1429
|
-
this["__v_isReadonly"] = false;
|
|
1430
|
-
this._dirty = true;
|
|
1431
|
-
this.effect = new ReactiveEffect(getter, () => {
|
|
1432
|
-
if (!this._dirty) {
|
|
1433
|
-
this._dirty = true;
|
|
1434
|
-
triggerRefValue(this);
|
|
1435
|
-
}
|
|
1436
|
-
});
|
|
1437
|
-
this.effect.computed = this;
|
|
1438
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1439
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1440
|
-
}
|
|
1441
|
-
get value() {
|
|
1442
|
-
const self = toRaw(this);
|
|
1443
|
-
trackRefValue(self);
|
|
1444
|
-
if (self._dirty || !self._cacheable) {
|
|
1445
|
-
self._dirty = false;
|
|
1446
|
-
self._value = self.effect.run();
|
|
1447
|
-
}
|
|
1448
|
-
return self._value;
|
|
1449
|
-
}
|
|
1450
|
-
set value(newValue) {
|
|
1451
|
-
this._setter(newValue);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1455
|
-
let getter;
|
|
1456
|
-
let setter;
|
|
1457
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1458
|
-
if (onlyGetter) {
|
|
1459
|
-
getter = getterOrOptions;
|
|
1460
|
-
setter = !!(process.env.NODE_ENV !== "production") ? () => {
|
|
1461
|
-
console.warn("Write operation failed: computed value is readonly");
|
|
1462
|
-
} : NOOP;
|
|
1463
|
-
} else {
|
|
1464
|
-
getter = getterOrOptions.get;
|
|
1465
|
-
setter = getterOrOptions.set;
|
|
1466
|
-
}
|
|
1467
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1468
|
-
if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
|
|
1469
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1470
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1471
|
-
}
|
|
1472
|
-
return cRef;
|
|
1473
|
-
}
|
|
1474
|
-
|
|
1475
|
-
const stack = [];
|
|
1501
|
+
const stack$1 = [];
|
|
1476
1502
|
function pushWarningContext(vnode) {
|
|
1477
|
-
stack.push(vnode);
|
|
1503
|
+
stack$1.push(vnode);
|
|
1478
1504
|
}
|
|
1479
1505
|
function popWarningContext() {
|
|
1480
|
-
stack.pop();
|
|
1506
|
+
stack$1.pop();
|
|
1481
1507
|
}
|
|
1482
1508
|
function warn(msg, ...args) {
|
|
1483
1509
|
if (!!!(process.env.NODE_ENV !== "production"))
|
|
1484
1510
|
return;
|
|
1485
1511
|
pauseTracking();
|
|
1486
|
-
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1512
|
+
const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
|
|
1487
1513
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1488
1514
|
const trace = getComponentTrace();
|
|
1489
1515
|
if (appWarnHandler) {
|
|
@@ -1512,7 +1538,7 @@ function warn(msg, ...args) {
|
|
|
1512
1538
|
resetTracking();
|
|
1513
1539
|
}
|
|
1514
1540
|
function getComponentTrace() {
|
|
1515
|
-
let currentVNode = stack[stack.length - 1];
|
|
1541
|
+
let currentVNode = stack$1[stack$1.length - 1];
|
|
1516
1542
|
if (!currentVNode) {
|
|
1517
1543
|
return [];
|
|
1518
1544
|
}
|
|
@@ -1590,7 +1616,7 @@ function assertNumber(val, type) {
|
|
|
1590
1616
|
}
|
|
1591
1617
|
}
|
|
1592
1618
|
|
|
1593
|
-
const ErrorTypeStrings = {
|
|
1619
|
+
const ErrorTypeStrings$1 = {
|
|
1594
1620
|
["sp"]: "serverPrefetch hook",
|
|
1595
1621
|
["bc"]: "beforeCreate hook",
|
|
1596
1622
|
["c"]: "created hook",
|
|
@@ -1651,7 +1677,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1651
1677
|
if (instance) {
|
|
1652
1678
|
let cur = instance.parent;
|
|
1653
1679
|
const exposedInstance = instance.proxy;
|
|
1654
|
-
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings[type] : type;
|
|
1680
|
+
const errorInfo = !!(process.env.NODE_ENV !== "production") ? ErrorTypeStrings$1[type] : type;
|
|
1655
1681
|
while (cur) {
|
|
1656
1682
|
const errorCapturedHooks = cur.ec;
|
|
1657
1683
|
if (errorCapturedHooks) {
|
|
@@ -1678,7 +1704,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1678
1704
|
}
|
|
1679
1705
|
function logError(err, type, contextVNode, throwInDev = true) {
|
|
1680
1706
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1681
|
-
const info = ErrorTypeStrings[type];
|
|
1707
|
+
const info = ErrorTypeStrings$1[type];
|
|
1682
1708
|
if (contextVNode) {
|
|
1683
1709
|
pushWarningContext(contextVNode);
|
|
1684
1710
|
}
|
|
@@ -1908,6 +1934,7 @@ function rerender(id, newRender) {
|
|
|
1908
1934
|
}
|
|
1909
1935
|
instance.renderCache = [];
|
|
1910
1936
|
isHmrUpdating = true;
|
|
1937
|
+
instance.effect.dirty = true;
|
|
1911
1938
|
instance.update();
|
|
1912
1939
|
isHmrUpdating = false;
|
|
1913
1940
|
});
|
|
@@ -1935,6 +1962,7 @@ function reload(id, newComp) {
|
|
|
1935
1962
|
instance.ceReload(newComp.styles);
|
|
1936
1963
|
hmrDirtyComponents.delete(oldComp);
|
|
1937
1964
|
} else if (instance.parent) {
|
|
1965
|
+
instance.parent.effect.dirty = true;
|
|
1938
1966
|
queueJob(instance.parent.update);
|
|
1939
1967
|
} else if (instance.appContext.reload) {
|
|
1940
1968
|
instance.appContext.reload();
|
|
@@ -3702,8 +3730,15 @@ function watch(source, cb, options) {
|
|
|
3702
3730
|
}
|
|
3703
3731
|
return doWatch(source, cb, options);
|
|
3704
3732
|
}
|
|
3705
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3733
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3706
3734
|
var _a;
|
|
3735
|
+
if (cb && once) {
|
|
3736
|
+
const _cb = cb;
|
|
3737
|
+
cb = (...args) => {
|
|
3738
|
+
_cb(...args);
|
|
3739
|
+
unwatch();
|
|
3740
|
+
};
|
|
3741
|
+
}
|
|
3707
3742
|
if (!!(process.env.NODE_ENV !== "production") && !cb) {
|
|
3708
3743
|
if (immediate !== void 0) {
|
|
3709
3744
|
warn(
|
|
@@ -3715,6 +3750,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3715
3750
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3716
3751
|
);
|
|
3717
3752
|
}
|
|
3753
|
+
if (once !== void 0) {
|
|
3754
|
+
warn(
|
|
3755
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3756
|
+
);
|
|
3757
|
+
}
|
|
3718
3758
|
}
|
|
3719
3759
|
const warnInvalidSource = (s) => {
|
|
3720
3760
|
warn(
|
|
@@ -3812,7 +3852,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3812
3852
|
}
|
|
3813
3853
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3814
3854
|
const job = () => {
|
|
3815
|
-
if (!effect.active) {
|
|
3855
|
+
if (!effect.active || !effect.dirty) {
|
|
3816
3856
|
return;
|
|
3817
3857
|
}
|
|
3818
3858
|
if (cb) {
|
|
@@ -3845,7 +3885,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3845
3885
|
job.id = instance.uid;
|
|
3846
3886
|
scheduler = () => queueJob(job);
|
|
3847
3887
|
}
|
|
3848
|
-
const effect = new ReactiveEffect(getter, scheduler);
|
|
3888
|
+
const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
|
3889
|
+
const unwatch = () => {
|
|
3890
|
+
effect.stop();
|
|
3891
|
+
if (instance && instance.scope) {
|
|
3892
|
+
remove(instance.scope.effects, effect);
|
|
3893
|
+
}
|
|
3894
|
+
};
|
|
3849
3895
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
3850
3896
|
effect.onTrack = onTrack;
|
|
3851
3897
|
effect.onTrigger = onTrigger;
|
|
@@ -3864,12 +3910,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3864
3910
|
} else {
|
|
3865
3911
|
effect.run();
|
|
3866
3912
|
}
|
|
3867
|
-
const unwatch = () => {
|
|
3868
|
-
effect.stop();
|
|
3869
|
-
if (instance && instance.scope) {
|
|
3870
|
-
remove(instance.scope.effects, effect);
|
|
3871
|
-
}
|
|
3872
|
-
};
|
|
3873
3913
|
if (ssrCleanup)
|
|
3874
3914
|
ssrCleanup.push(unwatch);
|
|
3875
3915
|
return unwatch;
|
|
@@ -4106,6 +4146,7 @@ const BaseTransitionImpl = {
|
|
|
4106
4146
|
leavingHooks.afterLeave = () => {
|
|
4107
4147
|
state.isLeaving = false;
|
|
4108
4148
|
if (instance.update.active !== false) {
|
|
4149
|
+
instance.effect.dirty = true;
|
|
4109
4150
|
instance.update();
|
|
4110
4151
|
}
|
|
4111
4152
|
};
|
|
@@ -4448,6 +4489,7 @@ function defineAsyncComponent(source) {
|
|
|
4448
4489
|
load().then(() => {
|
|
4449
4490
|
loaded.value = true;
|
|
4450
4491
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4492
|
+
instance.parent.effect.dirty = true;
|
|
4451
4493
|
queueJob(instance.parent.update);
|
|
4452
4494
|
}
|
|
4453
4495
|
}).catch((err) => {
|
|
@@ -4751,7 +4793,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4751
4793
|
}
|
|
4752
4794
|
return wrappedHook;
|
|
4753
4795
|
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
4754
|
-
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
4796
|
+
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
4755
4797
|
warn(
|
|
4756
4798
|
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
4757
4799
|
);
|
|
@@ -5414,7 +5456,10 @@ const publicPropertiesMap = (
|
|
|
5414
5456
|
$root: (i) => getPublicInstance(i.root),
|
|
5415
5457
|
$emit: (i) => i.emit,
|
|
5416
5458
|
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
|
|
5417
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
5459
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5460
|
+
i.effect.dirty = true;
|
|
5461
|
+
queueJob(i.update);
|
|
5462
|
+
}),
|
|
5418
5463
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
5419
5464
|
$watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP
|
|
5420
5465
|
})
|
|
@@ -6317,7 +6362,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6317
6362
|
return vm;
|
|
6318
6363
|
}
|
|
6319
6364
|
}
|
|
6320
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
6365
|
+
Vue.version = `2.6.14-compat:${"3.4.0-alpha.2"}`;
|
|
6321
6366
|
Vue.config = singletonApp.config;
|
|
6322
6367
|
Vue.use = (p, ...options) => {
|
|
6323
6368
|
if (p && isFunction(p.install)) {
|
|
@@ -8777,6 +8822,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8777
8822
|
} else {
|
|
8778
8823
|
instance.next = n2;
|
|
8779
8824
|
invalidateJob(instance.update);
|
|
8825
|
+
instance.effect.dirty = true;
|
|
8780
8826
|
instance.update();
|
|
8781
8827
|
}
|
|
8782
8828
|
} else {
|
|
@@ -8970,11 +9016,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8970
9016
|
};
|
|
8971
9017
|
const effect = instance.effect = new ReactiveEffect(
|
|
8972
9018
|
componentUpdateFn,
|
|
9019
|
+
NOOP,
|
|
8973
9020
|
() => queueJob(update),
|
|
8974
9021
|
instance.scope
|
|
8975
9022
|
// track it in component's effect scope
|
|
8976
9023
|
);
|
|
8977
|
-
const update = instance.update = () =>
|
|
9024
|
+
const update = instance.update = () => {
|
|
9025
|
+
if (effect.dirty) {
|
|
9026
|
+
effect.run();
|
|
9027
|
+
}
|
|
9028
|
+
};
|
|
8978
9029
|
update.id = instance.uid;
|
|
8979
9030
|
toggleRecurse(instance, true);
|
|
8980
9031
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
@@ -10975,7 +11026,8 @@ function isMemoSame(cached, memo) {
|
|
|
10975
11026
|
return true;
|
|
10976
11027
|
}
|
|
10977
11028
|
|
|
10978
|
-
const version = "3.
|
|
11029
|
+
const version = "3.4.0-alpha.2";
|
|
11030
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10979
11031
|
const _ssrUtils = {
|
|
10980
11032
|
createComponentInstance,
|
|
10981
11033
|
setupComponent,
|
|
@@ -12666,6 +12718,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
12666
12718
|
BaseTransitionPropsValidators: BaseTransitionPropsValidators,
|
|
12667
12719
|
Comment: Comment,
|
|
12668
12720
|
EffectScope: EffectScope,
|
|
12721
|
+
ErrorTypeStrings: ErrorTypeStrings,
|
|
12669
12722
|
Fragment: Fragment,
|
|
12670
12723
|
KeepAlive: KeepAlive,
|
|
12671
12724
|
ReactiveEffect: ReactiveEffect,
|
|
@@ -12843,83 +12896,6 @@ function createCompatVue() {
|
|
|
12843
12896
|
return Vue;
|
|
12844
12897
|
}
|
|
12845
12898
|
|
|
12846
|
-
function defaultOnError(error) {
|
|
12847
|
-
throw error;
|
|
12848
|
-
}
|
|
12849
|
-
function defaultOnWarn(msg) {
|
|
12850
|
-
!!(process.env.NODE_ENV !== "production") && console.warn(`[Vue warn] ${msg.message}`);
|
|
12851
|
-
}
|
|
12852
|
-
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
12853
|
-
const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : code;
|
|
12854
|
-
const error = new SyntaxError(String(msg));
|
|
12855
|
-
error.code = code;
|
|
12856
|
-
error.loc = loc;
|
|
12857
|
-
return error;
|
|
12858
|
-
}
|
|
12859
|
-
const errorMessages = {
|
|
12860
|
-
// parse errors
|
|
12861
|
-
[0]: "Illegal comment.",
|
|
12862
|
-
[1]: "CDATA section is allowed only in XML context.",
|
|
12863
|
-
[2]: "Duplicate attribute.",
|
|
12864
|
-
[3]: "End tag cannot have attributes.",
|
|
12865
|
-
[4]: "Illegal '/' in tags.",
|
|
12866
|
-
[5]: "Unexpected EOF in tag.",
|
|
12867
|
-
[6]: "Unexpected EOF in CDATA section.",
|
|
12868
|
-
[7]: "Unexpected EOF in comment.",
|
|
12869
|
-
[8]: "Unexpected EOF in script.",
|
|
12870
|
-
[9]: "Unexpected EOF in tag.",
|
|
12871
|
-
[10]: "Incorrectly closed comment.",
|
|
12872
|
-
[11]: "Incorrectly opened comment.",
|
|
12873
|
-
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
12874
|
-
[13]: "Attribute value was expected.",
|
|
12875
|
-
[14]: "End tag name was expected.",
|
|
12876
|
-
[15]: "Whitespace was expected.",
|
|
12877
|
-
[16]: "Unexpected '<!--' in comment.",
|
|
12878
|
-
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
12879
|
-
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
12880
|
-
[19]: "Attribute name cannot start with '='.",
|
|
12881
|
-
[21]: "'<?' is allowed only in XML context.",
|
|
12882
|
-
[20]: `Unexpected null character.`,
|
|
12883
|
-
[22]: "Illegal '/' in tags.",
|
|
12884
|
-
// Vue-specific parse errors
|
|
12885
|
-
[23]: "Invalid end tag.",
|
|
12886
|
-
[24]: "Element is missing end tag.",
|
|
12887
|
-
[25]: "Interpolation end sign was not found.",
|
|
12888
|
-
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
12889
|
-
[26]: "Legal directive name was expected.",
|
|
12890
|
-
// transform errors
|
|
12891
|
-
[28]: `v-if/v-else-if is missing expression.`,
|
|
12892
|
-
[29]: `v-if/else branches must use unique keys.`,
|
|
12893
|
-
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
12894
|
-
[31]: `v-for is missing expression.`,
|
|
12895
|
-
[32]: `v-for has invalid expression.`,
|
|
12896
|
-
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
12897
|
-
[34]: `v-bind is missing expression.`,
|
|
12898
|
-
[35]: `v-on is missing expression.`,
|
|
12899
|
-
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
12900
|
-
[37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
|
|
12901
|
-
[38]: `Duplicate slot names found. `,
|
|
12902
|
-
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
12903
|
-
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
12904
|
-
[41]: `v-model is missing expression.`,
|
|
12905
|
-
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
12906
|
-
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
12907
|
-
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
12908
|
-
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
12909
|
-
[45]: `Error parsing JavaScript expression: `,
|
|
12910
|
-
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
12911
|
-
// generic errors
|
|
12912
|
-
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
12913
|
-
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
12914
|
-
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
12915
|
-
[50]: `"scopeId" option is only supported in module mode.`,
|
|
12916
|
-
// deprecations
|
|
12917
|
-
[51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
12918
|
-
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
12919
|
-
// just to fulfill types
|
|
12920
|
-
[53]: ``
|
|
12921
|
-
};
|
|
12922
|
-
|
|
12923
12899
|
const FRAGMENT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Fragment` : ``);
|
|
12924
12900
|
const TELEPORT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Teleport` : ``);
|
|
12925
12901
|
const SUSPENSE = Symbol(!!(process.env.NODE_ENV !== "production") ? `Suspense` : ``);
|
|
@@ -13009,13 +12985,14 @@ function registerRuntimeHelpers(helpers) {
|
|
|
13009
12985
|
}
|
|
13010
12986
|
|
|
13011
12987
|
const locStub = {
|
|
13012
|
-
source: "",
|
|
13013
12988
|
start: { line: 1, column: 1, offset: 0 },
|
|
13014
|
-
end: { line: 1, column: 1, offset: 0 }
|
|
12989
|
+
end: { line: 1, column: 1, offset: 0 },
|
|
12990
|
+
source: ""
|
|
13015
12991
|
};
|
|
13016
|
-
function createRoot(children,
|
|
12992
|
+
function createRoot(children, source = "") {
|
|
13017
12993
|
return {
|
|
13018
12994
|
type: 0,
|
|
12995
|
+
source,
|
|
13019
12996
|
children,
|
|
13020
12997
|
helpers: /* @__PURE__ */ new Set(),
|
|
13021
12998
|
components: [],
|
|
@@ -13025,7 +13002,7 @@ function createRoot(children, loc = locStub) {
|
|
|
13025
13002
|
cached: 0,
|
|
13026
13003
|
temps: 0,
|
|
13027
13004
|
codegenNode: void 0,
|
|
13028
|
-
loc
|
|
13005
|
+
loc: locStub
|
|
13029
13006
|
};
|
|
13030
13007
|
}
|
|
13031
13008
|
function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
|
|
@@ -13151,268 +13128,809 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
|
13151
13128
|
}
|
|
13152
13129
|
}
|
|
13153
13130
|
|
|
13154
|
-
const
|
|
13155
|
-
const
|
|
13156
|
-
function
|
|
13157
|
-
|
|
13158
|
-
return TELEPORT;
|
|
13159
|
-
} else if (isBuiltInType(tag, "Suspense")) {
|
|
13160
|
-
return SUSPENSE;
|
|
13161
|
-
} else if (isBuiltInType(tag, "KeepAlive")) {
|
|
13162
|
-
return KEEP_ALIVE;
|
|
13163
|
-
} else if (isBuiltInType(tag, "BaseTransition")) {
|
|
13164
|
-
return BASE_TRANSITION;
|
|
13165
|
-
}
|
|
13131
|
+
const defaultDelimitersOpen = new Uint8Array([123, 123]);
|
|
13132
|
+
const defaultDelimitersClose = new Uint8Array([125, 125]);
|
|
13133
|
+
function isTagStartChar(c) {
|
|
13134
|
+
return c >= 97 && c <= 122 || c >= 65 && c <= 90;
|
|
13166
13135
|
}
|
|
13167
|
-
|
|
13168
|
-
|
|
13169
|
-
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
13170
|
-
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
13171
|
-
const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
|
|
13172
|
-
const isMemberExpressionBrowser = (path) => {
|
|
13173
|
-
path = path.trim().replace(whitespaceRE, (s) => s.trim());
|
|
13174
|
-
let state = 0 /* inMemberExp */;
|
|
13175
|
-
let stateStack = [];
|
|
13176
|
-
let currentOpenBracketCount = 0;
|
|
13177
|
-
let currentOpenParensCount = 0;
|
|
13178
|
-
let currentStringType = null;
|
|
13179
|
-
for (let i = 0; i < path.length; i++) {
|
|
13180
|
-
const char = path.charAt(i);
|
|
13181
|
-
switch (state) {
|
|
13182
|
-
case 0 /* inMemberExp */:
|
|
13183
|
-
if (char === "[") {
|
|
13184
|
-
stateStack.push(state);
|
|
13185
|
-
state = 1 /* inBrackets */;
|
|
13186
|
-
currentOpenBracketCount++;
|
|
13187
|
-
} else if (char === "(") {
|
|
13188
|
-
stateStack.push(state);
|
|
13189
|
-
state = 2 /* inParens */;
|
|
13190
|
-
currentOpenParensCount++;
|
|
13191
|
-
} else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
|
|
13192
|
-
return false;
|
|
13193
|
-
}
|
|
13194
|
-
break;
|
|
13195
|
-
case 1 /* inBrackets */:
|
|
13196
|
-
if (char === `'` || char === `"` || char === "`") {
|
|
13197
|
-
stateStack.push(state);
|
|
13198
|
-
state = 3 /* inString */;
|
|
13199
|
-
currentStringType = char;
|
|
13200
|
-
} else if (char === `[`) {
|
|
13201
|
-
currentOpenBracketCount++;
|
|
13202
|
-
} else if (char === `]`) {
|
|
13203
|
-
if (!--currentOpenBracketCount) {
|
|
13204
|
-
state = stateStack.pop();
|
|
13205
|
-
}
|
|
13206
|
-
}
|
|
13207
|
-
break;
|
|
13208
|
-
case 2 /* inParens */:
|
|
13209
|
-
if (char === `'` || char === `"` || char === "`") {
|
|
13210
|
-
stateStack.push(state);
|
|
13211
|
-
state = 3 /* inString */;
|
|
13212
|
-
currentStringType = char;
|
|
13213
|
-
} else if (char === `(`) {
|
|
13214
|
-
currentOpenParensCount++;
|
|
13215
|
-
} else if (char === `)`) {
|
|
13216
|
-
if (i === path.length - 1) {
|
|
13217
|
-
return false;
|
|
13218
|
-
}
|
|
13219
|
-
if (!--currentOpenParensCount) {
|
|
13220
|
-
state = stateStack.pop();
|
|
13221
|
-
}
|
|
13222
|
-
}
|
|
13223
|
-
break;
|
|
13224
|
-
case 3 /* inString */:
|
|
13225
|
-
if (char === currentStringType) {
|
|
13226
|
-
state = stateStack.pop();
|
|
13227
|
-
currentStringType = null;
|
|
13228
|
-
}
|
|
13229
|
-
break;
|
|
13230
|
-
}
|
|
13231
|
-
}
|
|
13232
|
-
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
13233
|
-
};
|
|
13234
|
-
const isMemberExpression = isMemberExpressionBrowser ;
|
|
13235
|
-
function getInnerRange(loc, offset, length) {
|
|
13236
|
-
const source = loc.source.slice(offset, offset + length);
|
|
13237
|
-
const newLoc = {
|
|
13238
|
-
source,
|
|
13239
|
-
start: advancePositionWithClone(loc.start, loc.source, offset),
|
|
13240
|
-
end: loc.end
|
|
13241
|
-
};
|
|
13242
|
-
if (length != null) {
|
|
13243
|
-
newLoc.end = advancePositionWithClone(
|
|
13244
|
-
loc.start,
|
|
13245
|
-
loc.source,
|
|
13246
|
-
offset + length
|
|
13247
|
-
);
|
|
13248
|
-
}
|
|
13249
|
-
return newLoc;
|
|
13136
|
+
function isWhitespace(c) {
|
|
13137
|
+
return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
|
|
13250
13138
|
}
|
|
13251
|
-
function
|
|
13252
|
-
return
|
|
13253
|
-
extend({}, pos),
|
|
13254
|
-
source,
|
|
13255
|
-
numberOfCharacters
|
|
13256
|
-
);
|
|
13139
|
+
function isEndOfTagSection(c) {
|
|
13140
|
+
return c === 47 || c === 62 || isWhitespace(c);
|
|
13257
13141
|
}
|
|
13258
|
-
function
|
|
13259
|
-
|
|
13260
|
-
let
|
|
13261
|
-
|
|
13262
|
-
if (source.charCodeAt(i) === 10) {
|
|
13263
|
-
linesCount++;
|
|
13264
|
-
lastNewLinePos = i;
|
|
13265
|
-
}
|
|
13142
|
+
function toCharCodes(str) {
|
|
13143
|
+
const ret = new Uint8Array(str.length);
|
|
13144
|
+
for (let i = 0; i < str.length; i++) {
|
|
13145
|
+
ret[i] = str.charCodeAt(i);
|
|
13266
13146
|
}
|
|
13267
|
-
|
|
13268
|
-
pos.line += linesCount;
|
|
13269
|
-
pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
|
|
13270
|
-
return pos;
|
|
13147
|
+
return ret;
|
|
13271
13148
|
}
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13149
|
+
const Sequences = {
|
|
13150
|
+
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
|
|
13151
|
+
// CDATA[
|
|
13152
|
+
CdataEnd: new Uint8Array([93, 93, 62]),
|
|
13153
|
+
// ]]>
|
|
13154
|
+
CommentEnd: new Uint8Array([45, 45, 62]),
|
|
13155
|
+
// `-->`
|
|
13156
|
+
ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
|
|
13157
|
+
// `<\/script`
|
|
13158
|
+
StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
|
|
13159
|
+
// `</style`
|
|
13160
|
+
TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
|
|
13161
|
+
// `</title`
|
|
13162
|
+
TextareaEnd: new Uint8Array([
|
|
13163
|
+
60,
|
|
13164
|
+
47,
|
|
13165
|
+
116,
|
|
13166
|
+
101,
|
|
13167
|
+
120,
|
|
13168
|
+
116,
|
|
13169
|
+
97,
|
|
13170
|
+
114,
|
|
13171
|
+
101,
|
|
13172
|
+
97
|
|
13173
|
+
])
|
|
13174
|
+
// `</textarea
|
|
13175
|
+
};
|
|
13176
|
+
class Tokenizer {
|
|
13177
|
+
constructor(stack, cbs) {
|
|
13178
|
+
this.stack = stack;
|
|
13179
|
+
this.cbs = cbs;
|
|
13180
|
+
/** The current state the tokenizer is in. */
|
|
13181
|
+
this.state = 1;
|
|
13182
|
+
/** The read buffer. */
|
|
13183
|
+
this.buffer = "";
|
|
13184
|
+
/** The beginning of the section that is currently being read. */
|
|
13185
|
+
this.sectionStart = 0;
|
|
13186
|
+
/** The index within the buffer that we are currently looking at. */
|
|
13187
|
+
this.index = 0;
|
|
13188
|
+
/** The start of the last entity. */
|
|
13189
|
+
this.entityStart = 0;
|
|
13190
|
+
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
|
|
13191
|
+
this.baseState = 1;
|
|
13192
|
+
/** For special parsing behavior inside of script and style tags. */
|
|
13193
|
+
this.inRCDATA = false;
|
|
13194
|
+
/** For disabling RCDATA tags handling */
|
|
13195
|
+
this.inXML = false;
|
|
13196
|
+
/** Reocrd newline positions for fast line / column calculation */
|
|
13197
|
+
this.newlines = [];
|
|
13198
|
+
this.mode = 0;
|
|
13199
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
13200
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
13201
|
+
this.delimiterIndex = -1;
|
|
13202
|
+
this.currentSequence = void 0;
|
|
13203
|
+
this.sequenceIndex = 0;
|
|
13204
|
+
}
|
|
13205
|
+
get inSFCRoot() {
|
|
13206
|
+
return this.mode === 2 && this.stack.length === 0;
|
|
13207
|
+
}
|
|
13208
|
+
reset() {
|
|
13209
|
+
this.state = 1;
|
|
13210
|
+
this.mode = 0;
|
|
13211
|
+
this.buffer = "";
|
|
13212
|
+
this.sectionStart = 0;
|
|
13213
|
+
this.index = 0;
|
|
13214
|
+
this.baseState = 1;
|
|
13215
|
+
this.currentSequence = void 0;
|
|
13216
|
+
this.newlines.length = 0;
|
|
13217
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
13218
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
13275
13219
|
}
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13220
|
+
/**
|
|
13221
|
+
* Generate Position object with line / column information using recorded
|
|
13222
|
+
* newline positions. We know the index is always going to be an already
|
|
13223
|
+
* processed index, so all the newlines up to this index should have been
|
|
13224
|
+
* recorded.
|
|
13225
|
+
*/
|
|
13226
|
+
getPos(index) {
|
|
13227
|
+
let line = 1;
|
|
13228
|
+
let column = index + 1;
|
|
13229
|
+
for (let i = this.newlines.length - 1; i >= 0; i--) {
|
|
13230
|
+
const newlineIndex = this.newlines[i];
|
|
13231
|
+
if (index > newlineIndex) {
|
|
13232
|
+
line = i + 2;
|
|
13233
|
+
column = index - newlineIndex;
|
|
13234
|
+
break;
|
|
13235
|
+
}
|
|
13282
13236
|
}
|
|
13237
|
+
return {
|
|
13238
|
+
column,
|
|
13239
|
+
line,
|
|
13240
|
+
offset: index
|
|
13241
|
+
};
|
|
13283
13242
|
}
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
if (
|
|
13289
|
-
if (
|
|
13290
|
-
|
|
13291
|
-
if (p.name === name && (p.value || allowEmpty)) {
|
|
13292
|
-
return p;
|
|
13243
|
+
peek() {
|
|
13244
|
+
return this.buffer.charCodeAt(this.index + 1);
|
|
13245
|
+
}
|
|
13246
|
+
stateText(c) {
|
|
13247
|
+
if (c === 60) {
|
|
13248
|
+
if (this.index > this.sectionStart) {
|
|
13249
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
13293
13250
|
}
|
|
13294
|
-
|
|
13295
|
-
|
|
13251
|
+
this.state = 5;
|
|
13252
|
+
this.sectionStart = this.index;
|
|
13253
|
+
} else if (c === this.delimiterOpen[0]) {
|
|
13254
|
+
this.state = 2;
|
|
13255
|
+
this.delimiterIndex = 0;
|
|
13256
|
+
this.stateInterpolationOpen(c);
|
|
13296
13257
|
}
|
|
13297
13258
|
}
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
|
|
13309
|
-
}
|
|
13310
|
-
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
function isTemplateNode(node) {
|
|
13317
|
-
return node.type === 1 && node.tagType === 3;
|
|
13318
|
-
}
|
|
13319
|
-
function isSlotOutlet(node) {
|
|
13320
|
-
return node.type === 1 && node.tagType === 2;
|
|
13321
|
-
}
|
|
13322
|
-
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
13323
|
-
function getUnnormalizedProps(props, callPath = []) {
|
|
13324
|
-
if (props && !isString(props) && props.type === 14) {
|
|
13325
|
-
const callee = props.callee;
|
|
13326
|
-
if (!isString(callee) && propsHelperSet.has(callee)) {
|
|
13327
|
-
return getUnnormalizedProps(
|
|
13328
|
-
props.arguments[0],
|
|
13329
|
-
callPath.concat(props)
|
|
13330
|
-
);
|
|
13259
|
+
stateInterpolationOpen(c) {
|
|
13260
|
+
if (c === this.delimiterOpen[this.delimiterIndex]) {
|
|
13261
|
+
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
|
|
13262
|
+
const start = this.index + 1 - this.delimiterOpen.length;
|
|
13263
|
+
if (start > this.sectionStart) {
|
|
13264
|
+
this.cbs.ontext(this.sectionStart, start);
|
|
13265
|
+
}
|
|
13266
|
+
this.state = 3;
|
|
13267
|
+
this.sectionStart = start;
|
|
13268
|
+
} else {
|
|
13269
|
+
this.delimiterIndex++;
|
|
13270
|
+
}
|
|
13271
|
+
} else if (this.inRCDATA) {
|
|
13272
|
+
this.state = 32;
|
|
13273
|
+
this.stateInRCDATA(c);
|
|
13274
|
+
} else {
|
|
13275
|
+
this.state = 1;
|
|
13276
|
+
this.stateText(c);
|
|
13331
13277
|
}
|
|
13332
13278
|
}
|
|
13333
|
-
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
let parentCall;
|
|
13340
|
-
if (props && !isString(props) && props.type === 14) {
|
|
13341
|
-
const ret = getUnnormalizedProps(props);
|
|
13342
|
-
props = ret[0];
|
|
13343
|
-
callPath = ret[1];
|
|
13344
|
-
parentCall = callPath[callPath.length - 1];
|
|
13279
|
+
stateInterpolation(c) {
|
|
13280
|
+
if (c === this.delimiterClose[0]) {
|
|
13281
|
+
this.state = 4;
|
|
13282
|
+
this.delimiterIndex = 0;
|
|
13283
|
+
this.stateInterpolationClose(c);
|
|
13284
|
+
}
|
|
13345
13285
|
}
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
|
|
13357
|
-
createObjectExpression([prop]),
|
|
13358
|
-
props
|
|
13359
|
-
]);
|
|
13286
|
+
stateInterpolationClose(c) {
|
|
13287
|
+
if (c === this.delimiterClose[this.delimiterIndex]) {
|
|
13288
|
+
if (this.delimiterIndex === this.delimiterClose.length - 1) {
|
|
13289
|
+
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
|
|
13290
|
+
if (this.inRCDATA) {
|
|
13291
|
+
this.state = 32;
|
|
13292
|
+
} else {
|
|
13293
|
+
this.state = 1;
|
|
13294
|
+
}
|
|
13295
|
+
this.sectionStart = this.index + 1;
|
|
13360
13296
|
} else {
|
|
13361
|
-
|
|
13297
|
+
this.delimiterIndex++;
|
|
13362
13298
|
}
|
|
13299
|
+
} else {
|
|
13300
|
+
this.state = 3;
|
|
13301
|
+
this.stateInterpolation(c);
|
|
13302
|
+
}
|
|
13303
|
+
}
|
|
13304
|
+
stateSpecialStartSequence(c) {
|
|
13305
|
+
const isEnd = this.sequenceIndex === this.currentSequence.length;
|
|
13306
|
+
const isMatch = isEnd ? (
|
|
13307
|
+
// If we are at the end of the sequence, make sure the tag name has ended
|
|
13308
|
+
isEndOfTagSection(c)
|
|
13309
|
+
) : (
|
|
13310
|
+
// Otherwise, do a case-insensitive comparison
|
|
13311
|
+
(c | 32) === this.currentSequence[this.sequenceIndex]
|
|
13312
|
+
);
|
|
13313
|
+
if (!isMatch) {
|
|
13314
|
+
this.inRCDATA = false;
|
|
13315
|
+
} else if (!isEnd) {
|
|
13316
|
+
this.sequenceIndex++;
|
|
13317
|
+
return;
|
|
13363
13318
|
}
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13319
|
+
this.sequenceIndex = 0;
|
|
13320
|
+
this.state = 6;
|
|
13321
|
+
this.stateInTagName(c);
|
|
13322
|
+
}
|
|
13323
|
+
/** Look for an end tag. For <title> and <textarea>, also decode entities. */
|
|
13324
|
+
stateInRCDATA(c) {
|
|
13325
|
+
if (this.sequenceIndex === this.currentSequence.length) {
|
|
13326
|
+
if (c === 62 || isWhitespace(c)) {
|
|
13327
|
+
const endOfText = this.index - this.currentSequence.length;
|
|
13328
|
+
if (this.sectionStart < endOfText) {
|
|
13329
|
+
const actualIndex = this.index;
|
|
13330
|
+
this.index = endOfText;
|
|
13331
|
+
this.cbs.ontext(this.sectionStart, endOfText);
|
|
13332
|
+
this.index = actualIndex;
|
|
13333
|
+
}
|
|
13334
|
+
this.sectionStart = endOfText + 2;
|
|
13335
|
+
this.stateInClosingTagName(c);
|
|
13336
|
+
this.inRCDATA = false;
|
|
13337
|
+
return;
|
|
13338
|
+
}
|
|
13339
|
+
this.sequenceIndex = 0;
|
|
13368
13340
|
}
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13341
|
+
if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
|
|
13342
|
+
this.sequenceIndex += 1;
|
|
13343
|
+
} else if (this.sequenceIndex === 0) {
|
|
13344
|
+
if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
|
|
13345
|
+
if (c === this.delimiterOpen[0]) {
|
|
13346
|
+
this.state = 2;
|
|
13347
|
+
this.delimiterIndex = 0;
|
|
13348
|
+
this.stateInterpolationOpen(c);
|
|
13349
|
+
}
|
|
13350
|
+
} else if (this.fastForwardTo(60)) {
|
|
13351
|
+
this.sequenceIndex = 1;
|
|
13352
|
+
}
|
|
13353
|
+
} else {
|
|
13354
|
+
this.sequenceIndex = Number(c === 60);
|
|
13377
13355
|
}
|
|
13378
13356
|
}
|
|
13379
|
-
|
|
13380
|
-
if (
|
|
13381
|
-
|
|
13357
|
+
stateCDATASequence(c) {
|
|
13358
|
+
if (c === Sequences.Cdata[this.sequenceIndex]) {
|
|
13359
|
+
if (++this.sequenceIndex === Sequences.Cdata.length) {
|
|
13360
|
+
this.state = 28;
|
|
13361
|
+
this.currentSequence = Sequences.CdataEnd;
|
|
13362
|
+
this.sequenceIndex = 0;
|
|
13363
|
+
this.sectionStart = this.index + 1;
|
|
13364
|
+
}
|
|
13382
13365
|
} else {
|
|
13383
|
-
|
|
13366
|
+
this.sequenceIndex = 0;
|
|
13367
|
+
this.state = 23;
|
|
13368
|
+
this.stateInDeclaration(c);
|
|
13384
13369
|
}
|
|
13385
|
-
}
|
|
13386
|
-
|
|
13387
|
-
|
|
13370
|
+
}
|
|
13371
|
+
/**
|
|
13372
|
+
* When we wait for one specific character, we can speed things up
|
|
13373
|
+
* by skipping through the buffer until we find it.
|
|
13374
|
+
*
|
|
13375
|
+
* @returns Whether the character was found.
|
|
13376
|
+
*/
|
|
13377
|
+
fastForwardTo(c) {
|
|
13378
|
+
while (++this.index < this.buffer.length) {
|
|
13379
|
+
const cc = this.buffer.charCodeAt(this.index);
|
|
13380
|
+
if (cc === 10) {
|
|
13381
|
+
this.newlines.push(this.index);
|
|
13382
|
+
}
|
|
13383
|
+
if (cc === c) {
|
|
13384
|
+
return true;
|
|
13385
|
+
}
|
|
13386
|
+
}
|
|
13387
|
+
this.index = this.buffer.length - 1;
|
|
13388
|
+
return false;
|
|
13389
|
+
}
|
|
13390
|
+
/**
|
|
13391
|
+
* Comments and CDATA end with `-->` and `]]>`.
|
|
13392
|
+
*
|
|
13393
|
+
* Their common qualities are:
|
|
13394
|
+
* - Their end sequences have a distinct character they start with.
|
|
13395
|
+
* - That character is then repeated, so we have to check multiple repeats.
|
|
13396
|
+
* - All characters but the start character of the sequence can be skipped.
|
|
13397
|
+
*/
|
|
13398
|
+
stateInCommentLike(c) {
|
|
13399
|
+
if (c === this.currentSequence[this.sequenceIndex]) {
|
|
13400
|
+
if (++this.sequenceIndex === this.currentSequence.length) {
|
|
13401
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
13402
|
+
this.cbs.oncdata(this.sectionStart, this.index - 2);
|
|
13403
|
+
} else {
|
|
13404
|
+
this.cbs.oncomment(this.sectionStart, this.index - 2);
|
|
13405
|
+
}
|
|
13406
|
+
this.sequenceIndex = 0;
|
|
13407
|
+
this.sectionStart = this.index + 1;
|
|
13408
|
+
this.state = 1;
|
|
13409
|
+
}
|
|
13410
|
+
} else if (this.sequenceIndex === 0) {
|
|
13411
|
+
if (this.fastForwardTo(this.currentSequence[0])) {
|
|
13412
|
+
this.sequenceIndex = 1;
|
|
13413
|
+
}
|
|
13414
|
+
} else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
|
|
13415
|
+
this.sequenceIndex = 0;
|
|
13416
|
+
}
|
|
13417
|
+
}
|
|
13418
|
+
startSpecial(sequence, offset) {
|
|
13419
|
+
this.enterRCDATA(sequence, offset);
|
|
13420
|
+
this.state = 31;
|
|
13421
|
+
}
|
|
13422
|
+
enterRCDATA(sequence, offset) {
|
|
13423
|
+
this.inRCDATA = true;
|
|
13424
|
+
this.currentSequence = sequence;
|
|
13425
|
+
this.sequenceIndex = offset;
|
|
13426
|
+
}
|
|
13427
|
+
stateBeforeTagName(c) {
|
|
13428
|
+
if (c === 33) {
|
|
13429
|
+
this.state = 22;
|
|
13430
|
+
this.sectionStart = this.index + 1;
|
|
13431
|
+
} else if (c === 63) {
|
|
13432
|
+
this.state = 24;
|
|
13433
|
+
this.sectionStart = this.index + 1;
|
|
13434
|
+
} else if (isTagStartChar(c)) {
|
|
13435
|
+
this.sectionStart = this.index;
|
|
13436
|
+
if (this.mode === 0) {
|
|
13437
|
+
this.state = 6;
|
|
13438
|
+
} else if (this.inSFCRoot) {
|
|
13439
|
+
this.state = 34;
|
|
13440
|
+
} else if (!this.inXML) {
|
|
13441
|
+
const lower = c | 32;
|
|
13442
|
+
if (lower === 116) {
|
|
13443
|
+
this.state = 30;
|
|
13444
|
+
} else {
|
|
13445
|
+
this.state = lower === 115 ? 29 : 6;
|
|
13446
|
+
}
|
|
13447
|
+
} else {
|
|
13448
|
+
this.state = 6;
|
|
13449
|
+
}
|
|
13450
|
+
} else if (c === 47) {
|
|
13451
|
+
this.state = 8;
|
|
13388
13452
|
} else {
|
|
13389
|
-
|
|
13453
|
+
this.state = 1;
|
|
13454
|
+
this.stateText(c);
|
|
13390
13455
|
}
|
|
13391
13456
|
}
|
|
13392
|
-
|
|
13393
|
-
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
const propKeyName = prop.key.content;
|
|
13397
|
-
result = props.properties.some(
|
|
13398
|
-
(p) => p.key.type === 4 && p.key.content === propKeyName
|
|
13399
|
-
);
|
|
13457
|
+
stateInTagName(c) {
|
|
13458
|
+
if (isEndOfTagSection(c)) {
|
|
13459
|
+
this.handleTagName(c);
|
|
13460
|
+
}
|
|
13400
13461
|
}
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13462
|
+
stateInSFCRootTagName(c) {
|
|
13463
|
+
if (isEndOfTagSection(c)) {
|
|
13464
|
+
const tag = this.buffer.slice(this.sectionStart, this.index);
|
|
13465
|
+
if (tag !== "template") {
|
|
13466
|
+
this.enterRCDATA(toCharCodes(`</` + tag), 0);
|
|
13467
|
+
}
|
|
13468
|
+
this.handleTagName(c);
|
|
13469
|
+
}
|
|
13470
|
+
}
|
|
13471
|
+
handleTagName(c) {
|
|
13472
|
+
this.cbs.onopentagname(this.sectionStart, this.index);
|
|
13473
|
+
this.sectionStart = -1;
|
|
13474
|
+
this.state = 11;
|
|
13475
|
+
this.stateBeforeAttrName(c);
|
|
13476
|
+
}
|
|
13477
|
+
stateBeforeClosingTagName(c) {
|
|
13478
|
+
if (isWhitespace(c)) ; else if (c === 62) {
|
|
13479
|
+
if (!!(process.env.NODE_ENV !== "production") || false) {
|
|
13480
|
+
this.cbs.onerr(14, this.index);
|
|
13481
|
+
}
|
|
13482
|
+
this.state = 1;
|
|
13483
|
+
this.sectionStart = this.index + 1;
|
|
13484
|
+
} else {
|
|
13485
|
+
this.state = isTagStartChar(c) ? 9 : 27;
|
|
13486
|
+
this.sectionStart = this.index;
|
|
13487
|
+
}
|
|
13488
|
+
}
|
|
13489
|
+
stateInClosingTagName(c) {
|
|
13490
|
+
if (c === 62 || isWhitespace(c)) {
|
|
13491
|
+
this.cbs.onclosetag(this.sectionStart, this.index);
|
|
13492
|
+
this.sectionStart = -1;
|
|
13493
|
+
this.state = 10;
|
|
13494
|
+
this.stateAfterClosingTagName(c);
|
|
13495
|
+
}
|
|
13496
|
+
}
|
|
13497
|
+
stateAfterClosingTagName(c) {
|
|
13498
|
+
if (c === 62) {
|
|
13499
|
+
this.state = 1;
|
|
13500
|
+
this.sectionStart = this.index + 1;
|
|
13501
|
+
}
|
|
13502
|
+
}
|
|
13503
|
+
stateBeforeAttrName(c) {
|
|
13504
|
+
if (c === 62) {
|
|
13505
|
+
this.cbs.onopentagend(this.index);
|
|
13506
|
+
if (this.inRCDATA) {
|
|
13507
|
+
this.state = 32;
|
|
13508
|
+
} else {
|
|
13509
|
+
this.state = 1;
|
|
13510
|
+
}
|
|
13511
|
+
this.sectionStart = this.index + 1;
|
|
13512
|
+
} else if (c === 47) {
|
|
13513
|
+
this.state = 7;
|
|
13514
|
+
if ((!!(process.env.NODE_ENV !== "production") || false) && this.peek() !== 62) {
|
|
13515
|
+
this.cbs.onerr(22, this.index);
|
|
13516
|
+
}
|
|
13517
|
+
} else if (c === 60 && this.peek() === 47) {
|
|
13518
|
+
this.cbs.onopentagend(this.index);
|
|
13519
|
+
this.state = 5;
|
|
13520
|
+
this.sectionStart = this.index;
|
|
13521
|
+
} else if (!isWhitespace(c)) {
|
|
13522
|
+
if ((!!(process.env.NODE_ENV !== "production") || false) && c === 61) {
|
|
13523
|
+
this.cbs.onerr(
|
|
13524
|
+
19,
|
|
13525
|
+
this.index
|
|
13526
|
+
);
|
|
13527
|
+
}
|
|
13528
|
+
this.handleAttrStart(c);
|
|
13529
|
+
}
|
|
13530
|
+
}
|
|
13531
|
+
handleAttrStart(c) {
|
|
13532
|
+
if (c === 118 && this.peek() === 45) {
|
|
13533
|
+
this.state = 13;
|
|
13534
|
+
this.sectionStart = this.index;
|
|
13535
|
+
} else if (c === 46 || c === 58 || c === 64 || c === 35) {
|
|
13536
|
+
this.cbs.ondirname(this.index, this.index + 1);
|
|
13537
|
+
this.state = 14;
|
|
13538
|
+
this.sectionStart = this.index + 1;
|
|
13539
|
+
} else {
|
|
13540
|
+
this.state = 12;
|
|
13541
|
+
this.sectionStart = this.index;
|
|
13542
|
+
}
|
|
13543
|
+
}
|
|
13544
|
+
stateInSelfClosingTag(c) {
|
|
13545
|
+
if (c === 62) {
|
|
13546
|
+
this.cbs.onselfclosingtag(this.index);
|
|
13547
|
+
this.state = 1;
|
|
13548
|
+
this.sectionStart = this.index + 1;
|
|
13549
|
+
this.inRCDATA = false;
|
|
13550
|
+
} else if (!isWhitespace(c)) {
|
|
13551
|
+
this.state = 11;
|
|
13552
|
+
this.stateBeforeAttrName(c);
|
|
13553
|
+
}
|
|
13554
|
+
}
|
|
13555
|
+
stateInAttrName(c) {
|
|
13556
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13557
|
+
this.cbs.onattribname(this.sectionStart, this.index);
|
|
13558
|
+
this.handleAttrNameEnd(c);
|
|
13559
|
+
} else if ((!!(process.env.NODE_ENV !== "production") || false) && (c === 34 || c === 39 || c === 60)) {
|
|
13560
|
+
this.cbs.onerr(
|
|
13561
|
+
17,
|
|
13562
|
+
this.index
|
|
13563
|
+
);
|
|
13564
|
+
}
|
|
13565
|
+
}
|
|
13566
|
+
stateInDirName(c) {
|
|
13567
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13568
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
13569
|
+
this.handleAttrNameEnd(c);
|
|
13570
|
+
} else if (c === 58) {
|
|
13571
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
13572
|
+
this.state = 14;
|
|
13573
|
+
this.sectionStart = this.index + 1;
|
|
13574
|
+
} else if (c === 46) {
|
|
13575
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
13576
|
+
this.state = 16;
|
|
13577
|
+
this.sectionStart = this.index + 1;
|
|
13578
|
+
}
|
|
13579
|
+
}
|
|
13580
|
+
stateInDirArg(c) {
|
|
13581
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13582
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
13583
|
+
this.handleAttrNameEnd(c);
|
|
13584
|
+
} else if (c === 91) {
|
|
13585
|
+
this.state = 15;
|
|
13586
|
+
} else if (c === 46) {
|
|
13587
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
13588
|
+
this.state = 16;
|
|
13589
|
+
this.sectionStart = this.index + 1;
|
|
13590
|
+
}
|
|
13591
|
+
}
|
|
13592
|
+
stateInDynamicDirArg(c) {
|
|
13593
|
+
if (c === 93) {
|
|
13594
|
+
this.state = 14;
|
|
13595
|
+
} else if (c === 61 || isEndOfTagSection(c)) {
|
|
13596
|
+
this.cbs.ondirarg(this.sectionStart, this.index + 1);
|
|
13597
|
+
this.handleAttrNameEnd(c);
|
|
13598
|
+
if (!!(process.env.NODE_ENV !== "production") || false) {
|
|
13599
|
+
this.cbs.onerr(
|
|
13600
|
+
27,
|
|
13601
|
+
this.index
|
|
13602
|
+
);
|
|
13603
|
+
}
|
|
13604
|
+
}
|
|
13605
|
+
}
|
|
13606
|
+
stateInDirModifier(c) {
|
|
13607
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13608
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
13609
|
+
this.handleAttrNameEnd(c);
|
|
13610
|
+
} else if (c === 46) {
|
|
13611
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
13612
|
+
this.sectionStart = this.index + 1;
|
|
13613
|
+
}
|
|
13614
|
+
}
|
|
13615
|
+
handleAttrNameEnd(c) {
|
|
13616
|
+
this.sectionStart = this.index;
|
|
13617
|
+
this.state = 17;
|
|
13618
|
+
this.cbs.onattribnameend(this.index);
|
|
13619
|
+
this.stateAfterAttrName(c);
|
|
13620
|
+
}
|
|
13621
|
+
stateAfterAttrName(c) {
|
|
13622
|
+
if (c === 61) {
|
|
13623
|
+
this.state = 18;
|
|
13624
|
+
} else if (c === 47 || c === 62) {
|
|
13625
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
13626
|
+
this.sectionStart = -1;
|
|
13627
|
+
this.state = 11;
|
|
13628
|
+
this.stateBeforeAttrName(c);
|
|
13629
|
+
} else if (!isWhitespace(c)) {
|
|
13630
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
13631
|
+
this.handleAttrStart(c);
|
|
13632
|
+
}
|
|
13633
|
+
}
|
|
13634
|
+
stateBeforeAttrValue(c) {
|
|
13635
|
+
if (c === 34) {
|
|
13636
|
+
this.state = 19;
|
|
13637
|
+
this.sectionStart = this.index + 1;
|
|
13638
|
+
} else if (c === 39) {
|
|
13639
|
+
this.state = 20;
|
|
13640
|
+
this.sectionStart = this.index + 1;
|
|
13641
|
+
} else if (!isWhitespace(c)) {
|
|
13642
|
+
this.sectionStart = this.index;
|
|
13643
|
+
this.state = 21;
|
|
13644
|
+
this.stateInAttrValueNoQuotes(c);
|
|
13645
|
+
}
|
|
13646
|
+
}
|
|
13647
|
+
handleInAttrValue(c, quote) {
|
|
13648
|
+
if (c === quote || this.fastForwardTo(quote)) {
|
|
13649
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
13650
|
+
this.sectionStart = -1;
|
|
13651
|
+
this.cbs.onattribend(
|
|
13652
|
+
quote === 34 ? 3 : 2,
|
|
13653
|
+
this.index + 1
|
|
13654
|
+
);
|
|
13655
|
+
this.state = 11;
|
|
13656
|
+
}
|
|
13657
|
+
}
|
|
13658
|
+
stateInAttrValueDoubleQuotes(c) {
|
|
13659
|
+
this.handleInAttrValue(c, 34);
|
|
13660
|
+
}
|
|
13661
|
+
stateInAttrValueSingleQuotes(c) {
|
|
13662
|
+
this.handleInAttrValue(c, 39);
|
|
13663
|
+
}
|
|
13664
|
+
stateInAttrValueNoQuotes(c) {
|
|
13665
|
+
if (isWhitespace(c) || c === 62) {
|
|
13666
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
13667
|
+
this.sectionStart = -1;
|
|
13668
|
+
this.cbs.onattribend(1, this.index);
|
|
13669
|
+
this.state = 11;
|
|
13670
|
+
this.stateBeforeAttrName(c);
|
|
13671
|
+
} else if ((!!(process.env.NODE_ENV !== "production") || false) && c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
|
|
13672
|
+
this.cbs.onerr(
|
|
13673
|
+
18,
|
|
13674
|
+
this.index
|
|
13675
|
+
);
|
|
13676
|
+
} else ;
|
|
13677
|
+
}
|
|
13678
|
+
stateBeforeDeclaration(c) {
|
|
13679
|
+
if (c === 91) {
|
|
13680
|
+
this.state = 26;
|
|
13681
|
+
this.sequenceIndex = 0;
|
|
13682
|
+
} else {
|
|
13683
|
+
this.state = c === 45 ? 25 : 23;
|
|
13684
|
+
}
|
|
13685
|
+
}
|
|
13686
|
+
stateInDeclaration(c) {
|
|
13687
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
13688
|
+
this.state = 1;
|
|
13689
|
+
this.sectionStart = this.index + 1;
|
|
13690
|
+
}
|
|
13691
|
+
}
|
|
13692
|
+
stateInProcessingInstruction(c) {
|
|
13693
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
13694
|
+
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
|
|
13695
|
+
this.state = 1;
|
|
13696
|
+
this.sectionStart = this.index + 1;
|
|
13697
|
+
}
|
|
13698
|
+
}
|
|
13699
|
+
stateBeforeComment(c) {
|
|
13700
|
+
if (c === 45) {
|
|
13701
|
+
this.state = 28;
|
|
13702
|
+
this.currentSequence = Sequences.CommentEnd;
|
|
13703
|
+
this.sequenceIndex = 2;
|
|
13704
|
+
this.sectionStart = this.index + 1;
|
|
13705
|
+
} else {
|
|
13706
|
+
this.state = 23;
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
13709
|
+
stateInSpecialComment(c) {
|
|
13710
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
13711
|
+
this.cbs.oncomment(this.sectionStart, this.index);
|
|
13712
|
+
this.state = 1;
|
|
13713
|
+
this.sectionStart = this.index + 1;
|
|
13714
|
+
}
|
|
13715
|
+
}
|
|
13716
|
+
stateBeforeSpecialS(c) {
|
|
13717
|
+
const lower = c | 32;
|
|
13718
|
+
if (lower === Sequences.ScriptEnd[3]) {
|
|
13719
|
+
this.startSpecial(Sequences.ScriptEnd, 4);
|
|
13720
|
+
} else if (lower === Sequences.StyleEnd[3]) {
|
|
13721
|
+
this.startSpecial(Sequences.StyleEnd, 4);
|
|
13722
|
+
} else {
|
|
13723
|
+
this.state = 6;
|
|
13724
|
+
this.stateInTagName(c);
|
|
13725
|
+
}
|
|
13726
|
+
}
|
|
13727
|
+
stateBeforeSpecialT(c) {
|
|
13728
|
+
const lower = c | 32;
|
|
13729
|
+
if (lower === Sequences.TitleEnd[3]) {
|
|
13730
|
+
this.startSpecial(Sequences.TitleEnd, 4);
|
|
13731
|
+
} else if (lower === Sequences.TextareaEnd[3]) {
|
|
13732
|
+
this.startSpecial(Sequences.TextareaEnd, 4);
|
|
13733
|
+
} else {
|
|
13734
|
+
this.state = 6;
|
|
13735
|
+
this.stateInTagName(c);
|
|
13736
|
+
}
|
|
13737
|
+
}
|
|
13738
|
+
startEntity() {
|
|
13739
|
+
}
|
|
13740
|
+
stateInEntity() {
|
|
13741
|
+
}
|
|
13742
|
+
/**
|
|
13743
|
+
* Iterates through the buffer, calling the function corresponding to the current state.
|
|
13744
|
+
*
|
|
13745
|
+
* States that are more likely to be hit are higher up, as a performance improvement.
|
|
13746
|
+
*/
|
|
13747
|
+
parse(input) {
|
|
13748
|
+
this.buffer = input;
|
|
13749
|
+
while (this.index < this.buffer.length) {
|
|
13750
|
+
const c = this.buffer.charCodeAt(this.index);
|
|
13751
|
+
if (c === 10) {
|
|
13752
|
+
this.newlines.push(this.index);
|
|
13753
|
+
}
|
|
13754
|
+
switch (this.state) {
|
|
13755
|
+
case 1: {
|
|
13756
|
+
this.stateText(c);
|
|
13757
|
+
break;
|
|
13758
|
+
}
|
|
13759
|
+
case 2: {
|
|
13760
|
+
this.stateInterpolationOpen(c);
|
|
13761
|
+
break;
|
|
13762
|
+
}
|
|
13763
|
+
case 3: {
|
|
13764
|
+
this.stateInterpolation(c);
|
|
13765
|
+
break;
|
|
13766
|
+
}
|
|
13767
|
+
case 4: {
|
|
13768
|
+
this.stateInterpolationClose(c);
|
|
13769
|
+
break;
|
|
13770
|
+
}
|
|
13771
|
+
case 31: {
|
|
13772
|
+
this.stateSpecialStartSequence(c);
|
|
13773
|
+
break;
|
|
13774
|
+
}
|
|
13775
|
+
case 32: {
|
|
13776
|
+
this.stateInRCDATA(c);
|
|
13777
|
+
break;
|
|
13778
|
+
}
|
|
13779
|
+
case 26: {
|
|
13780
|
+
this.stateCDATASequence(c);
|
|
13781
|
+
break;
|
|
13782
|
+
}
|
|
13783
|
+
case 19: {
|
|
13784
|
+
this.stateInAttrValueDoubleQuotes(c);
|
|
13785
|
+
break;
|
|
13786
|
+
}
|
|
13787
|
+
case 12: {
|
|
13788
|
+
this.stateInAttrName(c);
|
|
13789
|
+
break;
|
|
13790
|
+
}
|
|
13791
|
+
case 13: {
|
|
13792
|
+
this.stateInDirName(c);
|
|
13793
|
+
break;
|
|
13794
|
+
}
|
|
13795
|
+
case 14: {
|
|
13796
|
+
this.stateInDirArg(c);
|
|
13797
|
+
break;
|
|
13798
|
+
}
|
|
13799
|
+
case 15: {
|
|
13800
|
+
this.stateInDynamicDirArg(c);
|
|
13801
|
+
break;
|
|
13802
|
+
}
|
|
13803
|
+
case 16: {
|
|
13804
|
+
this.stateInDirModifier(c);
|
|
13805
|
+
break;
|
|
13806
|
+
}
|
|
13807
|
+
case 28: {
|
|
13808
|
+
this.stateInCommentLike(c);
|
|
13809
|
+
break;
|
|
13810
|
+
}
|
|
13811
|
+
case 27: {
|
|
13812
|
+
this.stateInSpecialComment(c);
|
|
13813
|
+
break;
|
|
13814
|
+
}
|
|
13815
|
+
case 11: {
|
|
13816
|
+
this.stateBeforeAttrName(c);
|
|
13817
|
+
break;
|
|
13818
|
+
}
|
|
13819
|
+
case 6: {
|
|
13820
|
+
this.stateInTagName(c);
|
|
13821
|
+
break;
|
|
13822
|
+
}
|
|
13823
|
+
case 34: {
|
|
13824
|
+
this.stateInSFCRootTagName(c);
|
|
13825
|
+
break;
|
|
13826
|
+
}
|
|
13827
|
+
case 9: {
|
|
13828
|
+
this.stateInClosingTagName(c);
|
|
13829
|
+
break;
|
|
13830
|
+
}
|
|
13831
|
+
case 5: {
|
|
13832
|
+
this.stateBeforeTagName(c);
|
|
13833
|
+
break;
|
|
13834
|
+
}
|
|
13835
|
+
case 17: {
|
|
13836
|
+
this.stateAfterAttrName(c);
|
|
13837
|
+
break;
|
|
13838
|
+
}
|
|
13839
|
+
case 20: {
|
|
13840
|
+
this.stateInAttrValueSingleQuotes(c);
|
|
13841
|
+
break;
|
|
13842
|
+
}
|
|
13843
|
+
case 18: {
|
|
13844
|
+
this.stateBeforeAttrValue(c);
|
|
13845
|
+
break;
|
|
13846
|
+
}
|
|
13847
|
+
case 8: {
|
|
13848
|
+
this.stateBeforeClosingTagName(c);
|
|
13849
|
+
break;
|
|
13850
|
+
}
|
|
13851
|
+
case 10: {
|
|
13852
|
+
this.stateAfterClosingTagName(c);
|
|
13853
|
+
break;
|
|
13854
|
+
}
|
|
13855
|
+
case 29: {
|
|
13856
|
+
this.stateBeforeSpecialS(c);
|
|
13857
|
+
break;
|
|
13858
|
+
}
|
|
13859
|
+
case 30: {
|
|
13860
|
+
this.stateBeforeSpecialT(c);
|
|
13861
|
+
break;
|
|
13862
|
+
}
|
|
13863
|
+
case 21: {
|
|
13864
|
+
this.stateInAttrValueNoQuotes(c);
|
|
13865
|
+
break;
|
|
13866
|
+
}
|
|
13867
|
+
case 7: {
|
|
13868
|
+
this.stateInSelfClosingTag(c);
|
|
13869
|
+
break;
|
|
13870
|
+
}
|
|
13871
|
+
case 23: {
|
|
13872
|
+
this.stateInDeclaration(c);
|
|
13873
|
+
break;
|
|
13874
|
+
}
|
|
13875
|
+
case 22: {
|
|
13876
|
+
this.stateBeforeDeclaration(c);
|
|
13877
|
+
break;
|
|
13878
|
+
}
|
|
13879
|
+
case 25: {
|
|
13880
|
+
this.stateBeforeComment(c);
|
|
13881
|
+
break;
|
|
13882
|
+
}
|
|
13883
|
+
case 24: {
|
|
13884
|
+
this.stateInProcessingInstruction(c);
|
|
13885
|
+
break;
|
|
13886
|
+
}
|
|
13887
|
+
case 33: {
|
|
13888
|
+
this.stateInEntity();
|
|
13889
|
+
break;
|
|
13890
|
+
}
|
|
13891
|
+
}
|
|
13892
|
+
this.index++;
|
|
13893
|
+
}
|
|
13894
|
+
this.cleanup();
|
|
13895
|
+
this.finish();
|
|
13896
|
+
}
|
|
13897
|
+
/**
|
|
13898
|
+
* Remove data that has already been consumed from the buffer.
|
|
13899
|
+
*/
|
|
13900
|
+
cleanup() {
|
|
13901
|
+
if (this.sectionStart !== this.index) {
|
|
13902
|
+
if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
|
|
13903
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
13904
|
+
this.sectionStart = this.index;
|
|
13905
|
+
} else if (this.state === 19 || this.state === 20 || this.state === 21) {
|
|
13906
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
13907
|
+
this.sectionStart = this.index;
|
|
13908
|
+
}
|
|
13909
|
+
}
|
|
13910
|
+
}
|
|
13911
|
+
finish() {
|
|
13912
|
+
this.handleTrailingData();
|
|
13913
|
+
this.cbs.onend();
|
|
13914
|
+
}
|
|
13915
|
+
/** Handle any trailing data. */
|
|
13916
|
+
handleTrailingData() {
|
|
13917
|
+
const endIndex = this.buffer.length;
|
|
13918
|
+
if (this.sectionStart >= endIndex) {
|
|
13919
|
+
return;
|
|
13920
|
+
}
|
|
13921
|
+
if (this.state === 28) {
|
|
13922
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
13923
|
+
this.cbs.oncdata(this.sectionStart, endIndex);
|
|
13924
|
+
} else {
|
|
13925
|
+
this.cbs.oncomment(this.sectionStart, endIndex);
|
|
13926
|
+
}
|
|
13927
|
+
} else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
|
|
13928
|
+
this.cbs.ontext(this.sectionStart, endIndex);
|
|
13929
|
+
}
|
|
13930
|
+
}
|
|
13931
|
+
emitCodePoint(cp, consumed) {
|
|
13413
13932
|
}
|
|
13414
13933
|
}
|
|
13415
|
-
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
13416
13934
|
|
|
13417
13935
|
const deprecationData = {
|
|
13418
13936
|
["COMPILER_IS_ON_ELEMENT"]: {
|
|
@@ -13423,9 +13941,6 @@ const deprecationData = {
|
|
|
13423
13941
|
message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
|
|
13424
13942
|
link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
|
|
13425
13943
|
},
|
|
13426
|
-
["COMPILER_V_BIND_PROP"]: {
|
|
13427
|
-
message: `.prop modifier for v-bind has been removed and no longer necessary. Vue 3 will automatically set a binding as DOM property when appropriate.`
|
|
13428
|
-
},
|
|
13429
13944
|
["COMPILER_V_BIND_OBJECT_ORDER"]: {
|
|
13430
13945
|
message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
|
|
13431
13946
|
link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
|
|
@@ -13450,9 +13965,8 @@ const deprecationData = {
|
|
|
13450
13965
|
link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
|
|
13451
13966
|
}
|
|
13452
13967
|
};
|
|
13453
|
-
function getCompatValue(key,
|
|
13454
|
-
const
|
|
13455
|
-
const value = config && config[key];
|
|
13968
|
+
function getCompatValue(key, { compatConfig }) {
|
|
13969
|
+
const value = compatConfig && compatConfig[key];
|
|
13456
13970
|
if (key === "MODE") {
|
|
13457
13971
|
return value || 3;
|
|
13458
13972
|
} else {
|
|
@@ -13486,398 +14000,865 @@ function warnDeprecation(key, context, loc, ...args) {
|
|
|
13486
14000
|
context.onWarn(err);
|
|
13487
14001
|
}
|
|
13488
14002
|
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
gt: ">",
|
|
13492
|
-
lt: "<",
|
|
13493
|
-
amp: "&",
|
|
13494
|
-
apos: "'",
|
|
13495
|
-
quot: '"'
|
|
13496
|
-
};
|
|
13497
|
-
const defaultParserOptions = {
|
|
13498
|
-
delimiters: [`{{`, `}}`],
|
|
13499
|
-
getNamespace: () => 0,
|
|
13500
|
-
getTextMode: () => 0,
|
|
13501
|
-
isVoidTag: NO,
|
|
13502
|
-
isPreTag: NO,
|
|
13503
|
-
isCustomElement: NO,
|
|
13504
|
-
decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
|
|
13505
|
-
onError: defaultOnError,
|
|
13506
|
-
onWarn: defaultOnWarn,
|
|
13507
|
-
comments: !!(process.env.NODE_ENV !== "production")
|
|
13508
|
-
};
|
|
13509
|
-
function baseParse(content, options = {}) {
|
|
13510
|
-
const context = createParserContext(content, options);
|
|
13511
|
-
const start = getCursor(context);
|
|
13512
|
-
return createRoot(
|
|
13513
|
-
parseChildren(context, 0, []),
|
|
13514
|
-
getSelection(context, start)
|
|
13515
|
-
);
|
|
13516
|
-
}
|
|
13517
|
-
function createParserContext(content, rawOptions) {
|
|
13518
|
-
const options = extend({}, defaultParserOptions);
|
|
13519
|
-
let key;
|
|
13520
|
-
for (key in rawOptions) {
|
|
13521
|
-
options[key] = rawOptions[key] === void 0 ? defaultParserOptions[key] : rawOptions[key];
|
|
13522
|
-
}
|
|
13523
|
-
return {
|
|
13524
|
-
options,
|
|
13525
|
-
column: 1,
|
|
13526
|
-
line: 1,
|
|
13527
|
-
offset: 0,
|
|
13528
|
-
originalSource: content,
|
|
13529
|
-
source: content,
|
|
13530
|
-
inPre: false,
|
|
13531
|
-
inVPre: false,
|
|
13532
|
-
onWarn: options.onWarn
|
|
13533
|
-
};
|
|
14003
|
+
function defaultOnError(error) {
|
|
14004
|
+
throw error;
|
|
13534
14005
|
}
|
|
13535
|
-
function
|
|
13536
|
-
|
|
13537
|
-
const ns = parent ? parent.ns : 0;
|
|
13538
|
-
const nodes = [];
|
|
13539
|
-
while (!isEnd(context, mode, ancestors)) {
|
|
13540
|
-
const s = context.source;
|
|
13541
|
-
let node = void 0;
|
|
13542
|
-
if (mode === 0 || mode === 1) {
|
|
13543
|
-
if (!context.inVPre && startsWith(s, context.options.delimiters[0])) {
|
|
13544
|
-
node = parseInterpolation(context, mode);
|
|
13545
|
-
} else if (mode === 0 && s[0] === "<") {
|
|
13546
|
-
if (s.length === 1) {
|
|
13547
|
-
emitError(context, 5, 1);
|
|
13548
|
-
} else if (s[1] === "!") {
|
|
13549
|
-
if (startsWith(s, "<!--")) {
|
|
13550
|
-
node = parseComment(context);
|
|
13551
|
-
} else if (startsWith(s, "<!DOCTYPE")) {
|
|
13552
|
-
node = parseBogusComment(context);
|
|
13553
|
-
} else if (startsWith(s, "<![CDATA[")) {
|
|
13554
|
-
if (ns !== 0) {
|
|
13555
|
-
node = parseCDATA(context, ancestors);
|
|
13556
|
-
} else {
|
|
13557
|
-
emitError(context, 1);
|
|
13558
|
-
node = parseBogusComment(context);
|
|
13559
|
-
}
|
|
13560
|
-
} else {
|
|
13561
|
-
emitError(context, 11);
|
|
13562
|
-
node = parseBogusComment(context);
|
|
13563
|
-
}
|
|
13564
|
-
} else if (s[1] === "/") {
|
|
13565
|
-
if (s.length === 2) {
|
|
13566
|
-
emitError(context, 5, 2);
|
|
13567
|
-
} else if (s[2] === ">") {
|
|
13568
|
-
emitError(context, 14, 2);
|
|
13569
|
-
advanceBy(context, 3);
|
|
13570
|
-
continue;
|
|
13571
|
-
} else if (/[a-z]/i.test(s[2])) {
|
|
13572
|
-
emitError(context, 23);
|
|
13573
|
-
parseTag(context, 1 /* End */, parent);
|
|
13574
|
-
continue;
|
|
13575
|
-
} else {
|
|
13576
|
-
emitError(
|
|
13577
|
-
context,
|
|
13578
|
-
12,
|
|
13579
|
-
2
|
|
13580
|
-
);
|
|
13581
|
-
node = parseBogusComment(context);
|
|
13582
|
-
}
|
|
13583
|
-
} else if (/[a-z]/i.test(s[1])) {
|
|
13584
|
-
node = parseElement(context, ancestors);
|
|
13585
|
-
if (isCompatEnabled(
|
|
13586
|
-
"COMPILER_NATIVE_TEMPLATE",
|
|
13587
|
-
context
|
|
13588
|
-
) && node && node.tag === "template" && !node.props.some(
|
|
13589
|
-
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
13590
|
-
)) {
|
|
13591
|
-
!!(process.env.NODE_ENV !== "production") && warnDeprecation(
|
|
13592
|
-
"COMPILER_NATIVE_TEMPLATE",
|
|
13593
|
-
context,
|
|
13594
|
-
node.loc
|
|
13595
|
-
);
|
|
13596
|
-
node = node.children;
|
|
13597
|
-
}
|
|
13598
|
-
} else if (s[1] === "?") {
|
|
13599
|
-
emitError(
|
|
13600
|
-
context,
|
|
13601
|
-
21,
|
|
13602
|
-
1
|
|
13603
|
-
);
|
|
13604
|
-
node = parseBogusComment(context);
|
|
13605
|
-
} else {
|
|
13606
|
-
emitError(context, 12, 1);
|
|
13607
|
-
}
|
|
13608
|
-
}
|
|
13609
|
-
}
|
|
13610
|
-
if (!node) {
|
|
13611
|
-
node = parseText(context, mode);
|
|
13612
|
-
}
|
|
13613
|
-
if (isArray(node)) {
|
|
13614
|
-
for (let i = 0; i < node.length; i++) {
|
|
13615
|
-
pushNode(nodes, node[i]);
|
|
13616
|
-
}
|
|
13617
|
-
} else {
|
|
13618
|
-
pushNode(nodes, node);
|
|
13619
|
-
}
|
|
13620
|
-
}
|
|
13621
|
-
let removedWhitespace = false;
|
|
13622
|
-
if (mode !== 2 && mode !== 1) {
|
|
13623
|
-
const shouldCondense = context.options.whitespace !== "preserve";
|
|
13624
|
-
for (let i = 0; i < nodes.length; i++) {
|
|
13625
|
-
const node = nodes[i];
|
|
13626
|
-
if (node.type === 2) {
|
|
13627
|
-
if (!context.inPre) {
|
|
13628
|
-
if (!/[^\t\r\n\f ]/.test(node.content)) {
|
|
13629
|
-
const prev = nodes[i - 1];
|
|
13630
|
-
const next = nodes[i + 1];
|
|
13631
|
-
if (!prev || !next || shouldCondense && (prev.type === 3 && next.type === 3 || prev.type === 3 && next.type === 1 || prev.type === 1 && next.type === 3 || prev.type === 1 && next.type === 1 && /[\r\n]/.test(node.content))) {
|
|
13632
|
-
removedWhitespace = true;
|
|
13633
|
-
nodes[i] = null;
|
|
13634
|
-
} else {
|
|
13635
|
-
node.content = " ";
|
|
13636
|
-
}
|
|
13637
|
-
} else if (shouldCondense) {
|
|
13638
|
-
node.content = node.content.replace(/[\t\r\n\f ]+/g, " ");
|
|
13639
|
-
}
|
|
13640
|
-
} else {
|
|
13641
|
-
node.content = node.content.replace(/\r\n/g, "\n");
|
|
13642
|
-
}
|
|
13643
|
-
} else if (node.type === 3 && !context.options.comments) {
|
|
13644
|
-
removedWhitespace = true;
|
|
13645
|
-
nodes[i] = null;
|
|
13646
|
-
}
|
|
13647
|
-
}
|
|
13648
|
-
if (context.inPre && parent && context.options.isPreTag(parent.tag)) {
|
|
13649
|
-
const first = nodes[0];
|
|
13650
|
-
if (first && first.type === 2) {
|
|
13651
|
-
first.content = first.content.replace(/^\r?\n/, "");
|
|
13652
|
-
}
|
|
13653
|
-
}
|
|
13654
|
-
}
|
|
13655
|
-
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
14006
|
+
function defaultOnWarn(msg) {
|
|
14007
|
+
!!(process.env.NODE_ENV !== "production") && console.warn(`[Vue warn] ${msg.message}`);
|
|
13656
14008
|
}
|
|
13657
|
-
function
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
prev.loc.source += node.loc.source;
|
|
13664
|
-
return;
|
|
13665
|
-
}
|
|
13666
|
-
}
|
|
13667
|
-
nodes.push(node);
|
|
14009
|
+
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
14010
|
+
const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : code;
|
|
14011
|
+
const error = new SyntaxError(String(msg));
|
|
14012
|
+
error.code = code;
|
|
14013
|
+
error.loc = loc;
|
|
14014
|
+
return error;
|
|
13668
14015
|
}
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
14016
|
+
const errorMessages = {
|
|
14017
|
+
// parse errors
|
|
14018
|
+
[0]: "Illegal comment.",
|
|
14019
|
+
[1]: "CDATA section is allowed only in XML context.",
|
|
14020
|
+
[2]: "Duplicate attribute.",
|
|
14021
|
+
[3]: "End tag cannot have attributes.",
|
|
14022
|
+
[4]: "Illegal '/' in tags.",
|
|
14023
|
+
[5]: "Unexpected EOF in tag.",
|
|
14024
|
+
[6]: "Unexpected EOF in CDATA section.",
|
|
14025
|
+
[7]: "Unexpected EOF in comment.",
|
|
14026
|
+
[8]: "Unexpected EOF in script.",
|
|
14027
|
+
[9]: "Unexpected EOF in tag.",
|
|
14028
|
+
[10]: "Incorrectly closed comment.",
|
|
14029
|
+
[11]: "Incorrectly opened comment.",
|
|
14030
|
+
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
14031
|
+
[13]: "Attribute value was expected.",
|
|
14032
|
+
[14]: "End tag name was expected.",
|
|
14033
|
+
[15]: "Whitespace was expected.",
|
|
14034
|
+
[16]: "Unexpected '<!--' in comment.",
|
|
14035
|
+
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
14036
|
+
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
14037
|
+
[19]: "Attribute name cannot start with '='.",
|
|
14038
|
+
[21]: "'<?' is allowed only in XML context.",
|
|
14039
|
+
[20]: `Unexpected null character.`,
|
|
14040
|
+
[22]: "Illegal '/' in tags.",
|
|
14041
|
+
// Vue-specific parse errors
|
|
14042
|
+
[23]: "Invalid end tag.",
|
|
14043
|
+
[24]: "Element is missing end tag.",
|
|
14044
|
+
[25]: "Interpolation end sign was not found.",
|
|
14045
|
+
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
14046
|
+
[26]: "Legal directive name was expected.",
|
|
14047
|
+
// transform errors
|
|
14048
|
+
[28]: `v-if/v-else-if is missing expression.`,
|
|
14049
|
+
[29]: `v-if/else branches must use unique keys.`,
|
|
14050
|
+
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
14051
|
+
[31]: `v-for is missing expression.`,
|
|
14052
|
+
[32]: `v-for has invalid expression.`,
|
|
14053
|
+
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
14054
|
+
[34]: `v-bind is missing expression.`,
|
|
14055
|
+
[35]: `v-on is missing expression.`,
|
|
14056
|
+
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
14057
|
+
[37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
|
|
14058
|
+
[38]: `Duplicate slot names found. `,
|
|
14059
|
+
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
14060
|
+
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
14061
|
+
[41]: `v-model is missing expression.`,
|
|
14062
|
+
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
14063
|
+
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
14064
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
14065
|
+
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
14066
|
+
[45]: `Error parsing JavaScript expression: `,
|
|
14067
|
+
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
14068
|
+
// generic errors
|
|
14069
|
+
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
14070
|
+
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
14071
|
+
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
14072
|
+
[50]: `"scopeId" option is only supported in module mode.`,
|
|
14073
|
+
// deprecations
|
|
14074
|
+
[51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
14075
|
+
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
14076
|
+
// just to fulfill types
|
|
14077
|
+
[53]: ``
|
|
14078
|
+
};
|
|
14079
|
+
|
|
14080
|
+
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
14081
|
+
function isCoreComponent(tag) {
|
|
14082
|
+
switch (tag) {
|
|
14083
|
+
case "Teleport":
|
|
14084
|
+
case "teleport":
|
|
14085
|
+
return TELEPORT;
|
|
14086
|
+
case "Suspense":
|
|
14087
|
+
case "suspense":
|
|
14088
|
+
return SUSPENSE;
|
|
14089
|
+
case "KeepAlive":
|
|
14090
|
+
case "keep-alive":
|
|
14091
|
+
return KEEP_ALIVE;
|
|
14092
|
+
case "BaseTransition":
|
|
14093
|
+
case "base-transition":
|
|
14094
|
+
return BASE_TRANSITION;
|
|
14095
|
+
}
|
|
14096
|
+
}
|
|
14097
|
+
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
14098
|
+
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
14099
|
+
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
14100
|
+
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
14101
|
+
const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
|
|
14102
|
+
const isMemberExpressionBrowser = (path) => {
|
|
14103
|
+
path = path.trim().replace(whitespaceRE, (s) => s.trim());
|
|
14104
|
+
let state = 0 /* inMemberExp */;
|
|
14105
|
+
let stateStack = [];
|
|
14106
|
+
let currentOpenBracketCount = 0;
|
|
14107
|
+
let currentOpenParensCount = 0;
|
|
14108
|
+
let currentStringType = null;
|
|
14109
|
+
for (let i = 0; i < path.length; i++) {
|
|
14110
|
+
const char = path.charAt(i);
|
|
14111
|
+
switch (state) {
|
|
14112
|
+
case 0 /* inMemberExp */:
|
|
14113
|
+
if (char === "[") {
|
|
14114
|
+
stateStack.push(state);
|
|
14115
|
+
state = 1 /* inBrackets */;
|
|
14116
|
+
currentOpenBracketCount++;
|
|
14117
|
+
} else if (char === "(") {
|
|
14118
|
+
stateStack.push(state);
|
|
14119
|
+
state = 2 /* inParens */;
|
|
14120
|
+
currentOpenParensCount++;
|
|
14121
|
+
} else if (!(i === 0 ? validFirstIdentCharRE : validIdentCharRE).test(char)) {
|
|
14122
|
+
return false;
|
|
14123
|
+
}
|
|
14124
|
+
break;
|
|
14125
|
+
case 1 /* inBrackets */:
|
|
14126
|
+
if (char === `'` || char === `"` || char === "`") {
|
|
14127
|
+
stateStack.push(state);
|
|
14128
|
+
state = 3 /* inString */;
|
|
14129
|
+
currentStringType = char;
|
|
14130
|
+
} else if (char === `[`) {
|
|
14131
|
+
currentOpenBracketCount++;
|
|
14132
|
+
} else if (char === `]`) {
|
|
14133
|
+
if (!--currentOpenBracketCount) {
|
|
14134
|
+
state = stateStack.pop();
|
|
14135
|
+
}
|
|
14136
|
+
}
|
|
14137
|
+
break;
|
|
14138
|
+
case 2 /* inParens */:
|
|
14139
|
+
if (char === `'` || char === `"` || char === "`") {
|
|
14140
|
+
stateStack.push(state);
|
|
14141
|
+
state = 3 /* inString */;
|
|
14142
|
+
currentStringType = char;
|
|
14143
|
+
} else if (char === `(`) {
|
|
14144
|
+
currentOpenParensCount++;
|
|
14145
|
+
} else if (char === `)`) {
|
|
14146
|
+
if (i === path.length - 1) {
|
|
14147
|
+
return false;
|
|
14148
|
+
}
|
|
14149
|
+
if (!--currentOpenParensCount) {
|
|
14150
|
+
state = stateStack.pop();
|
|
14151
|
+
}
|
|
14152
|
+
}
|
|
14153
|
+
break;
|
|
14154
|
+
case 3 /* inString */:
|
|
14155
|
+
if (char === currentStringType) {
|
|
14156
|
+
state = stateStack.pop();
|
|
14157
|
+
currentStringType = null;
|
|
14158
|
+
}
|
|
14159
|
+
break;
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14162
|
+
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
14163
|
+
};
|
|
14164
|
+
const isMemberExpression = isMemberExpressionBrowser ;
|
|
14165
|
+
function assert(condition, msg) {
|
|
14166
|
+
if (!condition) {
|
|
14167
|
+
throw new Error(msg || `unexpected compiler condition`);
|
|
14168
|
+
}
|
|
14169
|
+
}
|
|
14170
|
+
function findDir(node, name, allowEmpty = false) {
|
|
14171
|
+
for (let i = 0; i < node.props.length; i++) {
|
|
14172
|
+
const p = node.props[i];
|
|
14173
|
+
if (p.type === 7 && (allowEmpty || p.exp) && (isString(name) ? p.name === name : name.test(p.name))) {
|
|
14174
|
+
return p;
|
|
14175
|
+
}
|
|
14176
|
+
}
|
|
14177
|
+
}
|
|
14178
|
+
function findProp(node, name, dynamicOnly = false, allowEmpty = false) {
|
|
14179
|
+
for (let i = 0; i < node.props.length; i++) {
|
|
14180
|
+
const p = node.props[i];
|
|
14181
|
+
if (p.type === 6) {
|
|
14182
|
+
if (dynamicOnly)
|
|
14183
|
+
continue;
|
|
14184
|
+
if (p.name === name && (p.value || allowEmpty)) {
|
|
14185
|
+
return p;
|
|
14186
|
+
}
|
|
14187
|
+
} else if (p.name === "bind" && (p.exp || allowEmpty) && isStaticArgOf(p.arg, name)) {
|
|
14188
|
+
return p;
|
|
14189
|
+
}
|
|
14190
|
+
}
|
|
14191
|
+
}
|
|
14192
|
+
function isStaticArgOf(arg, name) {
|
|
14193
|
+
return !!(arg && isStaticExp(arg) && arg.content === name);
|
|
14194
|
+
}
|
|
14195
|
+
function hasDynamicKeyVBind(node) {
|
|
14196
|
+
return node.props.some(
|
|
14197
|
+
(p) => p.type === 7 && p.name === "bind" && (!p.arg || // v-bind="obj"
|
|
14198
|
+
p.arg.type !== 4 || // v-bind:[_ctx.foo]
|
|
14199
|
+
!p.arg.isStatic)
|
|
14200
|
+
// v-bind:[foo]
|
|
14201
|
+
);
|
|
14202
|
+
}
|
|
14203
|
+
function isText$1(node) {
|
|
14204
|
+
return node.type === 5 || node.type === 2;
|
|
14205
|
+
}
|
|
14206
|
+
function isVSlot(p) {
|
|
14207
|
+
return p.type === 7 && p.name === "slot";
|
|
14208
|
+
}
|
|
14209
|
+
function isTemplateNode(node) {
|
|
14210
|
+
return node.type === 1 && node.tagType === 3;
|
|
14211
|
+
}
|
|
14212
|
+
function isSlotOutlet(node) {
|
|
14213
|
+
return node.type === 1 && node.tagType === 2;
|
|
14214
|
+
}
|
|
14215
|
+
const propsHelperSet = /* @__PURE__ */ new Set([NORMALIZE_PROPS, GUARD_REACTIVE_PROPS]);
|
|
14216
|
+
function getUnnormalizedProps(props, callPath = []) {
|
|
14217
|
+
if (props && !isString(props) && props.type === 14) {
|
|
14218
|
+
const callee = props.callee;
|
|
14219
|
+
if (!isString(callee) && propsHelperSet.has(callee)) {
|
|
14220
|
+
return getUnnormalizedProps(
|
|
14221
|
+
props.arguments[0],
|
|
14222
|
+
callPath.concat(props)
|
|
14223
|
+
);
|
|
14224
|
+
}
|
|
14225
|
+
}
|
|
14226
|
+
return [props, callPath];
|
|
14227
|
+
}
|
|
14228
|
+
function injectProp(node, prop, context) {
|
|
14229
|
+
let propsWithInjection;
|
|
14230
|
+
let props = node.type === 13 ? node.props : node.arguments[2];
|
|
14231
|
+
let callPath = [];
|
|
14232
|
+
let parentCall;
|
|
14233
|
+
if (props && !isString(props) && props.type === 14) {
|
|
14234
|
+
const ret = getUnnormalizedProps(props);
|
|
14235
|
+
props = ret[0];
|
|
14236
|
+
callPath = ret[1];
|
|
14237
|
+
parentCall = callPath[callPath.length - 1];
|
|
14238
|
+
}
|
|
14239
|
+
if (props == null || isString(props)) {
|
|
14240
|
+
propsWithInjection = createObjectExpression([prop]);
|
|
14241
|
+
} else if (props.type === 14) {
|
|
14242
|
+
const first = props.arguments[0];
|
|
14243
|
+
if (!isString(first) && first.type === 15) {
|
|
14244
|
+
if (!hasProp(prop, first)) {
|
|
14245
|
+
first.properties.unshift(prop);
|
|
14246
|
+
}
|
|
14247
|
+
} else {
|
|
14248
|
+
if (props.callee === TO_HANDLERS) {
|
|
14249
|
+
propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
|
|
14250
|
+
createObjectExpression([prop]),
|
|
14251
|
+
props
|
|
14252
|
+
]);
|
|
14253
|
+
} else {
|
|
14254
|
+
props.arguments.unshift(createObjectExpression([prop]));
|
|
14255
|
+
}
|
|
14256
|
+
}
|
|
14257
|
+
!propsWithInjection && (propsWithInjection = props);
|
|
14258
|
+
} else if (props.type === 15) {
|
|
14259
|
+
if (!hasProp(prop, props)) {
|
|
14260
|
+
props.properties.unshift(prop);
|
|
14261
|
+
}
|
|
14262
|
+
propsWithInjection = props;
|
|
13674
14263
|
} else {
|
|
13675
|
-
|
|
13676
|
-
|
|
13677
|
-
|
|
13678
|
-
|
|
13679
|
-
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
if (
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
14264
|
+
propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
|
|
14265
|
+
createObjectExpression([prop]),
|
|
14266
|
+
props
|
|
14267
|
+
]);
|
|
14268
|
+
if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
|
|
14269
|
+
parentCall = callPath[callPath.length - 2];
|
|
14270
|
+
}
|
|
14271
|
+
}
|
|
14272
|
+
if (node.type === 13) {
|
|
14273
|
+
if (parentCall) {
|
|
14274
|
+
parentCall.arguments[0] = propsWithInjection;
|
|
14275
|
+
} else {
|
|
14276
|
+
node.props = propsWithInjection;
|
|
14277
|
+
}
|
|
14278
|
+
} else {
|
|
14279
|
+
if (parentCall) {
|
|
14280
|
+
parentCall.arguments[0] = propsWithInjection;
|
|
14281
|
+
} else {
|
|
14282
|
+
node.arguments[2] = propsWithInjection;
|
|
14283
|
+
}
|
|
14284
|
+
}
|
|
14285
|
+
}
|
|
14286
|
+
function hasProp(prop, props) {
|
|
14287
|
+
let result = false;
|
|
14288
|
+
if (prop.key.type === 4) {
|
|
14289
|
+
const propKeyName = prop.key.content;
|
|
14290
|
+
result = props.properties.some(
|
|
14291
|
+
(p) => p.key.type === 4 && p.key.content === propKeyName
|
|
14292
|
+
);
|
|
14293
|
+
}
|
|
14294
|
+
return result;
|
|
14295
|
+
}
|
|
14296
|
+
function toValidAssetId(name, type) {
|
|
14297
|
+
return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
|
|
14298
|
+
return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
|
|
14299
|
+
})}`;
|
|
14300
|
+
}
|
|
14301
|
+
function getMemoedVNodeCall(node) {
|
|
14302
|
+
if (node.type === 14 && node.callee === WITH_MEMO) {
|
|
14303
|
+
return node.arguments[1].returns;
|
|
13687
14304
|
} else {
|
|
13688
|
-
|
|
13689
|
-
|
|
14305
|
+
return node;
|
|
14306
|
+
}
|
|
14307
|
+
}
|
|
14308
|
+
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
14309
|
+
|
|
14310
|
+
const defaultParserOptions = {
|
|
14311
|
+
parseMode: "base",
|
|
14312
|
+
ns: 0,
|
|
14313
|
+
delimiters: [`{{`, `}}`],
|
|
14314
|
+
getNamespace: () => 0,
|
|
14315
|
+
isVoidTag: NO,
|
|
14316
|
+
isPreTag: NO,
|
|
14317
|
+
isCustomElement: NO,
|
|
14318
|
+
onError: defaultOnError,
|
|
14319
|
+
onWarn: defaultOnWarn,
|
|
14320
|
+
comments: !!(process.env.NODE_ENV !== "production")
|
|
14321
|
+
};
|
|
14322
|
+
let currentOptions = defaultParserOptions;
|
|
14323
|
+
let currentRoot = null;
|
|
14324
|
+
let currentInput = "";
|
|
14325
|
+
let currentOpenTag = null;
|
|
14326
|
+
let currentProp = null;
|
|
14327
|
+
let currentAttrValue = "";
|
|
14328
|
+
let currentAttrStartIndex = -1;
|
|
14329
|
+
let currentAttrEndIndex = -1;
|
|
14330
|
+
let inPre = 0;
|
|
14331
|
+
let inVPre = false;
|
|
14332
|
+
let currentVPreBoundary = null;
|
|
14333
|
+
const stack = [];
|
|
14334
|
+
const tokenizer = new Tokenizer(stack, {
|
|
14335
|
+
onerr: emitError,
|
|
14336
|
+
ontext(start, end) {
|
|
14337
|
+
onText(getSlice(start, end), start, end);
|
|
14338
|
+
},
|
|
14339
|
+
ontextentity(char, start, end) {
|
|
14340
|
+
onText(char, start, end);
|
|
14341
|
+
},
|
|
14342
|
+
oninterpolation(start, end) {
|
|
14343
|
+
if (inVPre) {
|
|
14344
|
+
return onText(getSlice(start, end), start, end);
|
|
14345
|
+
}
|
|
14346
|
+
let innerStart = start + tokenizer.delimiterOpen.length;
|
|
14347
|
+
let innerEnd = end - tokenizer.delimiterClose.length;
|
|
14348
|
+
while (isWhitespace(currentInput.charCodeAt(innerStart))) {
|
|
14349
|
+
innerStart++;
|
|
14350
|
+
}
|
|
14351
|
+
while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
|
|
14352
|
+
innerEnd--;
|
|
14353
|
+
}
|
|
14354
|
+
let exp = getSlice(innerStart, innerEnd);
|
|
14355
|
+
if (exp.includes("&")) {
|
|
14356
|
+
{
|
|
14357
|
+
exp = currentOptions.decodeEntities(exp, false);
|
|
14358
|
+
}
|
|
14359
|
+
}
|
|
14360
|
+
addNode({
|
|
14361
|
+
type: 5,
|
|
14362
|
+
content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
|
|
14363
|
+
loc: getLoc(start, end)
|
|
14364
|
+
});
|
|
14365
|
+
},
|
|
14366
|
+
onopentagname(start, end) {
|
|
14367
|
+
const name = getSlice(start, end);
|
|
14368
|
+
currentOpenTag = {
|
|
14369
|
+
type: 1,
|
|
14370
|
+
tag: name,
|
|
14371
|
+
ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
|
|
14372
|
+
tagType: 0,
|
|
14373
|
+
// will be refined on tag close
|
|
14374
|
+
props: [],
|
|
14375
|
+
children: [],
|
|
14376
|
+
loc: getLoc(start - 1, end),
|
|
14377
|
+
codegenNode: void 0
|
|
14378
|
+
};
|
|
14379
|
+
if (tokenizer.inSFCRoot) {
|
|
14380
|
+
currentOpenTag.innerLoc = getLoc(
|
|
14381
|
+
end + fastForward(end) + 1,
|
|
14382
|
+
end
|
|
14383
|
+
);
|
|
14384
|
+
}
|
|
14385
|
+
},
|
|
14386
|
+
onopentagend(end) {
|
|
14387
|
+
endOpenTag(end);
|
|
14388
|
+
},
|
|
14389
|
+
onclosetag(start, end) {
|
|
14390
|
+
const name = getSlice(start, end);
|
|
14391
|
+
if (!currentOptions.isVoidTag(name)) {
|
|
14392
|
+
let found = false;
|
|
14393
|
+
for (let i = 0; i < stack.length; i++) {
|
|
14394
|
+
const e = stack[i];
|
|
14395
|
+
if (e.tag.toLowerCase() === name.toLowerCase()) {
|
|
14396
|
+
found = true;
|
|
14397
|
+
if (i > 0) {
|
|
14398
|
+
emitError(24, stack[0].loc.start.offset);
|
|
14399
|
+
}
|
|
14400
|
+
for (let j = 0; j <= i; j++) {
|
|
14401
|
+
const el = stack.shift();
|
|
14402
|
+
onCloseTag(el, end, j < i);
|
|
14403
|
+
}
|
|
14404
|
+
break;
|
|
14405
|
+
}
|
|
14406
|
+
}
|
|
14407
|
+
if (!found) {
|
|
14408
|
+
emitError(23, backTrack(start, 60));
|
|
14409
|
+
}
|
|
14410
|
+
}
|
|
14411
|
+
},
|
|
14412
|
+
onselfclosingtag(end) {
|
|
14413
|
+
var _a;
|
|
14414
|
+
const name = currentOpenTag.tag;
|
|
14415
|
+
currentOpenTag.isSelfClosing = true;
|
|
14416
|
+
endOpenTag(end);
|
|
14417
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
14418
|
+
onCloseTag(stack.shift(), end);
|
|
14419
|
+
}
|
|
14420
|
+
},
|
|
14421
|
+
onattribname(start, end) {
|
|
14422
|
+
currentProp = {
|
|
14423
|
+
type: 6,
|
|
14424
|
+
name: getSlice(start, end),
|
|
14425
|
+
nameLoc: getLoc(start, end),
|
|
14426
|
+
value: void 0,
|
|
14427
|
+
loc: getLoc(start)
|
|
14428
|
+
};
|
|
14429
|
+
},
|
|
14430
|
+
ondirname(start, end) {
|
|
14431
|
+
const raw = getSlice(start, end);
|
|
14432
|
+
const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
|
|
14433
|
+
if (!inVPre && name === "") {
|
|
14434
|
+
emitError(26, start);
|
|
14435
|
+
}
|
|
14436
|
+
if (inVPre || name === "") {
|
|
14437
|
+
currentProp = {
|
|
14438
|
+
type: 6,
|
|
14439
|
+
name: raw,
|
|
14440
|
+
nameLoc: getLoc(start, end),
|
|
14441
|
+
value: void 0,
|
|
14442
|
+
loc: getLoc(start)
|
|
14443
|
+
};
|
|
14444
|
+
} else {
|
|
14445
|
+
currentProp = {
|
|
14446
|
+
type: 7,
|
|
14447
|
+
name,
|
|
14448
|
+
rawName: raw,
|
|
14449
|
+
exp: void 0,
|
|
14450
|
+
arg: void 0,
|
|
14451
|
+
modifiers: raw === "." ? ["prop"] : [],
|
|
14452
|
+
loc: getLoc(start)
|
|
14453
|
+
};
|
|
14454
|
+
if (name === "pre") {
|
|
14455
|
+
inVPre = true;
|
|
14456
|
+
currentVPreBoundary = currentOpenTag;
|
|
14457
|
+
const props = currentOpenTag.props;
|
|
14458
|
+
for (let i = 0; i < props.length; i++) {
|
|
14459
|
+
if (props[i].type === 7) {
|
|
14460
|
+
props[i] = dirToAttr(props[i]);
|
|
14461
|
+
}
|
|
14462
|
+
}
|
|
14463
|
+
}
|
|
14464
|
+
}
|
|
14465
|
+
},
|
|
14466
|
+
ondirarg(start, end) {
|
|
14467
|
+
const arg = getSlice(start, end);
|
|
14468
|
+
if (inVPre) {
|
|
14469
|
+
currentProp.name += arg;
|
|
14470
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
14471
|
+
} else {
|
|
14472
|
+
const isStatic = arg[0] !== `[`;
|
|
14473
|
+
currentProp.arg = createSimpleExpression(
|
|
14474
|
+
isStatic ? arg : arg.slice(1, -1),
|
|
14475
|
+
isStatic,
|
|
14476
|
+
getLoc(start, end),
|
|
14477
|
+
isStatic ? 3 : 0
|
|
14478
|
+
);
|
|
14479
|
+
}
|
|
14480
|
+
},
|
|
14481
|
+
ondirmodifier(start, end) {
|
|
14482
|
+
const mod = getSlice(start, end);
|
|
14483
|
+
if (inVPre) {
|
|
14484
|
+
currentProp.name += "." + mod;
|
|
14485
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
14486
|
+
} else if (currentProp.name === "slot") {
|
|
14487
|
+
const arg = currentProp.arg;
|
|
14488
|
+
if (arg) {
|
|
14489
|
+
arg.content += "." + mod;
|
|
14490
|
+
setLocEnd(arg.loc, end);
|
|
14491
|
+
}
|
|
14492
|
+
} else {
|
|
14493
|
+
currentProp.modifiers.push(mod);
|
|
14494
|
+
}
|
|
14495
|
+
},
|
|
14496
|
+
onattribdata(start, end) {
|
|
14497
|
+
currentAttrValue += getSlice(start, end);
|
|
14498
|
+
if (currentAttrStartIndex < 0)
|
|
14499
|
+
currentAttrStartIndex = start;
|
|
14500
|
+
currentAttrEndIndex = end;
|
|
14501
|
+
},
|
|
14502
|
+
onattribentity(char, start, end) {
|
|
14503
|
+
currentAttrValue += char;
|
|
14504
|
+
if (currentAttrStartIndex < 0)
|
|
14505
|
+
currentAttrStartIndex = start;
|
|
14506
|
+
currentAttrEndIndex = end;
|
|
14507
|
+
},
|
|
14508
|
+
onattribnameend(end) {
|
|
14509
|
+
const start = currentProp.loc.start.offset;
|
|
14510
|
+
const name = getSlice(start, end);
|
|
14511
|
+
if (currentProp.type === 7) {
|
|
14512
|
+
currentProp.rawName = name;
|
|
14513
|
+
}
|
|
14514
|
+
if (currentOpenTag.props.some(
|
|
14515
|
+
(p) => (p.type === 7 ? p.rawName : p.name) === name
|
|
14516
|
+
)) {
|
|
14517
|
+
emitError(2, start);
|
|
14518
|
+
}
|
|
14519
|
+
},
|
|
14520
|
+
onattribend(quote, end) {
|
|
14521
|
+
if (currentOpenTag && currentProp) {
|
|
14522
|
+
setLocEnd(currentProp.loc, end);
|
|
14523
|
+
if (quote !== 0) {
|
|
14524
|
+
if (currentAttrValue.includes("&")) {
|
|
14525
|
+
currentAttrValue = currentOptions.decodeEntities(
|
|
14526
|
+
currentAttrValue,
|
|
14527
|
+
true
|
|
14528
|
+
);
|
|
14529
|
+
}
|
|
14530
|
+
if (currentProp.type === 6) {
|
|
14531
|
+
if (currentProp.name === "class") {
|
|
14532
|
+
currentAttrValue = condense(currentAttrValue).trim();
|
|
14533
|
+
}
|
|
14534
|
+
if (quote === 1 && !currentAttrValue) {
|
|
14535
|
+
emitError(13, end);
|
|
14536
|
+
}
|
|
14537
|
+
currentProp.value = {
|
|
14538
|
+
type: 2,
|
|
14539
|
+
content: currentAttrValue,
|
|
14540
|
+
loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
|
|
14541
|
+
};
|
|
14542
|
+
if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
|
|
14543
|
+
tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
|
|
14544
|
+
}
|
|
14545
|
+
} else {
|
|
14546
|
+
currentProp.exp = createSimpleExpression(
|
|
14547
|
+
currentAttrValue,
|
|
14548
|
+
false,
|
|
14549
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
14550
|
+
);
|
|
14551
|
+
if (currentProp.name === "for") {
|
|
14552
|
+
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
14553
|
+
}
|
|
14554
|
+
let syncIndex = -1;
|
|
14555
|
+
if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
|
|
14556
|
+
"COMPILER_V_BIND_SYNC",
|
|
14557
|
+
currentOptions,
|
|
14558
|
+
currentProp.loc,
|
|
14559
|
+
currentProp.rawName
|
|
14560
|
+
)) {
|
|
14561
|
+
currentProp.name = "model";
|
|
14562
|
+
currentProp.modifiers.splice(syncIndex, 1);
|
|
14563
|
+
}
|
|
14564
|
+
}
|
|
14565
|
+
}
|
|
14566
|
+
if (currentProp.type !== 7 || currentProp.name !== "pre") {
|
|
14567
|
+
currentOpenTag.props.push(currentProp);
|
|
14568
|
+
}
|
|
13690
14569
|
}
|
|
13691
|
-
|
|
13692
|
-
|
|
14570
|
+
currentAttrValue = "";
|
|
14571
|
+
currentAttrStartIndex = currentAttrEndIndex = -1;
|
|
14572
|
+
},
|
|
14573
|
+
oncomment(start, end) {
|
|
14574
|
+
if (currentOptions.comments) {
|
|
14575
|
+
addNode({
|
|
14576
|
+
type: 3,
|
|
14577
|
+
content: getSlice(start, end),
|
|
14578
|
+
loc: getLoc(start - 4, end + 3)
|
|
14579
|
+
});
|
|
13693
14580
|
}
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
14581
|
+
},
|
|
14582
|
+
onend() {
|
|
14583
|
+
const end = currentInput.length;
|
|
14584
|
+
if ((!!(process.env.NODE_ENV !== "production") || false) && tokenizer.state !== 1) {
|
|
14585
|
+
switch (tokenizer.state) {
|
|
14586
|
+
case 5:
|
|
14587
|
+
case 8:
|
|
14588
|
+
emitError(5, end);
|
|
14589
|
+
break;
|
|
14590
|
+
case 3:
|
|
14591
|
+
case 4:
|
|
14592
|
+
emitError(
|
|
14593
|
+
25,
|
|
14594
|
+
tokenizer.sectionStart
|
|
14595
|
+
);
|
|
14596
|
+
break;
|
|
14597
|
+
case 28:
|
|
14598
|
+
if (tokenizer.currentSequence === Sequences.CdataEnd) {
|
|
14599
|
+
emitError(6, end);
|
|
14600
|
+
} else {
|
|
14601
|
+
emitError(7, end);
|
|
14602
|
+
}
|
|
14603
|
+
break;
|
|
14604
|
+
case 6:
|
|
14605
|
+
case 7:
|
|
14606
|
+
case 9:
|
|
14607
|
+
case 11:
|
|
14608
|
+
case 12:
|
|
14609
|
+
case 13:
|
|
14610
|
+
case 14:
|
|
14611
|
+
case 15:
|
|
14612
|
+
case 16:
|
|
14613
|
+
case 17:
|
|
14614
|
+
case 18:
|
|
14615
|
+
case 19:
|
|
14616
|
+
case 20:
|
|
14617
|
+
case 21:
|
|
14618
|
+
emitError(9, end);
|
|
14619
|
+
break;
|
|
13701
14620
|
}
|
|
13702
|
-
prevIndex = nestedIndex + 1;
|
|
13703
14621
|
}
|
|
13704
|
-
|
|
14622
|
+
for (let index = 0; index < stack.length; index++) {
|
|
14623
|
+
onCloseTag(stack[index], end - 1);
|
|
14624
|
+
emitError(24, stack[index].loc.start.offset);
|
|
14625
|
+
}
|
|
14626
|
+
},
|
|
14627
|
+
oncdata(start, end) {
|
|
14628
|
+
if (stack[0].ns !== 0) {
|
|
14629
|
+
onText(getSlice(start, end), start, end);
|
|
14630
|
+
} else {
|
|
14631
|
+
emitError(1, start - 9);
|
|
14632
|
+
}
|
|
14633
|
+
},
|
|
14634
|
+
onprocessinginstruction(start) {
|
|
14635
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
14636
|
+
emitError(
|
|
14637
|
+
21,
|
|
14638
|
+
start - 1
|
|
14639
|
+
);
|
|
14640
|
+
}
|
|
13705
14641
|
}
|
|
13706
|
-
|
|
13707
|
-
|
|
13708
|
-
|
|
13709
|
-
|
|
14642
|
+
});
|
|
14643
|
+
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
14644
|
+
const stripParensRE = /^\(|\)$/g;
|
|
14645
|
+
function parseForExpression(input) {
|
|
14646
|
+
const loc = input.loc;
|
|
14647
|
+
const exp = input.content;
|
|
14648
|
+
const inMatch = exp.match(forAliasRE);
|
|
14649
|
+
if (!inMatch)
|
|
14650
|
+
return;
|
|
14651
|
+
const [, LHS, RHS] = inMatch;
|
|
14652
|
+
const createAliasExpression = (content, offset) => {
|
|
14653
|
+
const start = loc.start.offset + offset;
|
|
14654
|
+
const end = start + content.length;
|
|
14655
|
+
return createSimpleExpression(content, false, getLoc(start, end));
|
|
13710
14656
|
};
|
|
14657
|
+
const result = {
|
|
14658
|
+
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
14659
|
+
value: void 0,
|
|
14660
|
+
key: void 0,
|
|
14661
|
+
index: void 0,
|
|
14662
|
+
finalized: false
|
|
14663
|
+
};
|
|
14664
|
+
let valueContent = LHS.trim().replace(stripParensRE, "").trim();
|
|
14665
|
+
const trimmedOffset = LHS.indexOf(valueContent);
|
|
14666
|
+
const iteratorMatch = valueContent.match(forIteratorRE);
|
|
14667
|
+
if (iteratorMatch) {
|
|
14668
|
+
valueContent = valueContent.replace(forIteratorRE, "").trim();
|
|
14669
|
+
const keyContent = iteratorMatch[1].trim();
|
|
14670
|
+
let keyOffset;
|
|
14671
|
+
if (keyContent) {
|
|
14672
|
+
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
14673
|
+
result.key = createAliasExpression(keyContent, keyOffset);
|
|
14674
|
+
}
|
|
14675
|
+
if (iteratorMatch[2]) {
|
|
14676
|
+
const indexContent = iteratorMatch[2].trim();
|
|
14677
|
+
if (indexContent) {
|
|
14678
|
+
result.index = createAliasExpression(
|
|
14679
|
+
indexContent,
|
|
14680
|
+
exp.indexOf(
|
|
14681
|
+
indexContent,
|
|
14682
|
+
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
14683
|
+
)
|
|
14684
|
+
);
|
|
14685
|
+
}
|
|
14686
|
+
}
|
|
14687
|
+
}
|
|
14688
|
+
if (valueContent) {
|
|
14689
|
+
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
14690
|
+
}
|
|
14691
|
+
return result;
|
|
14692
|
+
}
|
|
14693
|
+
function getSlice(start, end) {
|
|
14694
|
+
return currentInput.slice(start, end);
|
|
13711
14695
|
}
|
|
13712
|
-
function
|
|
13713
|
-
|
|
13714
|
-
const
|
|
13715
|
-
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
14696
|
+
function endOpenTag(end) {
|
|
14697
|
+
addNode(currentOpenTag);
|
|
14698
|
+
const { tag, ns } = currentOpenTag;
|
|
14699
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
14700
|
+
inPre++;
|
|
14701
|
+
}
|
|
14702
|
+
if (currentOptions.isVoidTag(tag)) {
|
|
14703
|
+
onCloseTag(currentOpenTag, end);
|
|
13720
14704
|
} else {
|
|
13721
|
-
|
|
13722
|
-
|
|
14705
|
+
stack.unshift(currentOpenTag);
|
|
14706
|
+
if (ns === 1 || ns === 2) {
|
|
14707
|
+
tokenizer.inXML = true;
|
|
14708
|
+
}
|
|
13723
14709
|
}
|
|
13724
|
-
|
|
13725
|
-
type: 3,
|
|
13726
|
-
content,
|
|
13727
|
-
loc: getSelection(context, start)
|
|
13728
|
-
};
|
|
14710
|
+
currentOpenTag = null;
|
|
13729
14711
|
}
|
|
13730
|
-
function
|
|
13731
|
-
|
|
13732
|
-
|
|
13733
|
-
|
|
13734
|
-
|
|
13735
|
-
|
|
13736
|
-
|
|
13737
|
-
|
|
13738
|
-
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
|
|
13749
|
-
|
|
14712
|
+
function onText(content, start, end) {
|
|
14713
|
+
var _a;
|
|
14714
|
+
{
|
|
14715
|
+
const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
|
|
14716
|
+
if (tag !== "script" && tag !== "style" && content.includes("&")) {
|
|
14717
|
+
content = currentOptions.decodeEntities(content, false);
|
|
14718
|
+
}
|
|
14719
|
+
}
|
|
14720
|
+
const parent = stack[0] || currentRoot;
|
|
14721
|
+
const lastNode = parent.children[parent.children.length - 1];
|
|
14722
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
14723
|
+
lastNode.content += content;
|
|
14724
|
+
setLocEnd(lastNode.loc, end);
|
|
14725
|
+
} else {
|
|
14726
|
+
parent.children.push({
|
|
14727
|
+
type: 2,
|
|
14728
|
+
content,
|
|
14729
|
+
loc: getLoc(start, end)
|
|
14730
|
+
});
|
|
14731
|
+
}
|
|
14732
|
+
}
|
|
14733
|
+
function onCloseTag(el, end, isImplied = false) {
|
|
14734
|
+
if (isImplied) {
|
|
14735
|
+
setLocEnd(el.loc, backTrack(end, 60));
|
|
14736
|
+
} else {
|
|
14737
|
+
setLocEnd(el.loc, end + fastForward(end) + 1);
|
|
14738
|
+
}
|
|
14739
|
+
if (tokenizer.inSFCRoot) {
|
|
14740
|
+
if (el.children.length) {
|
|
14741
|
+
el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
|
|
14742
|
+
} else {
|
|
14743
|
+
el.innerLoc.end = extend({}, el.innerLoc.start);
|
|
14744
|
+
}
|
|
14745
|
+
el.innerLoc.source = getSlice(
|
|
14746
|
+
el.innerLoc.start.offset,
|
|
14747
|
+
el.innerLoc.end.offset
|
|
14748
|
+
);
|
|
14749
|
+
}
|
|
14750
|
+
const { tag, ns } = el;
|
|
14751
|
+
if (!inVPre) {
|
|
14752
|
+
if (tag === "slot") {
|
|
14753
|
+
el.tagType = 2;
|
|
14754
|
+
} else if (isFragmentTemplate(el)) {
|
|
14755
|
+
el.tagType = 3;
|
|
14756
|
+
} else if (isComponent(el)) {
|
|
14757
|
+
el.tagType = 1;
|
|
14758
|
+
}
|
|
14759
|
+
}
|
|
14760
|
+
if (!tokenizer.inRCDATA) {
|
|
14761
|
+
el.children = condenseWhitespace(el.children, el.tag);
|
|
14762
|
+
}
|
|
14763
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
14764
|
+
inPre--;
|
|
14765
|
+
}
|
|
14766
|
+
if (currentVPreBoundary === el) {
|
|
14767
|
+
inVPre = false;
|
|
14768
|
+
currentVPreBoundary = null;
|
|
14769
|
+
}
|
|
14770
|
+
if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
14771
|
+
tokenizer.inXML = false;
|
|
14772
|
+
}
|
|
13750
14773
|
{
|
|
13751
|
-
const
|
|
14774
|
+
const props = el.props;
|
|
14775
|
+
if (!!(process.env.NODE_ENV !== "production") && isCompatEnabled(
|
|
14776
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
14777
|
+
currentOptions
|
|
14778
|
+
)) {
|
|
14779
|
+
let hasIf = false;
|
|
14780
|
+
let hasFor = false;
|
|
14781
|
+
for (let i = 0; i < props.length; i++) {
|
|
14782
|
+
const p = props[i];
|
|
14783
|
+
if (p.type === 7) {
|
|
14784
|
+
if (p.name === "if") {
|
|
14785
|
+
hasIf = true;
|
|
14786
|
+
} else if (p.name === "for") {
|
|
14787
|
+
hasFor = true;
|
|
14788
|
+
}
|
|
14789
|
+
}
|
|
14790
|
+
if (hasIf && hasFor) {
|
|
14791
|
+
warnDeprecation(
|
|
14792
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
14793
|
+
currentOptions,
|
|
14794
|
+
el.loc
|
|
14795
|
+
);
|
|
14796
|
+
break;
|
|
14797
|
+
}
|
|
14798
|
+
}
|
|
14799
|
+
}
|
|
14800
|
+
if (isCompatEnabled(
|
|
14801
|
+
"COMPILER_NATIVE_TEMPLATE",
|
|
14802
|
+
currentOptions
|
|
14803
|
+
) && el.tag === "template" && !isFragmentTemplate(el)) {
|
|
14804
|
+
!!(process.env.NODE_ENV !== "production") && warnDeprecation(
|
|
14805
|
+
"COMPILER_NATIVE_TEMPLATE",
|
|
14806
|
+
currentOptions,
|
|
14807
|
+
el.loc
|
|
14808
|
+
);
|
|
14809
|
+
const parent = stack[0] || currentRoot;
|
|
14810
|
+
const index = parent.children.indexOf(el);
|
|
14811
|
+
parent.children.splice(index, 1, ...el.children);
|
|
14812
|
+
}
|
|
14813
|
+
const inlineTemplateProp = props.find(
|
|
13752
14814
|
(p) => p.type === 6 && p.name === "inline-template"
|
|
13753
14815
|
);
|
|
13754
14816
|
if (inlineTemplateProp && checkCompatEnabled(
|
|
13755
14817
|
"COMPILER_INLINE_TEMPLATE",
|
|
13756
|
-
|
|
14818
|
+
currentOptions,
|
|
13757
14819
|
inlineTemplateProp.loc
|
|
13758
|
-
)) {
|
|
13759
|
-
const loc = getSelection(context, element.loc.end);
|
|
14820
|
+
) && el.children.length) {
|
|
13760
14821
|
inlineTemplateProp.value = {
|
|
13761
|
-
type: 2,
|
|
13762
|
-
content:
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
if (startsWithEndTagOpen(context.source, element.tag)) {
|
|
13769
|
-
parseTag(context, 1 /* End */, parent);
|
|
13770
|
-
} else {
|
|
13771
|
-
emitError(context, 24, 0, element.loc.start);
|
|
13772
|
-
if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
|
|
13773
|
-
const first = children[0];
|
|
13774
|
-
if (first && startsWith(first.loc.source, "<!--")) {
|
|
13775
|
-
emitError(context, 8);
|
|
13776
|
-
}
|
|
14822
|
+
type: 2,
|
|
14823
|
+
content: getSlice(
|
|
14824
|
+
el.children[0].loc.start.offset,
|
|
14825
|
+
el.children[el.children.length - 1].loc.end.offset
|
|
14826
|
+
),
|
|
14827
|
+
loc: inlineTemplateProp.loc
|
|
14828
|
+
};
|
|
13777
14829
|
}
|
|
13778
14830
|
}
|
|
13779
|
-
element.loc = getSelection(context, element.loc.start);
|
|
13780
|
-
if (isPreBoundary) {
|
|
13781
|
-
context.inPre = false;
|
|
13782
|
-
}
|
|
13783
|
-
if (isVPreBoundary) {
|
|
13784
|
-
context.inVPre = false;
|
|
13785
|
-
}
|
|
13786
|
-
return element;
|
|
13787
14831
|
}
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
)
|
|
13791
|
-
|
|
13792
|
-
const start = getCursor(context);
|
|
13793
|
-
const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
|
|
13794
|
-
const tag = match[1];
|
|
13795
|
-
const ns = context.options.getNamespace(tag, parent);
|
|
13796
|
-
advanceBy(context, match[0].length);
|
|
13797
|
-
advanceSpaces(context);
|
|
13798
|
-
const cursor = getCursor(context);
|
|
13799
|
-
const currentSource = context.source;
|
|
13800
|
-
if (context.options.isPreTag(tag)) {
|
|
13801
|
-
context.inPre = true;
|
|
13802
|
-
}
|
|
13803
|
-
let props = parseAttributes(context, type);
|
|
13804
|
-
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
|
|
13805
|
-
context.inVPre = true;
|
|
13806
|
-
extend(context, cursor);
|
|
13807
|
-
context.source = currentSource;
|
|
13808
|
-
props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
|
|
13809
|
-
}
|
|
13810
|
-
let isSelfClosing = false;
|
|
13811
|
-
if (context.source.length === 0) {
|
|
13812
|
-
emitError(context, 9);
|
|
13813
|
-
} else {
|
|
13814
|
-
isSelfClosing = startsWith(context.source, "/>");
|
|
13815
|
-
if (type === 1 /* End */ && isSelfClosing) {
|
|
13816
|
-
emitError(context, 4);
|
|
13817
|
-
}
|
|
13818
|
-
advanceBy(context, isSelfClosing ? 2 : 1);
|
|
14832
|
+
function fastForward(start, c) {
|
|
14833
|
+
let offset = 0;
|
|
14834
|
+
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
14835
|
+
offset++;
|
|
13819
14836
|
}
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
14837
|
+
return offset;
|
|
14838
|
+
}
|
|
14839
|
+
function backTrack(index, c) {
|
|
14840
|
+
let i = index;
|
|
14841
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
14842
|
+
i--;
|
|
14843
|
+
return i;
|
|
14844
|
+
}
|
|
14845
|
+
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
14846
|
+
function isFragmentTemplate({ tag, props }) {
|
|
14847
|
+
if (tag === "template") {
|
|
13829
14848
|
for (let i = 0; i < props.length; i++) {
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
if (p.name === "if") {
|
|
13833
|
-
hasIf = true;
|
|
13834
|
-
} else if (p.name === "for") {
|
|
13835
|
-
hasFor = true;
|
|
13836
|
-
}
|
|
13837
|
-
}
|
|
13838
|
-
if (hasIf && hasFor) {
|
|
13839
|
-
warnDeprecation(
|
|
13840
|
-
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
13841
|
-
context,
|
|
13842
|
-
getSelection(context, start)
|
|
13843
|
-
);
|
|
13844
|
-
break;
|
|
13845
|
-
}
|
|
13846
|
-
}
|
|
13847
|
-
}
|
|
13848
|
-
let tagType = 0;
|
|
13849
|
-
if (!context.inVPre) {
|
|
13850
|
-
if (tag === "slot") {
|
|
13851
|
-
tagType = 2;
|
|
13852
|
-
} else if (tag === "template") {
|
|
13853
|
-
if (props.some(
|
|
13854
|
-
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
13855
|
-
)) {
|
|
13856
|
-
tagType = 3;
|
|
14849
|
+
if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
|
|
14850
|
+
return true;
|
|
13857
14851
|
}
|
|
13858
|
-
} else if (isComponent(tag, props, context)) {
|
|
13859
|
-
tagType = 1;
|
|
13860
14852
|
}
|
|
13861
14853
|
}
|
|
13862
|
-
return
|
|
13863
|
-
type: 1,
|
|
13864
|
-
ns,
|
|
13865
|
-
tag,
|
|
13866
|
-
tagType,
|
|
13867
|
-
props,
|
|
13868
|
-
isSelfClosing,
|
|
13869
|
-
children: [],
|
|
13870
|
-
loc: getSelection(context, start),
|
|
13871
|
-
codegenNode: void 0
|
|
13872
|
-
// to be created during transform phase
|
|
13873
|
-
};
|
|
14854
|
+
return false;
|
|
13874
14855
|
}
|
|
13875
|
-
function isComponent(tag, props
|
|
13876
|
-
|
|
13877
|
-
if (
|
|
14856
|
+
function isComponent({ tag, props }) {
|
|
14857
|
+
var _a;
|
|
14858
|
+
if (currentOptions.isCustomElement(tag)) {
|
|
13878
14859
|
return false;
|
|
13879
14860
|
}
|
|
13880
|
-
if (tag === "component" ||
|
|
14861
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
13881
14862
|
return true;
|
|
13882
14863
|
}
|
|
13883
14864
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -13888,374 +14869,179 @@ function isComponent(tag, props, context) {
|
|
|
13888
14869
|
return true;
|
|
13889
14870
|
} else if (checkCompatEnabled(
|
|
13890
14871
|
"COMPILER_IS_ON_ELEMENT",
|
|
13891
|
-
|
|
14872
|
+
currentOptions,
|
|
13892
14873
|
p.loc
|
|
13893
14874
|
)) {
|
|
13894
14875
|
return true;
|
|
13895
14876
|
}
|
|
13896
14877
|
}
|
|
13897
|
-
} else
|
|
13898
|
-
|
|
13899
|
-
|
|
13900
|
-
|
|
13901
|
-
|
|
13902
|
-
|
|
13903
|
-
|
|
13904
|
-
context,
|
|
13905
|
-
p.loc
|
|
13906
|
-
)
|
|
13907
|
-
) {
|
|
13908
|
-
return true;
|
|
13909
|
-
}
|
|
14878
|
+
} else if (// :is on plain element - only treat as component in compat mode
|
|
14879
|
+
p.name === "bind" && isStaticArgOf(p.arg, "is") && checkCompatEnabled(
|
|
14880
|
+
"COMPILER_IS_ON_ELEMENT",
|
|
14881
|
+
currentOptions,
|
|
14882
|
+
p.loc
|
|
14883
|
+
)) {
|
|
14884
|
+
return true;
|
|
13910
14885
|
}
|
|
13911
14886
|
}
|
|
14887
|
+
return false;
|
|
13912
14888
|
}
|
|
13913
|
-
function
|
|
13914
|
-
|
|
13915
|
-
const attributeNames = /* @__PURE__ */ new Set();
|
|
13916
|
-
while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
|
|
13917
|
-
if (startsWith(context.source, "/")) {
|
|
13918
|
-
emitError(context, 22);
|
|
13919
|
-
advanceBy(context, 1);
|
|
13920
|
-
advanceSpaces(context);
|
|
13921
|
-
continue;
|
|
13922
|
-
}
|
|
13923
|
-
if (type === 1 /* End */) {
|
|
13924
|
-
emitError(context, 3);
|
|
13925
|
-
}
|
|
13926
|
-
const attr = parseAttribute(context, attributeNames);
|
|
13927
|
-
if (attr.type === 6 && attr.value && attr.name === "class") {
|
|
13928
|
-
attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
|
|
13929
|
-
}
|
|
13930
|
-
if (type === 0 /* Start */) {
|
|
13931
|
-
props.push(attr);
|
|
13932
|
-
}
|
|
13933
|
-
if (/^[^\t\r\n\f />]/.test(context.source)) {
|
|
13934
|
-
emitError(context, 15);
|
|
13935
|
-
}
|
|
13936
|
-
advanceSpaces(context);
|
|
13937
|
-
}
|
|
13938
|
-
return props;
|
|
14889
|
+
function isUpperCase(c) {
|
|
14890
|
+
return c > 64 && c < 91;
|
|
13939
14891
|
}
|
|
13940
|
-
|
|
13941
|
-
|
|
13942
|
-
|
|
13943
|
-
const
|
|
13944
|
-
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
13949
|
-
|
|
13950
|
-
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
);
|
|
13961
|
-
}
|
|
13962
|
-
}
|
|
13963
|
-
advanceBy(context, name.length);
|
|
13964
|
-
let value = void 0;
|
|
13965
|
-
if (/^[\t\r\n\f ]*=/.test(context.source)) {
|
|
13966
|
-
advanceSpaces(context);
|
|
13967
|
-
advanceBy(context, 1);
|
|
13968
|
-
advanceSpaces(context);
|
|
13969
|
-
value = parseAttributeValue(context);
|
|
13970
|
-
if (!value) {
|
|
13971
|
-
emitError(context, 13);
|
|
13972
|
-
}
|
|
13973
|
-
}
|
|
13974
|
-
const loc = getSelection(context, start);
|
|
13975
|
-
if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
|
|
13976
|
-
const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
|
|
13977
|
-
name
|
|
13978
|
-
);
|
|
13979
|
-
let isPropShorthand = startsWith(name, ".");
|
|
13980
|
-
let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
|
|
13981
|
-
let arg;
|
|
13982
|
-
if (match2[2]) {
|
|
13983
|
-
const isSlot = dirName === "slot";
|
|
13984
|
-
const startOffset = name.lastIndexOf(
|
|
13985
|
-
match2[2],
|
|
13986
|
-
name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
|
|
13987
|
-
);
|
|
13988
|
-
const loc2 = getSelection(
|
|
13989
|
-
context,
|
|
13990
|
-
getNewPosition(context, start, startOffset),
|
|
13991
|
-
getNewPosition(
|
|
13992
|
-
context,
|
|
13993
|
-
start,
|
|
13994
|
-
startOffset + match2[2].length + (isSlot && match2[3] || "").length
|
|
13995
|
-
)
|
|
13996
|
-
);
|
|
13997
|
-
let content = match2[2];
|
|
13998
|
-
let isStatic = true;
|
|
13999
|
-
if (content.startsWith("[")) {
|
|
14000
|
-
isStatic = false;
|
|
14001
|
-
if (!content.endsWith("]")) {
|
|
14002
|
-
emitError(
|
|
14003
|
-
context,
|
|
14004
|
-
27
|
|
14005
|
-
);
|
|
14006
|
-
content = content.slice(1);
|
|
14007
|
-
} else {
|
|
14008
|
-
content = content.slice(1, content.length - 1);
|
|
14892
|
+
const windowsNewlineRE = /\r\n/g;
|
|
14893
|
+
function condenseWhitespace(nodes, tag) {
|
|
14894
|
+
var _a, _b;
|
|
14895
|
+
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
14896
|
+
let removedWhitespace = false;
|
|
14897
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
14898
|
+
const node = nodes[i];
|
|
14899
|
+
if (node.type === 2) {
|
|
14900
|
+
if (!inPre) {
|
|
14901
|
+
if (isAllWhitespace(node.content)) {
|
|
14902
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
14903
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
14904
|
+
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
14905
|
+
removedWhitespace = true;
|
|
14906
|
+
nodes[i] = null;
|
|
14907
|
+
} else {
|
|
14908
|
+
node.content = " ";
|
|
14909
|
+
}
|
|
14910
|
+
} else if (shouldCondense) {
|
|
14911
|
+
node.content = condense(node.content);
|
|
14009
14912
|
}
|
|
14010
|
-
} else
|
|
14011
|
-
content
|
|
14012
|
-
}
|
|
14013
|
-
arg = {
|
|
14014
|
-
type: 4,
|
|
14015
|
-
content,
|
|
14016
|
-
isStatic,
|
|
14017
|
-
constType: isStatic ? 3 : 0,
|
|
14018
|
-
loc: loc2
|
|
14019
|
-
};
|
|
14020
|
-
}
|
|
14021
|
-
if (value && value.isQuoted) {
|
|
14022
|
-
const valueLoc = value.loc;
|
|
14023
|
-
valueLoc.start.offset++;
|
|
14024
|
-
valueLoc.start.column++;
|
|
14025
|
-
valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
|
|
14026
|
-
valueLoc.source = valueLoc.source.slice(1, -1);
|
|
14027
|
-
}
|
|
14028
|
-
const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
|
|
14029
|
-
if (isPropShorthand)
|
|
14030
|
-
modifiers.push("prop");
|
|
14031
|
-
if (dirName === "bind" && arg) {
|
|
14032
|
-
if (modifiers.includes("sync") && checkCompatEnabled(
|
|
14033
|
-
"COMPILER_V_BIND_SYNC",
|
|
14034
|
-
context,
|
|
14035
|
-
loc,
|
|
14036
|
-
arg.loc.source
|
|
14037
|
-
)) {
|
|
14038
|
-
dirName = "model";
|
|
14039
|
-
modifiers.splice(modifiers.indexOf("sync"), 1);
|
|
14040
|
-
}
|
|
14041
|
-
if (!!(process.env.NODE_ENV !== "production") && modifiers.includes("prop")) {
|
|
14042
|
-
checkCompatEnabled(
|
|
14043
|
-
"COMPILER_V_BIND_PROP",
|
|
14044
|
-
context,
|
|
14045
|
-
loc
|
|
14046
|
-
);
|
|
14913
|
+
} else {
|
|
14914
|
+
node.content = node.content.replace(windowsNewlineRE, "\n");
|
|
14047
14915
|
}
|
|
14048
14916
|
}
|
|
14049
|
-
return {
|
|
14050
|
-
type: 7,
|
|
14051
|
-
name: dirName,
|
|
14052
|
-
exp: value && {
|
|
14053
|
-
type: 4,
|
|
14054
|
-
content: value.content,
|
|
14055
|
-
isStatic: false,
|
|
14056
|
-
// Treat as non-constant by default. This can be potentially set to
|
|
14057
|
-
// other values by `transformExpression` to make it eligible for hoisting.
|
|
14058
|
-
constType: 0,
|
|
14059
|
-
loc: value.loc
|
|
14060
|
-
},
|
|
14061
|
-
arg,
|
|
14062
|
-
modifiers,
|
|
14063
|
-
loc
|
|
14064
|
-
};
|
|
14065
14917
|
}
|
|
14066
|
-
if (
|
|
14067
|
-
|
|
14918
|
+
if (inPre && tag && currentOptions.isPreTag(tag)) {
|
|
14919
|
+
const first = nodes[0];
|
|
14920
|
+
if (first && first.type === 2) {
|
|
14921
|
+
first.content = first.content.replace(/^\r?\n/, "");
|
|
14922
|
+
}
|
|
14068
14923
|
}
|
|
14069
|
-
return
|
|
14070
|
-
type: 6,
|
|
14071
|
-
name,
|
|
14072
|
-
value: value && {
|
|
14073
|
-
type: 2,
|
|
14074
|
-
content: value.content,
|
|
14075
|
-
loc: value.loc
|
|
14076
|
-
},
|
|
14077
|
-
loc
|
|
14078
|
-
};
|
|
14924
|
+
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
14079
14925
|
}
|
|
14080
|
-
function
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
const isQuoted = quote === `"` || quote === `'`;
|
|
14085
|
-
if (isQuoted) {
|
|
14086
|
-
advanceBy(context, 1);
|
|
14087
|
-
const endIndex = context.source.indexOf(quote);
|
|
14088
|
-
if (endIndex === -1) {
|
|
14089
|
-
content = parseTextData(
|
|
14090
|
-
context,
|
|
14091
|
-
context.source.length,
|
|
14092
|
-
4
|
|
14093
|
-
);
|
|
14094
|
-
} else {
|
|
14095
|
-
content = parseTextData(context, endIndex, 4);
|
|
14096
|
-
advanceBy(context, 1);
|
|
14097
|
-
}
|
|
14098
|
-
} else {
|
|
14099
|
-
const match = /^[^\t\r\n\f >]+/.exec(context.source);
|
|
14100
|
-
if (!match) {
|
|
14101
|
-
return void 0;
|
|
14102
|
-
}
|
|
14103
|
-
const unexpectedChars = /["'<=`]/g;
|
|
14104
|
-
let m;
|
|
14105
|
-
while (m = unexpectedChars.exec(match[0])) {
|
|
14106
|
-
emitError(
|
|
14107
|
-
context,
|
|
14108
|
-
18,
|
|
14109
|
-
m.index
|
|
14110
|
-
);
|
|
14926
|
+
function isAllWhitespace(str) {
|
|
14927
|
+
for (let i = 0; i < str.length; i++) {
|
|
14928
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
14929
|
+
return false;
|
|
14111
14930
|
}
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
return { content, isQuoted, loc: getSelection(context, start) };
|
|
14115
|
-
}
|
|
14116
|
-
function parseInterpolation(context, mode) {
|
|
14117
|
-
const [open, close] = context.options.delimiters;
|
|
14118
|
-
const closeIndex = context.source.indexOf(close, open.length);
|
|
14119
|
-
if (closeIndex === -1) {
|
|
14120
|
-
emitError(context, 25);
|
|
14121
|
-
return void 0;
|
|
14122
|
-
}
|
|
14123
|
-
const start = getCursor(context);
|
|
14124
|
-
advanceBy(context, open.length);
|
|
14125
|
-
const innerStart = getCursor(context);
|
|
14126
|
-
const innerEnd = getCursor(context);
|
|
14127
|
-
const rawContentLength = closeIndex - open.length;
|
|
14128
|
-
const rawContent = context.source.slice(0, rawContentLength);
|
|
14129
|
-
const preTrimContent = parseTextData(context, rawContentLength, mode);
|
|
14130
|
-
const content = preTrimContent.trim();
|
|
14131
|
-
const startOffset = preTrimContent.indexOf(content);
|
|
14132
|
-
if (startOffset > 0) {
|
|
14133
|
-
advancePositionWithMutation(innerStart, rawContent, startOffset);
|
|
14134
|
-
}
|
|
14135
|
-
const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
|
|
14136
|
-
advancePositionWithMutation(innerEnd, rawContent, endOffset);
|
|
14137
|
-
advanceBy(context, close.length);
|
|
14138
|
-
return {
|
|
14139
|
-
type: 5,
|
|
14140
|
-
content: {
|
|
14141
|
-
type: 4,
|
|
14142
|
-
isStatic: false,
|
|
14143
|
-
// Set `isConstant` to false by default and will decide in transformExpression
|
|
14144
|
-
constType: 0,
|
|
14145
|
-
content,
|
|
14146
|
-
loc: getSelection(context, innerStart, innerEnd)
|
|
14147
|
-
},
|
|
14148
|
-
loc: getSelection(context, start)
|
|
14149
|
-
};
|
|
14931
|
+
}
|
|
14932
|
+
return true;
|
|
14150
14933
|
}
|
|
14151
|
-
function
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
if (index !== -1 && endIndex > index) {
|
|
14157
|
-
endIndex = index;
|
|
14934
|
+
function hasNewlineChar(str) {
|
|
14935
|
+
for (let i = 0; i < str.length; i++) {
|
|
14936
|
+
const c = str.charCodeAt(i);
|
|
14937
|
+
if (c === 10 || c === 13) {
|
|
14938
|
+
return true;
|
|
14158
14939
|
}
|
|
14159
14940
|
}
|
|
14160
|
-
|
|
14161
|
-
const content = parseTextData(context, endIndex, mode);
|
|
14162
|
-
return {
|
|
14163
|
-
type: 2,
|
|
14164
|
-
content,
|
|
14165
|
-
loc: getSelection(context, start)
|
|
14166
|
-
};
|
|
14941
|
+
return false;
|
|
14167
14942
|
}
|
|
14168
|
-
function
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14172
|
-
|
|
14173
|
-
|
|
14174
|
-
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14943
|
+
function condense(str) {
|
|
14944
|
+
let ret = "";
|
|
14945
|
+
let prevCharIsWhitespace = false;
|
|
14946
|
+
for (let i = 0; i < str.length; i++) {
|
|
14947
|
+
if (isWhitespace(str.charCodeAt(i))) {
|
|
14948
|
+
if (!prevCharIsWhitespace) {
|
|
14949
|
+
ret += " ";
|
|
14950
|
+
prevCharIsWhitespace = true;
|
|
14951
|
+
}
|
|
14952
|
+
} else {
|
|
14953
|
+
ret += str[i];
|
|
14954
|
+
prevCharIsWhitespace = false;
|
|
14955
|
+
}
|
|
14178
14956
|
}
|
|
14957
|
+
return ret;
|
|
14179
14958
|
}
|
|
14180
|
-
function
|
|
14181
|
-
|
|
14182
|
-
return { column, line, offset };
|
|
14959
|
+
function addNode(node) {
|
|
14960
|
+
(stack[0] || currentRoot).children.push(node);
|
|
14183
14961
|
}
|
|
14184
|
-
function
|
|
14185
|
-
end = end || getCursor(context);
|
|
14962
|
+
function getLoc(start, end) {
|
|
14186
14963
|
return {
|
|
14187
|
-
start,
|
|
14188
|
-
|
|
14189
|
-
|
|
14964
|
+
start: tokenizer.getPos(start),
|
|
14965
|
+
// @ts-expect-error allow late attachment
|
|
14966
|
+
end: end == null ? end : tokenizer.getPos(end),
|
|
14967
|
+
// @ts-expect-error allow late attachment
|
|
14968
|
+
source: end == null ? end : getSlice(start, end)
|
|
14190
14969
|
};
|
|
14191
14970
|
}
|
|
14192
|
-
function
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
function startsWith(source, searchString) {
|
|
14196
|
-
return source.startsWith(searchString);
|
|
14197
|
-
}
|
|
14198
|
-
function advanceBy(context, numberOfCharacters) {
|
|
14199
|
-
const { source } = context;
|
|
14200
|
-
advancePositionWithMutation(context, source, numberOfCharacters);
|
|
14201
|
-
context.source = source.slice(numberOfCharacters);
|
|
14971
|
+
function setLocEnd(loc, end) {
|
|
14972
|
+
loc.end = tokenizer.getPos(end);
|
|
14973
|
+
loc.source = getSlice(loc.start.offset, end);
|
|
14202
14974
|
}
|
|
14203
|
-
function
|
|
14204
|
-
const
|
|
14205
|
-
|
|
14206
|
-
|
|
14975
|
+
function dirToAttr(dir) {
|
|
14976
|
+
const attr = {
|
|
14977
|
+
type: 6,
|
|
14978
|
+
name: dir.rawName,
|
|
14979
|
+
nameLoc: getLoc(
|
|
14980
|
+
dir.loc.start.offset,
|
|
14981
|
+
dir.loc.start.offset + dir.rawName.length
|
|
14982
|
+
),
|
|
14983
|
+
value: void 0,
|
|
14984
|
+
loc: dir.loc
|
|
14985
|
+
};
|
|
14986
|
+
if (dir.exp) {
|
|
14987
|
+
const loc = dir.exp.loc;
|
|
14988
|
+
if (loc.end.offset < dir.loc.end.offset) {
|
|
14989
|
+
loc.start.offset--;
|
|
14990
|
+
loc.start.column--;
|
|
14991
|
+
loc.end.offset++;
|
|
14992
|
+
loc.end.column++;
|
|
14993
|
+
}
|
|
14994
|
+
attr.value = {
|
|
14995
|
+
type: 2,
|
|
14996
|
+
content: dir.exp.content,
|
|
14997
|
+
loc
|
|
14998
|
+
};
|
|
14207
14999
|
}
|
|
15000
|
+
return attr;
|
|
14208
15001
|
}
|
|
14209
|
-
function
|
|
14210
|
-
|
|
14211
|
-
start,
|
|
14212
|
-
context.originalSource.slice(start.offset, numberOfCharacters),
|
|
14213
|
-
numberOfCharacters
|
|
14214
|
-
);
|
|
15002
|
+
function emitError(code, index) {
|
|
15003
|
+
currentOptions.onError(createCompilerError(code, getLoc(index, index)));
|
|
14215
15004
|
}
|
|
14216
|
-
function
|
|
14217
|
-
|
|
14218
|
-
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
end: loc,
|
|
14225
|
-
source: ""
|
|
14226
|
-
})
|
|
14227
|
-
);
|
|
15005
|
+
function reset() {
|
|
15006
|
+
tokenizer.reset();
|
|
15007
|
+
currentOpenTag = null;
|
|
15008
|
+
currentProp = null;
|
|
15009
|
+
currentAttrValue = "";
|
|
15010
|
+
currentAttrStartIndex = -1;
|
|
15011
|
+
currentAttrEndIndex = -1;
|
|
15012
|
+
stack.length = 0;
|
|
14228
15013
|
}
|
|
14229
|
-
function
|
|
14230
|
-
|
|
14231
|
-
|
|
14232
|
-
|
|
14233
|
-
|
|
14234
|
-
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
}
|
|
14239
|
-
}
|
|
14240
|
-
break;
|
|
14241
|
-
case 1:
|
|
14242
|
-
case 2: {
|
|
14243
|
-
const parent = last(ancestors);
|
|
14244
|
-
if (parent && startsWithEndTagOpen(s, parent.tag)) {
|
|
14245
|
-
return true;
|
|
15014
|
+
function baseParse(input, options) {
|
|
15015
|
+
reset();
|
|
15016
|
+
currentInput = input;
|
|
15017
|
+
currentOptions = extend({}, defaultParserOptions);
|
|
15018
|
+
if (options) {
|
|
15019
|
+
let key;
|
|
15020
|
+
for (key in options) {
|
|
15021
|
+
if (options[key] != null) {
|
|
15022
|
+
currentOptions[key] = options[key];
|
|
14246
15023
|
}
|
|
14247
|
-
break;
|
|
14248
15024
|
}
|
|
14249
|
-
case 3:
|
|
14250
|
-
if (startsWith(s, "]]>")) {
|
|
14251
|
-
return true;
|
|
14252
|
-
}
|
|
14253
|
-
break;
|
|
14254
15025
|
}
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
15026
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
15027
|
+
if (!currentOptions.decodeEntities) {
|
|
15028
|
+
throw new Error(
|
|
15029
|
+
`[@vue/compiler-core] decodeEntities option is required in browser builds.`
|
|
15030
|
+
);
|
|
15031
|
+
}
|
|
15032
|
+
}
|
|
15033
|
+
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
15034
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
15035
|
+
if (delimiters) {
|
|
15036
|
+
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
15037
|
+
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
15038
|
+
}
|
|
15039
|
+
const root = currentRoot = createRoot([], input);
|
|
15040
|
+
tokenizer.parse(currentInput);
|
|
15041
|
+
root.loc = getLoc(0, input.length);
|
|
15042
|
+
root.children = condenseWhitespace(root.children);
|
|
15043
|
+
currentRoot = null;
|
|
15044
|
+
return root;
|
|
14259
15045
|
}
|
|
14260
15046
|
|
|
14261
15047
|
function hoistStatic(root, context) {
|
|
@@ -14668,6 +15454,7 @@ function transform(root, options) {
|
|
|
14668
15454
|
root.hoists = context.hoists;
|
|
14669
15455
|
root.temps = context.temps;
|
|
14670
15456
|
root.cached = context.cached;
|
|
15457
|
+
root.transformed = true;
|
|
14671
15458
|
{
|
|
14672
15459
|
root.filters = [...context.filters];
|
|
14673
15460
|
}
|
|
@@ -14824,7 +15611,7 @@ function createCodegenContext(ast, {
|
|
|
14824
15611
|
ssr,
|
|
14825
15612
|
isTS,
|
|
14826
15613
|
inSSR,
|
|
14827
|
-
source: ast.
|
|
15614
|
+
source: ast.source,
|
|
14828
15615
|
code: ``,
|
|
14829
15616
|
column: 1,
|
|
14830
15617
|
line: 1,
|
|
@@ -14835,7 +15622,7 @@ function createCodegenContext(ast, {
|
|
|
14835
15622
|
helper(key) {
|
|
14836
15623
|
return `_${helperNameMap[key]}`;
|
|
14837
15624
|
},
|
|
14838
|
-
push(code, node) {
|
|
15625
|
+
push(code, newlineIndex = -2 /* None */, node) {
|
|
14839
15626
|
context.code += code;
|
|
14840
15627
|
},
|
|
14841
15628
|
indent() {
|
|
@@ -14853,7 +15640,7 @@ function createCodegenContext(ast, {
|
|
|
14853
15640
|
}
|
|
14854
15641
|
};
|
|
14855
15642
|
function newline(n) {
|
|
14856
|
-
context.push("\n" + ` `.repeat(n));
|
|
15643
|
+
context.push("\n" + ` `.repeat(n), 0 /* Start */);
|
|
14857
15644
|
}
|
|
14858
15645
|
return context;
|
|
14859
15646
|
}
|
|
@@ -14890,9 +15677,11 @@ function generate(ast, options = {}) {
|
|
|
14890
15677
|
push(`with (_ctx) {`);
|
|
14891
15678
|
indent();
|
|
14892
15679
|
if (hasHelpers) {
|
|
14893
|
-
push(
|
|
14894
|
-
|
|
14895
|
-
|
|
15680
|
+
push(
|
|
15681
|
+
`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
|
|
15682
|
+
`,
|
|
15683
|
+
-1 /* End */
|
|
15684
|
+
);
|
|
14896
15685
|
newline();
|
|
14897
15686
|
}
|
|
14898
15687
|
}
|
|
@@ -14921,7 +15710,7 @@ function generate(ast, options = {}) {
|
|
|
14921
15710
|
}
|
|
14922
15711
|
if (ast.components.length || ast.directives.length || ast.temps) {
|
|
14923
15712
|
push(`
|
|
14924
|
-
|
|
15713
|
+
`, 0 /* Start */);
|
|
14925
15714
|
newline();
|
|
14926
15715
|
}
|
|
14927
15716
|
if (!ssr) {
|
|
@@ -14942,7 +15731,6 @@ function generate(ast, options = {}) {
|
|
|
14942
15731
|
ast,
|
|
14943
15732
|
code: context.code,
|
|
14944
15733
|
preamble: isSetupInlined ? preambleContext.code : ``,
|
|
14945
|
-
// SourceMapGenerator does have toJSON() method but it's not in the types
|
|
14946
15734
|
map: context.map ? context.map.toJSON() : void 0
|
|
14947
15735
|
};
|
|
14948
15736
|
}
|
|
@@ -14961,7 +15749,7 @@ function genFunctionPreamble(ast, context) {
|
|
|
14961
15749
|
if (helpers.length > 0) {
|
|
14962
15750
|
{
|
|
14963
15751
|
push(`const _Vue = ${VueBinding}
|
|
14964
|
-
|
|
15752
|
+
`, -1 /* End */);
|
|
14965
15753
|
if (ast.hoists.length) {
|
|
14966
15754
|
const staticHelpers = [
|
|
14967
15755
|
CREATE_VNODE,
|
|
@@ -14971,7 +15759,7 @@ function genFunctionPreamble(ast, context) {
|
|
|
14971
15759
|
CREATE_STATIC
|
|
14972
15760
|
].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
|
|
14973
15761
|
push(`const { ${staticHelpers} } = _Vue
|
|
14974
|
-
|
|
15762
|
+
`, -1 /* End */);
|
|
14975
15763
|
}
|
|
14976
15764
|
}
|
|
14977
15765
|
}
|
|
@@ -15032,7 +15820,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
15032
15820
|
for (let i = 0; i < nodes.length; i++) {
|
|
15033
15821
|
const node = nodes[i];
|
|
15034
15822
|
if (isString(node)) {
|
|
15035
|
-
push(node);
|
|
15823
|
+
push(node, -3 /* Unknown */);
|
|
15036
15824
|
} else if (isArray(node)) {
|
|
15037
15825
|
genNodeListAsArray(node, context);
|
|
15038
15826
|
} else {
|
|
@@ -15050,7 +15838,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
15050
15838
|
}
|
|
15051
15839
|
function genNode(node, context) {
|
|
15052
15840
|
if (isString(node)) {
|
|
15053
|
-
context.push(node);
|
|
15841
|
+
context.push(node, -3 /* Unknown */);
|
|
15054
15842
|
return;
|
|
15055
15843
|
}
|
|
15056
15844
|
if (isSymbol(node)) {
|
|
@@ -15130,11 +15918,15 @@ function genNode(node, context) {
|
|
|
15130
15918
|
}
|
|
15131
15919
|
}
|
|
15132
15920
|
function genText(node, context) {
|
|
15133
|
-
context.push(JSON.stringify(node.content), node);
|
|
15921
|
+
context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
|
|
15134
15922
|
}
|
|
15135
15923
|
function genExpression(node, context) {
|
|
15136
15924
|
const { content, isStatic } = node;
|
|
15137
|
-
context.push(
|
|
15925
|
+
context.push(
|
|
15926
|
+
isStatic ? JSON.stringify(content) : content,
|
|
15927
|
+
-3 /* Unknown */,
|
|
15928
|
+
node
|
|
15929
|
+
);
|
|
15138
15930
|
}
|
|
15139
15931
|
function genInterpolation(node, context) {
|
|
15140
15932
|
const { push, helper, pure } = context;
|
|
@@ -15148,7 +15940,7 @@ function genCompoundExpression(node, context) {
|
|
|
15148
15940
|
for (let i = 0; i < node.children.length; i++) {
|
|
15149
15941
|
const child = node.children[i];
|
|
15150
15942
|
if (isString(child)) {
|
|
15151
|
-
context.push(child);
|
|
15943
|
+
context.push(child, -3 /* Unknown */);
|
|
15152
15944
|
} else {
|
|
15153
15945
|
genNode(child, context);
|
|
15154
15946
|
}
|
|
@@ -15162,9 +15954,9 @@ function genExpressionAsPropertyKey(node, context) {
|
|
|
15162
15954
|
push(`]`);
|
|
15163
15955
|
} else if (node.isStatic) {
|
|
15164
15956
|
const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
|
|
15165
|
-
push(text, node);
|
|
15957
|
+
push(text, -2 /* None */, node);
|
|
15166
15958
|
} else {
|
|
15167
|
-
push(`[${node.content}]`, node);
|
|
15959
|
+
push(`[${node.content}]`, -3 /* Unknown */, node);
|
|
15168
15960
|
}
|
|
15169
15961
|
}
|
|
15170
15962
|
function genComment(node, context) {
|
|
@@ -15172,7 +15964,11 @@ function genComment(node, context) {
|
|
|
15172
15964
|
if (pure) {
|
|
15173
15965
|
push(PURE_ANNOTATION);
|
|
15174
15966
|
}
|
|
15175
|
-
push(
|
|
15967
|
+
push(
|
|
15968
|
+
`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
|
|
15969
|
+
-3 /* Unknown */,
|
|
15970
|
+
node
|
|
15971
|
+
);
|
|
15176
15972
|
}
|
|
15177
15973
|
function genVNodeCall(node, context) {
|
|
15178
15974
|
const { push, helper, pure } = context;
|
|
@@ -15197,7 +15993,7 @@ function genVNodeCall(node, context) {
|
|
|
15197
15993
|
push(PURE_ANNOTATION);
|
|
15198
15994
|
}
|
|
15199
15995
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
15200
|
-
push(helper(callHelper) + `(`, node);
|
|
15996
|
+
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
15201
15997
|
genNodeList(
|
|
15202
15998
|
genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
|
|
15203
15999
|
context
|
|
@@ -15226,7 +16022,7 @@ function genCallExpression(node, context) {
|
|
|
15226
16022
|
if (pure) {
|
|
15227
16023
|
push(PURE_ANNOTATION);
|
|
15228
16024
|
}
|
|
15229
|
-
push(callee + `(`, node);
|
|
16025
|
+
push(callee + `(`, -2 /* None */, node);
|
|
15230
16026
|
genNodeList(node.arguments, context);
|
|
15231
16027
|
push(`)`);
|
|
15232
16028
|
}
|
|
@@ -15234,7 +16030,7 @@ function genObjectExpression(node, context) {
|
|
|
15234
16030
|
const { push, indent, deindent, newline } = context;
|
|
15235
16031
|
const { properties } = node;
|
|
15236
16032
|
if (!properties.length) {
|
|
15237
|
-
push(`{}`, node);
|
|
16033
|
+
push(`{}`, -2 /* None */, node);
|
|
15238
16034
|
return;
|
|
15239
16035
|
}
|
|
15240
16036
|
const multilines = properties.length > 1 || !!(process.env.NODE_ENV !== "production") && properties.some((p) => p.value.type !== 4);
|
|
@@ -15262,7 +16058,7 @@ function genFunctionExpression(node, context) {
|
|
|
15262
16058
|
if (isSlot) {
|
|
15263
16059
|
push(`_${helperNameMap[WITH_CTX]}(`);
|
|
15264
16060
|
}
|
|
15265
|
-
push(`(`, node);
|
|
16061
|
+
push(`(`, -2 /* None */, node);
|
|
15266
16062
|
if (isArray(params)) {
|
|
15267
16063
|
genNodeList(params, context);
|
|
15268
16064
|
} else if (params) {
|
|
@@ -15496,7 +16292,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15496
16292
|
context.removeNode();
|
|
15497
16293
|
const branch = createIfBranch(node, dir);
|
|
15498
16294
|
if (!!(process.env.NODE_ENV !== "production") && comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
|
|
15499
|
-
!(context.parent && context.parent.type === 1 &&
|
|
16295
|
+
!(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
|
|
15500
16296
|
branch.children = [...comments, ...branch.children];
|
|
15501
16297
|
}
|
|
15502
16298
|
if (!!(process.env.NODE_ENV !== "production") || false) {
|
|
@@ -15778,18 +16574,14 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
15778
16574
|
);
|
|
15779
16575
|
return;
|
|
15780
16576
|
}
|
|
15781
|
-
const parseResult =
|
|
15782
|
-
// can only be simple expression because vFor transform is applied
|
|
15783
|
-
// before expression transform.
|
|
15784
|
-
dir.exp,
|
|
15785
|
-
context
|
|
15786
|
-
);
|
|
16577
|
+
const parseResult = dir.forParseResult;
|
|
15787
16578
|
if (!parseResult) {
|
|
15788
16579
|
context.onError(
|
|
15789
16580
|
createCompilerError(32, dir.loc)
|
|
15790
16581
|
);
|
|
15791
16582
|
return;
|
|
15792
16583
|
}
|
|
16584
|
+
finalizeForParseResult(parseResult, context);
|
|
15793
16585
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
15794
16586
|
const { source, value, key, index } = parseResult;
|
|
15795
16587
|
const forNode = {
|
|
@@ -15811,70 +16603,26 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
15811
16603
|
onExit();
|
|
15812
16604
|
};
|
|
15813
16605
|
}
|
|
15814
|
-
|
|
15815
|
-
|
|
15816
|
-
function parseForExpression(input, context) {
|
|
15817
|
-
const loc = input.loc;
|
|
15818
|
-
const exp = input.content;
|
|
15819
|
-
const inMatch = exp.match(forAliasRE);
|
|
15820
|
-
if (!inMatch)
|
|
16606
|
+
function finalizeForParseResult(result, context) {
|
|
16607
|
+
if (result.finalized)
|
|
15821
16608
|
return;
|
|
15822
|
-
const [, LHS, RHS] = inMatch;
|
|
15823
|
-
const result = {
|
|
15824
|
-
source: createAliasExpression(
|
|
15825
|
-
loc,
|
|
15826
|
-
RHS.trim(),
|
|
15827
|
-
exp.indexOf(RHS, LHS.length)
|
|
15828
|
-
),
|
|
15829
|
-
value: void 0,
|
|
15830
|
-
key: void 0,
|
|
15831
|
-
index: void 0
|
|
15832
|
-
};
|
|
15833
16609
|
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
15834
16610
|
validateBrowserExpression(result.source, context);
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
const keyContent = iteratorMatch[1].trim();
|
|
15842
|
-
let keyOffset;
|
|
15843
|
-
if (keyContent) {
|
|
15844
|
-
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
15845
|
-
result.key = createAliasExpression(loc, keyContent, keyOffset);
|
|
15846
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
15847
|
-
validateBrowserExpression(
|
|
15848
|
-
result.key,
|
|
15849
|
-
context,
|
|
15850
|
-
true
|
|
15851
|
-
);
|
|
15852
|
-
}
|
|
16611
|
+
if (result.key) {
|
|
16612
|
+
validateBrowserExpression(
|
|
16613
|
+
result.key,
|
|
16614
|
+
context,
|
|
16615
|
+
true
|
|
16616
|
+
);
|
|
15853
16617
|
}
|
|
15854
|
-
if (
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
exp.indexOf(
|
|
15861
|
-
indexContent,
|
|
15862
|
-
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
15863
|
-
)
|
|
15864
|
-
);
|
|
15865
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
15866
|
-
validateBrowserExpression(
|
|
15867
|
-
result.index,
|
|
15868
|
-
context,
|
|
15869
|
-
true
|
|
15870
|
-
);
|
|
15871
|
-
}
|
|
15872
|
-
}
|
|
16618
|
+
if (result.index) {
|
|
16619
|
+
validateBrowserExpression(
|
|
16620
|
+
result.index,
|
|
16621
|
+
context,
|
|
16622
|
+
true
|
|
16623
|
+
);
|
|
15873
16624
|
}
|
|
15874
|
-
|
|
15875
|
-
if (valueContent) {
|
|
15876
|
-
result.value = createAliasExpression(loc, valueContent, trimmedOffset);
|
|
15877
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
16625
|
+
if (result.value) {
|
|
15878
16626
|
validateBrowserExpression(
|
|
15879
16627
|
result.value,
|
|
15880
16628
|
context,
|
|
@@ -15882,14 +16630,7 @@ function parseForExpression(input, context) {
|
|
|
15882
16630
|
);
|
|
15883
16631
|
}
|
|
15884
16632
|
}
|
|
15885
|
-
|
|
15886
|
-
}
|
|
15887
|
-
function createAliasExpression(range, content, offset) {
|
|
15888
|
-
return createSimpleExpression(
|
|
15889
|
-
content,
|
|
15890
|
-
false,
|
|
15891
|
-
getInnerRange(range, offset, content.length)
|
|
15892
|
-
);
|
|
16633
|
+
result.finalized = true;
|
|
15893
16634
|
}
|
|
15894
16635
|
function createForLoopParams({ value, key, index }, memoArgs = []) {
|
|
15895
16636
|
return createParamsList([value, key, index, ...memoArgs]);
|
|
@@ -15976,12 +16717,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
15976
16717
|
hasDynamicSlots = true;
|
|
15977
16718
|
}
|
|
15978
16719
|
const vFor = findDir(slotElement, "for");
|
|
15979
|
-
const slotFunction = buildSlotFn(
|
|
15980
|
-
slotProps,
|
|
15981
|
-
vFor == null ? void 0 : vFor.exp,
|
|
15982
|
-
slotChildren,
|
|
15983
|
-
slotLoc
|
|
15984
|
-
);
|
|
16720
|
+
const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
|
|
15985
16721
|
let vIf;
|
|
15986
16722
|
let vElse;
|
|
15987
16723
|
if (vIf = findDir(slotElement, "if")) {
|
|
@@ -16030,8 +16766,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16030
16766
|
}
|
|
16031
16767
|
} else if (vFor) {
|
|
16032
16768
|
hasDynamicSlots = true;
|
|
16033
|
-
const parseResult = vFor.
|
|
16769
|
+
const parseResult = vFor.forParseResult;
|
|
16034
16770
|
if (parseResult) {
|
|
16771
|
+
finalizeForParseResult(parseResult, context);
|
|
16035
16772
|
dynamicSlots.push(
|
|
16036
16773
|
createCallExpression(context.helper(RENDER_LIST), [
|
|
16037
16774
|
parseResult.source,
|
|
@@ -16294,17 +17031,6 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
16294
17031
|
tag = isProp.value.content.slice(4);
|
|
16295
17032
|
}
|
|
16296
17033
|
}
|
|
16297
|
-
const isDir = !isExplicitDynamic && findDir(node, "is");
|
|
16298
|
-
if (isDir && isDir.exp) {
|
|
16299
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
16300
|
-
context.onWarn(
|
|
16301
|
-
createCompilerError(52, isDir.loc)
|
|
16302
|
-
);
|
|
16303
|
-
}
|
|
16304
|
-
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
16305
|
-
isDir.exp
|
|
16306
|
-
]);
|
|
16307
|
-
}
|
|
16308
17034
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
16309
17035
|
if (builtIn) {
|
|
16310
17036
|
if (!ssr)
|
|
@@ -16376,7 +17102,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16376
17102
|
for (let i = 0; i < props.length; i++) {
|
|
16377
17103
|
const prop = props[i];
|
|
16378
17104
|
if (prop.type === 6) {
|
|
16379
|
-
const { loc, name, value } = prop;
|
|
17105
|
+
const { loc, name, nameLoc, value } = prop;
|
|
16380
17106
|
let isStatic = true;
|
|
16381
17107
|
if (name === "ref") {
|
|
16382
17108
|
hasRef = true;
|
|
@@ -16397,11 +17123,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16397
17123
|
}
|
|
16398
17124
|
properties.push(
|
|
16399
17125
|
createObjectProperty(
|
|
16400
|
-
createSimpleExpression(
|
|
16401
|
-
name,
|
|
16402
|
-
true,
|
|
16403
|
-
getInnerRange(loc, 0, name.length)
|
|
16404
|
-
),
|
|
17126
|
+
createSimpleExpression(name, true, nameLoc),
|
|
16405
17127
|
createSimpleExpression(
|
|
16406
17128
|
value ? value.content : "",
|
|
16407
17129
|
isStatic,
|
|
@@ -16883,8 +17605,13 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
16883
17605
|
};
|
|
16884
17606
|
|
|
16885
17607
|
const transformBind = (dir, _node, context) => {
|
|
16886
|
-
const {
|
|
17608
|
+
const { modifiers, loc } = dir;
|
|
16887
17609
|
const arg = dir.arg;
|
|
17610
|
+
let { exp } = dir;
|
|
17611
|
+
if (!exp && arg.type === 4) {
|
|
17612
|
+
const propName = camelize(arg.content);
|
|
17613
|
+
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
17614
|
+
}
|
|
16888
17615
|
if (arg.type !== 4) {
|
|
16889
17616
|
arg.children.unshift(`(`);
|
|
16890
17617
|
arg.children.push(`) || ""`);
|
|
@@ -17283,7 +18010,7 @@ function getBaseTransformPreset(prefixIdentifiers) {
|
|
|
17283
18010
|
}
|
|
17284
18011
|
];
|
|
17285
18012
|
}
|
|
17286
|
-
function baseCompile(
|
|
18013
|
+
function baseCompile(source, options = {}) {
|
|
17287
18014
|
const onError = options.onError || defaultOnError;
|
|
17288
18015
|
const isModuleMode = options.mode === "module";
|
|
17289
18016
|
{
|
|
@@ -17300,7 +18027,7 @@ function baseCompile(template, options = {}) {
|
|
|
17300
18027
|
if (options.scopeId && !isModuleMode) {
|
|
17301
18028
|
onError(createCompilerError(50));
|
|
17302
18029
|
}
|
|
17303
|
-
const ast = isString(
|
|
18030
|
+
const ast = isString(source) ? baseParse(source, options) : source;
|
|
17304
18031
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
|
17305
18032
|
transform(
|
|
17306
18033
|
ast,
|
|
@@ -17366,25 +18093,22 @@ function decodeHtmlBrowser(raw, asAttr = false) {
|
|
|
17366
18093
|
}
|
|
17367
18094
|
}
|
|
17368
18095
|
|
|
17369
|
-
const isRawTextContainer = /* @__PURE__ */ makeMap(
|
|
17370
|
-
"style,iframe,script,noscript",
|
|
17371
|
-
true
|
|
17372
|
-
);
|
|
17373
18096
|
const parserOptions = {
|
|
18097
|
+
parseMode: "html",
|
|
17374
18098
|
isVoidTag,
|
|
17375
18099
|
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
|
|
17376
18100
|
isPreTag: (tag) => tag === "pre",
|
|
17377
18101
|
decodeEntities: decodeHtmlBrowser ,
|
|
17378
18102
|
isBuiltInComponent: (tag) => {
|
|
17379
|
-
if (
|
|
18103
|
+
if (tag === "Transition" || tag === "transition") {
|
|
17380
18104
|
return TRANSITION;
|
|
17381
|
-
} else if (
|
|
18105
|
+
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
|
17382
18106
|
return TRANSITION_GROUP;
|
|
17383
18107
|
}
|
|
17384
18108
|
},
|
|
17385
18109
|
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
|
17386
|
-
getNamespace(tag, parent) {
|
|
17387
|
-
let ns = parent ? parent.ns :
|
|
18110
|
+
getNamespace(tag, parent, rootNamespace) {
|
|
18111
|
+
let ns = parent ? parent.ns : rootNamespace;
|
|
17388
18112
|
if (parent && ns === 2) {
|
|
17389
18113
|
if (parent.tag === "annotation-xml") {
|
|
17390
18114
|
if (tag === "svg") {
|
|
@@ -17412,18 +18136,6 @@ const parserOptions = {
|
|
|
17412
18136
|
}
|
|
17413
18137
|
}
|
|
17414
18138
|
return ns;
|
|
17415
|
-
},
|
|
17416
|
-
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
|
17417
|
-
getTextMode({ tag, ns }) {
|
|
17418
|
-
if (ns === 0) {
|
|
17419
|
-
if (tag === "textarea" || tag === "title") {
|
|
17420
|
-
return 1;
|
|
17421
|
-
}
|
|
17422
|
-
if (isRawTextContainer(tag)) {
|
|
17423
|
-
return 2;
|
|
17424
|
-
}
|
|
17425
|
-
}
|
|
17426
|
-
return 0;
|
|
17427
18139
|
}
|
|
17428
18140
|
};
|
|
17429
18141
|
|
|
@@ -17744,6 +18456,7 @@ const transformTransition = (node, context) => {
|
|
|
17744
18456
|
node.props.push({
|
|
17745
18457
|
type: 6,
|
|
17746
18458
|
name: "persisted",
|
|
18459
|
+
nameLoc: node.loc,
|
|
17747
18460
|
value: void 0,
|
|
17748
18461
|
loc: node.loc
|
|
17749
18462
|
});
|
|
@@ -17788,9 +18501,9 @@ const DOMDirectiveTransforms = {
|
|
|
17788
18501
|
// override compiler-core
|
|
17789
18502
|
show: transformShow
|
|
17790
18503
|
};
|
|
17791
|
-
function compile(
|
|
18504
|
+
function compile(src, options = {}) {
|
|
17792
18505
|
return baseCompile(
|
|
17793
|
-
|
|
18506
|
+
src,
|
|
17794
18507
|
extend({}, parserOptions, options, {
|
|
17795
18508
|
nodeTransforms: [
|
|
17796
18509
|
// ignore <script> and <tag>
|
|
@@ -17868,4 +18581,4 @@ var Vue$1 = Vue;
|
|
|
17868
18581
|
|
|
17869
18582
|
const { configureCompat } = Vue$1;
|
|
17870
18583
|
|
|
17871
|
-
export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|
|
18584
|
+
export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, computed, configureCompat, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, Vue$1 as default, defineAsyncComponent, defineComponent, defineCustomElement, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSSRCustomElement, defineSlots, devtools, effect, effectScope, getCurrentInstance, getCurrentScope, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrate, initCustomFormatter, initDirectivesForSSR, inject, isMemoSame, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isShallow, isVNode, markRaw, mergeDefaults, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, openBlock, popScopeId, provide, proxyRefs, pushScopeId, queuePostFlushCb, reactive, readonly, ref, registerRuntimeCompiler, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolveTransitionHooks, setBlockTracking, setDevtoolsHook, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, ssrContextKey, ssrUtils, stop, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, transformVNodeArgs, triggerRef, unref, useAttrs, useCssModule, useCssVars, useModel, useSSRContext, useSlots, useTransitionState, vModelCheckbox, vModelDynamic, vModelRadio, vModelSelect, vModelText, vShow, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withKeys, withMemo, withModifiers, withScopeId };
|