vue 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.esm-browser.js +1838 -1111
- package/dist/vue.esm-browser.prod.js +5 -5
- package/dist/vue.global.js +1837 -1110
- package/dist/vue.global.prod.js +5 -5
- package/dist/vue.runtime.esm-browser.js +293 -233
- package/dist/vue.runtime.esm-browser.prod.js +5 -5
- package/dist/vue.runtime.global.js +293 -232
- package/dist/vue.runtime.global.prod.js +5 -5
- package/package.json +8 -14
- package/macros-global.d.ts +0 -19
- package/macros.d.ts +0 -112
- package/ref-macros.d.ts +0 -2
package/dist/vue.esm-browser.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 = 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("iterate" );
|
|
461
|
-
const MAP_KEY_ITERATE_KEY = Symbol("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
|
+
{
|
|
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
|
+
{
|
|
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("iterate" );
|
|
619
|
+
const MAP_KEY_ITERATE_KEY = Symbol("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
|
-
const eventInfo = { effect: activeEffect, target, type, key } ;
|
|
569
|
-
trackEffects(dep, eventInfo);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
function trackEffects(dep, debuggerEventExtraInfo) {
|
|
573
|
-
let shouldTrack2 = false;
|
|
574
|
-
if (effectTrackDepth <= maxMarkerBits) {
|
|
575
|
-
if (!newTracked(dep)) {
|
|
576
|
-
dep.n |= trackOpBit;
|
|
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 (activeEffect.onTrack) {
|
|
586
|
-
activeEffect.onTrack(
|
|
587
|
-
extend(
|
|
588
|
-
{
|
|
589
|
-
effect: activeEffect
|
|
590
|
-
},
|
|
591
|
-
debuggerEventExtraInfo
|
|
592
|
-
)
|
|
593
|
-
);
|
|
628
|
+
depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
|
|
594
629
|
}
|
|
630
|
+
trackEffect(
|
|
631
|
+
activeEffect,
|
|
632
|
+
dep,
|
|
633
|
+
{
|
|
634
|
+
target,
|
|
635
|
+
type,
|
|
636
|
+
key
|
|
637
|
+
}
|
|
638
|
+
);
|
|
595
639
|
}
|
|
596
640
|
}
|
|
597
641
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
@@ -639,49 +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
|
-
triggerEffects(createDep(effects), eventInfo);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
662
|
-
const effects = isArray(dep) ? dep : [...dep];
|
|
663
|
-
for (const effect2 of effects) {
|
|
664
|
-
if (effect2.computed) {
|
|
665
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
for (const effect2 of effects) {
|
|
669
|
-
if (!effect2.computed) {
|
|
670
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
function triggerEffect(effect2, debuggerEventExtraInfo) {
|
|
675
|
-
if (effect2 !== activeEffect || effect2.allowRecurse) {
|
|
676
|
-
if (effect2.onTrigger) {
|
|
677
|
-
effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
678
|
-
}
|
|
679
|
-
if (effect2.scheduler) {
|
|
680
|
-
effect2.scheduler();
|
|
681
|
-
} else {
|
|
682
|
-
effect2.run();
|
|
686
|
+
pauseScheduling();
|
|
687
|
+
for (const dep of deps) {
|
|
688
|
+
if (dep) {
|
|
689
|
+
triggerEffects(
|
|
690
|
+
dep,
|
|
691
|
+
3,
|
|
692
|
+
{
|
|
693
|
+
target,
|
|
694
|
+
type,
|
|
695
|
+
key,
|
|
696
|
+
newValue,
|
|
697
|
+
oldValue,
|
|
698
|
+
oldTarget
|
|
699
|
+
}
|
|
700
|
+
);
|
|
683
701
|
}
|
|
684
702
|
}
|
|
703
|
+
resetScheduling();
|
|
685
704
|
}
|
|
686
705
|
function getDepFromReactive(object, key) {
|
|
687
706
|
var _a;
|
|
@@ -712,7 +731,9 @@ function createArrayInstrumentations() {
|
|
|
712
731
|
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
713
732
|
instrumentations[key] = function(...args) {
|
|
714
733
|
pauseTracking();
|
|
734
|
+
pauseScheduling();
|
|
715
735
|
const res = toRaw(this)[key].apply(this, args);
|
|
736
|
+
resetScheduling();
|
|
716
737
|
resetTracking();
|
|
717
738
|
return res;
|
|
718
739
|
};
|
|
@@ -1251,30 +1272,94 @@ function markRaw(value) {
|
|
|
1251
1272
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1252
1273
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1253
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 = () => {
|
|
1318
|
+
console.warn("Write operation failed: computed value is readonly");
|
|
1319
|
+
} ;
|
|
1320
|
+
} else {
|
|
1321
|
+
getter = getterOrOptions.get;
|
|
1322
|
+
setter = getterOrOptions.set;
|
|
1323
|
+
}
|
|
1324
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1325
|
+
if (debugOptions && !isSSR) {
|
|
1326
|
+
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1327
|
+
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1328
|
+
}
|
|
1329
|
+
return cRef;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1254
1332
|
function trackRefValue(ref2) {
|
|
1255
1333
|
if (shouldTrack && activeEffect) {
|
|
1256
1334
|
ref2 = toRaw(ref2);
|
|
1257
|
-
|
|
1258
|
-
|
|
1335
|
+
trackEffect(
|
|
1336
|
+
activeEffect,
|
|
1337
|
+
ref2.dep || (ref2.dep = createDep(
|
|
1338
|
+
() => ref2.dep = void 0,
|
|
1339
|
+
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1340
|
+
)),
|
|
1341
|
+
{
|
|
1259
1342
|
target: ref2,
|
|
1260
1343
|
type: "get",
|
|
1261
1344
|
key: "value"
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1345
|
+
}
|
|
1346
|
+
);
|
|
1264
1347
|
}
|
|
1265
1348
|
}
|
|
1266
|
-
function triggerRefValue(ref2, newVal) {
|
|
1349
|
+
function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
|
|
1267
1350
|
ref2 = toRaw(ref2);
|
|
1268
1351
|
const dep = ref2.dep;
|
|
1269
1352
|
if (dep) {
|
|
1270
|
-
|
|
1271
|
-
|
|
1353
|
+
triggerEffects(
|
|
1354
|
+
dep,
|
|
1355
|
+
dirtyLevel,
|
|
1356
|
+
{
|
|
1272
1357
|
target: ref2,
|
|
1273
1358
|
type: "set",
|
|
1274
1359
|
key: "value",
|
|
1275
1360
|
newValue: newVal
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1361
|
+
}
|
|
1362
|
+
);
|
|
1278
1363
|
}
|
|
1279
1364
|
}
|
|
1280
1365
|
function isRef(r) {
|
|
@@ -1310,12 +1395,12 @@ class RefImpl {
|
|
|
1310
1395
|
if (hasChanged(newVal, this._rawValue)) {
|
|
1311
1396
|
this._rawValue = newVal;
|
|
1312
1397
|
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1313
|
-
triggerRefValue(this, newVal);
|
|
1398
|
+
triggerRefValue(this, 3, newVal);
|
|
1314
1399
|
}
|
|
1315
1400
|
}
|
|
1316
1401
|
}
|
|
1317
1402
|
function triggerRef(ref2) {
|
|
1318
|
-
triggerRefValue(ref2, ref2.value );
|
|
1403
|
+
triggerRefValue(ref2, 3, ref2.value );
|
|
1319
1404
|
}
|
|
1320
1405
|
function unref(ref2) {
|
|
1321
1406
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1413,67 +1498,16 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1413
1498
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1414
1499
|
}
|
|
1415
1500
|
|
|
1416
|
-
|
|
1417
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1418
|
-
this._setter = _setter;
|
|
1419
|
-
this.dep = void 0;
|
|
1420
|
-
this.__v_isRef = true;
|
|
1421
|
-
this["__v_isReadonly"] = false;
|
|
1422
|
-
this._dirty = true;
|
|
1423
|
-
this.effect = new ReactiveEffect(getter, () => {
|
|
1424
|
-
if (!this._dirty) {
|
|
1425
|
-
this._dirty = true;
|
|
1426
|
-
triggerRefValue(this);
|
|
1427
|
-
}
|
|
1428
|
-
});
|
|
1429
|
-
this.effect.computed = this;
|
|
1430
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1431
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1432
|
-
}
|
|
1433
|
-
get value() {
|
|
1434
|
-
const self = toRaw(this);
|
|
1435
|
-
trackRefValue(self);
|
|
1436
|
-
if (self._dirty || !self._cacheable) {
|
|
1437
|
-
self._dirty = false;
|
|
1438
|
-
self._value = self.effect.run();
|
|
1439
|
-
}
|
|
1440
|
-
return self._value;
|
|
1441
|
-
}
|
|
1442
|
-
set value(newValue) {
|
|
1443
|
-
this._setter(newValue);
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1447
|
-
let getter;
|
|
1448
|
-
let setter;
|
|
1449
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1450
|
-
if (onlyGetter) {
|
|
1451
|
-
getter = getterOrOptions;
|
|
1452
|
-
setter = () => {
|
|
1453
|
-
console.warn("Write operation failed: computed value is readonly");
|
|
1454
|
-
} ;
|
|
1455
|
-
} else {
|
|
1456
|
-
getter = getterOrOptions.get;
|
|
1457
|
-
setter = getterOrOptions.set;
|
|
1458
|
-
}
|
|
1459
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1460
|
-
if (debugOptions && !isSSR) {
|
|
1461
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1462
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1463
|
-
}
|
|
1464
|
-
return cRef;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
const stack = [];
|
|
1501
|
+
const stack$1 = [];
|
|
1468
1502
|
function pushWarningContext(vnode) {
|
|
1469
|
-
stack.push(vnode);
|
|
1503
|
+
stack$1.push(vnode);
|
|
1470
1504
|
}
|
|
1471
1505
|
function popWarningContext() {
|
|
1472
|
-
stack.pop();
|
|
1506
|
+
stack$1.pop();
|
|
1473
1507
|
}
|
|
1474
1508
|
function warn(msg, ...args) {
|
|
1475
1509
|
pauseTracking();
|
|
1476
|
-
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1510
|
+
const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
|
|
1477
1511
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1478
1512
|
const trace = getComponentTrace();
|
|
1479
1513
|
if (appWarnHandler) {
|
|
@@ -1502,7 +1536,7 @@ function warn(msg, ...args) {
|
|
|
1502
1536
|
resetTracking();
|
|
1503
1537
|
}
|
|
1504
1538
|
function getComponentTrace() {
|
|
1505
|
-
let currentVNode = stack[stack.length - 1];
|
|
1539
|
+
let currentVNode = stack$1[stack$1.length - 1];
|
|
1506
1540
|
if (!currentVNode) {
|
|
1507
1541
|
return [];
|
|
1508
1542
|
}
|
|
@@ -1578,7 +1612,7 @@ function assertNumber(val, type) {
|
|
|
1578
1612
|
}
|
|
1579
1613
|
}
|
|
1580
1614
|
|
|
1581
|
-
const ErrorTypeStrings = {
|
|
1615
|
+
const ErrorTypeStrings$1 = {
|
|
1582
1616
|
["sp"]: "serverPrefetch hook",
|
|
1583
1617
|
["bc"]: "beforeCreate hook",
|
|
1584
1618
|
["c"]: "created hook",
|
|
@@ -1639,7 +1673,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1639
1673
|
if (instance) {
|
|
1640
1674
|
let cur = instance.parent;
|
|
1641
1675
|
const exposedInstance = instance.proxy;
|
|
1642
|
-
const errorInfo = ErrorTypeStrings[type] ;
|
|
1676
|
+
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
1643
1677
|
while (cur) {
|
|
1644
1678
|
const errorCapturedHooks = cur.ec;
|
|
1645
1679
|
if (errorCapturedHooks) {
|
|
@@ -1666,7 +1700,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1666
1700
|
}
|
|
1667
1701
|
function logError(err, type, contextVNode, throwInDev = true) {
|
|
1668
1702
|
{
|
|
1669
|
-
const info = ErrorTypeStrings[type];
|
|
1703
|
+
const info = ErrorTypeStrings$1[type];
|
|
1670
1704
|
if (contextVNode) {
|
|
1671
1705
|
pushWarningContext(contextVNode);
|
|
1672
1706
|
}
|
|
@@ -1894,6 +1928,7 @@ function rerender(id, newRender) {
|
|
|
1894
1928
|
}
|
|
1895
1929
|
instance.renderCache = [];
|
|
1896
1930
|
isHmrUpdating = true;
|
|
1931
|
+
instance.effect.dirty = true;
|
|
1897
1932
|
instance.update();
|
|
1898
1933
|
isHmrUpdating = false;
|
|
1899
1934
|
});
|
|
@@ -1921,6 +1956,7 @@ function reload(id, newComp) {
|
|
|
1921
1956
|
instance.ceReload(newComp.styles);
|
|
1922
1957
|
hmrDirtyComponents.delete(oldComp);
|
|
1923
1958
|
} else if (instance.parent) {
|
|
1959
|
+
instance.parent.effect.dirty = true;
|
|
1924
1960
|
queueJob(instance.parent.update);
|
|
1925
1961
|
} else if (instance.appContext.reload) {
|
|
1926
1962
|
instance.appContext.reload();
|
|
@@ -3170,8 +3206,15 @@ function watch(source, cb, options) {
|
|
|
3170
3206
|
}
|
|
3171
3207
|
return doWatch(source, cb, options);
|
|
3172
3208
|
}
|
|
3173
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3209
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3174
3210
|
var _a;
|
|
3211
|
+
if (cb && once) {
|
|
3212
|
+
const _cb = cb;
|
|
3213
|
+
cb = (...args) => {
|
|
3214
|
+
_cb(...args);
|
|
3215
|
+
unwatch();
|
|
3216
|
+
};
|
|
3217
|
+
}
|
|
3175
3218
|
if (!cb) {
|
|
3176
3219
|
if (immediate !== void 0) {
|
|
3177
3220
|
warn(
|
|
@@ -3183,6 +3226,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3183
3226
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3184
3227
|
);
|
|
3185
3228
|
}
|
|
3229
|
+
if (once !== void 0) {
|
|
3230
|
+
warn(
|
|
3231
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3232
|
+
);
|
|
3233
|
+
}
|
|
3186
3234
|
}
|
|
3187
3235
|
const warnInvalidSource = (s) => {
|
|
3188
3236
|
warn(
|
|
@@ -3251,7 +3299,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3251
3299
|
};
|
|
3252
3300
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3253
3301
|
const job = () => {
|
|
3254
|
-
if (!effect.active) {
|
|
3302
|
+
if (!effect.active || !effect.dirty) {
|
|
3255
3303
|
return;
|
|
3256
3304
|
}
|
|
3257
3305
|
if (cb) {
|
|
@@ -3284,7 +3332,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3284
3332
|
job.id = instance.uid;
|
|
3285
3333
|
scheduler = () => queueJob(job);
|
|
3286
3334
|
}
|
|
3287
|
-
const effect = new ReactiveEffect(getter, scheduler);
|
|
3335
|
+
const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
|
3336
|
+
const unwatch = () => {
|
|
3337
|
+
effect.stop();
|
|
3338
|
+
if (instance && instance.scope) {
|
|
3339
|
+
remove(instance.scope.effects, effect);
|
|
3340
|
+
}
|
|
3341
|
+
};
|
|
3288
3342
|
{
|
|
3289
3343
|
effect.onTrack = onTrack;
|
|
3290
3344
|
effect.onTrigger = onTrigger;
|
|
@@ -3303,12 +3357,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3303
3357
|
} else {
|
|
3304
3358
|
effect.run();
|
|
3305
3359
|
}
|
|
3306
|
-
const unwatch = () => {
|
|
3307
|
-
effect.stop();
|
|
3308
|
-
if (instance && instance.scope) {
|
|
3309
|
-
remove(instance.scope.effects, effect);
|
|
3310
|
-
}
|
|
3311
|
-
};
|
|
3312
3360
|
return unwatch;
|
|
3313
3361
|
}
|
|
3314
3362
|
function instanceWatch(source, value, options) {
|
|
@@ -3538,6 +3586,7 @@ const BaseTransitionImpl = {
|
|
|
3538
3586
|
leavingHooks.afterLeave = () => {
|
|
3539
3587
|
state.isLeaving = false;
|
|
3540
3588
|
if (instance.update.active !== false) {
|
|
3589
|
+
instance.effect.dirty = true;
|
|
3541
3590
|
instance.update();
|
|
3542
3591
|
}
|
|
3543
3592
|
};
|
|
@@ -3877,6 +3926,7 @@ function defineAsyncComponent(source) {
|
|
|
3877
3926
|
load().then(() => {
|
|
3878
3927
|
loaded.value = true;
|
|
3879
3928
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
3929
|
+
instance.parent.effect.dirty = true;
|
|
3880
3930
|
queueJob(instance.parent.update);
|
|
3881
3931
|
}
|
|
3882
3932
|
}).catch((err) => {
|
|
@@ -4171,7 +4221,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4171
4221
|
}
|
|
4172
4222
|
return wrappedHook;
|
|
4173
4223
|
} else {
|
|
4174
|
-
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
4224
|
+
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
4175
4225
|
warn(
|
|
4176
4226
|
`${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.` )
|
|
4177
4227
|
);
|
|
@@ -4338,7 +4388,10 @@ const publicPropertiesMap = (
|
|
|
4338
4388
|
$root: (i) => getPublicInstance(i.root),
|
|
4339
4389
|
$emit: (i) => i.emit,
|
|
4340
4390
|
$options: (i) => resolveMergedOptions(i) ,
|
|
4341
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
4391
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
4392
|
+
i.effect.dirty = true;
|
|
4393
|
+
queueJob(i.update);
|
|
4394
|
+
}),
|
|
4342
4395
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
4343
4396
|
$watch: (i) => instanceWatch.bind(i)
|
|
4344
4397
|
})
|
|
@@ -7106,6 +7159,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7106
7159
|
} else {
|
|
7107
7160
|
instance.next = n2;
|
|
7108
7161
|
invalidateJob(instance.update);
|
|
7162
|
+
instance.effect.dirty = true;
|
|
7109
7163
|
instance.update();
|
|
7110
7164
|
}
|
|
7111
7165
|
} else {
|
|
@@ -7275,11 +7329,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7275
7329
|
};
|
|
7276
7330
|
const effect = instance.effect = new ReactiveEffect(
|
|
7277
7331
|
componentUpdateFn,
|
|
7332
|
+
NOOP,
|
|
7278
7333
|
() => queueJob(update),
|
|
7279
7334
|
instance.scope
|
|
7280
7335
|
// track it in component's effect scope
|
|
7281
7336
|
);
|
|
7282
|
-
const update = instance.update = () =>
|
|
7337
|
+
const update = instance.update = () => {
|
|
7338
|
+
if (effect.dirty) {
|
|
7339
|
+
effect.run();
|
|
7340
|
+
}
|
|
7341
|
+
};
|
|
7283
7342
|
update.id = instance.uid;
|
|
7284
7343
|
toggleRecurse(instance, true);
|
|
7285
7344
|
{
|
|
@@ -9170,7 +9229,8 @@ function isMemoSame(cached, memo) {
|
|
|
9170
9229
|
return true;
|
|
9171
9230
|
}
|
|
9172
9231
|
|
|
9173
|
-
const version = "3.
|
|
9232
|
+
const version = "3.4.0-alpha.2";
|
|
9233
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9174
9234
|
const ssrUtils = null;
|
|
9175
9235
|
const resolveFilter = null;
|
|
9176
9236
|
const compatUtils = null;
|
|
@@ -10661,6 +10721,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
10661
10721
|
BaseTransitionPropsValidators: BaseTransitionPropsValidators,
|
|
10662
10722
|
Comment: Comment,
|
|
10663
10723
|
EffectScope: EffectScope,
|
|
10724
|
+
ErrorTypeStrings: ErrorTypeStrings,
|
|
10664
10725
|
Fragment: Fragment,
|
|
10665
10726
|
KeepAlive: KeepAlive,
|
|
10666
10727
|
ReactiveEffect: ReactiveEffect,
|
|
@@ -10824,83 +10885,6 @@ Make sure to use the production build (*.prod.js) when deploying for production.
|
|
|
10824
10885
|
}
|
|
10825
10886
|
}
|
|
10826
10887
|
|
|
10827
|
-
function defaultOnError(error) {
|
|
10828
|
-
throw error;
|
|
10829
|
-
}
|
|
10830
|
-
function defaultOnWarn(msg) {
|
|
10831
|
-
console.warn(`[Vue warn] ${msg.message}`);
|
|
10832
|
-
}
|
|
10833
|
-
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
10834
|
-
const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
|
|
10835
|
-
const error = new SyntaxError(String(msg));
|
|
10836
|
-
error.code = code;
|
|
10837
|
-
error.loc = loc;
|
|
10838
|
-
return error;
|
|
10839
|
-
}
|
|
10840
|
-
const errorMessages = {
|
|
10841
|
-
// parse errors
|
|
10842
|
-
[0]: "Illegal comment.",
|
|
10843
|
-
[1]: "CDATA section is allowed only in XML context.",
|
|
10844
|
-
[2]: "Duplicate attribute.",
|
|
10845
|
-
[3]: "End tag cannot have attributes.",
|
|
10846
|
-
[4]: "Illegal '/' in tags.",
|
|
10847
|
-
[5]: "Unexpected EOF in tag.",
|
|
10848
|
-
[6]: "Unexpected EOF in CDATA section.",
|
|
10849
|
-
[7]: "Unexpected EOF in comment.",
|
|
10850
|
-
[8]: "Unexpected EOF in script.",
|
|
10851
|
-
[9]: "Unexpected EOF in tag.",
|
|
10852
|
-
[10]: "Incorrectly closed comment.",
|
|
10853
|
-
[11]: "Incorrectly opened comment.",
|
|
10854
|
-
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
10855
|
-
[13]: "Attribute value was expected.",
|
|
10856
|
-
[14]: "End tag name was expected.",
|
|
10857
|
-
[15]: "Whitespace was expected.",
|
|
10858
|
-
[16]: "Unexpected '<!--' in comment.",
|
|
10859
|
-
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
10860
|
-
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
10861
|
-
[19]: "Attribute name cannot start with '='.",
|
|
10862
|
-
[21]: "'<?' is allowed only in XML context.",
|
|
10863
|
-
[20]: `Unexpected null character.`,
|
|
10864
|
-
[22]: "Illegal '/' in tags.",
|
|
10865
|
-
// Vue-specific parse errors
|
|
10866
|
-
[23]: "Invalid end tag.",
|
|
10867
|
-
[24]: "Element is missing end tag.",
|
|
10868
|
-
[25]: "Interpolation end sign was not found.",
|
|
10869
|
-
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
10870
|
-
[26]: "Legal directive name was expected.",
|
|
10871
|
-
// transform errors
|
|
10872
|
-
[28]: `v-if/v-else-if is missing expression.`,
|
|
10873
|
-
[29]: `v-if/else branches must use unique keys.`,
|
|
10874
|
-
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
10875
|
-
[31]: `v-for is missing expression.`,
|
|
10876
|
-
[32]: `v-for has invalid expression.`,
|
|
10877
|
-
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
10878
|
-
[34]: `v-bind is missing expression.`,
|
|
10879
|
-
[35]: `v-on is missing expression.`,
|
|
10880
|
-
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
10881
|
-
[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.`,
|
|
10882
|
-
[38]: `Duplicate slot names found. `,
|
|
10883
|
-
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
10884
|
-
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
10885
|
-
[41]: `v-model is missing expression.`,
|
|
10886
|
-
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
10887
|
-
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
10888
|
-
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
10889
|
-
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
10890
|
-
[45]: `Error parsing JavaScript expression: `,
|
|
10891
|
-
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
10892
|
-
// generic errors
|
|
10893
|
-
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
10894
|
-
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
10895
|
-
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
10896
|
-
[50]: `"scopeId" option is only supported in module mode.`,
|
|
10897
|
-
// deprecations
|
|
10898
|
-
[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.`,
|
|
10899
|
-
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
10900
|
-
// just to fulfill types
|
|
10901
|
-
[53]: ``
|
|
10902
|
-
};
|
|
10903
|
-
|
|
10904
10888
|
const FRAGMENT = Symbol(`Fragment` );
|
|
10905
10889
|
const TELEPORT = Symbol(`Teleport` );
|
|
10906
10890
|
const SUSPENSE = Symbol(`Suspense` );
|
|
@@ -10990,13 +10974,14 @@ function registerRuntimeHelpers(helpers) {
|
|
|
10990
10974
|
}
|
|
10991
10975
|
|
|
10992
10976
|
const locStub = {
|
|
10993
|
-
source: "",
|
|
10994
10977
|
start: { line: 1, column: 1, offset: 0 },
|
|
10995
|
-
end: { line: 1, column: 1, offset: 0 }
|
|
10978
|
+
end: { line: 1, column: 1, offset: 0 },
|
|
10979
|
+
source: ""
|
|
10996
10980
|
};
|
|
10997
|
-
function createRoot(children,
|
|
10981
|
+
function createRoot(children, source = "") {
|
|
10998
10982
|
return {
|
|
10999
10983
|
type: 0,
|
|
10984
|
+
source,
|
|
11000
10985
|
children,
|
|
11001
10986
|
helpers: /* @__PURE__ */ new Set(),
|
|
11002
10987
|
components: [],
|
|
@@ -11006,7 +10991,7 @@ function createRoot(children, loc = locStub) {
|
|
|
11006
10991
|
cached: 0,
|
|
11007
10992
|
temps: 0,
|
|
11008
10993
|
codegenNode: void 0,
|
|
11009
|
-
loc
|
|
10994
|
+
loc: locStub
|
|
11010
10995
|
};
|
|
11011
10996
|
}
|
|
11012
10997
|
function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
|
|
@@ -11132,17 +11117,902 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
|
11132
11117
|
}
|
|
11133
11118
|
}
|
|
11134
11119
|
|
|
11120
|
+
const defaultDelimitersOpen = new Uint8Array([123, 123]);
|
|
11121
|
+
const defaultDelimitersClose = new Uint8Array([125, 125]);
|
|
11122
|
+
function isTagStartChar(c) {
|
|
11123
|
+
return c >= 97 && c <= 122 || c >= 65 && c <= 90;
|
|
11124
|
+
}
|
|
11125
|
+
function isWhitespace(c) {
|
|
11126
|
+
return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
|
|
11127
|
+
}
|
|
11128
|
+
function isEndOfTagSection(c) {
|
|
11129
|
+
return c === 47 || c === 62 || isWhitespace(c);
|
|
11130
|
+
}
|
|
11131
|
+
function toCharCodes(str) {
|
|
11132
|
+
const ret = new Uint8Array(str.length);
|
|
11133
|
+
for (let i = 0; i < str.length; i++) {
|
|
11134
|
+
ret[i] = str.charCodeAt(i);
|
|
11135
|
+
}
|
|
11136
|
+
return ret;
|
|
11137
|
+
}
|
|
11138
|
+
const Sequences = {
|
|
11139
|
+
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
|
|
11140
|
+
// CDATA[
|
|
11141
|
+
CdataEnd: new Uint8Array([93, 93, 62]),
|
|
11142
|
+
// ]]>
|
|
11143
|
+
CommentEnd: new Uint8Array([45, 45, 62]),
|
|
11144
|
+
// `-->`
|
|
11145
|
+
ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
|
|
11146
|
+
// `<\/script`
|
|
11147
|
+
StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
|
|
11148
|
+
// `</style`
|
|
11149
|
+
TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
|
|
11150
|
+
// `</title`
|
|
11151
|
+
TextareaEnd: new Uint8Array([
|
|
11152
|
+
60,
|
|
11153
|
+
47,
|
|
11154
|
+
116,
|
|
11155
|
+
101,
|
|
11156
|
+
120,
|
|
11157
|
+
116,
|
|
11158
|
+
97,
|
|
11159
|
+
114,
|
|
11160
|
+
101,
|
|
11161
|
+
97
|
|
11162
|
+
])
|
|
11163
|
+
// `</textarea
|
|
11164
|
+
};
|
|
11165
|
+
class Tokenizer {
|
|
11166
|
+
constructor(stack, cbs) {
|
|
11167
|
+
this.stack = stack;
|
|
11168
|
+
this.cbs = cbs;
|
|
11169
|
+
/** The current state the tokenizer is in. */
|
|
11170
|
+
this.state = 1;
|
|
11171
|
+
/** The read buffer. */
|
|
11172
|
+
this.buffer = "";
|
|
11173
|
+
/** The beginning of the section that is currently being read. */
|
|
11174
|
+
this.sectionStart = 0;
|
|
11175
|
+
/** The index within the buffer that we are currently looking at. */
|
|
11176
|
+
this.index = 0;
|
|
11177
|
+
/** The start of the last entity. */
|
|
11178
|
+
this.entityStart = 0;
|
|
11179
|
+
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
|
|
11180
|
+
this.baseState = 1;
|
|
11181
|
+
/** For special parsing behavior inside of script and style tags. */
|
|
11182
|
+
this.inRCDATA = false;
|
|
11183
|
+
/** For disabling RCDATA tags handling */
|
|
11184
|
+
this.inXML = false;
|
|
11185
|
+
/** Reocrd newline positions for fast line / column calculation */
|
|
11186
|
+
this.newlines = [];
|
|
11187
|
+
this.mode = 0;
|
|
11188
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
11189
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
11190
|
+
this.delimiterIndex = -1;
|
|
11191
|
+
this.currentSequence = void 0;
|
|
11192
|
+
this.sequenceIndex = 0;
|
|
11193
|
+
}
|
|
11194
|
+
get inSFCRoot() {
|
|
11195
|
+
return this.mode === 2 && this.stack.length === 0;
|
|
11196
|
+
}
|
|
11197
|
+
reset() {
|
|
11198
|
+
this.state = 1;
|
|
11199
|
+
this.mode = 0;
|
|
11200
|
+
this.buffer = "";
|
|
11201
|
+
this.sectionStart = 0;
|
|
11202
|
+
this.index = 0;
|
|
11203
|
+
this.baseState = 1;
|
|
11204
|
+
this.currentSequence = void 0;
|
|
11205
|
+
this.newlines.length = 0;
|
|
11206
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
11207
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
11208
|
+
}
|
|
11209
|
+
/**
|
|
11210
|
+
* Generate Position object with line / column information using recorded
|
|
11211
|
+
* newline positions. We know the index is always going to be an already
|
|
11212
|
+
* processed index, so all the newlines up to this index should have been
|
|
11213
|
+
* recorded.
|
|
11214
|
+
*/
|
|
11215
|
+
getPos(index) {
|
|
11216
|
+
let line = 1;
|
|
11217
|
+
let column = index + 1;
|
|
11218
|
+
for (let i = this.newlines.length - 1; i >= 0; i--) {
|
|
11219
|
+
const newlineIndex = this.newlines[i];
|
|
11220
|
+
if (index > newlineIndex) {
|
|
11221
|
+
line = i + 2;
|
|
11222
|
+
column = index - newlineIndex;
|
|
11223
|
+
break;
|
|
11224
|
+
}
|
|
11225
|
+
}
|
|
11226
|
+
return {
|
|
11227
|
+
column,
|
|
11228
|
+
line,
|
|
11229
|
+
offset: index
|
|
11230
|
+
};
|
|
11231
|
+
}
|
|
11232
|
+
peek() {
|
|
11233
|
+
return this.buffer.charCodeAt(this.index + 1);
|
|
11234
|
+
}
|
|
11235
|
+
stateText(c) {
|
|
11236
|
+
if (c === 60) {
|
|
11237
|
+
if (this.index > this.sectionStart) {
|
|
11238
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
11239
|
+
}
|
|
11240
|
+
this.state = 5;
|
|
11241
|
+
this.sectionStart = this.index;
|
|
11242
|
+
} else if (c === this.delimiterOpen[0]) {
|
|
11243
|
+
this.state = 2;
|
|
11244
|
+
this.delimiterIndex = 0;
|
|
11245
|
+
this.stateInterpolationOpen(c);
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
stateInterpolationOpen(c) {
|
|
11249
|
+
if (c === this.delimiterOpen[this.delimiterIndex]) {
|
|
11250
|
+
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
|
|
11251
|
+
const start = this.index + 1 - this.delimiterOpen.length;
|
|
11252
|
+
if (start > this.sectionStart) {
|
|
11253
|
+
this.cbs.ontext(this.sectionStart, start);
|
|
11254
|
+
}
|
|
11255
|
+
this.state = 3;
|
|
11256
|
+
this.sectionStart = start;
|
|
11257
|
+
} else {
|
|
11258
|
+
this.delimiterIndex++;
|
|
11259
|
+
}
|
|
11260
|
+
} else if (this.inRCDATA) {
|
|
11261
|
+
this.state = 32;
|
|
11262
|
+
this.stateInRCDATA(c);
|
|
11263
|
+
} else {
|
|
11264
|
+
this.state = 1;
|
|
11265
|
+
this.stateText(c);
|
|
11266
|
+
}
|
|
11267
|
+
}
|
|
11268
|
+
stateInterpolation(c) {
|
|
11269
|
+
if (c === this.delimiterClose[0]) {
|
|
11270
|
+
this.state = 4;
|
|
11271
|
+
this.delimiterIndex = 0;
|
|
11272
|
+
this.stateInterpolationClose(c);
|
|
11273
|
+
}
|
|
11274
|
+
}
|
|
11275
|
+
stateInterpolationClose(c) {
|
|
11276
|
+
if (c === this.delimiterClose[this.delimiterIndex]) {
|
|
11277
|
+
if (this.delimiterIndex === this.delimiterClose.length - 1) {
|
|
11278
|
+
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
|
|
11279
|
+
if (this.inRCDATA) {
|
|
11280
|
+
this.state = 32;
|
|
11281
|
+
} else {
|
|
11282
|
+
this.state = 1;
|
|
11283
|
+
}
|
|
11284
|
+
this.sectionStart = this.index + 1;
|
|
11285
|
+
} else {
|
|
11286
|
+
this.delimiterIndex++;
|
|
11287
|
+
}
|
|
11288
|
+
} else {
|
|
11289
|
+
this.state = 3;
|
|
11290
|
+
this.stateInterpolation(c);
|
|
11291
|
+
}
|
|
11292
|
+
}
|
|
11293
|
+
stateSpecialStartSequence(c) {
|
|
11294
|
+
const isEnd = this.sequenceIndex === this.currentSequence.length;
|
|
11295
|
+
const isMatch = isEnd ? (
|
|
11296
|
+
// If we are at the end of the sequence, make sure the tag name has ended
|
|
11297
|
+
isEndOfTagSection(c)
|
|
11298
|
+
) : (
|
|
11299
|
+
// Otherwise, do a case-insensitive comparison
|
|
11300
|
+
(c | 32) === this.currentSequence[this.sequenceIndex]
|
|
11301
|
+
);
|
|
11302
|
+
if (!isMatch) {
|
|
11303
|
+
this.inRCDATA = false;
|
|
11304
|
+
} else if (!isEnd) {
|
|
11305
|
+
this.sequenceIndex++;
|
|
11306
|
+
return;
|
|
11307
|
+
}
|
|
11308
|
+
this.sequenceIndex = 0;
|
|
11309
|
+
this.state = 6;
|
|
11310
|
+
this.stateInTagName(c);
|
|
11311
|
+
}
|
|
11312
|
+
/** Look for an end tag. For <title> and <textarea>, also decode entities. */
|
|
11313
|
+
stateInRCDATA(c) {
|
|
11314
|
+
if (this.sequenceIndex === this.currentSequence.length) {
|
|
11315
|
+
if (c === 62 || isWhitespace(c)) {
|
|
11316
|
+
const endOfText = this.index - this.currentSequence.length;
|
|
11317
|
+
if (this.sectionStart < endOfText) {
|
|
11318
|
+
const actualIndex = this.index;
|
|
11319
|
+
this.index = endOfText;
|
|
11320
|
+
this.cbs.ontext(this.sectionStart, endOfText);
|
|
11321
|
+
this.index = actualIndex;
|
|
11322
|
+
}
|
|
11323
|
+
this.sectionStart = endOfText + 2;
|
|
11324
|
+
this.stateInClosingTagName(c);
|
|
11325
|
+
this.inRCDATA = false;
|
|
11326
|
+
return;
|
|
11327
|
+
}
|
|
11328
|
+
this.sequenceIndex = 0;
|
|
11329
|
+
}
|
|
11330
|
+
if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
|
|
11331
|
+
this.sequenceIndex += 1;
|
|
11332
|
+
} else if (this.sequenceIndex === 0) {
|
|
11333
|
+
if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
|
|
11334
|
+
if (c === this.delimiterOpen[0]) {
|
|
11335
|
+
this.state = 2;
|
|
11336
|
+
this.delimiterIndex = 0;
|
|
11337
|
+
this.stateInterpolationOpen(c);
|
|
11338
|
+
}
|
|
11339
|
+
} else if (this.fastForwardTo(60)) {
|
|
11340
|
+
this.sequenceIndex = 1;
|
|
11341
|
+
}
|
|
11342
|
+
} else {
|
|
11343
|
+
this.sequenceIndex = Number(c === 60);
|
|
11344
|
+
}
|
|
11345
|
+
}
|
|
11346
|
+
stateCDATASequence(c) {
|
|
11347
|
+
if (c === Sequences.Cdata[this.sequenceIndex]) {
|
|
11348
|
+
if (++this.sequenceIndex === Sequences.Cdata.length) {
|
|
11349
|
+
this.state = 28;
|
|
11350
|
+
this.currentSequence = Sequences.CdataEnd;
|
|
11351
|
+
this.sequenceIndex = 0;
|
|
11352
|
+
this.sectionStart = this.index + 1;
|
|
11353
|
+
}
|
|
11354
|
+
} else {
|
|
11355
|
+
this.sequenceIndex = 0;
|
|
11356
|
+
this.state = 23;
|
|
11357
|
+
this.stateInDeclaration(c);
|
|
11358
|
+
}
|
|
11359
|
+
}
|
|
11360
|
+
/**
|
|
11361
|
+
* When we wait for one specific character, we can speed things up
|
|
11362
|
+
* by skipping through the buffer until we find it.
|
|
11363
|
+
*
|
|
11364
|
+
* @returns Whether the character was found.
|
|
11365
|
+
*/
|
|
11366
|
+
fastForwardTo(c) {
|
|
11367
|
+
while (++this.index < this.buffer.length) {
|
|
11368
|
+
const cc = this.buffer.charCodeAt(this.index);
|
|
11369
|
+
if (cc === 10) {
|
|
11370
|
+
this.newlines.push(this.index);
|
|
11371
|
+
}
|
|
11372
|
+
if (cc === c) {
|
|
11373
|
+
return true;
|
|
11374
|
+
}
|
|
11375
|
+
}
|
|
11376
|
+
this.index = this.buffer.length - 1;
|
|
11377
|
+
return false;
|
|
11378
|
+
}
|
|
11379
|
+
/**
|
|
11380
|
+
* Comments and CDATA end with `-->` and `]]>`.
|
|
11381
|
+
*
|
|
11382
|
+
* Their common qualities are:
|
|
11383
|
+
* - Their end sequences have a distinct character they start with.
|
|
11384
|
+
* - That character is then repeated, so we have to check multiple repeats.
|
|
11385
|
+
* - All characters but the start character of the sequence can be skipped.
|
|
11386
|
+
*/
|
|
11387
|
+
stateInCommentLike(c) {
|
|
11388
|
+
if (c === this.currentSequence[this.sequenceIndex]) {
|
|
11389
|
+
if (++this.sequenceIndex === this.currentSequence.length) {
|
|
11390
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
11391
|
+
this.cbs.oncdata(this.sectionStart, this.index - 2);
|
|
11392
|
+
} else {
|
|
11393
|
+
this.cbs.oncomment(this.sectionStart, this.index - 2);
|
|
11394
|
+
}
|
|
11395
|
+
this.sequenceIndex = 0;
|
|
11396
|
+
this.sectionStart = this.index + 1;
|
|
11397
|
+
this.state = 1;
|
|
11398
|
+
}
|
|
11399
|
+
} else if (this.sequenceIndex === 0) {
|
|
11400
|
+
if (this.fastForwardTo(this.currentSequence[0])) {
|
|
11401
|
+
this.sequenceIndex = 1;
|
|
11402
|
+
}
|
|
11403
|
+
} else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
|
|
11404
|
+
this.sequenceIndex = 0;
|
|
11405
|
+
}
|
|
11406
|
+
}
|
|
11407
|
+
startSpecial(sequence, offset) {
|
|
11408
|
+
this.enterRCDATA(sequence, offset);
|
|
11409
|
+
this.state = 31;
|
|
11410
|
+
}
|
|
11411
|
+
enterRCDATA(sequence, offset) {
|
|
11412
|
+
this.inRCDATA = true;
|
|
11413
|
+
this.currentSequence = sequence;
|
|
11414
|
+
this.sequenceIndex = offset;
|
|
11415
|
+
}
|
|
11416
|
+
stateBeforeTagName(c) {
|
|
11417
|
+
if (c === 33) {
|
|
11418
|
+
this.state = 22;
|
|
11419
|
+
this.sectionStart = this.index + 1;
|
|
11420
|
+
} else if (c === 63) {
|
|
11421
|
+
this.state = 24;
|
|
11422
|
+
this.sectionStart = this.index + 1;
|
|
11423
|
+
} else if (isTagStartChar(c)) {
|
|
11424
|
+
this.sectionStart = this.index;
|
|
11425
|
+
if (this.mode === 0) {
|
|
11426
|
+
this.state = 6;
|
|
11427
|
+
} else if (this.inSFCRoot) {
|
|
11428
|
+
this.state = 34;
|
|
11429
|
+
} else if (!this.inXML) {
|
|
11430
|
+
const lower = c | 32;
|
|
11431
|
+
if (lower === 116) {
|
|
11432
|
+
this.state = 30;
|
|
11433
|
+
} else {
|
|
11434
|
+
this.state = lower === 115 ? 29 : 6;
|
|
11435
|
+
}
|
|
11436
|
+
} else {
|
|
11437
|
+
this.state = 6;
|
|
11438
|
+
}
|
|
11439
|
+
} else if (c === 47) {
|
|
11440
|
+
this.state = 8;
|
|
11441
|
+
} else {
|
|
11442
|
+
this.state = 1;
|
|
11443
|
+
this.stateText(c);
|
|
11444
|
+
}
|
|
11445
|
+
}
|
|
11446
|
+
stateInTagName(c) {
|
|
11447
|
+
if (isEndOfTagSection(c)) {
|
|
11448
|
+
this.handleTagName(c);
|
|
11449
|
+
}
|
|
11450
|
+
}
|
|
11451
|
+
stateInSFCRootTagName(c) {
|
|
11452
|
+
if (isEndOfTagSection(c)) {
|
|
11453
|
+
const tag = this.buffer.slice(this.sectionStart, this.index);
|
|
11454
|
+
if (tag !== "template") {
|
|
11455
|
+
this.enterRCDATA(toCharCodes(`</` + tag), 0);
|
|
11456
|
+
}
|
|
11457
|
+
this.handleTagName(c);
|
|
11458
|
+
}
|
|
11459
|
+
}
|
|
11460
|
+
handleTagName(c) {
|
|
11461
|
+
this.cbs.onopentagname(this.sectionStart, this.index);
|
|
11462
|
+
this.sectionStart = -1;
|
|
11463
|
+
this.state = 11;
|
|
11464
|
+
this.stateBeforeAttrName(c);
|
|
11465
|
+
}
|
|
11466
|
+
stateBeforeClosingTagName(c) {
|
|
11467
|
+
if (isWhitespace(c)) ; else if (c === 62) {
|
|
11468
|
+
{
|
|
11469
|
+
this.cbs.onerr(14, this.index);
|
|
11470
|
+
}
|
|
11471
|
+
this.state = 1;
|
|
11472
|
+
this.sectionStart = this.index + 1;
|
|
11473
|
+
} else {
|
|
11474
|
+
this.state = isTagStartChar(c) ? 9 : 27;
|
|
11475
|
+
this.sectionStart = this.index;
|
|
11476
|
+
}
|
|
11477
|
+
}
|
|
11478
|
+
stateInClosingTagName(c) {
|
|
11479
|
+
if (c === 62 || isWhitespace(c)) {
|
|
11480
|
+
this.cbs.onclosetag(this.sectionStart, this.index);
|
|
11481
|
+
this.sectionStart = -1;
|
|
11482
|
+
this.state = 10;
|
|
11483
|
+
this.stateAfterClosingTagName(c);
|
|
11484
|
+
}
|
|
11485
|
+
}
|
|
11486
|
+
stateAfterClosingTagName(c) {
|
|
11487
|
+
if (c === 62) {
|
|
11488
|
+
this.state = 1;
|
|
11489
|
+
this.sectionStart = this.index + 1;
|
|
11490
|
+
}
|
|
11491
|
+
}
|
|
11492
|
+
stateBeforeAttrName(c) {
|
|
11493
|
+
if (c === 62) {
|
|
11494
|
+
this.cbs.onopentagend(this.index);
|
|
11495
|
+
if (this.inRCDATA) {
|
|
11496
|
+
this.state = 32;
|
|
11497
|
+
} else {
|
|
11498
|
+
this.state = 1;
|
|
11499
|
+
}
|
|
11500
|
+
this.sectionStart = this.index + 1;
|
|
11501
|
+
} else if (c === 47) {
|
|
11502
|
+
this.state = 7;
|
|
11503
|
+
if (this.peek() !== 62) {
|
|
11504
|
+
this.cbs.onerr(22, this.index);
|
|
11505
|
+
}
|
|
11506
|
+
} else if (c === 60 && this.peek() === 47) {
|
|
11507
|
+
this.cbs.onopentagend(this.index);
|
|
11508
|
+
this.state = 5;
|
|
11509
|
+
this.sectionStart = this.index;
|
|
11510
|
+
} else if (!isWhitespace(c)) {
|
|
11511
|
+
if (c === 61) {
|
|
11512
|
+
this.cbs.onerr(
|
|
11513
|
+
19,
|
|
11514
|
+
this.index
|
|
11515
|
+
);
|
|
11516
|
+
}
|
|
11517
|
+
this.handleAttrStart(c);
|
|
11518
|
+
}
|
|
11519
|
+
}
|
|
11520
|
+
handleAttrStart(c) {
|
|
11521
|
+
if (c === 118 && this.peek() === 45) {
|
|
11522
|
+
this.state = 13;
|
|
11523
|
+
this.sectionStart = this.index;
|
|
11524
|
+
} else if (c === 46 || c === 58 || c === 64 || c === 35) {
|
|
11525
|
+
this.cbs.ondirname(this.index, this.index + 1);
|
|
11526
|
+
this.state = 14;
|
|
11527
|
+
this.sectionStart = this.index + 1;
|
|
11528
|
+
} else {
|
|
11529
|
+
this.state = 12;
|
|
11530
|
+
this.sectionStart = this.index;
|
|
11531
|
+
}
|
|
11532
|
+
}
|
|
11533
|
+
stateInSelfClosingTag(c) {
|
|
11534
|
+
if (c === 62) {
|
|
11535
|
+
this.cbs.onselfclosingtag(this.index);
|
|
11536
|
+
this.state = 1;
|
|
11537
|
+
this.sectionStart = this.index + 1;
|
|
11538
|
+
this.inRCDATA = false;
|
|
11539
|
+
} else if (!isWhitespace(c)) {
|
|
11540
|
+
this.state = 11;
|
|
11541
|
+
this.stateBeforeAttrName(c);
|
|
11542
|
+
}
|
|
11543
|
+
}
|
|
11544
|
+
stateInAttrName(c) {
|
|
11545
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
11546
|
+
this.cbs.onattribname(this.sectionStart, this.index);
|
|
11547
|
+
this.handleAttrNameEnd(c);
|
|
11548
|
+
} else if (c === 34 || c === 39 || c === 60) {
|
|
11549
|
+
this.cbs.onerr(
|
|
11550
|
+
17,
|
|
11551
|
+
this.index
|
|
11552
|
+
);
|
|
11553
|
+
}
|
|
11554
|
+
}
|
|
11555
|
+
stateInDirName(c) {
|
|
11556
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
11557
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
11558
|
+
this.handleAttrNameEnd(c);
|
|
11559
|
+
} else if (c === 58) {
|
|
11560
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
11561
|
+
this.state = 14;
|
|
11562
|
+
this.sectionStart = this.index + 1;
|
|
11563
|
+
} else if (c === 46) {
|
|
11564
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
11565
|
+
this.state = 16;
|
|
11566
|
+
this.sectionStart = this.index + 1;
|
|
11567
|
+
}
|
|
11568
|
+
}
|
|
11569
|
+
stateInDirArg(c) {
|
|
11570
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
11571
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
11572
|
+
this.handleAttrNameEnd(c);
|
|
11573
|
+
} else if (c === 91) {
|
|
11574
|
+
this.state = 15;
|
|
11575
|
+
} else if (c === 46) {
|
|
11576
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
11577
|
+
this.state = 16;
|
|
11578
|
+
this.sectionStart = this.index + 1;
|
|
11579
|
+
}
|
|
11580
|
+
}
|
|
11581
|
+
stateInDynamicDirArg(c) {
|
|
11582
|
+
if (c === 93) {
|
|
11583
|
+
this.state = 14;
|
|
11584
|
+
} else if (c === 61 || isEndOfTagSection(c)) {
|
|
11585
|
+
this.cbs.ondirarg(this.sectionStart, this.index + 1);
|
|
11586
|
+
this.handleAttrNameEnd(c);
|
|
11587
|
+
{
|
|
11588
|
+
this.cbs.onerr(
|
|
11589
|
+
27,
|
|
11590
|
+
this.index
|
|
11591
|
+
);
|
|
11592
|
+
}
|
|
11593
|
+
}
|
|
11594
|
+
}
|
|
11595
|
+
stateInDirModifier(c) {
|
|
11596
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
11597
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
11598
|
+
this.handleAttrNameEnd(c);
|
|
11599
|
+
} else if (c === 46) {
|
|
11600
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
11601
|
+
this.sectionStart = this.index + 1;
|
|
11602
|
+
}
|
|
11603
|
+
}
|
|
11604
|
+
handleAttrNameEnd(c) {
|
|
11605
|
+
this.sectionStart = this.index;
|
|
11606
|
+
this.state = 17;
|
|
11607
|
+
this.cbs.onattribnameend(this.index);
|
|
11608
|
+
this.stateAfterAttrName(c);
|
|
11609
|
+
}
|
|
11610
|
+
stateAfterAttrName(c) {
|
|
11611
|
+
if (c === 61) {
|
|
11612
|
+
this.state = 18;
|
|
11613
|
+
} else if (c === 47 || c === 62) {
|
|
11614
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
11615
|
+
this.sectionStart = -1;
|
|
11616
|
+
this.state = 11;
|
|
11617
|
+
this.stateBeforeAttrName(c);
|
|
11618
|
+
} else if (!isWhitespace(c)) {
|
|
11619
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
11620
|
+
this.handleAttrStart(c);
|
|
11621
|
+
}
|
|
11622
|
+
}
|
|
11623
|
+
stateBeforeAttrValue(c) {
|
|
11624
|
+
if (c === 34) {
|
|
11625
|
+
this.state = 19;
|
|
11626
|
+
this.sectionStart = this.index + 1;
|
|
11627
|
+
} else if (c === 39) {
|
|
11628
|
+
this.state = 20;
|
|
11629
|
+
this.sectionStart = this.index + 1;
|
|
11630
|
+
} else if (!isWhitespace(c)) {
|
|
11631
|
+
this.sectionStart = this.index;
|
|
11632
|
+
this.state = 21;
|
|
11633
|
+
this.stateInAttrValueNoQuotes(c);
|
|
11634
|
+
}
|
|
11635
|
+
}
|
|
11636
|
+
handleInAttrValue(c, quote) {
|
|
11637
|
+
if (c === quote || this.fastForwardTo(quote)) {
|
|
11638
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
11639
|
+
this.sectionStart = -1;
|
|
11640
|
+
this.cbs.onattribend(
|
|
11641
|
+
quote === 34 ? 3 : 2,
|
|
11642
|
+
this.index + 1
|
|
11643
|
+
);
|
|
11644
|
+
this.state = 11;
|
|
11645
|
+
}
|
|
11646
|
+
}
|
|
11647
|
+
stateInAttrValueDoubleQuotes(c) {
|
|
11648
|
+
this.handleInAttrValue(c, 34);
|
|
11649
|
+
}
|
|
11650
|
+
stateInAttrValueSingleQuotes(c) {
|
|
11651
|
+
this.handleInAttrValue(c, 39);
|
|
11652
|
+
}
|
|
11653
|
+
stateInAttrValueNoQuotes(c) {
|
|
11654
|
+
if (isWhitespace(c) || c === 62) {
|
|
11655
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
11656
|
+
this.sectionStart = -1;
|
|
11657
|
+
this.cbs.onattribend(1, this.index);
|
|
11658
|
+
this.state = 11;
|
|
11659
|
+
this.stateBeforeAttrName(c);
|
|
11660
|
+
} else if (c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
|
|
11661
|
+
this.cbs.onerr(
|
|
11662
|
+
18,
|
|
11663
|
+
this.index
|
|
11664
|
+
);
|
|
11665
|
+
} else ;
|
|
11666
|
+
}
|
|
11667
|
+
stateBeforeDeclaration(c) {
|
|
11668
|
+
if (c === 91) {
|
|
11669
|
+
this.state = 26;
|
|
11670
|
+
this.sequenceIndex = 0;
|
|
11671
|
+
} else {
|
|
11672
|
+
this.state = c === 45 ? 25 : 23;
|
|
11673
|
+
}
|
|
11674
|
+
}
|
|
11675
|
+
stateInDeclaration(c) {
|
|
11676
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
11677
|
+
this.state = 1;
|
|
11678
|
+
this.sectionStart = this.index + 1;
|
|
11679
|
+
}
|
|
11680
|
+
}
|
|
11681
|
+
stateInProcessingInstruction(c) {
|
|
11682
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
11683
|
+
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
|
|
11684
|
+
this.state = 1;
|
|
11685
|
+
this.sectionStart = this.index + 1;
|
|
11686
|
+
}
|
|
11687
|
+
}
|
|
11688
|
+
stateBeforeComment(c) {
|
|
11689
|
+
if (c === 45) {
|
|
11690
|
+
this.state = 28;
|
|
11691
|
+
this.currentSequence = Sequences.CommentEnd;
|
|
11692
|
+
this.sequenceIndex = 2;
|
|
11693
|
+
this.sectionStart = this.index + 1;
|
|
11694
|
+
} else {
|
|
11695
|
+
this.state = 23;
|
|
11696
|
+
}
|
|
11697
|
+
}
|
|
11698
|
+
stateInSpecialComment(c) {
|
|
11699
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
11700
|
+
this.cbs.oncomment(this.sectionStart, this.index);
|
|
11701
|
+
this.state = 1;
|
|
11702
|
+
this.sectionStart = this.index + 1;
|
|
11703
|
+
}
|
|
11704
|
+
}
|
|
11705
|
+
stateBeforeSpecialS(c) {
|
|
11706
|
+
const lower = c | 32;
|
|
11707
|
+
if (lower === Sequences.ScriptEnd[3]) {
|
|
11708
|
+
this.startSpecial(Sequences.ScriptEnd, 4);
|
|
11709
|
+
} else if (lower === Sequences.StyleEnd[3]) {
|
|
11710
|
+
this.startSpecial(Sequences.StyleEnd, 4);
|
|
11711
|
+
} else {
|
|
11712
|
+
this.state = 6;
|
|
11713
|
+
this.stateInTagName(c);
|
|
11714
|
+
}
|
|
11715
|
+
}
|
|
11716
|
+
stateBeforeSpecialT(c) {
|
|
11717
|
+
const lower = c | 32;
|
|
11718
|
+
if (lower === Sequences.TitleEnd[3]) {
|
|
11719
|
+
this.startSpecial(Sequences.TitleEnd, 4);
|
|
11720
|
+
} else if (lower === Sequences.TextareaEnd[3]) {
|
|
11721
|
+
this.startSpecial(Sequences.TextareaEnd, 4);
|
|
11722
|
+
} else {
|
|
11723
|
+
this.state = 6;
|
|
11724
|
+
this.stateInTagName(c);
|
|
11725
|
+
}
|
|
11726
|
+
}
|
|
11727
|
+
startEntity() {
|
|
11728
|
+
}
|
|
11729
|
+
stateInEntity() {
|
|
11730
|
+
}
|
|
11731
|
+
/**
|
|
11732
|
+
* Iterates through the buffer, calling the function corresponding to the current state.
|
|
11733
|
+
*
|
|
11734
|
+
* States that are more likely to be hit are higher up, as a performance improvement.
|
|
11735
|
+
*/
|
|
11736
|
+
parse(input) {
|
|
11737
|
+
this.buffer = input;
|
|
11738
|
+
while (this.index < this.buffer.length) {
|
|
11739
|
+
const c = this.buffer.charCodeAt(this.index);
|
|
11740
|
+
if (c === 10) {
|
|
11741
|
+
this.newlines.push(this.index);
|
|
11742
|
+
}
|
|
11743
|
+
switch (this.state) {
|
|
11744
|
+
case 1: {
|
|
11745
|
+
this.stateText(c);
|
|
11746
|
+
break;
|
|
11747
|
+
}
|
|
11748
|
+
case 2: {
|
|
11749
|
+
this.stateInterpolationOpen(c);
|
|
11750
|
+
break;
|
|
11751
|
+
}
|
|
11752
|
+
case 3: {
|
|
11753
|
+
this.stateInterpolation(c);
|
|
11754
|
+
break;
|
|
11755
|
+
}
|
|
11756
|
+
case 4: {
|
|
11757
|
+
this.stateInterpolationClose(c);
|
|
11758
|
+
break;
|
|
11759
|
+
}
|
|
11760
|
+
case 31: {
|
|
11761
|
+
this.stateSpecialStartSequence(c);
|
|
11762
|
+
break;
|
|
11763
|
+
}
|
|
11764
|
+
case 32: {
|
|
11765
|
+
this.stateInRCDATA(c);
|
|
11766
|
+
break;
|
|
11767
|
+
}
|
|
11768
|
+
case 26: {
|
|
11769
|
+
this.stateCDATASequence(c);
|
|
11770
|
+
break;
|
|
11771
|
+
}
|
|
11772
|
+
case 19: {
|
|
11773
|
+
this.stateInAttrValueDoubleQuotes(c);
|
|
11774
|
+
break;
|
|
11775
|
+
}
|
|
11776
|
+
case 12: {
|
|
11777
|
+
this.stateInAttrName(c);
|
|
11778
|
+
break;
|
|
11779
|
+
}
|
|
11780
|
+
case 13: {
|
|
11781
|
+
this.stateInDirName(c);
|
|
11782
|
+
break;
|
|
11783
|
+
}
|
|
11784
|
+
case 14: {
|
|
11785
|
+
this.stateInDirArg(c);
|
|
11786
|
+
break;
|
|
11787
|
+
}
|
|
11788
|
+
case 15: {
|
|
11789
|
+
this.stateInDynamicDirArg(c);
|
|
11790
|
+
break;
|
|
11791
|
+
}
|
|
11792
|
+
case 16: {
|
|
11793
|
+
this.stateInDirModifier(c);
|
|
11794
|
+
break;
|
|
11795
|
+
}
|
|
11796
|
+
case 28: {
|
|
11797
|
+
this.stateInCommentLike(c);
|
|
11798
|
+
break;
|
|
11799
|
+
}
|
|
11800
|
+
case 27: {
|
|
11801
|
+
this.stateInSpecialComment(c);
|
|
11802
|
+
break;
|
|
11803
|
+
}
|
|
11804
|
+
case 11: {
|
|
11805
|
+
this.stateBeforeAttrName(c);
|
|
11806
|
+
break;
|
|
11807
|
+
}
|
|
11808
|
+
case 6: {
|
|
11809
|
+
this.stateInTagName(c);
|
|
11810
|
+
break;
|
|
11811
|
+
}
|
|
11812
|
+
case 34: {
|
|
11813
|
+
this.stateInSFCRootTagName(c);
|
|
11814
|
+
break;
|
|
11815
|
+
}
|
|
11816
|
+
case 9: {
|
|
11817
|
+
this.stateInClosingTagName(c);
|
|
11818
|
+
break;
|
|
11819
|
+
}
|
|
11820
|
+
case 5: {
|
|
11821
|
+
this.stateBeforeTagName(c);
|
|
11822
|
+
break;
|
|
11823
|
+
}
|
|
11824
|
+
case 17: {
|
|
11825
|
+
this.stateAfterAttrName(c);
|
|
11826
|
+
break;
|
|
11827
|
+
}
|
|
11828
|
+
case 20: {
|
|
11829
|
+
this.stateInAttrValueSingleQuotes(c);
|
|
11830
|
+
break;
|
|
11831
|
+
}
|
|
11832
|
+
case 18: {
|
|
11833
|
+
this.stateBeforeAttrValue(c);
|
|
11834
|
+
break;
|
|
11835
|
+
}
|
|
11836
|
+
case 8: {
|
|
11837
|
+
this.stateBeforeClosingTagName(c);
|
|
11838
|
+
break;
|
|
11839
|
+
}
|
|
11840
|
+
case 10: {
|
|
11841
|
+
this.stateAfterClosingTagName(c);
|
|
11842
|
+
break;
|
|
11843
|
+
}
|
|
11844
|
+
case 29: {
|
|
11845
|
+
this.stateBeforeSpecialS(c);
|
|
11846
|
+
break;
|
|
11847
|
+
}
|
|
11848
|
+
case 30: {
|
|
11849
|
+
this.stateBeforeSpecialT(c);
|
|
11850
|
+
break;
|
|
11851
|
+
}
|
|
11852
|
+
case 21: {
|
|
11853
|
+
this.stateInAttrValueNoQuotes(c);
|
|
11854
|
+
break;
|
|
11855
|
+
}
|
|
11856
|
+
case 7: {
|
|
11857
|
+
this.stateInSelfClosingTag(c);
|
|
11858
|
+
break;
|
|
11859
|
+
}
|
|
11860
|
+
case 23: {
|
|
11861
|
+
this.stateInDeclaration(c);
|
|
11862
|
+
break;
|
|
11863
|
+
}
|
|
11864
|
+
case 22: {
|
|
11865
|
+
this.stateBeforeDeclaration(c);
|
|
11866
|
+
break;
|
|
11867
|
+
}
|
|
11868
|
+
case 25: {
|
|
11869
|
+
this.stateBeforeComment(c);
|
|
11870
|
+
break;
|
|
11871
|
+
}
|
|
11872
|
+
case 24: {
|
|
11873
|
+
this.stateInProcessingInstruction(c);
|
|
11874
|
+
break;
|
|
11875
|
+
}
|
|
11876
|
+
case 33: {
|
|
11877
|
+
this.stateInEntity();
|
|
11878
|
+
break;
|
|
11879
|
+
}
|
|
11880
|
+
}
|
|
11881
|
+
this.index++;
|
|
11882
|
+
}
|
|
11883
|
+
this.cleanup();
|
|
11884
|
+
this.finish();
|
|
11885
|
+
}
|
|
11886
|
+
/**
|
|
11887
|
+
* Remove data that has already been consumed from the buffer.
|
|
11888
|
+
*/
|
|
11889
|
+
cleanup() {
|
|
11890
|
+
if (this.sectionStart !== this.index) {
|
|
11891
|
+
if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
|
|
11892
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
11893
|
+
this.sectionStart = this.index;
|
|
11894
|
+
} else if (this.state === 19 || this.state === 20 || this.state === 21) {
|
|
11895
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
11896
|
+
this.sectionStart = this.index;
|
|
11897
|
+
}
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
finish() {
|
|
11901
|
+
this.handleTrailingData();
|
|
11902
|
+
this.cbs.onend();
|
|
11903
|
+
}
|
|
11904
|
+
/** Handle any trailing data. */
|
|
11905
|
+
handleTrailingData() {
|
|
11906
|
+
const endIndex = this.buffer.length;
|
|
11907
|
+
if (this.sectionStart >= endIndex) {
|
|
11908
|
+
return;
|
|
11909
|
+
}
|
|
11910
|
+
if (this.state === 28) {
|
|
11911
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
11912
|
+
this.cbs.oncdata(this.sectionStart, endIndex);
|
|
11913
|
+
} else {
|
|
11914
|
+
this.cbs.oncomment(this.sectionStart, endIndex);
|
|
11915
|
+
}
|
|
11916
|
+
} 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 {
|
|
11917
|
+
this.cbs.ontext(this.sectionStart, endIndex);
|
|
11918
|
+
}
|
|
11919
|
+
}
|
|
11920
|
+
emitCodePoint(cp, consumed) {
|
|
11921
|
+
}
|
|
11922
|
+
}
|
|
11923
|
+
|
|
11924
|
+
function defaultOnError(error) {
|
|
11925
|
+
throw error;
|
|
11926
|
+
}
|
|
11927
|
+
function defaultOnWarn(msg) {
|
|
11928
|
+
console.warn(`[Vue warn] ${msg.message}`);
|
|
11929
|
+
}
|
|
11930
|
+
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
11931
|
+
const msg = (messages || errorMessages)[code] + (additionalMessage || ``) ;
|
|
11932
|
+
const error = new SyntaxError(String(msg));
|
|
11933
|
+
error.code = code;
|
|
11934
|
+
error.loc = loc;
|
|
11935
|
+
return error;
|
|
11936
|
+
}
|
|
11937
|
+
const errorMessages = {
|
|
11938
|
+
// parse errors
|
|
11939
|
+
[0]: "Illegal comment.",
|
|
11940
|
+
[1]: "CDATA section is allowed only in XML context.",
|
|
11941
|
+
[2]: "Duplicate attribute.",
|
|
11942
|
+
[3]: "End tag cannot have attributes.",
|
|
11943
|
+
[4]: "Illegal '/' in tags.",
|
|
11944
|
+
[5]: "Unexpected EOF in tag.",
|
|
11945
|
+
[6]: "Unexpected EOF in CDATA section.",
|
|
11946
|
+
[7]: "Unexpected EOF in comment.",
|
|
11947
|
+
[8]: "Unexpected EOF in script.",
|
|
11948
|
+
[9]: "Unexpected EOF in tag.",
|
|
11949
|
+
[10]: "Incorrectly closed comment.",
|
|
11950
|
+
[11]: "Incorrectly opened comment.",
|
|
11951
|
+
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
11952
|
+
[13]: "Attribute value was expected.",
|
|
11953
|
+
[14]: "End tag name was expected.",
|
|
11954
|
+
[15]: "Whitespace was expected.",
|
|
11955
|
+
[16]: "Unexpected '<!--' in comment.",
|
|
11956
|
+
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
11957
|
+
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
11958
|
+
[19]: "Attribute name cannot start with '='.",
|
|
11959
|
+
[21]: "'<?' is allowed only in XML context.",
|
|
11960
|
+
[20]: `Unexpected null character.`,
|
|
11961
|
+
[22]: "Illegal '/' in tags.",
|
|
11962
|
+
// Vue-specific parse errors
|
|
11963
|
+
[23]: "Invalid end tag.",
|
|
11964
|
+
[24]: "Element is missing end tag.",
|
|
11965
|
+
[25]: "Interpolation end sign was not found.",
|
|
11966
|
+
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
11967
|
+
[26]: "Legal directive name was expected.",
|
|
11968
|
+
// transform errors
|
|
11969
|
+
[28]: `v-if/v-else-if is missing expression.`,
|
|
11970
|
+
[29]: `v-if/else branches must use unique keys.`,
|
|
11971
|
+
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
11972
|
+
[31]: `v-for is missing expression.`,
|
|
11973
|
+
[32]: `v-for has invalid expression.`,
|
|
11974
|
+
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
11975
|
+
[34]: `v-bind is missing expression.`,
|
|
11976
|
+
[35]: `v-on is missing expression.`,
|
|
11977
|
+
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
11978
|
+
[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.`,
|
|
11979
|
+
[38]: `Duplicate slot names found. `,
|
|
11980
|
+
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
11981
|
+
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
11982
|
+
[41]: `v-model is missing expression.`,
|
|
11983
|
+
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
11984
|
+
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
11985
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
11986
|
+
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
11987
|
+
[45]: `Error parsing JavaScript expression: `,
|
|
11988
|
+
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
11989
|
+
// generic errors
|
|
11990
|
+
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
11991
|
+
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
11992
|
+
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
11993
|
+
[50]: `"scopeId" option is only supported in module mode.`,
|
|
11994
|
+
// deprecations
|
|
11995
|
+
[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.`,
|
|
11996
|
+
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
11997
|
+
// just to fulfill types
|
|
11998
|
+
[53]: ``
|
|
11999
|
+
};
|
|
12000
|
+
|
|
11135
12001
|
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
11136
|
-
const isBuiltInType = (tag, expected) => tag === expected || tag === hyphenate(expected);
|
|
11137
12002
|
function isCoreComponent(tag) {
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
12003
|
+
switch (tag) {
|
|
12004
|
+
case "Teleport":
|
|
12005
|
+
case "teleport":
|
|
12006
|
+
return TELEPORT;
|
|
12007
|
+
case "Suspense":
|
|
12008
|
+
case "suspense":
|
|
12009
|
+
return SUSPENSE;
|
|
12010
|
+
case "KeepAlive":
|
|
12011
|
+
case "keep-alive":
|
|
12012
|
+
return KEEP_ALIVE;
|
|
12013
|
+
case "BaseTransition":
|
|
12014
|
+
case "base-transition":
|
|
12015
|
+
return BASE_TRANSITION;
|
|
11146
12016
|
}
|
|
11147
12017
|
}
|
|
11148
12018
|
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
@@ -11213,43 +12083,6 @@ const isMemberExpressionBrowser = (path) => {
|
|
|
11213
12083
|
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
11214
12084
|
};
|
|
11215
12085
|
const isMemberExpression = isMemberExpressionBrowser ;
|
|
11216
|
-
function getInnerRange(loc, offset, length) {
|
|
11217
|
-
const source = loc.source.slice(offset, offset + length);
|
|
11218
|
-
const newLoc = {
|
|
11219
|
-
source,
|
|
11220
|
-
start: advancePositionWithClone(loc.start, loc.source, offset),
|
|
11221
|
-
end: loc.end
|
|
11222
|
-
};
|
|
11223
|
-
if (length != null) {
|
|
11224
|
-
newLoc.end = advancePositionWithClone(
|
|
11225
|
-
loc.start,
|
|
11226
|
-
loc.source,
|
|
11227
|
-
offset + length
|
|
11228
|
-
);
|
|
11229
|
-
}
|
|
11230
|
-
return newLoc;
|
|
11231
|
-
}
|
|
11232
|
-
function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
|
|
11233
|
-
return advancePositionWithMutation(
|
|
11234
|
-
extend({}, pos),
|
|
11235
|
-
source,
|
|
11236
|
-
numberOfCharacters
|
|
11237
|
-
);
|
|
11238
|
-
}
|
|
11239
|
-
function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
|
|
11240
|
-
let linesCount = 0;
|
|
11241
|
-
let lastNewLinePos = -1;
|
|
11242
|
-
for (let i = 0; i < numberOfCharacters; i++) {
|
|
11243
|
-
if (source.charCodeAt(i) === 10) {
|
|
11244
|
-
linesCount++;
|
|
11245
|
-
lastNewLinePos = i;
|
|
11246
|
-
}
|
|
11247
|
-
}
|
|
11248
|
-
pos.offset += numberOfCharacters;
|
|
11249
|
-
pos.line += linesCount;
|
|
11250
|
-
pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
|
|
11251
|
-
return pos;
|
|
11252
|
-
}
|
|
11253
12086
|
function assert(condition, msg) {
|
|
11254
12087
|
if (!condition) {
|
|
11255
12088
|
throw new Error(msg || `unexpected compiler condition`);
|
|
@@ -11395,343 +12228,490 @@ function getMemoedVNodeCall(node) {
|
|
|
11395
12228
|
}
|
|
11396
12229
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
11397
12230
|
|
|
11398
|
-
const decodeRE = /&(gt|lt|amp|apos|quot);/g;
|
|
11399
|
-
const decodeMap = {
|
|
11400
|
-
gt: ">",
|
|
11401
|
-
lt: "<",
|
|
11402
|
-
amp: "&",
|
|
11403
|
-
apos: "'",
|
|
11404
|
-
quot: '"'
|
|
11405
|
-
};
|
|
11406
12231
|
const defaultParserOptions = {
|
|
12232
|
+
parseMode: "base",
|
|
12233
|
+
ns: 0,
|
|
11407
12234
|
delimiters: [`{{`, `}}`],
|
|
11408
12235
|
getNamespace: () => 0,
|
|
11409
|
-
getTextMode: () => 0,
|
|
11410
12236
|
isVoidTag: NO,
|
|
11411
12237
|
isPreTag: NO,
|
|
11412
12238
|
isCustomElement: NO,
|
|
11413
|
-
decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
|
|
11414
12239
|
onError: defaultOnError,
|
|
11415
12240
|
onWarn: defaultOnWarn,
|
|
11416
12241
|
comments: true
|
|
11417
12242
|
};
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
let
|
|
11451
|
-
if (
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
}
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
12243
|
+
let currentOptions = defaultParserOptions;
|
|
12244
|
+
let currentRoot = null;
|
|
12245
|
+
let currentInput = "";
|
|
12246
|
+
let currentOpenTag = null;
|
|
12247
|
+
let currentProp = null;
|
|
12248
|
+
let currentAttrValue = "";
|
|
12249
|
+
let currentAttrStartIndex = -1;
|
|
12250
|
+
let currentAttrEndIndex = -1;
|
|
12251
|
+
let inPre = 0;
|
|
12252
|
+
let inVPre = false;
|
|
12253
|
+
let currentVPreBoundary = null;
|
|
12254
|
+
const stack = [];
|
|
12255
|
+
const tokenizer = new Tokenizer(stack, {
|
|
12256
|
+
onerr: emitError,
|
|
12257
|
+
ontext(start, end) {
|
|
12258
|
+
onText(getSlice(start, end), start, end);
|
|
12259
|
+
},
|
|
12260
|
+
ontextentity(char, start, end) {
|
|
12261
|
+
onText(char, start, end);
|
|
12262
|
+
},
|
|
12263
|
+
oninterpolation(start, end) {
|
|
12264
|
+
if (inVPre) {
|
|
12265
|
+
return onText(getSlice(start, end), start, end);
|
|
12266
|
+
}
|
|
12267
|
+
let innerStart = start + tokenizer.delimiterOpen.length;
|
|
12268
|
+
let innerEnd = end - tokenizer.delimiterClose.length;
|
|
12269
|
+
while (isWhitespace(currentInput.charCodeAt(innerStart))) {
|
|
12270
|
+
innerStart++;
|
|
12271
|
+
}
|
|
12272
|
+
while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
|
|
12273
|
+
innerEnd--;
|
|
12274
|
+
}
|
|
12275
|
+
let exp = getSlice(innerStart, innerEnd);
|
|
12276
|
+
if (exp.includes("&")) {
|
|
12277
|
+
{
|
|
12278
|
+
exp = currentOptions.decodeEntities(exp, false);
|
|
12279
|
+
}
|
|
12280
|
+
}
|
|
12281
|
+
addNode({
|
|
12282
|
+
type: 5,
|
|
12283
|
+
content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
|
|
12284
|
+
loc: getLoc(start, end)
|
|
12285
|
+
});
|
|
12286
|
+
},
|
|
12287
|
+
onopentagname(start, end) {
|
|
12288
|
+
const name = getSlice(start, end);
|
|
12289
|
+
currentOpenTag = {
|
|
12290
|
+
type: 1,
|
|
12291
|
+
tag: name,
|
|
12292
|
+
ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
|
|
12293
|
+
tagType: 0,
|
|
12294
|
+
// will be refined on tag close
|
|
12295
|
+
props: [],
|
|
12296
|
+
children: [],
|
|
12297
|
+
loc: getLoc(start - 1, end),
|
|
12298
|
+
codegenNode: void 0
|
|
12299
|
+
};
|
|
12300
|
+
if (tokenizer.inSFCRoot) {
|
|
12301
|
+
currentOpenTag.innerLoc = getLoc(
|
|
12302
|
+
end + fastForward(end) + 1,
|
|
12303
|
+
end
|
|
12304
|
+
);
|
|
12305
|
+
}
|
|
12306
|
+
},
|
|
12307
|
+
onopentagend(end) {
|
|
12308
|
+
endOpenTag(end);
|
|
12309
|
+
},
|
|
12310
|
+
onclosetag(start, end) {
|
|
12311
|
+
const name = getSlice(start, end);
|
|
12312
|
+
if (!currentOptions.isVoidTag(name)) {
|
|
12313
|
+
let found = false;
|
|
12314
|
+
for (let i = 0; i < stack.length; i++) {
|
|
12315
|
+
const e = stack[i];
|
|
12316
|
+
if (e.tag.toLowerCase() === name.toLowerCase()) {
|
|
12317
|
+
found = true;
|
|
12318
|
+
if (i > 0) {
|
|
12319
|
+
emitError(24, stack[0].loc.start.offset);
|
|
11472
12320
|
}
|
|
11473
|
-
|
|
11474
|
-
|
|
11475
|
-
|
|
11476
|
-
}
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
12321
|
+
for (let j = 0; j <= i; j++) {
|
|
12322
|
+
const el = stack.shift();
|
|
12323
|
+
onCloseTag(el, end, j < i);
|
|
12324
|
+
}
|
|
12325
|
+
break;
|
|
12326
|
+
}
|
|
12327
|
+
}
|
|
12328
|
+
if (!found) {
|
|
12329
|
+
emitError(23, backTrack(start, 60));
|
|
12330
|
+
}
|
|
12331
|
+
}
|
|
12332
|
+
},
|
|
12333
|
+
onselfclosingtag(end) {
|
|
12334
|
+
var _a;
|
|
12335
|
+
const name = currentOpenTag.tag;
|
|
12336
|
+
currentOpenTag.isSelfClosing = true;
|
|
12337
|
+
endOpenTag(end);
|
|
12338
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
12339
|
+
onCloseTag(stack.shift(), end);
|
|
12340
|
+
}
|
|
12341
|
+
},
|
|
12342
|
+
onattribname(start, end) {
|
|
12343
|
+
currentProp = {
|
|
12344
|
+
type: 6,
|
|
12345
|
+
name: getSlice(start, end),
|
|
12346
|
+
nameLoc: getLoc(start, end),
|
|
12347
|
+
value: void 0,
|
|
12348
|
+
loc: getLoc(start)
|
|
12349
|
+
};
|
|
12350
|
+
},
|
|
12351
|
+
ondirname(start, end) {
|
|
12352
|
+
const raw = getSlice(start, end);
|
|
12353
|
+
const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
|
|
12354
|
+
if (!inVPre && name === "") {
|
|
12355
|
+
emitError(26, start);
|
|
12356
|
+
}
|
|
12357
|
+
if (inVPre || name === "") {
|
|
12358
|
+
currentProp = {
|
|
12359
|
+
type: 6,
|
|
12360
|
+
name: raw,
|
|
12361
|
+
nameLoc: getLoc(start, end),
|
|
12362
|
+
value: void 0,
|
|
12363
|
+
loc: getLoc(start)
|
|
12364
|
+
};
|
|
12365
|
+
} else {
|
|
12366
|
+
currentProp = {
|
|
12367
|
+
type: 7,
|
|
12368
|
+
name,
|
|
12369
|
+
rawName: raw,
|
|
12370
|
+
exp: void 0,
|
|
12371
|
+
arg: void 0,
|
|
12372
|
+
modifiers: raw === "." ? ["prop"] : [],
|
|
12373
|
+
loc: getLoc(start)
|
|
12374
|
+
};
|
|
12375
|
+
if (name === "pre") {
|
|
12376
|
+
inVPre = true;
|
|
12377
|
+
currentVPreBoundary = currentOpenTag;
|
|
12378
|
+
const props = currentOpenTag.props;
|
|
12379
|
+
for (let i = 0; i < props.length; i++) {
|
|
12380
|
+
if (props[i].type === 7) {
|
|
12381
|
+
props[i] = dirToAttr(props[i]);
|
|
11491
12382
|
}
|
|
11492
|
-
} else if (/[a-z]/i.test(s[1])) {
|
|
11493
|
-
node = parseElement(context, ancestors);
|
|
11494
|
-
} else if (s[1] === "?") {
|
|
11495
|
-
emitError(
|
|
11496
|
-
context,
|
|
11497
|
-
21,
|
|
11498
|
-
1
|
|
11499
|
-
);
|
|
11500
|
-
node = parseBogusComment(context);
|
|
11501
|
-
} else {
|
|
11502
|
-
emitError(context, 12, 1);
|
|
11503
12383
|
}
|
|
11504
12384
|
}
|
|
11505
12385
|
}
|
|
11506
|
-
|
|
11507
|
-
|
|
12386
|
+
},
|
|
12387
|
+
ondirarg(start, end) {
|
|
12388
|
+
const arg = getSlice(start, end);
|
|
12389
|
+
if (inVPre) {
|
|
12390
|
+
currentProp.name += arg;
|
|
12391
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
12392
|
+
} else {
|
|
12393
|
+
const isStatic = arg[0] !== `[`;
|
|
12394
|
+
currentProp.arg = createSimpleExpression(
|
|
12395
|
+
isStatic ? arg : arg.slice(1, -1),
|
|
12396
|
+
isStatic,
|
|
12397
|
+
getLoc(start, end),
|
|
12398
|
+
isStatic ? 3 : 0
|
|
12399
|
+
);
|
|
11508
12400
|
}
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
12401
|
+
},
|
|
12402
|
+
ondirmodifier(start, end) {
|
|
12403
|
+
const mod = getSlice(start, end);
|
|
12404
|
+
if (inVPre) {
|
|
12405
|
+
currentProp.name += "." + mod;
|
|
12406
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
12407
|
+
} else if (currentProp.name === "slot") {
|
|
12408
|
+
const arg = currentProp.arg;
|
|
12409
|
+
if (arg) {
|
|
12410
|
+
arg.content += "." + mod;
|
|
12411
|
+
setLocEnd(arg.loc, end);
|
|
11512
12412
|
}
|
|
11513
12413
|
} else {
|
|
11514
|
-
|
|
12414
|
+
currentProp.modifiers.push(mod);
|
|
11515
12415
|
}
|
|
11516
|
-
}
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
12416
|
+
},
|
|
12417
|
+
onattribdata(start, end) {
|
|
12418
|
+
currentAttrValue += getSlice(start, end);
|
|
12419
|
+
if (currentAttrStartIndex < 0)
|
|
12420
|
+
currentAttrStartIndex = start;
|
|
12421
|
+
currentAttrEndIndex = end;
|
|
12422
|
+
},
|
|
12423
|
+
onattribentity(char, start, end) {
|
|
12424
|
+
currentAttrValue += char;
|
|
12425
|
+
if (currentAttrStartIndex < 0)
|
|
12426
|
+
currentAttrStartIndex = start;
|
|
12427
|
+
currentAttrEndIndex = end;
|
|
12428
|
+
},
|
|
12429
|
+
onattribnameend(end) {
|
|
12430
|
+
const start = currentProp.loc.start.offset;
|
|
12431
|
+
const name = getSlice(start, end);
|
|
12432
|
+
if (currentProp.type === 7) {
|
|
12433
|
+
currentProp.rawName = name;
|
|
12434
|
+
}
|
|
12435
|
+
if (currentOpenTag.props.some(
|
|
12436
|
+
(p) => (p.type === 7 ? p.rawName : p.name) === name
|
|
12437
|
+
)) {
|
|
12438
|
+
emitError(2, start);
|
|
12439
|
+
}
|
|
12440
|
+
},
|
|
12441
|
+
onattribend(quote, end) {
|
|
12442
|
+
if (currentOpenTag && currentProp) {
|
|
12443
|
+
setLocEnd(currentProp.loc, end);
|
|
12444
|
+
if (quote !== 0) {
|
|
12445
|
+
if (currentAttrValue.includes("&")) {
|
|
12446
|
+
currentAttrValue = currentOptions.decodeEntities(
|
|
12447
|
+
currentAttrValue,
|
|
12448
|
+
true
|
|
12449
|
+
);
|
|
12450
|
+
}
|
|
12451
|
+
if (currentProp.type === 6) {
|
|
12452
|
+
if (currentProp.name === "class") {
|
|
12453
|
+
currentAttrValue = condense(currentAttrValue).trim();
|
|
12454
|
+
}
|
|
12455
|
+
if (quote === 1 && !currentAttrValue) {
|
|
12456
|
+
emitError(13, end);
|
|
12457
|
+
}
|
|
12458
|
+
currentProp.value = {
|
|
12459
|
+
type: 2,
|
|
12460
|
+
content: currentAttrValue,
|
|
12461
|
+
loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
|
|
12462
|
+
};
|
|
12463
|
+
if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
|
|
12464
|
+
tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
|
|
11535
12465
|
}
|
|
11536
12466
|
} else {
|
|
11537
|
-
|
|
12467
|
+
currentProp.exp = createSimpleExpression(
|
|
12468
|
+
currentAttrValue,
|
|
12469
|
+
false,
|
|
12470
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
12471
|
+
);
|
|
12472
|
+
if (currentProp.name === "for") {
|
|
12473
|
+
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
12474
|
+
}
|
|
11538
12475
|
}
|
|
11539
|
-
}
|
|
11540
|
-
|
|
11541
|
-
|
|
12476
|
+
}
|
|
12477
|
+
if (currentProp.type !== 7 || currentProp.name !== "pre") {
|
|
12478
|
+
currentOpenTag.props.push(currentProp);
|
|
11542
12479
|
}
|
|
11543
12480
|
}
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
12481
|
+
currentAttrValue = "";
|
|
12482
|
+
currentAttrStartIndex = currentAttrEndIndex = -1;
|
|
12483
|
+
},
|
|
12484
|
+
oncomment(start, end) {
|
|
12485
|
+
if (currentOptions.comments) {
|
|
12486
|
+
addNode({
|
|
12487
|
+
type: 3,
|
|
12488
|
+
content: getSlice(start, end),
|
|
12489
|
+
loc: getLoc(start - 4, end + 3)
|
|
12490
|
+
});
|
|
12491
|
+
}
|
|
12492
|
+
},
|
|
12493
|
+
onend() {
|
|
12494
|
+
const end = currentInput.length;
|
|
12495
|
+
if (tokenizer.state !== 1) {
|
|
12496
|
+
switch (tokenizer.state) {
|
|
12497
|
+
case 5:
|
|
12498
|
+
case 8:
|
|
12499
|
+
emitError(5, end);
|
|
12500
|
+
break;
|
|
12501
|
+
case 3:
|
|
12502
|
+
case 4:
|
|
12503
|
+
emitError(
|
|
12504
|
+
25,
|
|
12505
|
+
tokenizer.sectionStart
|
|
12506
|
+
);
|
|
12507
|
+
break;
|
|
12508
|
+
case 28:
|
|
12509
|
+
if (tokenizer.currentSequence === Sequences.CdataEnd) {
|
|
12510
|
+
emitError(6, end);
|
|
12511
|
+
} else {
|
|
12512
|
+
emitError(7, end);
|
|
12513
|
+
}
|
|
12514
|
+
break;
|
|
12515
|
+
case 6:
|
|
12516
|
+
case 7:
|
|
12517
|
+
case 9:
|
|
12518
|
+
case 11:
|
|
12519
|
+
case 12:
|
|
12520
|
+
case 13:
|
|
12521
|
+
case 14:
|
|
12522
|
+
case 15:
|
|
12523
|
+
case 16:
|
|
12524
|
+
case 17:
|
|
12525
|
+
case 18:
|
|
12526
|
+
case 19:
|
|
12527
|
+
case 20:
|
|
12528
|
+
case 21:
|
|
12529
|
+
emitError(9, end);
|
|
12530
|
+
break;
|
|
11548
12531
|
}
|
|
11549
12532
|
}
|
|
12533
|
+
for (let index = 0; index < stack.length; index++) {
|
|
12534
|
+
onCloseTag(stack[index], end - 1);
|
|
12535
|
+
emitError(24, stack[index].loc.start.offset);
|
|
12536
|
+
}
|
|
12537
|
+
},
|
|
12538
|
+
oncdata(start, end) {
|
|
12539
|
+
if (stack[0].ns !== 0) {
|
|
12540
|
+
onText(getSlice(start, end), start, end);
|
|
12541
|
+
} else {
|
|
12542
|
+
emitError(1, start - 9);
|
|
12543
|
+
}
|
|
12544
|
+
},
|
|
12545
|
+
onprocessinginstruction(start) {
|
|
12546
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
12547
|
+
emitError(
|
|
12548
|
+
21,
|
|
12549
|
+
start - 1
|
|
12550
|
+
);
|
|
12551
|
+
}
|
|
12552
|
+
}
|
|
12553
|
+
});
|
|
12554
|
+
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
12555
|
+
const stripParensRE = /^\(|\)$/g;
|
|
12556
|
+
function parseForExpression(input) {
|
|
12557
|
+
const loc = input.loc;
|
|
12558
|
+
const exp = input.content;
|
|
12559
|
+
const inMatch = exp.match(forAliasRE);
|
|
12560
|
+
if (!inMatch)
|
|
12561
|
+
return;
|
|
12562
|
+
const [, LHS, RHS] = inMatch;
|
|
12563
|
+
const createAliasExpression = (content, offset) => {
|
|
12564
|
+
const start = loc.start.offset + offset;
|
|
12565
|
+
const end = start + content.length;
|
|
12566
|
+
return createSimpleExpression(content, false, getLoc(start, end));
|
|
12567
|
+
};
|
|
12568
|
+
const result = {
|
|
12569
|
+
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
12570
|
+
value: void 0,
|
|
12571
|
+
key: void 0,
|
|
12572
|
+
index: void 0,
|
|
12573
|
+
finalized: false
|
|
12574
|
+
};
|
|
12575
|
+
let valueContent = LHS.trim().replace(stripParensRE, "").trim();
|
|
12576
|
+
const trimmedOffset = LHS.indexOf(valueContent);
|
|
12577
|
+
const iteratorMatch = valueContent.match(forIteratorRE);
|
|
12578
|
+
if (iteratorMatch) {
|
|
12579
|
+
valueContent = valueContent.replace(forIteratorRE, "").trim();
|
|
12580
|
+
const keyContent = iteratorMatch[1].trim();
|
|
12581
|
+
let keyOffset;
|
|
12582
|
+
if (keyContent) {
|
|
12583
|
+
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
12584
|
+
result.key = createAliasExpression(keyContent, keyOffset);
|
|
12585
|
+
}
|
|
12586
|
+
if (iteratorMatch[2]) {
|
|
12587
|
+
const indexContent = iteratorMatch[2].trim();
|
|
12588
|
+
if (indexContent) {
|
|
12589
|
+
result.index = createAliasExpression(
|
|
12590
|
+
indexContent,
|
|
12591
|
+
exp.indexOf(
|
|
12592
|
+
indexContent,
|
|
12593
|
+
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
12594
|
+
)
|
|
12595
|
+
);
|
|
12596
|
+
}
|
|
12597
|
+
}
|
|
12598
|
+
}
|
|
12599
|
+
if (valueContent) {
|
|
12600
|
+
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
12601
|
+
}
|
|
12602
|
+
return result;
|
|
12603
|
+
}
|
|
12604
|
+
function getSlice(start, end) {
|
|
12605
|
+
return currentInput.slice(start, end);
|
|
12606
|
+
}
|
|
12607
|
+
function endOpenTag(end) {
|
|
12608
|
+
addNode(currentOpenTag);
|
|
12609
|
+
const { tag, ns } = currentOpenTag;
|
|
12610
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
12611
|
+
inPre++;
|
|
12612
|
+
}
|
|
12613
|
+
if (currentOptions.isVoidTag(tag)) {
|
|
12614
|
+
onCloseTag(currentOpenTag, end);
|
|
12615
|
+
} else {
|
|
12616
|
+
stack.unshift(currentOpenTag);
|
|
12617
|
+
if (ns === 1 || ns === 2) {
|
|
12618
|
+
tokenizer.inXML = true;
|
|
12619
|
+
}
|
|
11550
12620
|
}
|
|
11551
|
-
|
|
12621
|
+
currentOpenTag = null;
|
|
11552
12622
|
}
|
|
11553
|
-
function
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
|
|
11559
|
-
prev.loc.source += node.loc.source;
|
|
11560
|
-
return;
|
|
12623
|
+
function onText(content, start, end) {
|
|
12624
|
+
var _a;
|
|
12625
|
+
{
|
|
12626
|
+
const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
|
|
12627
|
+
if (tag !== "script" && tag !== "style" && content.includes("&")) {
|
|
12628
|
+
content = currentOptions.decodeEntities(content, false);
|
|
11561
12629
|
}
|
|
11562
12630
|
}
|
|
11563
|
-
|
|
11564
|
-
|
|
11565
|
-
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
if (context.source.length === 0) {
|
|
11569
|
-
emitError(context, 6);
|
|
12631
|
+
const parent = stack[0] || currentRoot;
|
|
12632
|
+
const lastNode = parent.children[parent.children.length - 1];
|
|
12633
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
12634
|
+
lastNode.content += content;
|
|
12635
|
+
setLocEnd(lastNode.loc, end);
|
|
11570
12636
|
} else {
|
|
11571
|
-
|
|
11572
|
-
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
const start = getCursor(context);
|
|
11577
|
-
let content;
|
|
11578
|
-
const match = /--(\!)?>/.exec(context.source);
|
|
11579
|
-
if (!match) {
|
|
11580
|
-
content = context.source.slice(4);
|
|
11581
|
-
advanceBy(context, context.source.length);
|
|
11582
|
-
emitError(context, 7);
|
|
11583
|
-
} else {
|
|
11584
|
-
if (match.index <= 3) {
|
|
11585
|
-
emitError(context, 0);
|
|
11586
|
-
}
|
|
11587
|
-
if (match[1]) {
|
|
11588
|
-
emitError(context, 10);
|
|
11589
|
-
}
|
|
11590
|
-
content = context.source.slice(4, match.index);
|
|
11591
|
-
const s = context.source.slice(0, match.index);
|
|
11592
|
-
let prevIndex = 1, nestedIndex = 0;
|
|
11593
|
-
while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
|
|
11594
|
-
advanceBy(context, nestedIndex - prevIndex + 1);
|
|
11595
|
-
if (nestedIndex + 4 < s.length) {
|
|
11596
|
-
emitError(context, 16);
|
|
11597
|
-
}
|
|
11598
|
-
prevIndex = nestedIndex + 1;
|
|
11599
|
-
}
|
|
11600
|
-
advanceBy(context, match.index + match[0].length - prevIndex + 1);
|
|
12637
|
+
parent.children.push({
|
|
12638
|
+
type: 2,
|
|
12639
|
+
content,
|
|
12640
|
+
loc: getLoc(start, end)
|
|
12641
|
+
});
|
|
11601
12642
|
}
|
|
11602
|
-
return {
|
|
11603
|
-
type: 3,
|
|
11604
|
-
content,
|
|
11605
|
-
loc: getSelection(context, start)
|
|
11606
|
-
};
|
|
11607
12643
|
}
|
|
11608
|
-
function
|
|
11609
|
-
|
|
11610
|
-
|
|
11611
|
-
let content;
|
|
11612
|
-
const closeIndex = context.source.indexOf(">");
|
|
11613
|
-
if (closeIndex === -1) {
|
|
11614
|
-
content = context.source.slice(contentStart);
|
|
11615
|
-
advanceBy(context, context.source.length);
|
|
12644
|
+
function onCloseTag(el, end, isImplied = false) {
|
|
12645
|
+
if (isImplied) {
|
|
12646
|
+
setLocEnd(el.loc, backTrack(end, 60));
|
|
11616
12647
|
} else {
|
|
11617
|
-
|
|
11618
|
-
advanceBy(context, closeIndex + 1);
|
|
12648
|
+
setLocEnd(el.loc, end + fastForward(end) + 1);
|
|
11619
12649
|
}
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
}
|
|
11626
|
-
function parseElement(context, ancestors) {
|
|
11627
|
-
const wasInPre = context.inPre;
|
|
11628
|
-
const wasInVPre = context.inVPre;
|
|
11629
|
-
const parent = last(ancestors);
|
|
11630
|
-
const element = parseTag(context, 0 /* Start */, parent);
|
|
11631
|
-
const isPreBoundary = context.inPre && !wasInPre;
|
|
11632
|
-
const isVPreBoundary = context.inVPre && !wasInVPre;
|
|
11633
|
-
if (element.isSelfClosing || context.options.isVoidTag(element.tag)) {
|
|
11634
|
-
if (isPreBoundary) {
|
|
11635
|
-
context.inPre = false;
|
|
11636
|
-
}
|
|
11637
|
-
if (isVPreBoundary) {
|
|
11638
|
-
context.inVPre = false;
|
|
11639
|
-
}
|
|
11640
|
-
return element;
|
|
11641
|
-
}
|
|
11642
|
-
ancestors.push(element);
|
|
11643
|
-
const mode = context.options.getTextMode(element, parent);
|
|
11644
|
-
const children = parseChildren(context, mode, ancestors);
|
|
11645
|
-
ancestors.pop();
|
|
11646
|
-
element.children = children;
|
|
11647
|
-
if (startsWithEndTagOpen(context.source, element.tag)) {
|
|
11648
|
-
parseTag(context, 1 /* End */, parent);
|
|
11649
|
-
} else {
|
|
11650
|
-
emitError(context, 24, 0, element.loc.start);
|
|
11651
|
-
if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
|
|
11652
|
-
const first = children[0];
|
|
11653
|
-
if (first && startsWith(first.loc.source, "<!--")) {
|
|
11654
|
-
emitError(context, 8);
|
|
11655
|
-
}
|
|
12650
|
+
if (tokenizer.inSFCRoot) {
|
|
12651
|
+
if (el.children.length) {
|
|
12652
|
+
el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
|
|
12653
|
+
} else {
|
|
12654
|
+
el.innerLoc.end = extend({}, el.innerLoc.start);
|
|
11656
12655
|
}
|
|
12656
|
+
el.innerLoc.source = getSlice(
|
|
12657
|
+
el.innerLoc.start.offset,
|
|
12658
|
+
el.innerLoc.end.offset
|
|
12659
|
+
);
|
|
11657
12660
|
}
|
|
11658
|
-
|
|
11659
|
-
if (
|
|
11660
|
-
|
|
12661
|
+
const { tag, ns } = el;
|
|
12662
|
+
if (!inVPre) {
|
|
12663
|
+
if (tag === "slot") {
|
|
12664
|
+
el.tagType = 2;
|
|
12665
|
+
} else if (isFragmentTemplate(el)) {
|
|
12666
|
+
el.tagType = 3;
|
|
12667
|
+
} else if (isComponent(el)) {
|
|
12668
|
+
el.tagType = 1;
|
|
12669
|
+
}
|
|
11661
12670
|
}
|
|
11662
|
-
if (
|
|
11663
|
-
|
|
12671
|
+
if (!tokenizer.inRCDATA) {
|
|
12672
|
+
el.children = condenseWhitespace(el.children, el.tag);
|
|
11664
12673
|
}
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
const isSpecialTemplateDirective = /* @__PURE__ */ makeMap(
|
|
11668
|
-
`if,else,else-if,for,slot`
|
|
11669
|
-
);
|
|
11670
|
-
function parseTag(context, type, parent) {
|
|
11671
|
-
const start = getCursor(context);
|
|
11672
|
-
const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
|
|
11673
|
-
const tag = match[1];
|
|
11674
|
-
const ns = context.options.getNamespace(tag, parent);
|
|
11675
|
-
advanceBy(context, match[0].length);
|
|
11676
|
-
advanceSpaces(context);
|
|
11677
|
-
const cursor = getCursor(context);
|
|
11678
|
-
const currentSource = context.source;
|
|
11679
|
-
if (context.options.isPreTag(tag)) {
|
|
11680
|
-
context.inPre = true;
|
|
11681
|
-
}
|
|
11682
|
-
let props = parseAttributes(context, type);
|
|
11683
|
-
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
|
|
11684
|
-
context.inVPre = true;
|
|
11685
|
-
extend(context, cursor);
|
|
11686
|
-
context.source = currentSource;
|
|
11687
|
-
props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
|
|
11688
|
-
}
|
|
11689
|
-
let isSelfClosing = false;
|
|
11690
|
-
if (context.source.length === 0) {
|
|
11691
|
-
emitError(context, 9);
|
|
11692
|
-
} else {
|
|
11693
|
-
isSelfClosing = startsWith(context.source, "/>");
|
|
11694
|
-
if (type === 1 /* End */ && isSelfClosing) {
|
|
11695
|
-
emitError(context, 4);
|
|
11696
|
-
}
|
|
11697
|
-
advanceBy(context, isSelfClosing ? 2 : 1);
|
|
12674
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
12675
|
+
inPre--;
|
|
11698
12676
|
}
|
|
11699
|
-
if (
|
|
11700
|
-
|
|
12677
|
+
if (currentVPreBoundary === el) {
|
|
12678
|
+
inVPre = false;
|
|
12679
|
+
currentVPreBoundary = null;
|
|
11701
12680
|
}
|
|
11702
|
-
|
|
11703
|
-
|
|
11704
|
-
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
12681
|
+
if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
12682
|
+
tokenizer.inXML = false;
|
|
12683
|
+
}
|
|
12684
|
+
}
|
|
12685
|
+
function fastForward(start, c) {
|
|
12686
|
+
let offset = 0;
|
|
12687
|
+
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
12688
|
+
offset++;
|
|
12689
|
+
}
|
|
12690
|
+
return offset;
|
|
12691
|
+
}
|
|
12692
|
+
function backTrack(index, c) {
|
|
12693
|
+
let i = index;
|
|
12694
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
12695
|
+
i--;
|
|
12696
|
+
return i;
|
|
12697
|
+
}
|
|
12698
|
+
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
12699
|
+
function isFragmentTemplate({ tag, props }) {
|
|
12700
|
+
if (tag === "template") {
|
|
12701
|
+
for (let i = 0; i < props.length; i++) {
|
|
12702
|
+
if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
|
|
12703
|
+
return true;
|
|
11711
12704
|
}
|
|
11712
|
-
} else if (isComponent(tag, props, context)) {
|
|
11713
|
-
tagType = 1;
|
|
11714
12705
|
}
|
|
11715
12706
|
}
|
|
11716
|
-
return
|
|
11717
|
-
type: 1,
|
|
11718
|
-
ns,
|
|
11719
|
-
tag,
|
|
11720
|
-
tagType,
|
|
11721
|
-
props,
|
|
11722
|
-
isSelfClosing,
|
|
11723
|
-
children: [],
|
|
11724
|
-
loc: getSelection(context, start),
|
|
11725
|
-
codegenNode: void 0
|
|
11726
|
-
// to be created during transform phase
|
|
11727
|
-
};
|
|
12707
|
+
return false;
|
|
11728
12708
|
}
|
|
11729
|
-
function isComponent(tag, props
|
|
11730
|
-
|
|
11731
|
-
if (
|
|
12709
|
+
function isComponent({ tag, props }) {
|
|
12710
|
+
var _a;
|
|
12711
|
+
if (currentOptions.isCustomElement(tag)) {
|
|
11732
12712
|
return false;
|
|
11733
12713
|
}
|
|
11734
|
-
if (tag === "component" ||
|
|
12714
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
11735
12715
|
return true;
|
|
11736
12716
|
}
|
|
11737
12717
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -11742,346 +12722,166 @@ function isComponent(tag, props, context) {
|
|
|
11742
12722
|
return true;
|
|
11743
12723
|
}
|
|
11744
12724
|
}
|
|
11745
|
-
} else {
|
|
11746
|
-
if (p.name === "is") {
|
|
11747
|
-
return true;
|
|
11748
|
-
} else if (
|
|
11749
|
-
// :is on plain element - only treat as component in compat mode
|
|
11750
|
-
p.name === "bind" && isStaticArgOf(p.arg, "is") && false
|
|
11751
|
-
) {
|
|
11752
|
-
return true;
|
|
11753
|
-
}
|
|
11754
12725
|
}
|
|
11755
12726
|
}
|
|
12727
|
+
return false;
|
|
11756
12728
|
}
|
|
11757
|
-
function
|
|
11758
|
-
|
|
11759
|
-
const attributeNames = /* @__PURE__ */ new Set();
|
|
11760
|
-
while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
|
|
11761
|
-
if (startsWith(context.source, "/")) {
|
|
11762
|
-
emitError(context, 22);
|
|
11763
|
-
advanceBy(context, 1);
|
|
11764
|
-
advanceSpaces(context);
|
|
11765
|
-
continue;
|
|
11766
|
-
}
|
|
11767
|
-
if (type === 1 /* End */) {
|
|
11768
|
-
emitError(context, 3);
|
|
11769
|
-
}
|
|
11770
|
-
const attr = parseAttribute(context, attributeNames);
|
|
11771
|
-
if (attr.type === 6 && attr.value && attr.name === "class") {
|
|
11772
|
-
attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
|
|
11773
|
-
}
|
|
11774
|
-
if (type === 0 /* Start */) {
|
|
11775
|
-
props.push(attr);
|
|
11776
|
-
}
|
|
11777
|
-
if (/^[^\t\r\n\f />]/.test(context.source)) {
|
|
11778
|
-
emitError(context, 15);
|
|
11779
|
-
}
|
|
11780
|
-
advanceSpaces(context);
|
|
11781
|
-
}
|
|
11782
|
-
return props;
|
|
12729
|
+
function isUpperCase(c) {
|
|
12730
|
+
return c > 64 && c < 91;
|
|
11783
12731
|
}
|
|
11784
|
-
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
const
|
|
11788
|
-
|
|
11789
|
-
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
);
|
|
11805
|
-
}
|
|
11806
|
-
}
|
|
11807
|
-
advanceBy(context, name.length);
|
|
11808
|
-
let value = void 0;
|
|
11809
|
-
if (/^[\t\r\n\f ]*=/.test(context.source)) {
|
|
11810
|
-
advanceSpaces(context);
|
|
11811
|
-
advanceBy(context, 1);
|
|
11812
|
-
advanceSpaces(context);
|
|
11813
|
-
value = parseAttributeValue(context);
|
|
11814
|
-
if (!value) {
|
|
11815
|
-
emitError(context, 13);
|
|
11816
|
-
}
|
|
11817
|
-
}
|
|
11818
|
-
const loc = getSelection(context, start);
|
|
11819
|
-
if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
|
|
11820
|
-
const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
|
|
11821
|
-
name
|
|
11822
|
-
);
|
|
11823
|
-
let isPropShorthand = startsWith(name, ".");
|
|
11824
|
-
let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
|
|
11825
|
-
let arg;
|
|
11826
|
-
if (match2[2]) {
|
|
11827
|
-
const isSlot = dirName === "slot";
|
|
11828
|
-
const startOffset = name.lastIndexOf(
|
|
11829
|
-
match2[2],
|
|
11830
|
-
name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
|
|
11831
|
-
);
|
|
11832
|
-
const loc2 = getSelection(
|
|
11833
|
-
context,
|
|
11834
|
-
getNewPosition(context, start, startOffset),
|
|
11835
|
-
getNewPosition(
|
|
11836
|
-
context,
|
|
11837
|
-
start,
|
|
11838
|
-
startOffset + match2[2].length + (isSlot && match2[3] || "").length
|
|
11839
|
-
)
|
|
11840
|
-
);
|
|
11841
|
-
let content = match2[2];
|
|
11842
|
-
let isStatic = true;
|
|
11843
|
-
if (content.startsWith("[")) {
|
|
11844
|
-
isStatic = false;
|
|
11845
|
-
if (!content.endsWith("]")) {
|
|
11846
|
-
emitError(
|
|
11847
|
-
context,
|
|
11848
|
-
27
|
|
11849
|
-
);
|
|
11850
|
-
content = content.slice(1);
|
|
11851
|
-
} else {
|
|
11852
|
-
content = content.slice(1, content.length - 1);
|
|
12732
|
+
const windowsNewlineRE = /\r\n/g;
|
|
12733
|
+
function condenseWhitespace(nodes, tag) {
|
|
12734
|
+
var _a, _b;
|
|
12735
|
+
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
12736
|
+
let removedWhitespace = false;
|
|
12737
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
12738
|
+
const node = nodes[i];
|
|
12739
|
+
if (node.type === 2) {
|
|
12740
|
+
if (!inPre) {
|
|
12741
|
+
if (isAllWhitespace(node.content)) {
|
|
12742
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
12743
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
12744
|
+
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
12745
|
+
removedWhitespace = true;
|
|
12746
|
+
nodes[i] = null;
|
|
12747
|
+
} else {
|
|
12748
|
+
node.content = " ";
|
|
12749
|
+
}
|
|
12750
|
+
} else if (shouldCondense) {
|
|
12751
|
+
node.content = condense(node.content);
|
|
11853
12752
|
}
|
|
11854
|
-
} else
|
|
11855
|
-
content
|
|
12753
|
+
} else {
|
|
12754
|
+
node.content = node.content.replace(windowsNewlineRE, "\n");
|
|
11856
12755
|
}
|
|
11857
|
-
arg = {
|
|
11858
|
-
type: 4,
|
|
11859
|
-
content,
|
|
11860
|
-
isStatic,
|
|
11861
|
-
constType: isStatic ? 3 : 0,
|
|
11862
|
-
loc: loc2
|
|
11863
|
-
};
|
|
11864
|
-
}
|
|
11865
|
-
if (value && value.isQuoted) {
|
|
11866
|
-
const valueLoc = value.loc;
|
|
11867
|
-
valueLoc.start.offset++;
|
|
11868
|
-
valueLoc.start.column++;
|
|
11869
|
-
valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
|
|
11870
|
-
valueLoc.source = valueLoc.source.slice(1, -1);
|
|
11871
12756
|
}
|
|
11872
|
-
const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
|
|
11873
|
-
if (isPropShorthand)
|
|
11874
|
-
modifiers.push("prop");
|
|
11875
|
-
return {
|
|
11876
|
-
type: 7,
|
|
11877
|
-
name: dirName,
|
|
11878
|
-
exp: value && {
|
|
11879
|
-
type: 4,
|
|
11880
|
-
content: value.content,
|
|
11881
|
-
isStatic: false,
|
|
11882
|
-
// Treat as non-constant by default. This can be potentially set to
|
|
11883
|
-
// other values by `transformExpression` to make it eligible for hoisting.
|
|
11884
|
-
constType: 0,
|
|
11885
|
-
loc: value.loc
|
|
11886
|
-
},
|
|
11887
|
-
arg,
|
|
11888
|
-
modifiers,
|
|
11889
|
-
loc
|
|
11890
|
-
};
|
|
11891
12757
|
}
|
|
11892
|
-
if (
|
|
11893
|
-
|
|
12758
|
+
if (inPre && tag && currentOptions.isPreTag(tag)) {
|
|
12759
|
+
const first = nodes[0];
|
|
12760
|
+
if (first && first.type === 2) {
|
|
12761
|
+
first.content = first.content.replace(/^\r?\n/, "");
|
|
12762
|
+
}
|
|
11894
12763
|
}
|
|
11895
|
-
return
|
|
11896
|
-
type: 6,
|
|
11897
|
-
name,
|
|
11898
|
-
value: value && {
|
|
11899
|
-
type: 2,
|
|
11900
|
-
content: value.content,
|
|
11901
|
-
loc: value.loc
|
|
11902
|
-
},
|
|
11903
|
-
loc
|
|
11904
|
-
};
|
|
12764
|
+
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
11905
12765
|
}
|
|
11906
|
-
function
|
|
11907
|
-
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
const isQuoted = quote === `"` || quote === `'`;
|
|
11911
|
-
if (isQuoted) {
|
|
11912
|
-
advanceBy(context, 1);
|
|
11913
|
-
const endIndex = context.source.indexOf(quote);
|
|
11914
|
-
if (endIndex === -1) {
|
|
11915
|
-
content = parseTextData(
|
|
11916
|
-
context,
|
|
11917
|
-
context.source.length,
|
|
11918
|
-
4
|
|
11919
|
-
);
|
|
11920
|
-
} else {
|
|
11921
|
-
content = parseTextData(context, endIndex, 4);
|
|
11922
|
-
advanceBy(context, 1);
|
|
11923
|
-
}
|
|
11924
|
-
} else {
|
|
11925
|
-
const match = /^[^\t\r\n\f >]+/.exec(context.source);
|
|
11926
|
-
if (!match) {
|
|
11927
|
-
return void 0;
|
|
11928
|
-
}
|
|
11929
|
-
const unexpectedChars = /["'<=`]/g;
|
|
11930
|
-
let m;
|
|
11931
|
-
while (m = unexpectedChars.exec(match[0])) {
|
|
11932
|
-
emitError(
|
|
11933
|
-
context,
|
|
11934
|
-
18,
|
|
11935
|
-
m.index
|
|
11936
|
-
);
|
|
12766
|
+
function isAllWhitespace(str) {
|
|
12767
|
+
for (let i = 0; i < str.length; i++) {
|
|
12768
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
12769
|
+
return false;
|
|
11937
12770
|
}
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
return { content, isQuoted, loc: getSelection(context, start) };
|
|
11941
|
-
}
|
|
11942
|
-
function parseInterpolation(context, mode) {
|
|
11943
|
-
const [open, close] = context.options.delimiters;
|
|
11944
|
-
const closeIndex = context.source.indexOf(close, open.length);
|
|
11945
|
-
if (closeIndex === -1) {
|
|
11946
|
-
emitError(context, 25);
|
|
11947
|
-
return void 0;
|
|
11948
|
-
}
|
|
11949
|
-
const start = getCursor(context);
|
|
11950
|
-
advanceBy(context, open.length);
|
|
11951
|
-
const innerStart = getCursor(context);
|
|
11952
|
-
const innerEnd = getCursor(context);
|
|
11953
|
-
const rawContentLength = closeIndex - open.length;
|
|
11954
|
-
const rawContent = context.source.slice(0, rawContentLength);
|
|
11955
|
-
const preTrimContent = parseTextData(context, rawContentLength, mode);
|
|
11956
|
-
const content = preTrimContent.trim();
|
|
11957
|
-
const startOffset = preTrimContent.indexOf(content);
|
|
11958
|
-
if (startOffset > 0) {
|
|
11959
|
-
advancePositionWithMutation(innerStart, rawContent, startOffset);
|
|
11960
|
-
}
|
|
11961
|
-
const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
|
|
11962
|
-
advancePositionWithMutation(innerEnd, rawContent, endOffset);
|
|
11963
|
-
advanceBy(context, close.length);
|
|
11964
|
-
return {
|
|
11965
|
-
type: 5,
|
|
11966
|
-
content: {
|
|
11967
|
-
type: 4,
|
|
11968
|
-
isStatic: false,
|
|
11969
|
-
// Set `isConstant` to false by default and will decide in transformExpression
|
|
11970
|
-
constType: 0,
|
|
11971
|
-
content,
|
|
11972
|
-
loc: getSelection(context, innerStart, innerEnd)
|
|
11973
|
-
},
|
|
11974
|
-
loc: getSelection(context, start)
|
|
11975
|
-
};
|
|
12771
|
+
}
|
|
12772
|
+
return true;
|
|
11976
12773
|
}
|
|
11977
|
-
function
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
if (index !== -1 && endIndex > index) {
|
|
11983
|
-
endIndex = index;
|
|
12774
|
+
function hasNewlineChar(str) {
|
|
12775
|
+
for (let i = 0; i < str.length; i++) {
|
|
12776
|
+
const c = str.charCodeAt(i);
|
|
12777
|
+
if (c === 10 || c === 13) {
|
|
12778
|
+
return true;
|
|
11984
12779
|
}
|
|
11985
12780
|
}
|
|
11986
|
-
|
|
11987
|
-
const content = parseTextData(context, endIndex, mode);
|
|
11988
|
-
return {
|
|
11989
|
-
type: 2,
|
|
11990
|
-
content,
|
|
11991
|
-
loc: getSelection(context, start)
|
|
11992
|
-
};
|
|
12781
|
+
return false;
|
|
11993
12782
|
}
|
|
11994
|
-
function
|
|
11995
|
-
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12783
|
+
function condense(str) {
|
|
12784
|
+
let ret = "";
|
|
12785
|
+
let prevCharIsWhitespace = false;
|
|
12786
|
+
for (let i = 0; i < str.length; i++) {
|
|
12787
|
+
if (isWhitespace(str.charCodeAt(i))) {
|
|
12788
|
+
if (!prevCharIsWhitespace) {
|
|
12789
|
+
ret += " ";
|
|
12790
|
+
prevCharIsWhitespace = true;
|
|
12791
|
+
}
|
|
12792
|
+
} else {
|
|
12793
|
+
ret += str[i];
|
|
12794
|
+
prevCharIsWhitespace = false;
|
|
12795
|
+
}
|
|
12004
12796
|
}
|
|
12797
|
+
return ret;
|
|
12005
12798
|
}
|
|
12006
|
-
function
|
|
12007
|
-
|
|
12008
|
-
return { column, line, offset };
|
|
12799
|
+
function addNode(node) {
|
|
12800
|
+
(stack[0] || currentRoot).children.push(node);
|
|
12009
12801
|
}
|
|
12010
|
-
function
|
|
12011
|
-
end = end || getCursor(context);
|
|
12802
|
+
function getLoc(start, end) {
|
|
12012
12803
|
return {
|
|
12013
|
-
start,
|
|
12014
|
-
|
|
12015
|
-
|
|
12804
|
+
start: tokenizer.getPos(start),
|
|
12805
|
+
// @ts-expect-error allow late attachment
|
|
12806
|
+
end: end == null ? end : tokenizer.getPos(end),
|
|
12807
|
+
// @ts-expect-error allow late attachment
|
|
12808
|
+
source: end == null ? end : getSlice(start, end)
|
|
12016
12809
|
};
|
|
12017
12810
|
}
|
|
12018
|
-
function
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
function startsWith(source, searchString) {
|
|
12022
|
-
return source.startsWith(searchString);
|
|
12811
|
+
function setLocEnd(loc, end) {
|
|
12812
|
+
loc.end = tokenizer.getPos(end);
|
|
12813
|
+
loc.source = getSlice(loc.start.offset, end);
|
|
12023
12814
|
}
|
|
12024
|
-
function
|
|
12025
|
-
const
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12815
|
+
function dirToAttr(dir) {
|
|
12816
|
+
const attr = {
|
|
12817
|
+
type: 6,
|
|
12818
|
+
name: dir.rawName,
|
|
12819
|
+
nameLoc: getLoc(
|
|
12820
|
+
dir.loc.start.offset,
|
|
12821
|
+
dir.loc.start.offset + dir.rawName.length
|
|
12822
|
+
),
|
|
12823
|
+
value: void 0,
|
|
12824
|
+
loc: dir.loc
|
|
12825
|
+
};
|
|
12826
|
+
if (dir.exp) {
|
|
12827
|
+
const loc = dir.exp.loc;
|
|
12828
|
+
if (loc.end.offset < dir.loc.end.offset) {
|
|
12829
|
+
loc.start.offset--;
|
|
12830
|
+
loc.start.column--;
|
|
12831
|
+
loc.end.offset++;
|
|
12832
|
+
loc.end.column++;
|
|
12833
|
+
}
|
|
12834
|
+
attr.value = {
|
|
12835
|
+
type: 2,
|
|
12836
|
+
content: dir.exp.content,
|
|
12837
|
+
loc
|
|
12838
|
+
};
|
|
12033
12839
|
}
|
|
12840
|
+
return attr;
|
|
12034
12841
|
}
|
|
12035
|
-
function
|
|
12036
|
-
|
|
12037
|
-
start,
|
|
12038
|
-
context.originalSource.slice(start.offset, numberOfCharacters),
|
|
12039
|
-
numberOfCharacters
|
|
12040
|
-
);
|
|
12842
|
+
function emitError(code, index) {
|
|
12843
|
+
currentOptions.onError(createCompilerError(code, getLoc(index, index)));
|
|
12041
12844
|
}
|
|
12042
|
-
function
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
end: loc,
|
|
12051
|
-
source: ""
|
|
12052
|
-
})
|
|
12053
|
-
);
|
|
12845
|
+
function reset() {
|
|
12846
|
+
tokenizer.reset();
|
|
12847
|
+
currentOpenTag = null;
|
|
12848
|
+
currentProp = null;
|
|
12849
|
+
currentAttrValue = "";
|
|
12850
|
+
currentAttrStartIndex = -1;
|
|
12851
|
+
currentAttrEndIndex = -1;
|
|
12852
|
+
stack.length = 0;
|
|
12054
12853
|
}
|
|
12055
|
-
function
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
}
|
|
12065
|
-
}
|
|
12066
|
-
break;
|
|
12067
|
-
case 1:
|
|
12068
|
-
case 2: {
|
|
12069
|
-
const parent = last(ancestors);
|
|
12070
|
-
if (parent && startsWithEndTagOpen(s, parent.tag)) {
|
|
12071
|
-
return true;
|
|
12854
|
+
function baseParse(input, options) {
|
|
12855
|
+
reset();
|
|
12856
|
+
currentInput = input;
|
|
12857
|
+
currentOptions = extend({}, defaultParserOptions);
|
|
12858
|
+
if (options) {
|
|
12859
|
+
let key;
|
|
12860
|
+
for (key in options) {
|
|
12861
|
+
if (options[key] != null) {
|
|
12862
|
+
currentOptions[key] = options[key];
|
|
12072
12863
|
}
|
|
12073
|
-
break;
|
|
12074
12864
|
}
|
|
12075
|
-
case 3:
|
|
12076
|
-
if (startsWith(s, "]]>")) {
|
|
12077
|
-
return true;
|
|
12078
|
-
}
|
|
12079
|
-
break;
|
|
12080
12865
|
}
|
|
12081
|
-
|
|
12082
|
-
|
|
12083
|
-
|
|
12084
|
-
|
|
12866
|
+
{
|
|
12867
|
+
if (!currentOptions.decodeEntities) {
|
|
12868
|
+
throw new Error(
|
|
12869
|
+
`[@vue/compiler-core] decodeEntities option is required in browser builds.`
|
|
12870
|
+
);
|
|
12871
|
+
}
|
|
12872
|
+
}
|
|
12873
|
+
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
12874
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
12875
|
+
if (delimiters) {
|
|
12876
|
+
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
12877
|
+
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
12878
|
+
}
|
|
12879
|
+
const root = currentRoot = createRoot([], input);
|
|
12880
|
+
tokenizer.parse(currentInput);
|
|
12881
|
+
root.loc = getLoc(0, input.length);
|
|
12882
|
+
root.children = condenseWhitespace(root.children);
|
|
12883
|
+
currentRoot = null;
|
|
12884
|
+
return root;
|
|
12085
12885
|
}
|
|
12086
12886
|
|
|
12087
12887
|
function hoistStatic(root, context) {
|
|
@@ -12490,6 +13290,7 @@ function transform(root, options) {
|
|
|
12490
13290
|
root.hoists = context.hoists;
|
|
12491
13291
|
root.temps = context.temps;
|
|
12492
13292
|
root.cached = context.cached;
|
|
13293
|
+
root.transformed = true;
|
|
12493
13294
|
}
|
|
12494
13295
|
function createRootCodegen(root, context) {
|
|
12495
13296
|
const { helper } = context;
|
|
@@ -12643,7 +13444,7 @@ function createCodegenContext(ast, {
|
|
|
12643
13444
|
ssr,
|
|
12644
13445
|
isTS,
|
|
12645
13446
|
inSSR,
|
|
12646
|
-
source: ast.
|
|
13447
|
+
source: ast.source,
|
|
12647
13448
|
code: ``,
|
|
12648
13449
|
column: 1,
|
|
12649
13450
|
line: 1,
|
|
@@ -12654,7 +13455,7 @@ function createCodegenContext(ast, {
|
|
|
12654
13455
|
helper(key) {
|
|
12655
13456
|
return `_${helperNameMap[key]}`;
|
|
12656
13457
|
},
|
|
12657
|
-
push(code, node) {
|
|
13458
|
+
push(code, newlineIndex = -2 /* None */, node) {
|
|
12658
13459
|
context.code += code;
|
|
12659
13460
|
},
|
|
12660
13461
|
indent() {
|
|
@@ -12672,7 +13473,7 @@ function createCodegenContext(ast, {
|
|
|
12672
13473
|
}
|
|
12673
13474
|
};
|
|
12674
13475
|
function newline(n) {
|
|
12675
|
-
context.push("\n" + ` `.repeat(n));
|
|
13476
|
+
context.push("\n" + ` `.repeat(n), 0 /* Start */);
|
|
12676
13477
|
}
|
|
12677
13478
|
return context;
|
|
12678
13479
|
}
|
|
@@ -12709,9 +13510,11 @@ function generate(ast, options = {}) {
|
|
|
12709
13510
|
push(`with (_ctx) {`);
|
|
12710
13511
|
indent();
|
|
12711
13512
|
if (hasHelpers) {
|
|
12712
|
-
push(
|
|
12713
|
-
|
|
12714
|
-
|
|
13513
|
+
push(
|
|
13514
|
+
`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
|
|
13515
|
+
`,
|
|
13516
|
+
-1 /* End */
|
|
13517
|
+
);
|
|
12715
13518
|
newline();
|
|
12716
13519
|
}
|
|
12717
13520
|
}
|
|
@@ -12735,7 +13538,7 @@ function generate(ast, options = {}) {
|
|
|
12735
13538
|
}
|
|
12736
13539
|
if (ast.components.length || ast.directives.length || ast.temps) {
|
|
12737
13540
|
push(`
|
|
12738
|
-
|
|
13541
|
+
`, 0 /* Start */);
|
|
12739
13542
|
newline();
|
|
12740
13543
|
}
|
|
12741
13544
|
if (!ssr) {
|
|
@@ -12756,7 +13559,6 @@ function generate(ast, options = {}) {
|
|
|
12756
13559
|
ast,
|
|
12757
13560
|
code: context.code,
|
|
12758
13561
|
preamble: isSetupInlined ? preambleContext.code : ``,
|
|
12759
|
-
// SourceMapGenerator does have toJSON() method but it's not in the types
|
|
12760
13562
|
map: context.map ? context.map.toJSON() : void 0
|
|
12761
13563
|
};
|
|
12762
13564
|
}
|
|
@@ -12775,7 +13577,7 @@ function genFunctionPreamble(ast, context) {
|
|
|
12775
13577
|
if (helpers.length > 0) {
|
|
12776
13578
|
{
|
|
12777
13579
|
push(`const _Vue = ${VueBinding}
|
|
12778
|
-
|
|
13580
|
+
`, -1 /* End */);
|
|
12779
13581
|
if (ast.hoists.length) {
|
|
12780
13582
|
const staticHelpers = [
|
|
12781
13583
|
CREATE_VNODE,
|
|
@@ -12785,7 +13587,7 @@ function genFunctionPreamble(ast, context) {
|
|
|
12785
13587
|
CREATE_STATIC
|
|
12786
13588
|
].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
|
|
12787
13589
|
push(`const { ${staticHelpers} } = _Vue
|
|
12788
|
-
|
|
13590
|
+
`, -1 /* End */);
|
|
12789
13591
|
}
|
|
12790
13592
|
}
|
|
12791
13593
|
}
|
|
@@ -12846,7 +13648,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
12846
13648
|
for (let i = 0; i < nodes.length; i++) {
|
|
12847
13649
|
const node = nodes[i];
|
|
12848
13650
|
if (isString(node)) {
|
|
12849
|
-
push(node);
|
|
13651
|
+
push(node, -3 /* Unknown */);
|
|
12850
13652
|
} else if (isArray(node)) {
|
|
12851
13653
|
genNodeListAsArray(node, context);
|
|
12852
13654
|
} else {
|
|
@@ -12864,7 +13666,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
12864
13666
|
}
|
|
12865
13667
|
function genNode(node, context) {
|
|
12866
13668
|
if (isString(node)) {
|
|
12867
|
-
context.push(node);
|
|
13669
|
+
context.push(node, -3 /* Unknown */);
|
|
12868
13670
|
return;
|
|
12869
13671
|
}
|
|
12870
13672
|
if (isSymbol(node)) {
|
|
@@ -12944,11 +13746,15 @@ function genNode(node, context) {
|
|
|
12944
13746
|
}
|
|
12945
13747
|
}
|
|
12946
13748
|
function genText(node, context) {
|
|
12947
|
-
context.push(JSON.stringify(node.content), node);
|
|
13749
|
+
context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
|
|
12948
13750
|
}
|
|
12949
13751
|
function genExpression(node, context) {
|
|
12950
13752
|
const { content, isStatic } = node;
|
|
12951
|
-
context.push(
|
|
13753
|
+
context.push(
|
|
13754
|
+
isStatic ? JSON.stringify(content) : content,
|
|
13755
|
+
-3 /* Unknown */,
|
|
13756
|
+
node
|
|
13757
|
+
);
|
|
12952
13758
|
}
|
|
12953
13759
|
function genInterpolation(node, context) {
|
|
12954
13760
|
const { push, helper, pure } = context;
|
|
@@ -12962,7 +13768,7 @@ function genCompoundExpression(node, context) {
|
|
|
12962
13768
|
for (let i = 0; i < node.children.length; i++) {
|
|
12963
13769
|
const child = node.children[i];
|
|
12964
13770
|
if (isString(child)) {
|
|
12965
|
-
context.push(child);
|
|
13771
|
+
context.push(child, -3 /* Unknown */);
|
|
12966
13772
|
} else {
|
|
12967
13773
|
genNode(child, context);
|
|
12968
13774
|
}
|
|
@@ -12976,9 +13782,9 @@ function genExpressionAsPropertyKey(node, context) {
|
|
|
12976
13782
|
push(`]`);
|
|
12977
13783
|
} else if (node.isStatic) {
|
|
12978
13784
|
const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
|
|
12979
|
-
push(text, node);
|
|
13785
|
+
push(text, -2 /* None */, node);
|
|
12980
13786
|
} else {
|
|
12981
|
-
push(`[${node.content}]`, node);
|
|
13787
|
+
push(`[${node.content}]`, -3 /* Unknown */, node);
|
|
12982
13788
|
}
|
|
12983
13789
|
}
|
|
12984
13790
|
function genComment(node, context) {
|
|
@@ -12986,7 +13792,11 @@ function genComment(node, context) {
|
|
|
12986
13792
|
if (pure) {
|
|
12987
13793
|
push(PURE_ANNOTATION);
|
|
12988
13794
|
}
|
|
12989
|
-
push(
|
|
13795
|
+
push(
|
|
13796
|
+
`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
|
|
13797
|
+
-3 /* Unknown */,
|
|
13798
|
+
node
|
|
13799
|
+
);
|
|
12990
13800
|
}
|
|
12991
13801
|
function genVNodeCall(node, context) {
|
|
12992
13802
|
const { push, helper, pure } = context;
|
|
@@ -13011,7 +13821,7 @@ function genVNodeCall(node, context) {
|
|
|
13011
13821
|
push(PURE_ANNOTATION);
|
|
13012
13822
|
}
|
|
13013
13823
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
13014
|
-
push(helper(callHelper) + `(`, node);
|
|
13824
|
+
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
13015
13825
|
genNodeList(
|
|
13016
13826
|
genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
|
|
13017
13827
|
context
|
|
@@ -13040,7 +13850,7 @@ function genCallExpression(node, context) {
|
|
|
13040
13850
|
if (pure) {
|
|
13041
13851
|
push(PURE_ANNOTATION);
|
|
13042
13852
|
}
|
|
13043
|
-
push(callee + `(`, node);
|
|
13853
|
+
push(callee + `(`, -2 /* None */, node);
|
|
13044
13854
|
genNodeList(node.arguments, context);
|
|
13045
13855
|
push(`)`);
|
|
13046
13856
|
}
|
|
@@ -13048,7 +13858,7 @@ function genObjectExpression(node, context) {
|
|
|
13048
13858
|
const { push, indent, deindent, newline } = context;
|
|
13049
13859
|
const { properties } = node;
|
|
13050
13860
|
if (!properties.length) {
|
|
13051
|
-
push(`{}`, node);
|
|
13861
|
+
push(`{}`, -2 /* None */, node);
|
|
13052
13862
|
return;
|
|
13053
13863
|
}
|
|
13054
13864
|
const multilines = properties.length > 1 || properties.some((p) => p.value.type !== 4);
|
|
@@ -13076,7 +13886,7 @@ function genFunctionExpression(node, context) {
|
|
|
13076
13886
|
if (isSlot) {
|
|
13077
13887
|
push(`_${helperNameMap[WITH_CTX]}(`);
|
|
13078
13888
|
}
|
|
13079
|
-
push(`(`, node);
|
|
13889
|
+
push(`(`, -2 /* None */, node);
|
|
13080
13890
|
if (isArray(params)) {
|
|
13081
13891
|
genNodeList(params, context);
|
|
13082
13892
|
} else if (params) {
|
|
@@ -13307,7 +14117,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
13307
14117
|
context.removeNode();
|
|
13308
14118
|
const branch = createIfBranch(node, dir);
|
|
13309
14119
|
if (comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
|
|
13310
|
-
!(context.parent && context.parent.type === 1 &&
|
|
14120
|
+
!(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
|
|
13311
14121
|
branch.children = [...comments, ...branch.children];
|
|
13312
14122
|
}
|
|
13313
14123
|
{
|
|
@@ -13589,18 +14399,14 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
13589
14399
|
);
|
|
13590
14400
|
return;
|
|
13591
14401
|
}
|
|
13592
|
-
const parseResult =
|
|
13593
|
-
// can only be simple expression because vFor transform is applied
|
|
13594
|
-
// before expression transform.
|
|
13595
|
-
dir.exp,
|
|
13596
|
-
context
|
|
13597
|
-
);
|
|
14402
|
+
const parseResult = dir.forParseResult;
|
|
13598
14403
|
if (!parseResult) {
|
|
13599
14404
|
context.onError(
|
|
13600
14405
|
createCompilerError(32, dir.loc)
|
|
13601
14406
|
);
|
|
13602
14407
|
return;
|
|
13603
14408
|
}
|
|
14409
|
+
finalizeForParseResult(parseResult, context);
|
|
13604
14410
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
13605
14411
|
const { source, value, key, index } = parseResult;
|
|
13606
14412
|
const forNode = {
|
|
@@ -13622,70 +14428,26 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
13622
14428
|
onExit();
|
|
13623
14429
|
};
|
|
13624
14430
|
}
|
|
13625
|
-
|
|
13626
|
-
|
|
13627
|
-
function parseForExpression(input, context) {
|
|
13628
|
-
const loc = input.loc;
|
|
13629
|
-
const exp = input.content;
|
|
13630
|
-
const inMatch = exp.match(forAliasRE);
|
|
13631
|
-
if (!inMatch)
|
|
14431
|
+
function finalizeForParseResult(result, context) {
|
|
14432
|
+
if (result.finalized)
|
|
13632
14433
|
return;
|
|
13633
|
-
const [, LHS, RHS] = inMatch;
|
|
13634
|
-
const result = {
|
|
13635
|
-
source: createAliasExpression(
|
|
13636
|
-
loc,
|
|
13637
|
-
RHS.trim(),
|
|
13638
|
-
exp.indexOf(RHS, LHS.length)
|
|
13639
|
-
),
|
|
13640
|
-
value: void 0,
|
|
13641
|
-
key: void 0,
|
|
13642
|
-
index: void 0
|
|
13643
|
-
};
|
|
13644
14434
|
{
|
|
13645
14435
|
validateBrowserExpression(result.source, context);
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
const keyContent = iteratorMatch[1].trim();
|
|
13653
|
-
let keyOffset;
|
|
13654
|
-
if (keyContent) {
|
|
13655
|
-
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
13656
|
-
result.key = createAliasExpression(loc, keyContent, keyOffset);
|
|
13657
|
-
{
|
|
13658
|
-
validateBrowserExpression(
|
|
13659
|
-
result.key,
|
|
13660
|
-
context,
|
|
13661
|
-
true
|
|
13662
|
-
);
|
|
13663
|
-
}
|
|
14436
|
+
if (result.key) {
|
|
14437
|
+
validateBrowserExpression(
|
|
14438
|
+
result.key,
|
|
14439
|
+
context,
|
|
14440
|
+
true
|
|
14441
|
+
);
|
|
13664
14442
|
}
|
|
13665
|
-
if (
|
|
13666
|
-
|
|
13667
|
-
|
|
13668
|
-
|
|
13669
|
-
|
|
13670
|
-
|
|
13671
|
-
exp.indexOf(
|
|
13672
|
-
indexContent,
|
|
13673
|
-
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
13674
|
-
)
|
|
13675
|
-
);
|
|
13676
|
-
{
|
|
13677
|
-
validateBrowserExpression(
|
|
13678
|
-
result.index,
|
|
13679
|
-
context,
|
|
13680
|
-
true
|
|
13681
|
-
);
|
|
13682
|
-
}
|
|
13683
|
-
}
|
|
14443
|
+
if (result.index) {
|
|
14444
|
+
validateBrowserExpression(
|
|
14445
|
+
result.index,
|
|
14446
|
+
context,
|
|
14447
|
+
true
|
|
14448
|
+
);
|
|
13684
14449
|
}
|
|
13685
|
-
|
|
13686
|
-
if (valueContent) {
|
|
13687
|
-
result.value = createAliasExpression(loc, valueContent, trimmedOffset);
|
|
13688
|
-
{
|
|
14450
|
+
if (result.value) {
|
|
13689
14451
|
validateBrowserExpression(
|
|
13690
14452
|
result.value,
|
|
13691
14453
|
context,
|
|
@@ -13693,14 +14455,7 @@ function parseForExpression(input, context) {
|
|
|
13693
14455
|
);
|
|
13694
14456
|
}
|
|
13695
14457
|
}
|
|
13696
|
-
|
|
13697
|
-
}
|
|
13698
|
-
function createAliasExpression(range, content, offset) {
|
|
13699
|
-
return createSimpleExpression(
|
|
13700
|
-
content,
|
|
13701
|
-
false,
|
|
13702
|
-
getInnerRange(range, offset, content.length)
|
|
13703
|
-
);
|
|
14458
|
+
result.finalized = true;
|
|
13704
14459
|
}
|
|
13705
14460
|
function createForLoopParams({ value, key, index }, memoArgs = []) {
|
|
13706
14461
|
return createParamsList([value, key, index, ...memoArgs]);
|
|
@@ -13787,12 +14542,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
13787
14542
|
hasDynamicSlots = true;
|
|
13788
14543
|
}
|
|
13789
14544
|
const vFor = findDir(slotElement, "for");
|
|
13790
|
-
const slotFunction = buildSlotFn(
|
|
13791
|
-
slotProps,
|
|
13792
|
-
vFor == null ? void 0 : vFor.exp,
|
|
13793
|
-
slotChildren,
|
|
13794
|
-
slotLoc
|
|
13795
|
-
);
|
|
14545
|
+
const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
|
|
13796
14546
|
let vIf;
|
|
13797
14547
|
let vElse;
|
|
13798
14548
|
if (vIf = findDir(slotElement, "if")) {
|
|
@@ -13841,8 +14591,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
13841
14591
|
}
|
|
13842
14592
|
} else if (vFor) {
|
|
13843
14593
|
hasDynamicSlots = true;
|
|
13844
|
-
const parseResult = vFor.
|
|
14594
|
+
const parseResult = vFor.forParseResult;
|
|
13845
14595
|
if (parseResult) {
|
|
14596
|
+
finalizeForParseResult(parseResult, context);
|
|
13846
14597
|
dynamicSlots.push(
|
|
13847
14598
|
createCallExpression(context.helper(RENDER_LIST), [
|
|
13848
14599
|
parseResult.source,
|
|
@@ -14097,17 +14848,6 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
14097
14848
|
tag = isProp.value.content.slice(4);
|
|
14098
14849
|
}
|
|
14099
14850
|
}
|
|
14100
|
-
const isDir = !isExplicitDynamic && findDir(node, "is");
|
|
14101
|
-
if (isDir && isDir.exp) {
|
|
14102
|
-
{
|
|
14103
|
-
context.onWarn(
|
|
14104
|
-
createCompilerError(52, isDir.loc)
|
|
14105
|
-
);
|
|
14106
|
-
}
|
|
14107
|
-
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
14108
|
-
isDir.exp
|
|
14109
|
-
]);
|
|
14110
|
-
}
|
|
14111
14851
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
14112
14852
|
if (builtIn) {
|
|
14113
14853
|
if (!ssr)
|
|
@@ -14179,7 +14919,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
14179
14919
|
for (let i = 0; i < props.length; i++) {
|
|
14180
14920
|
const prop = props[i];
|
|
14181
14921
|
if (prop.type === 6) {
|
|
14182
|
-
const { loc, name, value } = prop;
|
|
14922
|
+
const { loc, name, nameLoc, value } = prop;
|
|
14183
14923
|
let isStatic = true;
|
|
14184
14924
|
if (name === "ref") {
|
|
14185
14925
|
hasRef = true;
|
|
@@ -14197,11 +14937,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
14197
14937
|
}
|
|
14198
14938
|
properties.push(
|
|
14199
14939
|
createObjectProperty(
|
|
14200
|
-
createSimpleExpression(
|
|
14201
|
-
name,
|
|
14202
|
-
true,
|
|
14203
|
-
getInnerRange(loc, 0, name.length)
|
|
14204
|
-
),
|
|
14940
|
+
createSimpleExpression(name, true, nameLoc),
|
|
14205
14941
|
createSimpleExpression(
|
|
14206
14942
|
value ? value.content : "",
|
|
14207
14943
|
isStatic,
|
|
@@ -14650,8 +15386,13 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
14650
15386
|
};
|
|
14651
15387
|
|
|
14652
15388
|
const transformBind = (dir, _node, context) => {
|
|
14653
|
-
const {
|
|
15389
|
+
const { modifiers, loc } = dir;
|
|
14654
15390
|
const arg = dir.arg;
|
|
15391
|
+
let { exp } = dir;
|
|
15392
|
+
if (!exp && arg.type === 4) {
|
|
15393
|
+
const propName = camelize(arg.content);
|
|
15394
|
+
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
15395
|
+
}
|
|
14655
15396
|
if (arg.type !== 4) {
|
|
14656
15397
|
arg.children.unshift(`(`);
|
|
14657
15398
|
arg.children.push(`) || ""`);
|
|
@@ -14903,7 +15644,7 @@ function getBaseTransformPreset(prefixIdentifiers) {
|
|
|
14903
15644
|
}
|
|
14904
15645
|
];
|
|
14905
15646
|
}
|
|
14906
|
-
function baseCompile(
|
|
15647
|
+
function baseCompile(source, options = {}) {
|
|
14907
15648
|
const onError = options.onError || defaultOnError;
|
|
14908
15649
|
const isModuleMode = options.mode === "module";
|
|
14909
15650
|
{
|
|
@@ -14920,7 +15661,7 @@ function baseCompile(template, options = {}) {
|
|
|
14920
15661
|
if (options.scopeId && !isModuleMode) {
|
|
14921
15662
|
onError(createCompilerError(50));
|
|
14922
15663
|
}
|
|
14923
|
-
const ast = isString(
|
|
15664
|
+
const ast = isString(source) ? baseParse(source, options) : source;
|
|
14924
15665
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
|
14925
15666
|
transform(
|
|
14926
15667
|
ast,
|
|
@@ -14986,25 +15727,22 @@ function decodeHtmlBrowser(raw, asAttr = false) {
|
|
|
14986
15727
|
}
|
|
14987
15728
|
}
|
|
14988
15729
|
|
|
14989
|
-
const isRawTextContainer = /* @__PURE__ */ makeMap(
|
|
14990
|
-
"style,iframe,script,noscript",
|
|
14991
|
-
true
|
|
14992
|
-
);
|
|
14993
15730
|
const parserOptions = {
|
|
15731
|
+
parseMode: "html",
|
|
14994
15732
|
isVoidTag,
|
|
14995
15733
|
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
|
|
14996
15734
|
isPreTag: (tag) => tag === "pre",
|
|
14997
15735
|
decodeEntities: decodeHtmlBrowser ,
|
|
14998
15736
|
isBuiltInComponent: (tag) => {
|
|
14999
|
-
if (
|
|
15737
|
+
if (tag === "Transition" || tag === "transition") {
|
|
15000
15738
|
return TRANSITION;
|
|
15001
|
-
} else if (
|
|
15739
|
+
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
|
15002
15740
|
return TRANSITION_GROUP;
|
|
15003
15741
|
}
|
|
15004
15742
|
},
|
|
15005
15743
|
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
|
15006
|
-
getNamespace(tag, parent) {
|
|
15007
|
-
let ns = parent ? parent.ns :
|
|
15744
|
+
getNamespace(tag, parent, rootNamespace) {
|
|
15745
|
+
let ns = parent ? parent.ns : rootNamespace;
|
|
15008
15746
|
if (parent && ns === 2) {
|
|
15009
15747
|
if (parent.tag === "annotation-xml") {
|
|
15010
15748
|
if (tag === "svg") {
|
|
@@ -15032,18 +15770,6 @@ const parserOptions = {
|
|
|
15032
15770
|
}
|
|
15033
15771
|
}
|
|
15034
15772
|
return ns;
|
|
15035
|
-
},
|
|
15036
|
-
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
|
15037
|
-
getTextMode({ tag, ns }) {
|
|
15038
|
-
if (ns === 0) {
|
|
15039
|
-
if (tag === "textarea" || tag === "title") {
|
|
15040
|
-
return 1;
|
|
15041
|
-
}
|
|
15042
|
-
if (isRawTextContainer(tag)) {
|
|
15043
|
-
return 2;
|
|
15044
|
-
}
|
|
15045
|
-
}
|
|
15046
|
-
return 0;
|
|
15047
15773
|
}
|
|
15048
15774
|
};
|
|
15049
15775
|
|
|
@@ -15358,6 +16084,7 @@ const transformTransition = (node, context) => {
|
|
|
15358
16084
|
node.props.push({
|
|
15359
16085
|
type: 6,
|
|
15360
16086
|
name: "persisted",
|
|
16087
|
+
nameLoc: node.loc,
|
|
15361
16088
|
value: void 0,
|
|
15362
16089
|
loc: node.loc
|
|
15363
16090
|
});
|
|
@@ -15402,9 +16129,9 @@ const DOMDirectiveTransforms = {
|
|
|
15402
16129
|
// override compiler-core
|
|
15403
16130
|
show: transformShow
|
|
15404
16131
|
};
|
|
15405
|
-
function compile(
|
|
16132
|
+
function compile(src, options = {}) {
|
|
15406
16133
|
return baseCompile(
|
|
15407
|
-
|
|
16134
|
+
src,
|
|
15408
16135
|
extend({}, parserOptions, options, {
|
|
15409
16136
|
nodeTransforms: [
|
|
15410
16137
|
// ignore <script> and <tag>
|
|
@@ -15477,4 +16204,4 @@ ${codeFrame}` : message);
|
|
|
15477
16204
|
}
|
|
15478
16205
|
registerRuntimeCompiler(compileToFunction);
|
|
15479
16206
|
|
|
15480
|
-
export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, 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 };
|
|
16207
|
+
export { BaseTransition, BaseTransitionPropsValidators, Comment, EffectScope, ErrorTypeStrings, Fragment, KeepAlive, ReactiveEffect, Static, Suspense, Teleport, Text, Transition, TransitionGroup, VueElement, assertNumber, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, cloneVNode, compatUtils, compileToFunction as compile, computed, createApp, createBlock, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createPropsRestProxy, createRenderer, createSSRApp, createSlots, createStaticVNode, createTextVNode, createVNode, customRef, 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 };
|