@vue/compat 3.4.0-alpha.1 → 3.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.cjs.js +1965 -3493
- package/dist/vue.cjs.prod.js +1854 -3392
- package/dist/vue.esm-browser.js +1867 -1175
- package/dist/vue.esm-browser.prod.js +5 -5
- package/dist/vue.esm-bundler.js +1869 -1177
- package/dist/vue.global.js +1867 -1175
- package/dist/vue.global.prod.js +5 -5
- package/dist/vue.runtime.esm-browser.js +126 -97
- package/dist/vue.runtime.esm-browser.prod.js +5 -5
- package/dist/vue.runtime.esm-bundler.js +127 -98
- package/dist/vue.runtime.global.js +126 -97
- package/dist/vue.runtime.global.prod.js +5 -5
- package/package.json +3 -3
package/dist/vue.esm-bundler.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
function makeMap(str, expectsLowerCase) {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
for (let i = 0; i < list.length; i++) {
|
|
5
|
-
map[list[i]] = true;
|
|
6
|
-
}
|
|
7
|
-
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val];
|
|
2
|
+
const set = new Set(str.split(","));
|
|
3
|
+
return expectsLowerCase ? (val) => set.has(val.toLowerCase()) : (val) => set.has(val);
|
|
8
4
|
}
|
|
9
5
|
|
|
10
6
|
const EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
@@ -104,7 +100,7 @@ const PatchFlagNames = {
|
|
|
104
100
|
[4]: `STYLE`,
|
|
105
101
|
[8]: `PROPS`,
|
|
106
102
|
[16]: `FULL_PROPS`,
|
|
107
|
-
[32]: `
|
|
103
|
+
[32]: `NEED_HYDRATION`,
|
|
108
104
|
[64]: `STABLE_FRAGMENT`,
|
|
109
105
|
[128]: `KEYED_FRAGMENT`,
|
|
110
106
|
[256]: `UNKEYED_FRAGMENT`,
|
|
@@ -1026,7 +1022,7 @@ function createReadonlyMethod(type) {
|
|
|
1026
1022
|
toRaw(this)
|
|
1027
1023
|
);
|
|
1028
1024
|
}
|
|
1029
|
-
return type === "delete" ? false : this;
|
|
1025
|
+
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
1030
1026
|
};
|
|
1031
1027
|
}
|
|
1032
1028
|
function createInstrumentations() {
|
|
@@ -1282,9 +1278,10 @@ class ComputedRefImpl {
|
|
|
1282
1278
|
this.dep = void 0;
|
|
1283
1279
|
this.__v_isRef = true;
|
|
1284
1280
|
this["__v_isReadonly"] = false;
|
|
1285
|
-
this.effect = new ReactiveEffect(
|
|
1286
|
-
|
|
1287
|
-
|
|
1281
|
+
this.effect = new ReactiveEffect(
|
|
1282
|
+
() => getter(this._value),
|
|
1283
|
+
() => triggerRefValue(this, 1)
|
|
1284
|
+
);
|
|
1288
1285
|
this.effect.computed = this;
|
|
1289
1286
|
this.effect.active = this._cacheable = !isSSR;
|
|
1290
1287
|
this["__v_isReadonly"] = isReadonly;
|
|
@@ -1501,18 +1498,18 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1501
1498
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1502
1499
|
}
|
|
1503
1500
|
|
|
1504
|
-
const stack = [];
|
|
1501
|
+
const stack$1 = [];
|
|
1505
1502
|
function pushWarningContext(vnode) {
|
|
1506
|
-
stack.push(vnode);
|
|
1503
|
+
stack$1.push(vnode);
|
|
1507
1504
|
}
|
|
1508
1505
|
function popWarningContext() {
|
|
1509
|
-
stack.pop();
|
|
1506
|
+
stack$1.pop();
|
|
1510
1507
|
}
|
|
1511
1508
|
function warn(msg, ...args) {
|
|
1512
1509
|
if (!!!(process.env.NODE_ENV !== "production"))
|
|
1513
1510
|
return;
|
|
1514
1511
|
pauseTracking();
|
|
1515
|
-
const instance = stack.length ? stack[stack.length - 1].component : null;
|
|
1512
|
+
const instance = stack$1.length ? stack$1[stack$1.length - 1].component : null;
|
|
1516
1513
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1517
1514
|
const trace = getComponentTrace();
|
|
1518
1515
|
if (appWarnHandler) {
|
|
@@ -1541,7 +1538,7 @@ function warn(msg, ...args) {
|
|
|
1541
1538
|
resetTracking();
|
|
1542
1539
|
}
|
|
1543
1540
|
function getComponentTrace() {
|
|
1544
|
-
let currentVNode = stack[stack.length - 1];
|
|
1541
|
+
let currentVNode = stack$1[stack$1.length - 1];
|
|
1545
1542
|
if (!currentVNode) {
|
|
1546
1543
|
return [];
|
|
1547
1544
|
}
|
|
@@ -2777,9 +2774,19 @@ function renderComponentRoot(instance) {
|
|
|
2777
2774
|
try {
|
|
2778
2775
|
if (vnode.shapeFlag & 4) {
|
|
2779
2776
|
const proxyToUse = withProxy || proxy;
|
|
2777
|
+
const thisProxy = !!(process.env.NODE_ENV !== "production") && setupState.__isScriptSetup ? new Proxy(proxyToUse, {
|
|
2778
|
+
get(target, key, receiver) {
|
|
2779
|
+
warn(
|
|
2780
|
+
`Property '${String(
|
|
2781
|
+
key
|
|
2782
|
+
)}' was accessed via 'this'. Avoid using 'this' in templates.`
|
|
2783
|
+
);
|
|
2784
|
+
return Reflect.get(target, key, receiver);
|
|
2785
|
+
}
|
|
2786
|
+
}) : proxyToUse;
|
|
2780
2787
|
result = normalizeVNode(
|
|
2781
2788
|
render.call(
|
|
2782
|
-
|
|
2789
|
+
thisProxy,
|
|
2783
2790
|
proxyToUse,
|
|
2784
2791
|
renderCache,
|
|
2785
2792
|
props,
|
|
@@ -3030,6 +3037,65 @@ function updateHOCHostEl({ vnode, parent }, el) {
|
|
|
3030
3037
|
}
|
|
3031
3038
|
}
|
|
3032
3039
|
|
|
3040
|
+
const COMPONENTS = "components";
|
|
3041
|
+
const DIRECTIVES = "directives";
|
|
3042
|
+
const FILTERS = "filters";
|
|
3043
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
3044
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
3045
|
+
}
|
|
3046
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
3047
|
+
function resolveDynamicComponent(component) {
|
|
3048
|
+
if (isString(component)) {
|
|
3049
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
3050
|
+
} else {
|
|
3051
|
+
return component || NULL_DYNAMIC_COMPONENT;
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
3054
|
+
function resolveDirective(name) {
|
|
3055
|
+
return resolveAsset(DIRECTIVES, name);
|
|
3056
|
+
}
|
|
3057
|
+
function resolveFilter$1(name) {
|
|
3058
|
+
return resolveAsset(FILTERS, name);
|
|
3059
|
+
}
|
|
3060
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
3061
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
3062
|
+
if (instance) {
|
|
3063
|
+
const Component = instance.type;
|
|
3064
|
+
if (type === COMPONENTS) {
|
|
3065
|
+
const selfName = getComponentName(
|
|
3066
|
+
Component,
|
|
3067
|
+
false
|
|
3068
|
+
/* do not include inferred name to avoid breaking existing code */
|
|
3069
|
+
);
|
|
3070
|
+
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
|
3071
|
+
return Component;
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
const res = (
|
|
3075
|
+
// local registration
|
|
3076
|
+
// check instance[type] first which is resolved for options API
|
|
3077
|
+
resolve(instance[type] || Component[type], name) || // global registration
|
|
3078
|
+
resolve(instance.appContext[type], name)
|
|
3079
|
+
);
|
|
3080
|
+
if (!res && maybeSelfReference) {
|
|
3081
|
+
return Component;
|
|
3082
|
+
}
|
|
3083
|
+
if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
|
|
3084
|
+
const extra = type === COMPONENTS ? `
|
|
3085
|
+
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
|
|
3086
|
+
warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
3087
|
+
}
|
|
3088
|
+
return res;
|
|
3089
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
3090
|
+
warn(
|
|
3091
|
+
`resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
|
|
3092
|
+
);
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
function resolve(registry, name) {
|
|
3096
|
+
return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3033
3099
|
const isSuspense = (type) => type.__isSuspense;
|
|
3034
3100
|
const SuspenseImpl = {
|
|
3035
3101
|
name: "Suspense",
|
|
@@ -3564,7 +3630,7 @@ function normalizeSuspenseSlot(s) {
|
|
|
3564
3630
|
}
|
|
3565
3631
|
if (isArray(s)) {
|
|
3566
3632
|
const singleChild = filterSingleRoot(s);
|
|
3567
|
-
if (!!(process.env.NODE_ENV !== "production") && !singleChild) {
|
|
3633
|
+
if (!!(process.env.NODE_ENV !== "production") && !singleChild && s.filter((child) => child !== NULL_DYNAMIC_COMPONENT).length > 0) {
|
|
3568
3634
|
warn(`<Suspense> slots expect a single root node.`);
|
|
3569
3635
|
}
|
|
3570
3636
|
s = singleChild;
|
|
@@ -3762,6 +3828,7 @@ function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger
|
|
|
3762
3828
|
let onCleanup = (fn) => {
|
|
3763
3829
|
cleanup = effect.onStop = () => {
|
|
3764
3830
|
callWithErrorHandling(fn, instance, 4);
|
|
3831
|
+
cleanup = effect.onStop = void 0;
|
|
3765
3832
|
};
|
|
3766
3833
|
};
|
|
3767
3834
|
let ssrCleanup;
|
|
@@ -4262,7 +4329,11 @@ function emptyPlaceholder(vnode) {
|
|
|
4262
4329
|
}
|
|
4263
4330
|
}
|
|
4264
4331
|
function getKeepAliveChild(vnode) {
|
|
4265
|
-
return isKeepAlive(vnode) ?
|
|
4332
|
+
return isKeepAlive(vnode) ? (
|
|
4333
|
+
// #7121 ensure get the child component subtree in case
|
|
4334
|
+
// it's been replaced during HMR
|
|
4335
|
+
!!(process.env.NODE_ENV !== "production") && vnode.component ? vnode.component.subTree : vnode.children ? vnode.children[0] : void 0
|
|
4336
|
+
) : vnode;
|
|
4266
4337
|
}
|
|
4267
4338
|
function setTransitionHooks(vnode, hooks) {
|
|
4268
4339
|
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
@@ -4784,65 +4855,6 @@ function getCompatListeners(instance) {
|
|
|
4784
4855
|
return listeners;
|
|
4785
4856
|
}
|
|
4786
4857
|
|
|
4787
|
-
const COMPONENTS = "components";
|
|
4788
|
-
const DIRECTIVES = "directives";
|
|
4789
|
-
const FILTERS = "filters";
|
|
4790
|
-
function resolveComponent(name, maybeSelfReference) {
|
|
4791
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
4792
|
-
}
|
|
4793
|
-
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
4794
|
-
function resolveDynamicComponent(component) {
|
|
4795
|
-
if (isString(component)) {
|
|
4796
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
4797
|
-
} else {
|
|
4798
|
-
return component || NULL_DYNAMIC_COMPONENT;
|
|
4799
|
-
}
|
|
4800
|
-
}
|
|
4801
|
-
function resolveDirective(name) {
|
|
4802
|
-
return resolveAsset(DIRECTIVES, name);
|
|
4803
|
-
}
|
|
4804
|
-
function resolveFilter$1(name) {
|
|
4805
|
-
return resolveAsset(FILTERS, name);
|
|
4806
|
-
}
|
|
4807
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
4808
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
4809
|
-
if (instance) {
|
|
4810
|
-
const Component = instance.type;
|
|
4811
|
-
if (type === COMPONENTS) {
|
|
4812
|
-
const selfName = getComponentName(
|
|
4813
|
-
Component,
|
|
4814
|
-
false
|
|
4815
|
-
/* do not include inferred name to avoid breaking existing code */
|
|
4816
|
-
);
|
|
4817
|
-
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
|
|
4818
|
-
return Component;
|
|
4819
|
-
}
|
|
4820
|
-
}
|
|
4821
|
-
const res = (
|
|
4822
|
-
// local registration
|
|
4823
|
-
// check instance[type] first which is resolved for options API
|
|
4824
|
-
resolve(instance[type] || Component[type], name) || // global registration
|
|
4825
|
-
resolve(instance.appContext[type], name)
|
|
4826
|
-
);
|
|
4827
|
-
if (!res && maybeSelfReference) {
|
|
4828
|
-
return Component;
|
|
4829
|
-
}
|
|
4830
|
-
if (!!(process.env.NODE_ENV !== "production") && warnMissing && !res) {
|
|
4831
|
-
const extra = type === COMPONENTS ? `
|
|
4832
|
-
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.` : ``;
|
|
4833
|
-
warn(`Failed to resolve ${type.slice(0, -1)}: ${name}${extra}`);
|
|
4834
|
-
}
|
|
4835
|
-
return res;
|
|
4836
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
4837
|
-
warn(
|
|
4838
|
-
`resolve${capitalize(type.slice(0, -1))} can only be used in render() or setup().`
|
|
4839
|
-
);
|
|
4840
|
-
}
|
|
4841
|
-
}
|
|
4842
|
-
function resolve(registry, name) {
|
|
4843
|
-
return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
|
|
4844
|
-
}
|
|
4845
|
-
|
|
4846
4858
|
function convertLegacyRenderFn(instance) {
|
|
4847
4859
|
const Component2 = instance.type;
|
|
4848
4860
|
const render = Component2.render;
|
|
@@ -6350,7 +6362,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6350
6362
|
return vm;
|
|
6351
6363
|
}
|
|
6352
6364
|
}
|
|
6353
|
-
Vue.version = `2.6.14-compat:${"3.4.0-alpha.
|
|
6365
|
+
Vue.version = `2.6.14-compat:${"3.4.0-alpha.2"}`;
|
|
6354
6366
|
Vue.config = singletonApp.config;
|
|
6355
6367
|
Vue.use = (p, ...options) => {
|
|
6356
6368
|
if (p && isFunction(p.install)) {
|
|
@@ -7381,6 +7393,9 @@ function assertType(value, type) {
|
|
|
7381
7393
|
};
|
|
7382
7394
|
}
|
|
7383
7395
|
function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
7396
|
+
if (expectedTypes.length === 0) {
|
|
7397
|
+
return `Prop type [] for prop "${name}" won't match anything. Did you mean to use type Array instead?`;
|
|
7398
|
+
}
|
|
7384
7399
|
let message = `Invalid prop: type check failed for prop "${name}". Expected ${expectedTypes.map(capitalize).join(" | ")}`;
|
|
7385
7400
|
const expectedType = expectedTypes[0];
|
|
7386
7401
|
const receivedType = toRawType(value);
|
|
@@ -7652,6 +7667,20 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
7652
7667
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
7653
7668
|
let domType = node.nodeType;
|
|
7654
7669
|
vnode.el = node;
|
|
7670
|
+
if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
|
|
7671
|
+
if (!("__vnode" in node)) {
|
|
7672
|
+
Object.defineProperty(node, "__vnode", {
|
|
7673
|
+
value: vnode,
|
|
7674
|
+
enumerable: false
|
|
7675
|
+
});
|
|
7676
|
+
}
|
|
7677
|
+
if (!("__vueParentComponent" in node)) {
|
|
7678
|
+
Object.defineProperty(node, "__vueParentComponent", {
|
|
7679
|
+
value: parentComponent,
|
|
7680
|
+
enumerable: false
|
|
7681
|
+
});
|
|
7682
|
+
}
|
|
7683
|
+
}
|
|
7655
7684
|
if (patchFlag === -2) {
|
|
7656
7685
|
optimized = false;
|
|
7657
7686
|
vnode.dynamicChildren = null;
|
|
@@ -7682,15 +7711,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
7682
7711
|
}
|
|
7683
7712
|
break;
|
|
7684
7713
|
case Comment:
|
|
7685
|
-
if (
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7714
|
+
if (isTemplateNode(node)) {
|
|
7715
|
+
nextNode = nextSibling(node);
|
|
7716
|
+
replaceNode(
|
|
7717
|
+
vnode.el = node.content.firstChild,
|
|
7718
|
+
node,
|
|
7719
|
+
parentComponent
|
|
7720
|
+
);
|
|
7721
|
+
} else if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
7722
|
+
nextNode = onMismatch();
|
|
7694
7723
|
} else {
|
|
7695
7724
|
nextNode = nextSibling(node);
|
|
7696
7725
|
}
|
|
@@ -7813,15 +7842,16 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
7813
7842
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
7814
7843
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
7815
7844
|
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
7816
|
-
const
|
|
7817
|
-
if (!!(process.env.NODE_ENV !== "production") ||
|
|
7845
|
+
const forcePatch = type === "input" || type === "option";
|
|
7846
|
+
if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
|
|
7818
7847
|
if (dirs) {
|
|
7819
7848
|
invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
7820
7849
|
}
|
|
7821
7850
|
if (props) {
|
|
7822
|
-
if (
|
|
7851
|
+
if (forcePatch || !optimized || patchFlag & (16 | 32)) {
|
|
7823
7852
|
for (const key in props) {
|
|
7824
|
-
if (
|
|
7853
|
+
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || // force hydrate v-bind with .prop modifiers
|
|
7854
|
+
key[0] === ".") {
|
|
7825
7855
|
patchProp(
|
|
7826
7856
|
el,
|
|
7827
7857
|
key,
|
|
@@ -8034,8 +8064,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
8034
8064
|
let parent = parentComponent;
|
|
8035
8065
|
while (parent) {
|
|
8036
8066
|
if (parent.vnode.el === oldNode) {
|
|
8037
|
-
parent.vnode.el = newNode;
|
|
8038
|
-
parent.subTree.el = newNode;
|
|
8067
|
+
parent.vnode.el = parent.subTree.el = newNode;
|
|
8039
8068
|
}
|
|
8040
8069
|
parent = parent.parent;
|
|
8041
8070
|
}
|
|
@@ -9653,6 +9682,7 @@ const resolveTarget = (props, select) => {
|
|
|
9653
9682
|
}
|
|
9654
9683
|
};
|
|
9655
9684
|
const TeleportImpl = {
|
|
9685
|
+
name: "Teleport",
|
|
9656
9686
|
__isTeleport: true,
|
|
9657
9687
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals) {
|
|
9658
9688
|
const {
|
|
@@ -10132,7 +10162,7 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
10132
10162
|
if (!!(process.env.NODE_ENV !== "production") && shapeFlag & 4 && isProxy(type)) {
|
|
10133
10163
|
type = toRaw(type);
|
|
10134
10164
|
warn(
|
|
10135
|
-
`Vue received a Component
|
|
10165
|
+
`Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with \`markRaw\` or using \`shallowRef\` instead of \`ref\`.`,
|
|
10136
10166
|
`
|
|
10137
10167
|
Component that was made reactive: `,
|
|
10138
10168
|
type
|
|
@@ -10996,7 +11026,7 @@ function isMemoSame(cached, memo) {
|
|
|
10996
11026
|
return true;
|
|
10997
11027
|
}
|
|
10998
11028
|
|
|
10999
|
-
const version = "3.4.0-alpha.
|
|
11029
|
+
const version = "3.4.0-alpha.2";
|
|
11000
11030
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11001
11031
|
const _ssrUtils = {
|
|
11002
11032
|
createComponentInstance,
|
|
@@ -12253,21 +12283,20 @@ const vModelText = {
|
|
|
12253
12283
|
el[assignKey] = getModelAssigner(vnode);
|
|
12254
12284
|
if (el.composing)
|
|
12255
12285
|
return;
|
|
12286
|
+
const elValue = number || el.type === "number" ? looseToNumber(el.value) : el.value;
|
|
12287
|
+
const newValue = value == null ? "" : value;
|
|
12288
|
+
if (elValue === newValue) {
|
|
12289
|
+
return;
|
|
12290
|
+
}
|
|
12256
12291
|
if (document.activeElement === el && el.type !== "range") {
|
|
12257
12292
|
if (lazy) {
|
|
12258
12293
|
return;
|
|
12259
12294
|
}
|
|
12260
|
-
if (trim && el.value.trim() ===
|
|
12261
|
-
return;
|
|
12262
|
-
}
|
|
12263
|
-
if ((number || el.type === "number") && looseToNumber(el.value) === value) {
|
|
12295
|
+
if (trim && el.value.trim() === newValue) {
|
|
12264
12296
|
return;
|
|
12265
12297
|
}
|
|
12266
12298
|
}
|
|
12267
|
-
|
|
12268
|
-
if (el.value !== newValue) {
|
|
12269
|
-
el.value = newValue;
|
|
12270
|
-
}
|
|
12299
|
+
el.value = newValue;
|
|
12271
12300
|
}
|
|
12272
12301
|
};
|
|
12273
12302
|
const vModelCheckbox = {
|
|
@@ -12867,83 +12896,6 @@ function createCompatVue() {
|
|
|
12867
12896
|
return Vue;
|
|
12868
12897
|
}
|
|
12869
12898
|
|
|
12870
|
-
function defaultOnError(error) {
|
|
12871
|
-
throw error;
|
|
12872
|
-
}
|
|
12873
|
-
function defaultOnWarn(msg) {
|
|
12874
|
-
!!(process.env.NODE_ENV !== "production") && console.warn(`[Vue warn] ${msg.message}`);
|
|
12875
|
-
}
|
|
12876
|
-
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
12877
|
-
const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : code;
|
|
12878
|
-
const error = new SyntaxError(String(msg));
|
|
12879
|
-
error.code = code;
|
|
12880
|
-
error.loc = loc;
|
|
12881
|
-
return error;
|
|
12882
|
-
}
|
|
12883
|
-
const errorMessages = {
|
|
12884
|
-
// parse errors
|
|
12885
|
-
[0]: "Illegal comment.",
|
|
12886
|
-
[1]: "CDATA section is allowed only in XML context.",
|
|
12887
|
-
[2]: "Duplicate attribute.",
|
|
12888
|
-
[3]: "End tag cannot have attributes.",
|
|
12889
|
-
[4]: "Illegal '/' in tags.",
|
|
12890
|
-
[5]: "Unexpected EOF in tag.",
|
|
12891
|
-
[6]: "Unexpected EOF in CDATA section.",
|
|
12892
|
-
[7]: "Unexpected EOF in comment.",
|
|
12893
|
-
[8]: "Unexpected EOF in script.",
|
|
12894
|
-
[9]: "Unexpected EOF in tag.",
|
|
12895
|
-
[10]: "Incorrectly closed comment.",
|
|
12896
|
-
[11]: "Incorrectly opened comment.",
|
|
12897
|
-
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
12898
|
-
[13]: "Attribute value was expected.",
|
|
12899
|
-
[14]: "End tag name was expected.",
|
|
12900
|
-
[15]: "Whitespace was expected.",
|
|
12901
|
-
[16]: "Unexpected '<!--' in comment.",
|
|
12902
|
-
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
12903
|
-
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
12904
|
-
[19]: "Attribute name cannot start with '='.",
|
|
12905
|
-
[21]: "'<?' is allowed only in XML context.",
|
|
12906
|
-
[20]: `Unexpected null character.`,
|
|
12907
|
-
[22]: "Illegal '/' in tags.",
|
|
12908
|
-
// Vue-specific parse errors
|
|
12909
|
-
[23]: "Invalid end tag.",
|
|
12910
|
-
[24]: "Element is missing end tag.",
|
|
12911
|
-
[25]: "Interpolation end sign was not found.",
|
|
12912
|
-
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
12913
|
-
[26]: "Legal directive name was expected.",
|
|
12914
|
-
// transform errors
|
|
12915
|
-
[28]: `v-if/v-else-if is missing expression.`,
|
|
12916
|
-
[29]: `v-if/else branches must use unique keys.`,
|
|
12917
|
-
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
12918
|
-
[31]: `v-for is missing expression.`,
|
|
12919
|
-
[32]: `v-for has invalid expression.`,
|
|
12920
|
-
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
12921
|
-
[34]: `v-bind is missing expression.`,
|
|
12922
|
-
[35]: `v-on is missing expression.`,
|
|
12923
|
-
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
12924
|
-
[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.`,
|
|
12925
|
-
[38]: `Duplicate slot names found. `,
|
|
12926
|
-
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
12927
|
-
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
12928
|
-
[41]: `v-model is missing expression.`,
|
|
12929
|
-
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
12930
|
-
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
12931
|
-
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
12932
|
-
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
12933
|
-
[45]: `Error parsing JavaScript expression: `,
|
|
12934
|
-
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
12935
|
-
// generic errors
|
|
12936
|
-
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
12937
|
-
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
12938
|
-
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
12939
|
-
[50]: `"scopeId" option is only supported in module mode.`,
|
|
12940
|
-
// deprecations
|
|
12941
|
-
[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.`,
|
|
12942
|
-
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
12943
|
-
// just to fulfill types
|
|
12944
|
-
[53]: ``
|
|
12945
|
-
};
|
|
12946
|
-
|
|
12947
12899
|
const FRAGMENT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Fragment` : ``);
|
|
12948
12900
|
const TELEPORT = Symbol(!!(process.env.NODE_ENV !== "production") ? `Teleport` : ``);
|
|
12949
12901
|
const SUSPENSE = Symbol(!!(process.env.NODE_ENV !== "production") ? `Suspense` : ``);
|
|
@@ -13033,13 +12985,14 @@ function registerRuntimeHelpers(helpers) {
|
|
|
13033
12985
|
}
|
|
13034
12986
|
|
|
13035
12987
|
const locStub = {
|
|
13036
|
-
source: "",
|
|
13037
12988
|
start: { line: 1, column: 1, offset: 0 },
|
|
13038
|
-
end: { line: 1, column: 1, offset: 0 }
|
|
12989
|
+
end: { line: 1, column: 1, offset: 0 },
|
|
12990
|
+
source: ""
|
|
13039
12991
|
};
|
|
13040
|
-
function createRoot(children,
|
|
12992
|
+
function createRoot(children, source = "") {
|
|
13041
12993
|
return {
|
|
13042
12994
|
type: 0,
|
|
12995
|
+
source,
|
|
13043
12996
|
children,
|
|
13044
12997
|
helpers: /* @__PURE__ */ new Set(),
|
|
13045
12998
|
components: [],
|
|
@@ -13049,7 +13002,7 @@ function createRoot(children, loc = locStub) {
|
|
|
13049
13002
|
cached: 0,
|
|
13050
13003
|
temps: 0,
|
|
13051
13004
|
codegenNode: void 0,
|
|
13052
|
-
loc
|
|
13005
|
+
loc: locStub
|
|
13053
13006
|
};
|
|
13054
13007
|
}
|
|
13055
13008
|
function createVNodeCall(context, tag, props, children, patchFlag, dynamicProps, directives, isBlock = false, disableTracking = false, isComponent = false, loc = locStub) {
|
|
@@ -13175,39 +13128,992 @@ function convertToBlock(node, { helper, removeHelper, inSSR }) {
|
|
|
13175
13128
|
}
|
|
13176
13129
|
}
|
|
13177
13130
|
|
|
13178
|
-
const
|
|
13179
|
-
const
|
|
13180
|
-
function
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13131
|
+
const defaultDelimitersOpen = new Uint8Array([123, 123]);
|
|
13132
|
+
const defaultDelimitersClose = new Uint8Array([125, 125]);
|
|
13133
|
+
function isTagStartChar(c) {
|
|
13134
|
+
return c >= 97 && c <= 122 || c >= 65 && c <= 90;
|
|
13135
|
+
}
|
|
13136
|
+
function isWhitespace(c) {
|
|
13137
|
+
return c === 32 || c === 10 || c === 9 || c === 12 || c === 13;
|
|
13138
|
+
}
|
|
13139
|
+
function isEndOfTagSection(c) {
|
|
13140
|
+
return c === 47 || c === 62 || isWhitespace(c);
|
|
13141
|
+
}
|
|
13142
|
+
function toCharCodes(str) {
|
|
13143
|
+
const ret = new Uint8Array(str.length);
|
|
13144
|
+
for (let i = 0; i < str.length; i++) {
|
|
13145
|
+
ret[i] = str.charCodeAt(i);
|
|
13189
13146
|
}
|
|
13147
|
+
return ret;
|
|
13190
13148
|
}
|
|
13191
|
-
const
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13149
|
+
const Sequences = {
|
|
13150
|
+
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
|
|
13151
|
+
// CDATA[
|
|
13152
|
+
CdataEnd: new Uint8Array([93, 93, 62]),
|
|
13153
|
+
// ]]>
|
|
13154
|
+
CommentEnd: new Uint8Array([45, 45, 62]),
|
|
13155
|
+
// `-->`
|
|
13156
|
+
ScriptEnd: new Uint8Array([60, 47, 115, 99, 114, 105, 112, 116]),
|
|
13157
|
+
// `<\/script`
|
|
13158
|
+
StyleEnd: new Uint8Array([60, 47, 115, 116, 121, 108, 101]),
|
|
13159
|
+
// `</style`
|
|
13160
|
+
TitleEnd: new Uint8Array([60, 47, 116, 105, 116, 108, 101]),
|
|
13161
|
+
// `</title`
|
|
13162
|
+
TextareaEnd: new Uint8Array([
|
|
13163
|
+
60,
|
|
13164
|
+
47,
|
|
13165
|
+
116,
|
|
13166
|
+
101,
|
|
13167
|
+
120,
|
|
13168
|
+
116,
|
|
13169
|
+
97,
|
|
13170
|
+
114,
|
|
13171
|
+
101,
|
|
13172
|
+
97
|
|
13173
|
+
])
|
|
13174
|
+
// `</textarea
|
|
13175
|
+
};
|
|
13176
|
+
class Tokenizer {
|
|
13177
|
+
constructor(stack, cbs) {
|
|
13178
|
+
this.stack = stack;
|
|
13179
|
+
this.cbs = cbs;
|
|
13180
|
+
/** The current state the tokenizer is in. */
|
|
13181
|
+
this.state = 1;
|
|
13182
|
+
/** The read buffer. */
|
|
13183
|
+
this.buffer = "";
|
|
13184
|
+
/** The beginning of the section that is currently being read. */
|
|
13185
|
+
this.sectionStart = 0;
|
|
13186
|
+
/** The index within the buffer that we are currently looking at. */
|
|
13187
|
+
this.index = 0;
|
|
13188
|
+
/** The start of the last entity. */
|
|
13189
|
+
this.entityStart = 0;
|
|
13190
|
+
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
|
|
13191
|
+
this.baseState = 1;
|
|
13192
|
+
/** For special parsing behavior inside of script and style tags. */
|
|
13193
|
+
this.inRCDATA = false;
|
|
13194
|
+
/** For disabling RCDATA tags handling */
|
|
13195
|
+
this.inXML = false;
|
|
13196
|
+
/** Reocrd newline positions for fast line / column calculation */
|
|
13197
|
+
this.newlines = [];
|
|
13198
|
+
this.mode = 0;
|
|
13199
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
13200
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
13201
|
+
this.delimiterIndex = -1;
|
|
13202
|
+
this.currentSequence = void 0;
|
|
13203
|
+
this.sequenceIndex = 0;
|
|
13204
|
+
}
|
|
13205
|
+
get inSFCRoot() {
|
|
13206
|
+
return this.mode === 2 && this.stack.length === 0;
|
|
13207
|
+
}
|
|
13208
|
+
reset() {
|
|
13209
|
+
this.state = 1;
|
|
13210
|
+
this.mode = 0;
|
|
13211
|
+
this.buffer = "";
|
|
13212
|
+
this.sectionStart = 0;
|
|
13213
|
+
this.index = 0;
|
|
13214
|
+
this.baseState = 1;
|
|
13215
|
+
this.currentSequence = void 0;
|
|
13216
|
+
this.newlines.length = 0;
|
|
13217
|
+
this.delimiterOpen = defaultDelimitersOpen;
|
|
13218
|
+
this.delimiterClose = defaultDelimitersClose;
|
|
13219
|
+
}
|
|
13220
|
+
/**
|
|
13221
|
+
* Generate Position object with line / column information using recorded
|
|
13222
|
+
* newline positions. We know the index is always going to be an already
|
|
13223
|
+
* processed index, so all the newlines up to this index should have been
|
|
13224
|
+
* recorded.
|
|
13225
|
+
*/
|
|
13226
|
+
getPos(index) {
|
|
13227
|
+
let line = 1;
|
|
13228
|
+
let column = index + 1;
|
|
13229
|
+
for (let i = this.newlines.length - 1; i >= 0; i--) {
|
|
13230
|
+
const newlineIndex = this.newlines[i];
|
|
13231
|
+
if (index > newlineIndex) {
|
|
13232
|
+
line = i + 2;
|
|
13233
|
+
column = index - newlineIndex;
|
|
13234
|
+
break;
|
|
13235
|
+
}
|
|
13236
|
+
}
|
|
13237
|
+
return {
|
|
13238
|
+
column,
|
|
13239
|
+
line,
|
|
13240
|
+
offset: index
|
|
13241
|
+
};
|
|
13242
|
+
}
|
|
13243
|
+
peek() {
|
|
13244
|
+
return this.buffer.charCodeAt(this.index + 1);
|
|
13245
|
+
}
|
|
13246
|
+
stateText(c) {
|
|
13247
|
+
if (c === 60) {
|
|
13248
|
+
if (this.index > this.sectionStart) {
|
|
13249
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
13250
|
+
}
|
|
13251
|
+
this.state = 5;
|
|
13252
|
+
this.sectionStart = this.index;
|
|
13253
|
+
} else if (c === this.delimiterOpen[0]) {
|
|
13254
|
+
this.state = 2;
|
|
13255
|
+
this.delimiterIndex = 0;
|
|
13256
|
+
this.stateInterpolationOpen(c);
|
|
13257
|
+
}
|
|
13258
|
+
}
|
|
13259
|
+
stateInterpolationOpen(c) {
|
|
13260
|
+
if (c === this.delimiterOpen[this.delimiterIndex]) {
|
|
13261
|
+
if (this.delimiterIndex === this.delimiterOpen.length - 1) {
|
|
13262
|
+
const start = this.index + 1 - this.delimiterOpen.length;
|
|
13263
|
+
if (start > this.sectionStart) {
|
|
13264
|
+
this.cbs.ontext(this.sectionStart, start);
|
|
13265
|
+
}
|
|
13266
|
+
this.state = 3;
|
|
13267
|
+
this.sectionStart = start;
|
|
13268
|
+
} else {
|
|
13269
|
+
this.delimiterIndex++;
|
|
13270
|
+
}
|
|
13271
|
+
} else if (this.inRCDATA) {
|
|
13272
|
+
this.state = 32;
|
|
13273
|
+
this.stateInRCDATA(c);
|
|
13274
|
+
} else {
|
|
13275
|
+
this.state = 1;
|
|
13276
|
+
this.stateText(c);
|
|
13277
|
+
}
|
|
13278
|
+
}
|
|
13279
|
+
stateInterpolation(c) {
|
|
13280
|
+
if (c === this.delimiterClose[0]) {
|
|
13281
|
+
this.state = 4;
|
|
13282
|
+
this.delimiterIndex = 0;
|
|
13283
|
+
this.stateInterpolationClose(c);
|
|
13284
|
+
}
|
|
13285
|
+
}
|
|
13286
|
+
stateInterpolationClose(c) {
|
|
13287
|
+
if (c === this.delimiterClose[this.delimiterIndex]) {
|
|
13288
|
+
if (this.delimiterIndex === this.delimiterClose.length - 1) {
|
|
13289
|
+
this.cbs.oninterpolation(this.sectionStart, this.index + 1);
|
|
13290
|
+
if (this.inRCDATA) {
|
|
13291
|
+
this.state = 32;
|
|
13292
|
+
} else {
|
|
13293
|
+
this.state = 1;
|
|
13294
|
+
}
|
|
13295
|
+
this.sectionStart = this.index + 1;
|
|
13296
|
+
} else {
|
|
13297
|
+
this.delimiterIndex++;
|
|
13298
|
+
}
|
|
13299
|
+
} else {
|
|
13300
|
+
this.state = 3;
|
|
13301
|
+
this.stateInterpolation(c);
|
|
13302
|
+
}
|
|
13303
|
+
}
|
|
13304
|
+
stateSpecialStartSequence(c) {
|
|
13305
|
+
const isEnd = this.sequenceIndex === this.currentSequence.length;
|
|
13306
|
+
const isMatch = isEnd ? (
|
|
13307
|
+
// If we are at the end of the sequence, make sure the tag name has ended
|
|
13308
|
+
isEndOfTagSection(c)
|
|
13309
|
+
) : (
|
|
13310
|
+
// Otherwise, do a case-insensitive comparison
|
|
13311
|
+
(c | 32) === this.currentSequence[this.sequenceIndex]
|
|
13312
|
+
);
|
|
13313
|
+
if (!isMatch) {
|
|
13314
|
+
this.inRCDATA = false;
|
|
13315
|
+
} else if (!isEnd) {
|
|
13316
|
+
this.sequenceIndex++;
|
|
13317
|
+
return;
|
|
13318
|
+
}
|
|
13319
|
+
this.sequenceIndex = 0;
|
|
13320
|
+
this.state = 6;
|
|
13321
|
+
this.stateInTagName(c);
|
|
13322
|
+
}
|
|
13323
|
+
/** Look for an end tag. For <title> and <textarea>, also decode entities. */
|
|
13324
|
+
stateInRCDATA(c) {
|
|
13325
|
+
if (this.sequenceIndex === this.currentSequence.length) {
|
|
13326
|
+
if (c === 62 || isWhitespace(c)) {
|
|
13327
|
+
const endOfText = this.index - this.currentSequence.length;
|
|
13328
|
+
if (this.sectionStart < endOfText) {
|
|
13329
|
+
const actualIndex = this.index;
|
|
13330
|
+
this.index = endOfText;
|
|
13331
|
+
this.cbs.ontext(this.sectionStart, endOfText);
|
|
13332
|
+
this.index = actualIndex;
|
|
13333
|
+
}
|
|
13334
|
+
this.sectionStart = endOfText + 2;
|
|
13335
|
+
this.stateInClosingTagName(c);
|
|
13336
|
+
this.inRCDATA = false;
|
|
13337
|
+
return;
|
|
13338
|
+
}
|
|
13339
|
+
this.sequenceIndex = 0;
|
|
13340
|
+
}
|
|
13341
|
+
if ((c | 32) === this.currentSequence[this.sequenceIndex]) {
|
|
13342
|
+
this.sequenceIndex += 1;
|
|
13343
|
+
} else if (this.sequenceIndex === 0) {
|
|
13344
|
+
if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd && !this.inSFCRoot) {
|
|
13345
|
+
if (c === this.delimiterOpen[0]) {
|
|
13346
|
+
this.state = 2;
|
|
13347
|
+
this.delimiterIndex = 0;
|
|
13348
|
+
this.stateInterpolationOpen(c);
|
|
13349
|
+
}
|
|
13350
|
+
} else if (this.fastForwardTo(60)) {
|
|
13351
|
+
this.sequenceIndex = 1;
|
|
13352
|
+
}
|
|
13353
|
+
} else {
|
|
13354
|
+
this.sequenceIndex = Number(c === 60);
|
|
13355
|
+
}
|
|
13356
|
+
}
|
|
13357
|
+
stateCDATASequence(c) {
|
|
13358
|
+
if (c === Sequences.Cdata[this.sequenceIndex]) {
|
|
13359
|
+
if (++this.sequenceIndex === Sequences.Cdata.length) {
|
|
13360
|
+
this.state = 28;
|
|
13361
|
+
this.currentSequence = Sequences.CdataEnd;
|
|
13362
|
+
this.sequenceIndex = 0;
|
|
13363
|
+
this.sectionStart = this.index + 1;
|
|
13364
|
+
}
|
|
13365
|
+
} else {
|
|
13366
|
+
this.sequenceIndex = 0;
|
|
13367
|
+
this.state = 23;
|
|
13368
|
+
this.stateInDeclaration(c);
|
|
13369
|
+
}
|
|
13370
|
+
}
|
|
13371
|
+
/**
|
|
13372
|
+
* When we wait for one specific character, we can speed things up
|
|
13373
|
+
* by skipping through the buffer until we find it.
|
|
13374
|
+
*
|
|
13375
|
+
* @returns Whether the character was found.
|
|
13376
|
+
*/
|
|
13377
|
+
fastForwardTo(c) {
|
|
13378
|
+
while (++this.index < this.buffer.length) {
|
|
13379
|
+
const cc = this.buffer.charCodeAt(this.index);
|
|
13380
|
+
if (cc === 10) {
|
|
13381
|
+
this.newlines.push(this.index);
|
|
13382
|
+
}
|
|
13383
|
+
if (cc === c) {
|
|
13384
|
+
return true;
|
|
13385
|
+
}
|
|
13386
|
+
}
|
|
13387
|
+
this.index = this.buffer.length - 1;
|
|
13388
|
+
return false;
|
|
13389
|
+
}
|
|
13390
|
+
/**
|
|
13391
|
+
* Comments and CDATA end with `-->` and `]]>`.
|
|
13392
|
+
*
|
|
13393
|
+
* Their common qualities are:
|
|
13394
|
+
* - Their end sequences have a distinct character they start with.
|
|
13395
|
+
* - That character is then repeated, so we have to check multiple repeats.
|
|
13396
|
+
* - All characters but the start character of the sequence can be skipped.
|
|
13397
|
+
*/
|
|
13398
|
+
stateInCommentLike(c) {
|
|
13399
|
+
if (c === this.currentSequence[this.sequenceIndex]) {
|
|
13400
|
+
if (++this.sequenceIndex === this.currentSequence.length) {
|
|
13401
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
13402
|
+
this.cbs.oncdata(this.sectionStart, this.index - 2);
|
|
13403
|
+
} else {
|
|
13404
|
+
this.cbs.oncomment(this.sectionStart, this.index - 2);
|
|
13405
|
+
}
|
|
13406
|
+
this.sequenceIndex = 0;
|
|
13407
|
+
this.sectionStart = this.index + 1;
|
|
13408
|
+
this.state = 1;
|
|
13409
|
+
}
|
|
13410
|
+
} else if (this.sequenceIndex === 0) {
|
|
13411
|
+
if (this.fastForwardTo(this.currentSequence[0])) {
|
|
13412
|
+
this.sequenceIndex = 1;
|
|
13413
|
+
}
|
|
13414
|
+
} else if (c !== this.currentSequence[this.sequenceIndex - 1]) {
|
|
13415
|
+
this.sequenceIndex = 0;
|
|
13416
|
+
}
|
|
13417
|
+
}
|
|
13418
|
+
startSpecial(sequence, offset) {
|
|
13419
|
+
this.enterRCDATA(sequence, offset);
|
|
13420
|
+
this.state = 31;
|
|
13421
|
+
}
|
|
13422
|
+
enterRCDATA(sequence, offset) {
|
|
13423
|
+
this.inRCDATA = true;
|
|
13424
|
+
this.currentSequence = sequence;
|
|
13425
|
+
this.sequenceIndex = offset;
|
|
13426
|
+
}
|
|
13427
|
+
stateBeforeTagName(c) {
|
|
13428
|
+
if (c === 33) {
|
|
13429
|
+
this.state = 22;
|
|
13430
|
+
this.sectionStart = this.index + 1;
|
|
13431
|
+
} else if (c === 63) {
|
|
13432
|
+
this.state = 24;
|
|
13433
|
+
this.sectionStart = this.index + 1;
|
|
13434
|
+
} else if (isTagStartChar(c)) {
|
|
13435
|
+
this.sectionStart = this.index;
|
|
13436
|
+
if (this.mode === 0) {
|
|
13437
|
+
this.state = 6;
|
|
13438
|
+
} else if (this.inSFCRoot) {
|
|
13439
|
+
this.state = 34;
|
|
13440
|
+
} else if (!this.inXML) {
|
|
13441
|
+
const lower = c | 32;
|
|
13442
|
+
if (lower === 116) {
|
|
13443
|
+
this.state = 30;
|
|
13444
|
+
} else {
|
|
13445
|
+
this.state = lower === 115 ? 29 : 6;
|
|
13446
|
+
}
|
|
13447
|
+
} else {
|
|
13448
|
+
this.state = 6;
|
|
13449
|
+
}
|
|
13450
|
+
} else if (c === 47) {
|
|
13451
|
+
this.state = 8;
|
|
13452
|
+
} else {
|
|
13453
|
+
this.state = 1;
|
|
13454
|
+
this.stateText(c);
|
|
13455
|
+
}
|
|
13456
|
+
}
|
|
13457
|
+
stateInTagName(c) {
|
|
13458
|
+
if (isEndOfTagSection(c)) {
|
|
13459
|
+
this.handleTagName(c);
|
|
13460
|
+
}
|
|
13461
|
+
}
|
|
13462
|
+
stateInSFCRootTagName(c) {
|
|
13463
|
+
if (isEndOfTagSection(c)) {
|
|
13464
|
+
const tag = this.buffer.slice(this.sectionStart, this.index);
|
|
13465
|
+
if (tag !== "template") {
|
|
13466
|
+
this.enterRCDATA(toCharCodes(`</` + tag), 0);
|
|
13467
|
+
}
|
|
13468
|
+
this.handleTagName(c);
|
|
13469
|
+
}
|
|
13470
|
+
}
|
|
13471
|
+
handleTagName(c) {
|
|
13472
|
+
this.cbs.onopentagname(this.sectionStart, this.index);
|
|
13473
|
+
this.sectionStart = -1;
|
|
13474
|
+
this.state = 11;
|
|
13475
|
+
this.stateBeforeAttrName(c);
|
|
13476
|
+
}
|
|
13477
|
+
stateBeforeClosingTagName(c) {
|
|
13478
|
+
if (isWhitespace(c)) ; else if (c === 62) {
|
|
13479
|
+
if (!!(process.env.NODE_ENV !== "production") || false) {
|
|
13480
|
+
this.cbs.onerr(14, this.index);
|
|
13481
|
+
}
|
|
13482
|
+
this.state = 1;
|
|
13483
|
+
this.sectionStart = this.index + 1;
|
|
13484
|
+
} else {
|
|
13485
|
+
this.state = isTagStartChar(c) ? 9 : 27;
|
|
13486
|
+
this.sectionStart = this.index;
|
|
13487
|
+
}
|
|
13488
|
+
}
|
|
13489
|
+
stateInClosingTagName(c) {
|
|
13490
|
+
if (c === 62 || isWhitespace(c)) {
|
|
13491
|
+
this.cbs.onclosetag(this.sectionStart, this.index);
|
|
13492
|
+
this.sectionStart = -1;
|
|
13493
|
+
this.state = 10;
|
|
13494
|
+
this.stateAfterClosingTagName(c);
|
|
13495
|
+
}
|
|
13496
|
+
}
|
|
13497
|
+
stateAfterClosingTagName(c) {
|
|
13498
|
+
if (c === 62) {
|
|
13499
|
+
this.state = 1;
|
|
13500
|
+
this.sectionStart = this.index + 1;
|
|
13501
|
+
}
|
|
13502
|
+
}
|
|
13503
|
+
stateBeforeAttrName(c) {
|
|
13504
|
+
if (c === 62) {
|
|
13505
|
+
this.cbs.onopentagend(this.index);
|
|
13506
|
+
if (this.inRCDATA) {
|
|
13507
|
+
this.state = 32;
|
|
13508
|
+
} else {
|
|
13509
|
+
this.state = 1;
|
|
13510
|
+
}
|
|
13511
|
+
this.sectionStart = this.index + 1;
|
|
13512
|
+
} else if (c === 47) {
|
|
13513
|
+
this.state = 7;
|
|
13514
|
+
if ((!!(process.env.NODE_ENV !== "production") || false) && this.peek() !== 62) {
|
|
13515
|
+
this.cbs.onerr(22, this.index);
|
|
13516
|
+
}
|
|
13517
|
+
} else if (c === 60 && this.peek() === 47) {
|
|
13518
|
+
this.cbs.onopentagend(this.index);
|
|
13519
|
+
this.state = 5;
|
|
13520
|
+
this.sectionStart = this.index;
|
|
13521
|
+
} else if (!isWhitespace(c)) {
|
|
13522
|
+
if ((!!(process.env.NODE_ENV !== "production") || false) && c === 61) {
|
|
13523
|
+
this.cbs.onerr(
|
|
13524
|
+
19,
|
|
13525
|
+
this.index
|
|
13526
|
+
);
|
|
13527
|
+
}
|
|
13528
|
+
this.handleAttrStart(c);
|
|
13529
|
+
}
|
|
13530
|
+
}
|
|
13531
|
+
handleAttrStart(c) {
|
|
13532
|
+
if (c === 118 && this.peek() === 45) {
|
|
13533
|
+
this.state = 13;
|
|
13534
|
+
this.sectionStart = this.index;
|
|
13535
|
+
} else if (c === 46 || c === 58 || c === 64 || c === 35) {
|
|
13536
|
+
this.cbs.ondirname(this.index, this.index + 1);
|
|
13537
|
+
this.state = 14;
|
|
13538
|
+
this.sectionStart = this.index + 1;
|
|
13539
|
+
} else {
|
|
13540
|
+
this.state = 12;
|
|
13541
|
+
this.sectionStart = this.index;
|
|
13542
|
+
}
|
|
13543
|
+
}
|
|
13544
|
+
stateInSelfClosingTag(c) {
|
|
13545
|
+
if (c === 62) {
|
|
13546
|
+
this.cbs.onselfclosingtag(this.index);
|
|
13547
|
+
this.state = 1;
|
|
13548
|
+
this.sectionStart = this.index + 1;
|
|
13549
|
+
this.inRCDATA = false;
|
|
13550
|
+
} else if (!isWhitespace(c)) {
|
|
13551
|
+
this.state = 11;
|
|
13552
|
+
this.stateBeforeAttrName(c);
|
|
13553
|
+
}
|
|
13554
|
+
}
|
|
13555
|
+
stateInAttrName(c) {
|
|
13556
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13557
|
+
this.cbs.onattribname(this.sectionStart, this.index);
|
|
13558
|
+
this.handleAttrNameEnd(c);
|
|
13559
|
+
} else if ((!!(process.env.NODE_ENV !== "production") || false) && (c === 34 || c === 39 || c === 60)) {
|
|
13560
|
+
this.cbs.onerr(
|
|
13561
|
+
17,
|
|
13562
|
+
this.index
|
|
13563
|
+
);
|
|
13564
|
+
}
|
|
13565
|
+
}
|
|
13566
|
+
stateInDirName(c) {
|
|
13567
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13568
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
13569
|
+
this.handleAttrNameEnd(c);
|
|
13570
|
+
} else if (c === 58) {
|
|
13571
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
13572
|
+
this.state = 14;
|
|
13573
|
+
this.sectionStart = this.index + 1;
|
|
13574
|
+
} else if (c === 46) {
|
|
13575
|
+
this.cbs.ondirname(this.sectionStart, this.index);
|
|
13576
|
+
this.state = 16;
|
|
13577
|
+
this.sectionStart = this.index + 1;
|
|
13578
|
+
}
|
|
13579
|
+
}
|
|
13580
|
+
stateInDirArg(c) {
|
|
13581
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13582
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
13583
|
+
this.handleAttrNameEnd(c);
|
|
13584
|
+
} else if (c === 91) {
|
|
13585
|
+
this.state = 15;
|
|
13586
|
+
} else if (c === 46) {
|
|
13587
|
+
this.cbs.ondirarg(this.sectionStart, this.index);
|
|
13588
|
+
this.state = 16;
|
|
13589
|
+
this.sectionStart = this.index + 1;
|
|
13590
|
+
}
|
|
13591
|
+
}
|
|
13592
|
+
stateInDynamicDirArg(c) {
|
|
13593
|
+
if (c === 93) {
|
|
13594
|
+
this.state = 14;
|
|
13595
|
+
} else if (c === 61 || isEndOfTagSection(c)) {
|
|
13596
|
+
this.cbs.ondirarg(this.sectionStart, this.index + 1);
|
|
13597
|
+
this.handleAttrNameEnd(c);
|
|
13598
|
+
if (!!(process.env.NODE_ENV !== "production") || false) {
|
|
13599
|
+
this.cbs.onerr(
|
|
13600
|
+
27,
|
|
13601
|
+
this.index
|
|
13602
|
+
);
|
|
13603
|
+
}
|
|
13604
|
+
}
|
|
13605
|
+
}
|
|
13606
|
+
stateInDirModifier(c) {
|
|
13607
|
+
if (c === 61 || isEndOfTagSection(c)) {
|
|
13608
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
13609
|
+
this.handleAttrNameEnd(c);
|
|
13610
|
+
} else if (c === 46) {
|
|
13611
|
+
this.cbs.ondirmodifier(this.sectionStart, this.index);
|
|
13612
|
+
this.sectionStart = this.index + 1;
|
|
13613
|
+
}
|
|
13614
|
+
}
|
|
13615
|
+
handleAttrNameEnd(c) {
|
|
13616
|
+
this.sectionStart = this.index;
|
|
13617
|
+
this.state = 17;
|
|
13618
|
+
this.cbs.onattribnameend(this.index);
|
|
13619
|
+
this.stateAfterAttrName(c);
|
|
13620
|
+
}
|
|
13621
|
+
stateAfterAttrName(c) {
|
|
13622
|
+
if (c === 61) {
|
|
13623
|
+
this.state = 18;
|
|
13624
|
+
} else if (c === 47 || c === 62) {
|
|
13625
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
13626
|
+
this.sectionStart = -1;
|
|
13627
|
+
this.state = 11;
|
|
13628
|
+
this.stateBeforeAttrName(c);
|
|
13629
|
+
} else if (!isWhitespace(c)) {
|
|
13630
|
+
this.cbs.onattribend(0, this.sectionStart);
|
|
13631
|
+
this.handleAttrStart(c);
|
|
13632
|
+
}
|
|
13633
|
+
}
|
|
13634
|
+
stateBeforeAttrValue(c) {
|
|
13635
|
+
if (c === 34) {
|
|
13636
|
+
this.state = 19;
|
|
13637
|
+
this.sectionStart = this.index + 1;
|
|
13638
|
+
} else if (c === 39) {
|
|
13639
|
+
this.state = 20;
|
|
13640
|
+
this.sectionStart = this.index + 1;
|
|
13641
|
+
} else if (!isWhitespace(c)) {
|
|
13642
|
+
this.sectionStart = this.index;
|
|
13643
|
+
this.state = 21;
|
|
13644
|
+
this.stateInAttrValueNoQuotes(c);
|
|
13645
|
+
}
|
|
13646
|
+
}
|
|
13647
|
+
handleInAttrValue(c, quote) {
|
|
13648
|
+
if (c === quote || this.fastForwardTo(quote)) {
|
|
13649
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
13650
|
+
this.sectionStart = -1;
|
|
13651
|
+
this.cbs.onattribend(
|
|
13652
|
+
quote === 34 ? 3 : 2,
|
|
13653
|
+
this.index + 1
|
|
13654
|
+
);
|
|
13655
|
+
this.state = 11;
|
|
13656
|
+
}
|
|
13657
|
+
}
|
|
13658
|
+
stateInAttrValueDoubleQuotes(c) {
|
|
13659
|
+
this.handleInAttrValue(c, 34);
|
|
13660
|
+
}
|
|
13661
|
+
stateInAttrValueSingleQuotes(c) {
|
|
13662
|
+
this.handleInAttrValue(c, 39);
|
|
13663
|
+
}
|
|
13664
|
+
stateInAttrValueNoQuotes(c) {
|
|
13665
|
+
if (isWhitespace(c) || c === 62) {
|
|
13666
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
13667
|
+
this.sectionStart = -1;
|
|
13668
|
+
this.cbs.onattribend(1, this.index);
|
|
13669
|
+
this.state = 11;
|
|
13670
|
+
this.stateBeforeAttrName(c);
|
|
13671
|
+
} else if ((!!(process.env.NODE_ENV !== "production") || false) && c === 34 || c === 39 || c === 60 || c === 61 || c === 96) {
|
|
13672
|
+
this.cbs.onerr(
|
|
13673
|
+
18,
|
|
13674
|
+
this.index
|
|
13675
|
+
);
|
|
13676
|
+
} else ;
|
|
13677
|
+
}
|
|
13678
|
+
stateBeforeDeclaration(c) {
|
|
13679
|
+
if (c === 91) {
|
|
13680
|
+
this.state = 26;
|
|
13681
|
+
this.sequenceIndex = 0;
|
|
13682
|
+
} else {
|
|
13683
|
+
this.state = c === 45 ? 25 : 23;
|
|
13684
|
+
}
|
|
13685
|
+
}
|
|
13686
|
+
stateInDeclaration(c) {
|
|
13687
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
13688
|
+
this.state = 1;
|
|
13689
|
+
this.sectionStart = this.index + 1;
|
|
13690
|
+
}
|
|
13691
|
+
}
|
|
13692
|
+
stateInProcessingInstruction(c) {
|
|
13693
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
13694
|
+
this.cbs.onprocessinginstruction(this.sectionStart, this.index);
|
|
13695
|
+
this.state = 1;
|
|
13696
|
+
this.sectionStart = this.index + 1;
|
|
13697
|
+
}
|
|
13698
|
+
}
|
|
13699
|
+
stateBeforeComment(c) {
|
|
13700
|
+
if (c === 45) {
|
|
13701
|
+
this.state = 28;
|
|
13702
|
+
this.currentSequence = Sequences.CommentEnd;
|
|
13703
|
+
this.sequenceIndex = 2;
|
|
13704
|
+
this.sectionStart = this.index + 1;
|
|
13705
|
+
} else {
|
|
13706
|
+
this.state = 23;
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
13709
|
+
stateInSpecialComment(c) {
|
|
13710
|
+
if (c === 62 || this.fastForwardTo(62)) {
|
|
13711
|
+
this.cbs.oncomment(this.sectionStart, this.index);
|
|
13712
|
+
this.state = 1;
|
|
13713
|
+
this.sectionStart = this.index + 1;
|
|
13714
|
+
}
|
|
13715
|
+
}
|
|
13716
|
+
stateBeforeSpecialS(c) {
|
|
13717
|
+
const lower = c | 32;
|
|
13718
|
+
if (lower === Sequences.ScriptEnd[3]) {
|
|
13719
|
+
this.startSpecial(Sequences.ScriptEnd, 4);
|
|
13720
|
+
} else if (lower === Sequences.StyleEnd[3]) {
|
|
13721
|
+
this.startSpecial(Sequences.StyleEnd, 4);
|
|
13722
|
+
} else {
|
|
13723
|
+
this.state = 6;
|
|
13724
|
+
this.stateInTagName(c);
|
|
13725
|
+
}
|
|
13726
|
+
}
|
|
13727
|
+
stateBeforeSpecialT(c) {
|
|
13728
|
+
const lower = c | 32;
|
|
13729
|
+
if (lower === Sequences.TitleEnd[3]) {
|
|
13730
|
+
this.startSpecial(Sequences.TitleEnd, 4);
|
|
13731
|
+
} else if (lower === Sequences.TextareaEnd[3]) {
|
|
13732
|
+
this.startSpecial(Sequences.TextareaEnd, 4);
|
|
13733
|
+
} else {
|
|
13734
|
+
this.state = 6;
|
|
13735
|
+
this.stateInTagName(c);
|
|
13736
|
+
}
|
|
13737
|
+
}
|
|
13738
|
+
startEntity() {
|
|
13739
|
+
}
|
|
13740
|
+
stateInEntity() {
|
|
13741
|
+
}
|
|
13742
|
+
/**
|
|
13743
|
+
* Iterates through the buffer, calling the function corresponding to the current state.
|
|
13744
|
+
*
|
|
13745
|
+
* States that are more likely to be hit are higher up, as a performance improvement.
|
|
13746
|
+
*/
|
|
13747
|
+
parse(input) {
|
|
13748
|
+
this.buffer = input;
|
|
13749
|
+
while (this.index < this.buffer.length) {
|
|
13750
|
+
const c = this.buffer.charCodeAt(this.index);
|
|
13751
|
+
if (c === 10) {
|
|
13752
|
+
this.newlines.push(this.index);
|
|
13753
|
+
}
|
|
13754
|
+
switch (this.state) {
|
|
13755
|
+
case 1: {
|
|
13756
|
+
this.stateText(c);
|
|
13757
|
+
break;
|
|
13758
|
+
}
|
|
13759
|
+
case 2: {
|
|
13760
|
+
this.stateInterpolationOpen(c);
|
|
13761
|
+
break;
|
|
13762
|
+
}
|
|
13763
|
+
case 3: {
|
|
13764
|
+
this.stateInterpolation(c);
|
|
13765
|
+
break;
|
|
13766
|
+
}
|
|
13767
|
+
case 4: {
|
|
13768
|
+
this.stateInterpolationClose(c);
|
|
13769
|
+
break;
|
|
13770
|
+
}
|
|
13771
|
+
case 31: {
|
|
13772
|
+
this.stateSpecialStartSequence(c);
|
|
13773
|
+
break;
|
|
13774
|
+
}
|
|
13775
|
+
case 32: {
|
|
13776
|
+
this.stateInRCDATA(c);
|
|
13777
|
+
break;
|
|
13778
|
+
}
|
|
13779
|
+
case 26: {
|
|
13780
|
+
this.stateCDATASequence(c);
|
|
13781
|
+
break;
|
|
13782
|
+
}
|
|
13783
|
+
case 19: {
|
|
13784
|
+
this.stateInAttrValueDoubleQuotes(c);
|
|
13785
|
+
break;
|
|
13786
|
+
}
|
|
13787
|
+
case 12: {
|
|
13788
|
+
this.stateInAttrName(c);
|
|
13789
|
+
break;
|
|
13790
|
+
}
|
|
13791
|
+
case 13: {
|
|
13792
|
+
this.stateInDirName(c);
|
|
13793
|
+
break;
|
|
13794
|
+
}
|
|
13795
|
+
case 14: {
|
|
13796
|
+
this.stateInDirArg(c);
|
|
13797
|
+
break;
|
|
13798
|
+
}
|
|
13799
|
+
case 15: {
|
|
13800
|
+
this.stateInDynamicDirArg(c);
|
|
13801
|
+
break;
|
|
13802
|
+
}
|
|
13803
|
+
case 16: {
|
|
13804
|
+
this.stateInDirModifier(c);
|
|
13805
|
+
break;
|
|
13806
|
+
}
|
|
13807
|
+
case 28: {
|
|
13808
|
+
this.stateInCommentLike(c);
|
|
13809
|
+
break;
|
|
13810
|
+
}
|
|
13811
|
+
case 27: {
|
|
13812
|
+
this.stateInSpecialComment(c);
|
|
13813
|
+
break;
|
|
13814
|
+
}
|
|
13815
|
+
case 11: {
|
|
13816
|
+
this.stateBeforeAttrName(c);
|
|
13817
|
+
break;
|
|
13818
|
+
}
|
|
13819
|
+
case 6: {
|
|
13820
|
+
this.stateInTagName(c);
|
|
13821
|
+
break;
|
|
13822
|
+
}
|
|
13823
|
+
case 34: {
|
|
13824
|
+
this.stateInSFCRootTagName(c);
|
|
13825
|
+
break;
|
|
13826
|
+
}
|
|
13827
|
+
case 9: {
|
|
13828
|
+
this.stateInClosingTagName(c);
|
|
13829
|
+
break;
|
|
13830
|
+
}
|
|
13831
|
+
case 5: {
|
|
13832
|
+
this.stateBeforeTagName(c);
|
|
13833
|
+
break;
|
|
13834
|
+
}
|
|
13835
|
+
case 17: {
|
|
13836
|
+
this.stateAfterAttrName(c);
|
|
13837
|
+
break;
|
|
13838
|
+
}
|
|
13839
|
+
case 20: {
|
|
13840
|
+
this.stateInAttrValueSingleQuotes(c);
|
|
13841
|
+
break;
|
|
13842
|
+
}
|
|
13843
|
+
case 18: {
|
|
13844
|
+
this.stateBeforeAttrValue(c);
|
|
13845
|
+
break;
|
|
13846
|
+
}
|
|
13847
|
+
case 8: {
|
|
13848
|
+
this.stateBeforeClosingTagName(c);
|
|
13849
|
+
break;
|
|
13850
|
+
}
|
|
13851
|
+
case 10: {
|
|
13852
|
+
this.stateAfterClosingTagName(c);
|
|
13853
|
+
break;
|
|
13854
|
+
}
|
|
13855
|
+
case 29: {
|
|
13856
|
+
this.stateBeforeSpecialS(c);
|
|
13857
|
+
break;
|
|
13858
|
+
}
|
|
13859
|
+
case 30: {
|
|
13860
|
+
this.stateBeforeSpecialT(c);
|
|
13861
|
+
break;
|
|
13862
|
+
}
|
|
13863
|
+
case 21: {
|
|
13864
|
+
this.stateInAttrValueNoQuotes(c);
|
|
13865
|
+
break;
|
|
13866
|
+
}
|
|
13867
|
+
case 7: {
|
|
13868
|
+
this.stateInSelfClosingTag(c);
|
|
13869
|
+
break;
|
|
13870
|
+
}
|
|
13871
|
+
case 23: {
|
|
13872
|
+
this.stateInDeclaration(c);
|
|
13873
|
+
break;
|
|
13874
|
+
}
|
|
13875
|
+
case 22: {
|
|
13876
|
+
this.stateBeforeDeclaration(c);
|
|
13877
|
+
break;
|
|
13878
|
+
}
|
|
13879
|
+
case 25: {
|
|
13880
|
+
this.stateBeforeComment(c);
|
|
13881
|
+
break;
|
|
13882
|
+
}
|
|
13883
|
+
case 24: {
|
|
13884
|
+
this.stateInProcessingInstruction(c);
|
|
13885
|
+
break;
|
|
13886
|
+
}
|
|
13887
|
+
case 33: {
|
|
13888
|
+
this.stateInEntity();
|
|
13889
|
+
break;
|
|
13890
|
+
}
|
|
13891
|
+
}
|
|
13892
|
+
this.index++;
|
|
13893
|
+
}
|
|
13894
|
+
this.cleanup();
|
|
13895
|
+
this.finish();
|
|
13896
|
+
}
|
|
13897
|
+
/**
|
|
13898
|
+
* Remove data that has already been consumed from the buffer.
|
|
13899
|
+
*/
|
|
13900
|
+
cleanup() {
|
|
13901
|
+
if (this.sectionStart !== this.index) {
|
|
13902
|
+
if (this.state === 1 || this.state === 32 && this.sequenceIndex === 0) {
|
|
13903
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
13904
|
+
this.sectionStart = this.index;
|
|
13905
|
+
} else if (this.state === 19 || this.state === 20 || this.state === 21) {
|
|
13906
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
13907
|
+
this.sectionStart = this.index;
|
|
13908
|
+
}
|
|
13909
|
+
}
|
|
13910
|
+
}
|
|
13911
|
+
finish() {
|
|
13912
|
+
this.handleTrailingData();
|
|
13913
|
+
this.cbs.onend();
|
|
13914
|
+
}
|
|
13915
|
+
/** Handle any trailing data. */
|
|
13916
|
+
handleTrailingData() {
|
|
13917
|
+
const endIndex = this.buffer.length;
|
|
13918
|
+
if (this.sectionStart >= endIndex) {
|
|
13919
|
+
return;
|
|
13920
|
+
}
|
|
13921
|
+
if (this.state === 28) {
|
|
13922
|
+
if (this.currentSequence === Sequences.CdataEnd) {
|
|
13923
|
+
this.cbs.oncdata(this.sectionStart, endIndex);
|
|
13924
|
+
} else {
|
|
13925
|
+
this.cbs.oncomment(this.sectionStart, endIndex);
|
|
13926
|
+
}
|
|
13927
|
+
} else if (this.state === 6 || this.state === 11 || this.state === 18 || this.state === 17 || this.state === 12 || this.state === 13 || this.state === 14 || this.state === 15 || this.state === 16 || this.state === 20 || this.state === 19 || this.state === 21 || this.state === 9) ; else {
|
|
13928
|
+
this.cbs.ontext(this.sectionStart, endIndex);
|
|
13929
|
+
}
|
|
13930
|
+
}
|
|
13931
|
+
emitCodePoint(cp, consumed) {
|
|
13932
|
+
}
|
|
13933
|
+
}
|
|
13934
|
+
|
|
13935
|
+
const deprecationData = {
|
|
13936
|
+
["COMPILER_IS_ON_ELEMENT"]: {
|
|
13937
|
+
message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`,
|
|
13938
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
|
|
13939
|
+
},
|
|
13940
|
+
["COMPILER_V_BIND_SYNC"]: {
|
|
13941
|
+
message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
|
|
13942
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
|
|
13943
|
+
},
|
|
13944
|
+
["COMPILER_V_BIND_OBJECT_ORDER"]: {
|
|
13945
|
+
message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
|
|
13946
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
|
|
13947
|
+
},
|
|
13948
|
+
["COMPILER_V_ON_NATIVE"]: {
|
|
13949
|
+
message: `.native modifier for v-on has been removed as is no longer necessary.`,
|
|
13950
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
|
|
13951
|
+
},
|
|
13952
|
+
["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
|
|
13953
|
+
message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
|
|
13954
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
|
|
13955
|
+
},
|
|
13956
|
+
["COMPILER_NATIVE_TEMPLATE"]: {
|
|
13957
|
+
message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
|
|
13958
|
+
},
|
|
13959
|
+
["COMPILER_INLINE_TEMPLATE"]: {
|
|
13960
|
+
message: `"inline-template" has been removed in Vue 3.`,
|
|
13961
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
|
|
13962
|
+
},
|
|
13963
|
+
["COMPILER_FILTER"]: {
|
|
13964
|
+
message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
|
|
13965
|
+
link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
|
|
13966
|
+
}
|
|
13967
|
+
};
|
|
13968
|
+
function getCompatValue(key, { compatConfig }) {
|
|
13969
|
+
const value = compatConfig && compatConfig[key];
|
|
13970
|
+
if (key === "MODE") {
|
|
13971
|
+
return value || 3;
|
|
13972
|
+
} else {
|
|
13973
|
+
return value;
|
|
13974
|
+
}
|
|
13975
|
+
}
|
|
13976
|
+
function isCompatEnabled(key, context) {
|
|
13977
|
+
const mode = getCompatValue("MODE", context);
|
|
13978
|
+
const value = getCompatValue(key, context);
|
|
13979
|
+
return mode === 3 ? value === true : value !== false;
|
|
13980
|
+
}
|
|
13981
|
+
function checkCompatEnabled(key, context, loc, ...args) {
|
|
13982
|
+
const enabled = isCompatEnabled(key, context);
|
|
13983
|
+
if (!!(process.env.NODE_ENV !== "production") && enabled) {
|
|
13984
|
+
warnDeprecation(key, context, loc, ...args);
|
|
13985
|
+
}
|
|
13986
|
+
return enabled;
|
|
13987
|
+
}
|
|
13988
|
+
function warnDeprecation(key, context, loc, ...args) {
|
|
13989
|
+
const val = getCompatValue(key, context);
|
|
13990
|
+
if (val === "suppress-warning") {
|
|
13991
|
+
return;
|
|
13992
|
+
}
|
|
13993
|
+
const { message, link } = deprecationData[key];
|
|
13994
|
+
const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
|
|
13995
|
+
Details: ${link}` : ``}`;
|
|
13996
|
+
const err = new SyntaxError(msg);
|
|
13997
|
+
err.code = key;
|
|
13998
|
+
if (loc)
|
|
13999
|
+
err.loc = loc;
|
|
14000
|
+
context.onWarn(err);
|
|
14001
|
+
}
|
|
14002
|
+
|
|
14003
|
+
function defaultOnError(error) {
|
|
14004
|
+
throw error;
|
|
14005
|
+
}
|
|
14006
|
+
function defaultOnWarn(msg) {
|
|
14007
|
+
!!(process.env.NODE_ENV !== "production") && console.warn(`[Vue warn] ${msg.message}`);
|
|
14008
|
+
}
|
|
14009
|
+
function createCompilerError(code, loc, messages, additionalMessage) {
|
|
14010
|
+
const msg = !!(process.env.NODE_ENV !== "production") || false ? (messages || errorMessages)[code] + (additionalMessage || ``) : code;
|
|
14011
|
+
const error = new SyntaxError(String(msg));
|
|
14012
|
+
error.code = code;
|
|
14013
|
+
error.loc = loc;
|
|
14014
|
+
return error;
|
|
14015
|
+
}
|
|
14016
|
+
const errorMessages = {
|
|
14017
|
+
// parse errors
|
|
14018
|
+
[0]: "Illegal comment.",
|
|
14019
|
+
[1]: "CDATA section is allowed only in XML context.",
|
|
14020
|
+
[2]: "Duplicate attribute.",
|
|
14021
|
+
[3]: "End tag cannot have attributes.",
|
|
14022
|
+
[4]: "Illegal '/' in tags.",
|
|
14023
|
+
[5]: "Unexpected EOF in tag.",
|
|
14024
|
+
[6]: "Unexpected EOF in CDATA section.",
|
|
14025
|
+
[7]: "Unexpected EOF in comment.",
|
|
14026
|
+
[8]: "Unexpected EOF in script.",
|
|
14027
|
+
[9]: "Unexpected EOF in tag.",
|
|
14028
|
+
[10]: "Incorrectly closed comment.",
|
|
14029
|
+
[11]: "Incorrectly opened comment.",
|
|
14030
|
+
[12]: "Illegal tag name. Use '<' to print '<'.",
|
|
14031
|
+
[13]: "Attribute value was expected.",
|
|
14032
|
+
[14]: "End tag name was expected.",
|
|
14033
|
+
[15]: "Whitespace was expected.",
|
|
14034
|
+
[16]: "Unexpected '<!--' in comment.",
|
|
14035
|
+
[17]: `Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,
|
|
14036
|
+
[18]: "Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",
|
|
14037
|
+
[19]: "Attribute name cannot start with '='.",
|
|
14038
|
+
[21]: "'<?' is allowed only in XML context.",
|
|
14039
|
+
[20]: `Unexpected null character.`,
|
|
14040
|
+
[22]: "Illegal '/' in tags.",
|
|
14041
|
+
// Vue-specific parse errors
|
|
14042
|
+
[23]: "Invalid end tag.",
|
|
14043
|
+
[24]: "Element is missing end tag.",
|
|
14044
|
+
[25]: "Interpolation end sign was not found.",
|
|
14045
|
+
[27]: "End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",
|
|
14046
|
+
[26]: "Legal directive name was expected.",
|
|
14047
|
+
// transform errors
|
|
14048
|
+
[28]: `v-if/v-else-if is missing expression.`,
|
|
14049
|
+
[29]: `v-if/else branches must use unique keys.`,
|
|
14050
|
+
[30]: `v-else/v-else-if has no adjacent v-if or v-else-if.`,
|
|
14051
|
+
[31]: `v-for is missing expression.`,
|
|
14052
|
+
[32]: `v-for has invalid expression.`,
|
|
14053
|
+
[33]: `<template v-for> key should be placed on the <template> tag.`,
|
|
14054
|
+
[34]: `v-bind is missing expression.`,
|
|
14055
|
+
[35]: `v-on is missing expression.`,
|
|
14056
|
+
[36]: `Unexpected custom directive on <slot> outlet.`,
|
|
14057
|
+
[37]: `Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.`,
|
|
14058
|
+
[38]: `Duplicate slot names found. `,
|
|
14059
|
+
[39]: `Extraneous children found when component already has explicitly named default slot. These children will be ignored.`,
|
|
14060
|
+
[40]: `v-slot can only be used on components or <template> tags.`,
|
|
14061
|
+
[41]: `v-model is missing expression.`,
|
|
14062
|
+
[42]: `v-model value must be a valid JavaScript member expression.`,
|
|
14063
|
+
[43]: `v-model cannot be used on v-for or v-slot scope variables because they are not writable.`,
|
|
14064
|
+
[44]: `v-model cannot be used on a prop, because local prop bindings are not writable.
|
|
14065
|
+
Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,
|
|
14066
|
+
[45]: `Error parsing JavaScript expression: `,
|
|
14067
|
+
[46]: `<KeepAlive> expects exactly one child component.`,
|
|
14068
|
+
// generic errors
|
|
14069
|
+
[47]: `"prefixIdentifiers" option is not supported in this build of compiler.`,
|
|
14070
|
+
[48]: `ES module mode is not supported in this build of compiler.`,
|
|
14071
|
+
[49]: `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.`,
|
|
14072
|
+
[50]: `"scopeId" option is only supported in module mode.`,
|
|
14073
|
+
// deprecations
|
|
14074
|
+
[51]: `@vnode-* hooks in templates are deprecated. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support will be removed in 3.4.`,
|
|
14075
|
+
[52]: `v-is="component-name" has been deprecated. Use is="vue:component-name" instead. v-is support will be removed in 3.4.`,
|
|
14076
|
+
// just to fulfill types
|
|
14077
|
+
[53]: ``
|
|
14078
|
+
};
|
|
14079
|
+
|
|
14080
|
+
const isStaticExp = (p) => p.type === 4 && p.isStatic;
|
|
14081
|
+
function isCoreComponent(tag) {
|
|
14082
|
+
switch (tag) {
|
|
14083
|
+
case "Teleport":
|
|
14084
|
+
case "teleport":
|
|
14085
|
+
return TELEPORT;
|
|
14086
|
+
case "Suspense":
|
|
14087
|
+
case "suspense":
|
|
14088
|
+
return SUSPENSE;
|
|
14089
|
+
case "KeepAlive":
|
|
14090
|
+
case "keep-alive":
|
|
14091
|
+
return KEEP_ALIVE;
|
|
14092
|
+
case "BaseTransition":
|
|
14093
|
+
case "base-transition":
|
|
14094
|
+
return BASE_TRANSITION;
|
|
14095
|
+
}
|
|
14096
|
+
}
|
|
14097
|
+
const nonIdentifierRE = /^\d|[^\$\w]/;
|
|
14098
|
+
const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
|
|
14099
|
+
const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
14100
|
+
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
14101
|
+
const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
|
|
14102
|
+
const isMemberExpressionBrowser = (path) => {
|
|
14103
|
+
path = path.trim().replace(whitespaceRE, (s) => s.trim());
|
|
14104
|
+
let state = 0 /* inMemberExp */;
|
|
14105
|
+
let stateStack = [];
|
|
14106
|
+
let currentOpenBracketCount = 0;
|
|
14107
|
+
let currentOpenParensCount = 0;
|
|
14108
|
+
let currentStringType = null;
|
|
14109
|
+
for (let i = 0; i < path.length; i++) {
|
|
14110
|
+
const char = path.charAt(i);
|
|
14111
|
+
switch (state) {
|
|
14112
|
+
case 0 /* inMemberExp */:
|
|
14113
|
+
if (char === "[") {
|
|
14114
|
+
stateStack.push(state);
|
|
14115
|
+
state = 1 /* inBrackets */;
|
|
14116
|
+
currentOpenBracketCount++;
|
|
13211
14117
|
} else if (char === "(") {
|
|
13212
14118
|
stateStack.push(state);
|
|
13213
14119
|
state = 2 /* inParens */;
|
|
@@ -13256,43 +14162,6 @@ const isMemberExpressionBrowser = (path) => {
|
|
|
13256
14162
|
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
13257
14163
|
};
|
|
13258
14164
|
const isMemberExpression = isMemberExpressionBrowser ;
|
|
13259
|
-
function getInnerRange(loc, offset, length) {
|
|
13260
|
-
const source = loc.source.slice(offset, offset + length);
|
|
13261
|
-
const newLoc = {
|
|
13262
|
-
source,
|
|
13263
|
-
start: advancePositionWithClone(loc.start, loc.source, offset),
|
|
13264
|
-
end: loc.end
|
|
13265
|
-
};
|
|
13266
|
-
if (length != null) {
|
|
13267
|
-
newLoc.end = advancePositionWithClone(
|
|
13268
|
-
loc.start,
|
|
13269
|
-
loc.source,
|
|
13270
|
-
offset + length
|
|
13271
|
-
);
|
|
13272
|
-
}
|
|
13273
|
-
return newLoc;
|
|
13274
|
-
}
|
|
13275
|
-
function advancePositionWithClone(pos, source, numberOfCharacters = source.length) {
|
|
13276
|
-
return advancePositionWithMutation(
|
|
13277
|
-
extend({}, pos),
|
|
13278
|
-
source,
|
|
13279
|
-
numberOfCharacters
|
|
13280
|
-
);
|
|
13281
|
-
}
|
|
13282
|
-
function advancePositionWithMutation(pos, source, numberOfCharacters = source.length) {
|
|
13283
|
-
let linesCount = 0;
|
|
13284
|
-
let lastNewLinePos = -1;
|
|
13285
|
-
for (let i = 0; i < numberOfCharacters; i++) {
|
|
13286
|
-
if (source.charCodeAt(i) === 10) {
|
|
13287
|
-
linesCount++;
|
|
13288
|
-
lastNewLinePos = i;
|
|
13289
|
-
}
|
|
13290
|
-
}
|
|
13291
|
-
pos.offset += numberOfCharacters;
|
|
13292
|
-
pos.line += linesCount;
|
|
13293
|
-
pos.column = lastNewLinePos === -1 ? pos.column + numberOfCharacters : numberOfCharacters - lastNewLinePos;
|
|
13294
|
-
return pos;
|
|
13295
|
-
}
|
|
13296
14165
|
function assert(condition, msg) {
|
|
13297
14166
|
if (!condition) {
|
|
13298
14167
|
throw new Error(msg || `unexpected compiler condition`);
|
|
@@ -13394,513 +14263,602 @@ function injectProp(node, prop, context) {
|
|
|
13394
14263
|
} else {
|
|
13395
14264
|
propsWithInjection = createCallExpression(context.helper(MERGE_PROPS), [
|
|
13396
14265
|
createObjectExpression([prop]),
|
|
13397
|
-
props
|
|
13398
|
-
]);
|
|
13399
|
-
if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
|
|
13400
|
-
parentCall = callPath[callPath.length - 2];
|
|
13401
|
-
}
|
|
13402
|
-
}
|
|
13403
|
-
if (node.type === 13) {
|
|
13404
|
-
if (parentCall) {
|
|
13405
|
-
parentCall.arguments[0] = propsWithInjection;
|
|
13406
|
-
} else {
|
|
13407
|
-
node.props = propsWithInjection;
|
|
13408
|
-
}
|
|
13409
|
-
} else {
|
|
13410
|
-
if (parentCall) {
|
|
13411
|
-
parentCall.arguments[0] = propsWithInjection;
|
|
13412
|
-
} else {
|
|
13413
|
-
node.arguments[2] = propsWithInjection;
|
|
13414
|
-
}
|
|
13415
|
-
}
|
|
13416
|
-
}
|
|
13417
|
-
function hasProp(prop, props) {
|
|
13418
|
-
let result = false;
|
|
13419
|
-
if (prop.key.type === 4) {
|
|
13420
|
-
const propKeyName = prop.key.content;
|
|
13421
|
-
result = props.properties.some(
|
|
13422
|
-
(p) => p.key.type === 4 && p.key.content === propKeyName
|
|
13423
|
-
);
|
|
13424
|
-
}
|
|
13425
|
-
return result;
|
|
13426
|
-
}
|
|
13427
|
-
function toValidAssetId(name, type) {
|
|
13428
|
-
return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
|
|
13429
|
-
return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
|
|
13430
|
-
})}`;
|
|
13431
|
-
}
|
|
13432
|
-
function getMemoedVNodeCall(node) {
|
|
13433
|
-
if (node.type === 14 && node.callee === WITH_MEMO) {
|
|
13434
|
-
return node.arguments[1].returns;
|
|
13435
|
-
} else {
|
|
13436
|
-
return node;
|
|
13437
|
-
}
|
|
13438
|
-
}
|
|
13439
|
-
|
|
13440
|
-
const deprecationData = {
|
|
13441
|
-
["COMPILER_IS_ON_ELEMENT"]: {
|
|
13442
|
-
message: `Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".`,
|
|
13443
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html`
|
|
13444
|
-
},
|
|
13445
|
-
["COMPILER_V_BIND_SYNC"]: {
|
|
13446
|
-
message: (key) => `.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${key}.sync\` should be changed to \`v-model:${key}\`.`,
|
|
13447
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-model.html`
|
|
13448
|
-
},
|
|
13449
|
-
["COMPILER_V_BIND_PROP"]: {
|
|
13450
|
-
message: `.prop modifier for v-bind has been removed and no longer necessary. Vue 3 will automatically set a binding as DOM property when appropriate.`
|
|
13451
|
-
},
|
|
13452
|
-
["COMPILER_V_BIND_OBJECT_ORDER"]: {
|
|
13453
|
-
message: `v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.`,
|
|
13454
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-bind.html`
|
|
13455
|
-
},
|
|
13456
|
-
["COMPILER_V_ON_NATIVE"]: {
|
|
13457
|
-
message: `.native modifier for v-on has been removed as is no longer necessary.`,
|
|
13458
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html`
|
|
13459
|
-
},
|
|
13460
|
-
["COMPILER_V_IF_V_FOR_PRECEDENCE"]: {
|
|
13461
|
-
message: `v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.`,
|
|
13462
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html`
|
|
13463
|
-
},
|
|
13464
|
-
["COMPILER_NATIVE_TEMPLATE"]: {
|
|
13465
|
-
message: `<template> with no special directives will render as a native template element instead of its inner content in Vue 3.`
|
|
13466
|
-
},
|
|
13467
|
-
["COMPILER_INLINE_TEMPLATE"]: {
|
|
13468
|
-
message: `"inline-template" has been removed in Vue 3.`,
|
|
13469
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html`
|
|
13470
|
-
},
|
|
13471
|
-
["COMPILER_FILTER"]: {
|
|
13472
|
-
message: `filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.`,
|
|
13473
|
-
link: `https://v3-migration.vuejs.org/breaking-changes/filters.html`
|
|
14266
|
+
props
|
|
14267
|
+
]);
|
|
14268
|
+
if (parentCall && parentCall.callee === GUARD_REACTIVE_PROPS) {
|
|
14269
|
+
parentCall = callPath[callPath.length - 2];
|
|
14270
|
+
}
|
|
13474
14271
|
}
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
14272
|
+
if (node.type === 13) {
|
|
14273
|
+
if (parentCall) {
|
|
14274
|
+
parentCall.arguments[0] = propsWithInjection;
|
|
14275
|
+
} else {
|
|
14276
|
+
node.props = propsWithInjection;
|
|
14277
|
+
}
|
|
13481
14278
|
} else {
|
|
13482
|
-
|
|
14279
|
+
if (parentCall) {
|
|
14280
|
+
parentCall.arguments[0] = propsWithInjection;
|
|
14281
|
+
} else {
|
|
14282
|
+
node.arguments[2] = propsWithInjection;
|
|
14283
|
+
}
|
|
13483
14284
|
}
|
|
13484
14285
|
}
|
|
13485
|
-
function
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
if (!!(process.env.NODE_ENV !== "production") && enabled) {
|
|
13493
|
-
warnDeprecation(key, context, loc, ...args);
|
|
14286
|
+
function hasProp(prop, props) {
|
|
14287
|
+
let result = false;
|
|
14288
|
+
if (prop.key.type === 4) {
|
|
14289
|
+
const propKeyName = prop.key.content;
|
|
14290
|
+
result = props.properties.some(
|
|
14291
|
+
(p) => p.key.type === 4 && p.key.content === propKeyName
|
|
14292
|
+
);
|
|
13494
14293
|
}
|
|
13495
|
-
return
|
|
14294
|
+
return result;
|
|
13496
14295
|
}
|
|
13497
|
-
function
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
14296
|
+
function toValidAssetId(name, type) {
|
|
14297
|
+
return `_${type}_${name.replace(/[^\w]/g, (searchValue, replaceValue) => {
|
|
14298
|
+
return searchValue === "-" ? "_" : name.charCodeAt(replaceValue).toString();
|
|
14299
|
+
})}`;
|
|
14300
|
+
}
|
|
14301
|
+
function getMemoedVNodeCall(node) {
|
|
14302
|
+
if (node.type === 14 && node.callee === WITH_MEMO) {
|
|
14303
|
+
return node.arguments[1].returns;
|
|
14304
|
+
} else {
|
|
14305
|
+
return node;
|
|
13501
14306
|
}
|
|
13502
|
-
const { message, link } = deprecationData[key];
|
|
13503
|
-
const msg = `(deprecation ${key}) ${typeof message === "function" ? message(...args) : message}${link ? `
|
|
13504
|
-
Details: ${link}` : ``}`;
|
|
13505
|
-
const err = new SyntaxError(msg);
|
|
13506
|
-
err.code = key;
|
|
13507
|
-
if (loc)
|
|
13508
|
-
err.loc = loc;
|
|
13509
|
-
context.onWarn(err);
|
|
13510
14307
|
}
|
|
14308
|
+
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
13511
14309
|
|
|
13512
|
-
const decodeRE = /&(gt|lt|amp|apos|quot);/g;
|
|
13513
|
-
const decodeMap = {
|
|
13514
|
-
gt: ">",
|
|
13515
|
-
lt: "<",
|
|
13516
|
-
amp: "&",
|
|
13517
|
-
apos: "'",
|
|
13518
|
-
quot: '"'
|
|
13519
|
-
};
|
|
13520
14310
|
const defaultParserOptions = {
|
|
14311
|
+
parseMode: "base",
|
|
14312
|
+
ns: 0,
|
|
13521
14313
|
delimiters: [`{{`, `}}`],
|
|
13522
14314
|
getNamespace: () => 0,
|
|
13523
|
-
getTextMode: () => 0,
|
|
13524
14315
|
isVoidTag: NO,
|
|
13525
14316
|
isPreTag: NO,
|
|
13526
14317
|
isCustomElement: NO,
|
|
13527
|
-
decodeEntities: (rawText) => rawText.replace(decodeRE, (_, p1) => decodeMap[p1]),
|
|
13528
14318
|
onError: defaultOnError,
|
|
13529
14319
|
onWarn: defaultOnWarn,
|
|
13530
14320
|
comments: !!(process.env.NODE_ENV !== "production")
|
|
13531
14321
|
};
|
|
13532
|
-
|
|
13533
|
-
|
|
13534
|
-
|
|
13535
|
-
|
|
13536
|
-
|
|
13537
|
-
|
|
13538
|
-
|
|
13539
|
-
|
|
13540
|
-
|
|
13541
|
-
|
|
13542
|
-
|
|
13543
|
-
|
|
13544
|
-
|
|
13545
|
-
|
|
13546
|
-
|
|
13547
|
-
|
|
13548
|
-
|
|
13549
|
-
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
|
|
13558
|
-
|
|
13559
|
-
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13563
|
-
|
|
13564
|
-
let
|
|
13565
|
-
if (
|
|
13566
|
-
|
|
13567
|
-
|
|
13568
|
-
}
|
|
13569
|
-
|
|
13570
|
-
|
|
13571
|
-
|
|
13572
|
-
|
|
13573
|
-
|
|
13574
|
-
|
|
13575
|
-
|
|
13576
|
-
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
14322
|
+
let currentOptions = defaultParserOptions;
|
|
14323
|
+
let currentRoot = null;
|
|
14324
|
+
let currentInput = "";
|
|
14325
|
+
let currentOpenTag = null;
|
|
14326
|
+
let currentProp = null;
|
|
14327
|
+
let currentAttrValue = "";
|
|
14328
|
+
let currentAttrStartIndex = -1;
|
|
14329
|
+
let currentAttrEndIndex = -1;
|
|
14330
|
+
let inPre = 0;
|
|
14331
|
+
let inVPre = false;
|
|
14332
|
+
let currentVPreBoundary = null;
|
|
14333
|
+
const stack = [];
|
|
14334
|
+
const tokenizer = new Tokenizer(stack, {
|
|
14335
|
+
onerr: emitError,
|
|
14336
|
+
ontext(start, end) {
|
|
14337
|
+
onText(getSlice(start, end), start, end);
|
|
14338
|
+
},
|
|
14339
|
+
ontextentity(char, start, end) {
|
|
14340
|
+
onText(char, start, end);
|
|
14341
|
+
},
|
|
14342
|
+
oninterpolation(start, end) {
|
|
14343
|
+
if (inVPre) {
|
|
14344
|
+
return onText(getSlice(start, end), start, end);
|
|
14345
|
+
}
|
|
14346
|
+
let innerStart = start + tokenizer.delimiterOpen.length;
|
|
14347
|
+
let innerEnd = end - tokenizer.delimiterClose.length;
|
|
14348
|
+
while (isWhitespace(currentInput.charCodeAt(innerStart))) {
|
|
14349
|
+
innerStart++;
|
|
14350
|
+
}
|
|
14351
|
+
while (isWhitespace(currentInput.charCodeAt(innerEnd - 1))) {
|
|
14352
|
+
innerEnd--;
|
|
14353
|
+
}
|
|
14354
|
+
let exp = getSlice(innerStart, innerEnd);
|
|
14355
|
+
if (exp.includes("&")) {
|
|
14356
|
+
{
|
|
14357
|
+
exp = currentOptions.decodeEntities(exp, false);
|
|
14358
|
+
}
|
|
14359
|
+
}
|
|
14360
|
+
addNode({
|
|
14361
|
+
type: 5,
|
|
14362
|
+
content: createSimpleExpression(exp, false, getLoc(innerStart, innerEnd)),
|
|
14363
|
+
loc: getLoc(start, end)
|
|
14364
|
+
});
|
|
14365
|
+
},
|
|
14366
|
+
onopentagname(start, end) {
|
|
14367
|
+
const name = getSlice(start, end);
|
|
14368
|
+
currentOpenTag = {
|
|
14369
|
+
type: 1,
|
|
14370
|
+
tag: name,
|
|
14371
|
+
ns: currentOptions.getNamespace(name, stack[0], currentOptions.ns),
|
|
14372
|
+
tagType: 0,
|
|
14373
|
+
// will be refined on tag close
|
|
14374
|
+
props: [],
|
|
14375
|
+
children: [],
|
|
14376
|
+
loc: getLoc(start - 1, end),
|
|
14377
|
+
codegenNode: void 0
|
|
14378
|
+
};
|
|
14379
|
+
if (tokenizer.inSFCRoot) {
|
|
14380
|
+
currentOpenTag.innerLoc = getLoc(
|
|
14381
|
+
end + fastForward(end) + 1,
|
|
14382
|
+
end
|
|
14383
|
+
);
|
|
14384
|
+
}
|
|
14385
|
+
},
|
|
14386
|
+
onopentagend(end) {
|
|
14387
|
+
endOpenTag(end);
|
|
14388
|
+
},
|
|
14389
|
+
onclosetag(start, end) {
|
|
14390
|
+
const name = getSlice(start, end);
|
|
14391
|
+
if (!currentOptions.isVoidTag(name)) {
|
|
14392
|
+
let found = false;
|
|
14393
|
+
for (let i = 0; i < stack.length; i++) {
|
|
14394
|
+
const e = stack[i];
|
|
14395
|
+
if (e.tag.toLowerCase() === name.toLowerCase()) {
|
|
14396
|
+
found = true;
|
|
14397
|
+
if (i > 0) {
|
|
14398
|
+
emitError(24, stack[0].loc.start.offset);
|
|
13586
14399
|
}
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
} else if (s[2] === ">") {
|
|
13591
|
-
emitError(context, 14, 2);
|
|
13592
|
-
advanceBy(context, 3);
|
|
13593
|
-
continue;
|
|
13594
|
-
} else if (/[a-z]/i.test(s[2])) {
|
|
13595
|
-
emitError(context, 23);
|
|
13596
|
-
parseTag(context, 1 /* End */, parent);
|
|
13597
|
-
continue;
|
|
13598
|
-
} else {
|
|
13599
|
-
emitError(
|
|
13600
|
-
context,
|
|
13601
|
-
12,
|
|
13602
|
-
2
|
|
13603
|
-
);
|
|
13604
|
-
node = parseBogusComment(context);
|
|
14400
|
+
for (let j = 0; j <= i; j++) {
|
|
14401
|
+
const el = stack.shift();
|
|
14402
|
+
onCloseTag(el, end, j < i);
|
|
13605
14403
|
}
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13619
|
-
|
|
14404
|
+
break;
|
|
14405
|
+
}
|
|
14406
|
+
}
|
|
14407
|
+
if (!found) {
|
|
14408
|
+
emitError(23, backTrack(start, 60));
|
|
14409
|
+
}
|
|
14410
|
+
}
|
|
14411
|
+
},
|
|
14412
|
+
onselfclosingtag(end) {
|
|
14413
|
+
var _a;
|
|
14414
|
+
const name = currentOpenTag.tag;
|
|
14415
|
+
currentOpenTag.isSelfClosing = true;
|
|
14416
|
+
endOpenTag(end);
|
|
14417
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
14418
|
+
onCloseTag(stack.shift(), end);
|
|
14419
|
+
}
|
|
14420
|
+
},
|
|
14421
|
+
onattribname(start, end) {
|
|
14422
|
+
currentProp = {
|
|
14423
|
+
type: 6,
|
|
14424
|
+
name: getSlice(start, end),
|
|
14425
|
+
nameLoc: getLoc(start, end),
|
|
14426
|
+
value: void 0,
|
|
14427
|
+
loc: getLoc(start)
|
|
14428
|
+
};
|
|
14429
|
+
},
|
|
14430
|
+
ondirname(start, end) {
|
|
14431
|
+
const raw = getSlice(start, end);
|
|
14432
|
+
const name = raw === "." || raw === ":" ? "bind" : raw === "@" ? "on" : raw === "#" ? "slot" : raw.slice(2);
|
|
14433
|
+
if (!inVPre && name === "") {
|
|
14434
|
+
emitError(26, start);
|
|
14435
|
+
}
|
|
14436
|
+
if (inVPre || name === "") {
|
|
14437
|
+
currentProp = {
|
|
14438
|
+
type: 6,
|
|
14439
|
+
name: raw,
|
|
14440
|
+
nameLoc: getLoc(start, end),
|
|
14441
|
+
value: void 0,
|
|
14442
|
+
loc: getLoc(start)
|
|
14443
|
+
};
|
|
14444
|
+
} else {
|
|
14445
|
+
currentProp = {
|
|
14446
|
+
type: 7,
|
|
14447
|
+
name,
|
|
14448
|
+
rawName: raw,
|
|
14449
|
+
exp: void 0,
|
|
14450
|
+
arg: void 0,
|
|
14451
|
+
modifiers: raw === "." ? ["prop"] : [],
|
|
14452
|
+
loc: getLoc(start)
|
|
14453
|
+
};
|
|
14454
|
+
if (name === "pre") {
|
|
14455
|
+
inVPre = true;
|
|
14456
|
+
currentVPreBoundary = currentOpenTag;
|
|
14457
|
+
const props = currentOpenTag.props;
|
|
14458
|
+
for (let i = 0; i < props.length; i++) {
|
|
14459
|
+
if (props[i].type === 7) {
|
|
14460
|
+
props[i] = dirToAttr(props[i]);
|
|
13620
14461
|
}
|
|
13621
|
-
} else if (s[1] === "?") {
|
|
13622
|
-
emitError(
|
|
13623
|
-
context,
|
|
13624
|
-
21,
|
|
13625
|
-
1
|
|
13626
|
-
);
|
|
13627
|
-
node = parseBogusComment(context);
|
|
13628
|
-
} else {
|
|
13629
|
-
emitError(context, 12, 1);
|
|
13630
14462
|
}
|
|
13631
14463
|
}
|
|
13632
14464
|
}
|
|
13633
|
-
|
|
13634
|
-
|
|
14465
|
+
},
|
|
14466
|
+
ondirarg(start, end) {
|
|
14467
|
+
const arg = getSlice(start, end);
|
|
14468
|
+
if (inVPre) {
|
|
14469
|
+
currentProp.name += arg;
|
|
14470
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
14471
|
+
} else {
|
|
14472
|
+
const isStatic = arg[0] !== `[`;
|
|
14473
|
+
currentProp.arg = createSimpleExpression(
|
|
14474
|
+
isStatic ? arg : arg.slice(1, -1),
|
|
14475
|
+
isStatic,
|
|
14476
|
+
getLoc(start, end),
|
|
14477
|
+
isStatic ? 3 : 0
|
|
14478
|
+
);
|
|
13635
14479
|
}
|
|
13636
|
-
|
|
13637
|
-
|
|
13638
|
-
|
|
14480
|
+
},
|
|
14481
|
+
ondirmodifier(start, end) {
|
|
14482
|
+
const mod = getSlice(start, end);
|
|
14483
|
+
if (inVPre) {
|
|
14484
|
+
currentProp.name += "." + mod;
|
|
14485
|
+
setLocEnd(currentProp.nameLoc, end);
|
|
14486
|
+
} else if (currentProp.name === "slot") {
|
|
14487
|
+
const arg = currentProp.arg;
|
|
14488
|
+
if (arg) {
|
|
14489
|
+
arg.content += "." + mod;
|
|
14490
|
+
setLocEnd(arg.loc, end);
|
|
13639
14491
|
}
|
|
13640
14492
|
} else {
|
|
13641
|
-
|
|
14493
|
+
currentProp.modifiers.push(mod);
|
|
13642
14494
|
}
|
|
13643
|
-
}
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
|
|
13655
|
-
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13659
|
-
|
|
13660
|
-
|
|
13661
|
-
|
|
14495
|
+
},
|
|
14496
|
+
onattribdata(start, end) {
|
|
14497
|
+
currentAttrValue += getSlice(start, end);
|
|
14498
|
+
if (currentAttrStartIndex < 0)
|
|
14499
|
+
currentAttrStartIndex = start;
|
|
14500
|
+
currentAttrEndIndex = end;
|
|
14501
|
+
},
|
|
14502
|
+
onattribentity(char, start, end) {
|
|
14503
|
+
currentAttrValue += char;
|
|
14504
|
+
if (currentAttrStartIndex < 0)
|
|
14505
|
+
currentAttrStartIndex = start;
|
|
14506
|
+
currentAttrEndIndex = end;
|
|
14507
|
+
},
|
|
14508
|
+
onattribnameend(end) {
|
|
14509
|
+
const start = currentProp.loc.start.offset;
|
|
14510
|
+
const name = getSlice(start, end);
|
|
14511
|
+
if (currentProp.type === 7) {
|
|
14512
|
+
currentProp.rawName = name;
|
|
14513
|
+
}
|
|
14514
|
+
if (currentOpenTag.props.some(
|
|
14515
|
+
(p) => (p.type === 7 ? p.rawName : p.name) === name
|
|
14516
|
+
)) {
|
|
14517
|
+
emitError(2, start);
|
|
14518
|
+
}
|
|
14519
|
+
},
|
|
14520
|
+
onattribend(quote, end) {
|
|
14521
|
+
if (currentOpenTag && currentProp) {
|
|
14522
|
+
setLocEnd(currentProp.loc, end);
|
|
14523
|
+
if (quote !== 0) {
|
|
14524
|
+
if (currentAttrValue.includes("&")) {
|
|
14525
|
+
currentAttrValue = currentOptions.decodeEntities(
|
|
14526
|
+
currentAttrValue,
|
|
14527
|
+
true
|
|
14528
|
+
);
|
|
14529
|
+
}
|
|
14530
|
+
if (currentProp.type === 6) {
|
|
14531
|
+
if (currentProp.name === "class") {
|
|
14532
|
+
currentAttrValue = condense(currentAttrValue).trim();
|
|
14533
|
+
}
|
|
14534
|
+
if (quote === 1 && !currentAttrValue) {
|
|
14535
|
+
emitError(13, end);
|
|
14536
|
+
}
|
|
14537
|
+
currentProp.value = {
|
|
14538
|
+
type: 2,
|
|
14539
|
+
content: currentAttrValue,
|
|
14540
|
+
loc: quote === 1 ? getLoc(currentAttrStartIndex, currentAttrEndIndex) : getLoc(currentAttrStartIndex - 1, currentAttrEndIndex + 1)
|
|
14541
|
+
};
|
|
14542
|
+
if (tokenizer.inSFCRoot && currentOpenTag.tag === "template" && currentProp.name === "lang" && currentAttrValue && currentAttrValue !== "html") {
|
|
14543
|
+
tokenizer.enterRCDATA(toCharCodes(`</template`), 0);
|
|
13662
14544
|
}
|
|
13663
14545
|
} else {
|
|
13664
|
-
|
|
14546
|
+
currentProp.exp = createSimpleExpression(
|
|
14547
|
+
currentAttrValue,
|
|
14548
|
+
false,
|
|
14549
|
+
getLoc(currentAttrStartIndex, currentAttrEndIndex)
|
|
14550
|
+
);
|
|
14551
|
+
if (currentProp.name === "for") {
|
|
14552
|
+
currentProp.forParseResult = parseForExpression(currentProp.exp);
|
|
14553
|
+
}
|
|
14554
|
+
let syncIndex = -1;
|
|
14555
|
+
if (currentProp.name === "bind" && (syncIndex = currentProp.modifiers.indexOf("sync")) > -1 && checkCompatEnabled(
|
|
14556
|
+
"COMPILER_V_BIND_SYNC",
|
|
14557
|
+
currentOptions,
|
|
14558
|
+
currentProp.loc,
|
|
14559
|
+
currentProp.rawName
|
|
14560
|
+
)) {
|
|
14561
|
+
currentProp.name = "model";
|
|
14562
|
+
currentProp.modifiers.splice(syncIndex, 1);
|
|
14563
|
+
}
|
|
13665
14564
|
}
|
|
13666
|
-
} else if (node.type === 3 && !context.options.comments) {
|
|
13667
|
-
removedWhitespace = true;
|
|
13668
|
-
nodes[i] = null;
|
|
13669
14565
|
}
|
|
14566
|
+
if (currentProp.type !== 7 || currentProp.name !== "pre") {
|
|
14567
|
+
currentOpenTag.props.push(currentProp);
|
|
14568
|
+
}
|
|
14569
|
+
}
|
|
14570
|
+
currentAttrValue = "";
|
|
14571
|
+
currentAttrStartIndex = currentAttrEndIndex = -1;
|
|
14572
|
+
},
|
|
14573
|
+
oncomment(start, end) {
|
|
14574
|
+
if (currentOptions.comments) {
|
|
14575
|
+
addNode({
|
|
14576
|
+
type: 3,
|
|
14577
|
+
content: getSlice(start, end),
|
|
14578
|
+
loc: getLoc(start - 4, end + 3)
|
|
14579
|
+
});
|
|
13670
14580
|
}
|
|
13671
|
-
|
|
13672
|
-
|
|
13673
|
-
|
|
13674
|
-
|
|
14581
|
+
},
|
|
14582
|
+
onend() {
|
|
14583
|
+
const end = currentInput.length;
|
|
14584
|
+
if ((!!(process.env.NODE_ENV !== "production") || false) && tokenizer.state !== 1) {
|
|
14585
|
+
switch (tokenizer.state) {
|
|
14586
|
+
case 5:
|
|
14587
|
+
case 8:
|
|
14588
|
+
emitError(5, end);
|
|
14589
|
+
break;
|
|
14590
|
+
case 3:
|
|
14591
|
+
case 4:
|
|
14592
|
+
emitError(
|
|
14593
|
+
25,
|
|
14594
|
+
tokenizer.sectionStart
|
|
14595
|
+
);
|
|
14596
|
+
break;
|
|
14597
|
+
case 28:
|
|
14598
|
+
if (tokenizer.currentSequence === Sequences.CdataEnd) {
|
|
14599
|
+
emitError(6, end);
|
|
14600
|
+
} else {
|
|
14601
|
+
emitError(7, end);
|
|
14602
|
+
}
|
|
14603
|
+
break;
|
|
14604
|
+
case 6:
|
|
14605
|
+
case 7:
|
|
14606
|
+
case 9:
|
|
14607
|
+
case 11:
|
|
14608
|
+
case 12:
|
|
14609
|
+
case 13:
|
|
14610
|
+
case 14:
|
|
14611
|
+
case 15:
|
|
14612
|
+
case 16:
|
|
14613
|
+
case 17:
|
|
14614
|
+
case 18:
|
|
14615
|
+
case 19:
|
|
14616
|
+
case 20:
|
|
14617
|
+
case 21:
|
|
14618
|
+
emitError(9, end);
|
|
14619
|
+
break;
|
|
13675
14620
|
}
|
|
13676
14621
|
}
|
|
14622
|
+
for (let index = 0; index < stack.length; index++) {
|
|
14623
|
+
onCloseTag(stack[index], end - 1);
|
|
14624
|
+
emitError(24, stack[index].loc.start.offset);
|
|
14625
|
+
}
|
|
14626
|
+
},
|
|
14627
|
+
oncdata(start, end) {
|
|
14628
|
+
if (stack[0].ns !== 0) {
|
|
14629
|
+
onText(getSlice(start, end), start, end);
|
|
14630
|
+
} else {
|
|
14631
|
+
emitError(1, start - 9);
|
|
14632
|
+
}
|
|
14633
|
+
},
|
|
14634
|
+
onprocessinginstruction(start) {
|
|
14635
|
+
if ((stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
14636
|
+
emitError(
|
|
14637
|
+
21,
|
|
14638
|
+
start - 1
|
|
14639
|
+
);
|
|
14640
|
+
}
|
|
13677
14641
|
}
|
|
13678
|
-
|
|
13679
|
-
}
|
|
13680
|
-
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
14642
|
+
});
|
|
14643
|
+
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
14644
|
+
const stripParensRE = /^\(|\)$/g;
|
|
14645
|
+
function parseForExpression(input) {
|
|
14646
|
+
const loc = input.loc;
|
|
14647
|
+
const exp = input.content;
|
|
14648
|
+
const inMatch = exp.match(forAliasRE);
|
|
14649
|
+
if (!inMatch)
|
|
14650
|
+
return;
|
|
14651
|
+
const [, LHS, RHS] = inMatch;
|
|
14652
|
+
const createAliasExpression = (content, offset) => {
|
|
14653
|
+
const start = loc.start.offset + offset;
|
|
14654
|
+
const end = start + content.length;
|
|
14655
|
+
return createSimpleExpression(content, false, getLoc(start, end));
|
|
14656
|
+
};
|
|
14657
|
+
const result = {
|
|
14658
|
+
source: createAliasExpression(RHS.trim(), exp.indexOf(RHS, LHS.length)),
|
|
14659
|
+
value: void 0,
|
|
14660
|
+
key: void 0,
|
|
14661
|
+
index: void 0,
|
|
14662
|
+
finalized: false
|
|
14663
|
+
};
|
|
14664
|
+
let valueContent = LHS.trim().replace(stripParensRE, "").trim();
|
|
14665
|
+
const trimmedOffset = LHS.indexOf(valueContent);
|
|
14666
|
+
const iteratorMatch = valueContent.match(forIteratorRE);
|
|
14667
|
+
if (iteratorMatch) {
|
|
14668
|
+
valueContent = valueContent.replace(forIteratorRE, "").trim();
|
|
14669
|
+
const keyContent = iteratorMatch[1].trim();
|
|
14670
|
+
let keyOffset;
|
|
14671
|
+
if (keyContent) {
|
|
14672
|
+
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
14673
|
+
result.key = createAliasExpression(keyContent, keyOffset);
|
|
14674
|
+
}
|
|
14675
|
+
if (iteratorMatch[2]) {
|
|
14676
|
+
const indexContent = iteratorMatch[2].trim();
|
|
14677
|
+
if (indexContent) {
|
|
14678
|
+
result.index = createAliasExpression(
|
|
14679
|
+
indexContent,
|
|
14680
|
+
exp.indexOf(
|
|
14681
|
+
indexContent,
|
|
14682
|
+
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
14683
|
+
)
|
|
14684
|
+
);
|
|
14685
|
+
}
|
|
13688
14686
|
}
|
|
13689
14687
|
}
|
|
13690
|
-
|
|
14688
|
+
if (valueContent) {
|
|
14689
|
+
result.value = createAliasExpression(valueContent, trimmedOffset);
|
|
14690
|
+
}
|
|
14691
|
+
return result;
|
|
13691
14692
|
}
|
|
13692
|
-
function
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
|
|
13697
|
-
}
|
|
13698
|
-
|
|
13699
|
-
|
|
13700
|
-
|
|
13701
|
-
|
|
13702
|
-
|
|
13703
|
-
const start = getCursor(context);
|
|
13704
|
-
let content;
|
|
13705
|
-
const match = /--(\!)?>/.exec(context.source);
|
|
13706
|
-
if (!match) {
|
|
13707
|
-
content = context.source.slice(4);
|
|
13708
|
-
advanceBy(context, context.source.length);
|
|
13709
|
-
emitError(context, 7);
|
|
14693
|
+
function getSlice(start, end) {
|
|
14694
|
+
return currentInput.slice(start, end);
|
|
14695
|
+
}
|
|
14696
|
+
function endOpenTag(end) {
|
|
14697
|
+
addNode(currentOpenTag);
|
|
14698
|
+
const { tag, ns } = currentOpenTag;
|
|
14699
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
14700
|
+
inPre++;
|
|
14701
|
+
}
|
|
14702
|
+
if (currentOptions.isVoidTag(tag)) {
|
|
14703
|
+
onCloseTag(currentOpenTag, end);
|
|
13710
14704
|
} else {
|
|
13711
|
-
|
|
13712
|
-
|
|
13713
|
-
|
|
13714
|
-
if (match[1]) {
|
|
13715
|
-
emitError(context, 10);
|
|
14705
|
+
stack.unshift(currentOpenTag);
|
|
14706
|
+
if (ns === 1 || ns === 2) {
|
|
14707
|
+
tokenizer.inXML = true;
|
|
13716
14708
|
}
|
|
13717
|
-
content = context.source.slice(4, match.index);
|
|
13718
|
-
const s = context.source.slice(0, match.index);
|
|
13719
|
-
let prevIndex = 1, nestedIndex = 0;
|
|
13720
|
-
while ((nestedIndex = s.indexOf("<!--", prevIndex)) !== -1) {
|
|
13721
|
-
advanceBy(context, nestedIndex - prevIndex + 1);
|
|
13722
|
-
if (nestedIndex + 4 < s.length) {
|
|
13723
|
-
emitError(context, 16);
|
|
13724
|
-
}
|
|
13725
|
-
prevIndex = nestedIndex + 1;
|
|
13726
|
-
}
|
|
13727
|
-
advanceBy(context, match.index + match[0].length - prevIndex + 1);
|
|
13728
14709
|
}
|
|
13729
|
-
|
|
13730
|
-
type: 3,
|
|
13731
|
-
content,
|
|
13732
|
-
loc: getSelection(context, start)
|
|
13733
|
-
};
|
|
14710
|
+
currentOpenTag = null;
|
|
13734
14711
|
}
|
|
13735
|
-
function
|
|
13736
|
-
|
|
13737
|
-
|
|
13738
|
-
|
|
13739
|
-
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
14712
|
+
function onText(content, start, end) {
|
|
14713
|
+
var _a;
|
|
14714
|
+
{
|
|
14715
|
+
const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
|
|
14716
|
+
if (tag !== "script" && tag !== "style" && content.includes("&")) {
|
|
14717
|
+
content = currentOptions.decodeEntities(content, false);
|
|
14718
|
+
}
|
|
14719
|
+
}
|
|
14720
|
+
const parent = stack[0] || currentRoot;
|
|
14721
|
+
const lastNode = parent.children[parent.children.length - 1];
|
|
14722
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
14723
|
+
lastNode.content += content;
|
|
14724
|
+
setLocEnd(lastNode.loc, end);
|
|
13743
14725
|
} else {
|
|
13744
|
-
|
|
13745
|
-
|
|
14726
|
+
parent.children.push({
|
|
14727
|
+
type: 2,
|
|
14728
|
+
content,
|
|
14729
|
+
loc: getLoc(start, end)
|
|
14730
|
+
});
|
|
13746
14731
|
}
|
|
13747
|
-
return {
|
|
13748
|
-
type: 3,
|
|
13749
|
-
content,
|
|
13750
|
-
loc: getSelection(context, start)
|
|
13751
|
-
};
|
|
13752
14732
|
}
|
|
13753
|
-
function
|
|
13754
|
-
|
|
13755
|
-
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
|
|
13759
|
-
|
|
13760
|
-
|
|
13761
|
-
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
const
|
|
13771
|
-
|
|
13772
|
-
|
|
14733
|
+
function onCloseTag(el, end, isImplied = false) {
|
|
14734
|
+
if (isImplied) {
|
|
14735
|
+
setLocEnd(el.loc, backTrack(end, 60));
|
|
14736
|
+
} else {
|
|
14737
|
+
setLocEnd(el.loc, end + fastForward(end) + 1);
|
|
14738
|
+
}
|
|
14739
|
+
if (tokenizer.inSFCRoot) {
|
|
14740
|
+
if (el.children.length) {
|
|
14741
|
+
el.innerLoc.end = extend({}, el.children[el.children.length - 1].loc.end);
|
|
14742
|
+
} else {
|
|
14743
|
+
el.innerLoc.end = extend({}, el.innerLoc.start);
|
|
14744
|
+
}
|
|
14745
|
+
el.innerLoc.source = getSlice(
|
|
14746
|
+
el.innerLoc.start.offset,
|
|
14747
|
+
el.innerLoc.end.offset
|
|
14748
|
+
);
|
|
14749
|
+
}
|
|
14750
|
+
const { tag, ns } = el;
|
|
14751
|
+
if (!inVPre) {
|
|
14752
|
+
if (tag === "slot") {
|
|
14753
|
+
el.tagType = 2;
|
|
14754
|
+
} else if (isFragmentTemplate(el)) {
|
|
14755
|
+
el.tagType = 3;
|
|
14756
|
+
} else if (isComponent(el)) {
|
|
14757
|
+
el.tagType = 1;
|
|
14758
|
+
}
|
|
14759
|
+
}
|
|
14760
|
+
if (!tokenizer.inRCDATA) {
|
|
14761
|
+
el.children = condenseWhitespace(el.children, el.tag);
|
|
14762
|
+
}
|
|
14763
|
+
if (ns === 0 && currentOptions.isPreTag(tag)) {
|
|
14764
|
+
inPre--;
|
|
14765
|
+
}
|
|
14766
|
+
if (currentVPreBoundary === el) {
|
|
14767
|
+
inVPre = false;
|
|
14768
|
+
currentVPreBoundary = null;
|
|
14769
|
+
}
|
|
14770
|
+
if (tokenizer.inXML && (stack[0] ? stack[0].ns : currentOptions.ns) === 0) {
|
|
14771
|
+
tokenizer.inXML = false;
|
|
14772
|
+
}
|
|
13773
14773
|
{
|
|
13774
|
-
const
|
|
14774
|
+
const props = el.props;
|
|
14775
|
+
if (!!(process.env.NODE_ENV !== "production") && isCompatEnabled(
|
|
14776
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
14777
|
+
currentOptions
|
|
14778
|
+
)) {
|
|
14779
|
+
let hasIf = false;
|
|
14780
|
+
let hasFor = false;
|
|
14781
|
+
for (let i = 0; i < props.length; i++) {
|
|
14782
|
+
const p = props[i];
|
|
14783
|
+
if (p.type === 7) {
|
|
14784
|
+
if (p.name === "if") {
|
|
14785
|
+
hasIf = true;
|
|
14786
|
+
} else if (p.name === "for") {
|
|
14787
|
+
hasFor = true;
|
|
14788
|
+
}
|
|
14789
|
+
}
|
|
14790
|
+
if (hasIf && hasFor) {
|
|
14791
|
+
warnDeprecation(
|
|
14792
|
+
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
14793
|
+
currentOptions,
|
|
14794
|
+
el.loc
|
|
14795
|
+
);
|
|
14796
|
+
break;
|
|
14797
|
+
}
|
|
14798
|
+
}
|
|
14799
|
+
}
|
|
14800
|
+
if (isCompatEnabled(
|
|
14801
|
+
"COMPILER_NATIVE_TEMPLATE",
|
|
14802
|
+
currentOptions
|
|
14803
|
+
) && el.tag === "template" && !isFragmentTemplate(el)) {
|
|
14804
|
+
!!(process.env.NODE_ENV !== "production") && warnDeprecation(
|
|
14805
|
+
"COMPILER_NATIVE_TEMPLATE",
|
|
14806
|
+
currentOptions,
|
|
14807
|
+
el.loc
|
|
14808
|
+
);
|
|
14809
|
+
const parent = stack[0] || currentRoot;
|
|
14810
|
+
const index = parent.children.indexOf(el);
|
|
14811
|
+
parent.children.splice(index, 1, ...el.children);
|
|
14812
|
+
}
|
|
14813
|
+
const inlineTemplateProp = props.find(
|
|
13775
14814
|
(p) => p.type === 6 && p.name === "inline-template"
|
|
13776
14815
|
);
|
|
13777
14816
|
if (inlineTemplateProp && checkCompatEnabled(
|
|
13778
14817
|
"COMPILER_INLINE_TEMPLATE",
|
|
13779
|
-
|
|
14818
|
+
currentOptions,
|
|
13780
14819
|
inlineTemplateProp.loc
|
|
13781
|
-
)) {
|
|
13782
|
-
const loc = getSelection(context, element.loc.end);
|
|
14820
|
+
) && el.children.length) {
|
|
13783
14821
|
inlineTemplateProp.value = {
|
|
13784
14822
|
type: 2,
|
|
13785
|
-
content:
|
|
13786
|
-
|
|
13787
|
-
|
|
13788
|
-
|
|
13789
|
-
|
|
13790
|
-
|
|
13791
|
-
if (startsWithEndTagOpen(context.source, element.tag)) {
|
|
13792
|
-
parseTag(context, 1 /* End */, parent);
|
|
13793
|
-
} else {
|
|
13794
|
-
emitError(context, 24, 0, element.loc.start);
|
|
13795
|
-
if (context.source.length === 0 && element.tag.toLowerCase() === "script") {
|
|
13796
|
-
const first = children[0];
|
|
13797
|
-
if (first && startsWith(first.loc.source, "<!--")) {
|
|
13798
|
-
emitError(context, 8);
|
|
13799
|
-
}
|
|
14823
|
+
content: getSlice(
|
|
14824
|
+
el.children[0].loc.start.offset,
|
|
14825
|
+
el.children[el.children.length - 1].loc.end.offset
|
|
14826
|
+
),
|
|
14827
|
+
loc: inlineTemplateProp.loc
|
|
14828
|
+
};
|
|
13800
14829
|
}
|
|
13801
14830
|
}
|
|
13802
|
-
element.loc = getSelection(context, element.loc.start);
|
|
13803
|
-
if (isPreBoundary) {
|
|
13804
|
-
context.inPre = false;
|
|
13805
|
-
}
|
|
13806
|
-
if (isVPreBoundary) {
|
|
13807
|
-
context.inVPre = false;
|
|
13808
|
-
}
|
|
13809
|
-
return element;
|
|
13810
14831
|
}
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
)
|
|
13814
|
-
|
|
13815
|
-
const start = getCursor(context);
|
|
13816
|
-
const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source);
|
|
13817
|
-
const tag = match[1];
|
|
13818
|
-
const ns = context.options.getNamespace(tag, parent);
|
|
13819
|
-
advanceBy(context, match[0].length);
|
|
13820
|
-
advanceSpaces(context);
|
|
13821
|
-
const cursor = getCursor(context);
|
|
13822
|
-
const currentSource = context.source;
|
|
13823
|
-
if (context.options.isPreTag(tag)) {
|
|
13824
|
-
context.inPre = true;
|
|
13825
|
-
}
|
|
13826
|
-
let props = parseAttributes(context, type);
|
|
13827
|
-
if (type === 0 /* Start */ && !context.inVPre && props.some((p) => p.type === 7 && p.name === "pre")) {
|
|
13828
|
-
context.inVPre = true;
|
|
13829
|
-
extend(context, cursor);
|
|
13830
|
-
context.source = currentSource;
|
|
13831
|
-
props = parseAttributes(context, type).filter((p) => p.name !== "v-pre");
|
|
13832
|
-
}
|
|
13833
|
-
let isSelfClosing = false;
|
|
13834
|
-
if (context.source.length === 0) {
|
|
13835
|
-
emitError(context, 9);
|
|
13836
|
-
} else {
|
|
13837
|
-
isSelfClosing = startsWith(context.source, "/>");
|
|
13838
|
-
if (type === 1 /* End */ && isSelfClosing) {
|
|
13839
|
-
emitError(context, 4);
|
|
13840
|
-
}
|
|
13841
|
-
advanceBy(context, isSelfClosing ? 2 : 1);
|
|
13842
|
-
}
|
|
13843
|
-
if (type === 1 /* End */) {
|
|
13844
|
-
return;
|
|
14832
|
+
function fastForward(start, c) {
|
|
14833
|
+
let offset = 0;
|
|
14834
|
+
while (currentInput.charCodeAt(start + offset) !== 62 && start + offset < currentInput.length) {
|
|
14835
|
+
offset++;
|
|
13845
14836
|
}
|
|
13846
|
-
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
14837
|
+
return offset;
|
|
14838
|
+
}
|
|
14839
|
+
function backTrack(index, c) {
|
|
14840
|
+
let i = index;
|
|
14841
|
+
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
14842
|
+
i--;
|
|
14843
|
+
return i;
|
|
14844
|
+
}
|
|
14845
|
+
const specialTemplateDir = /* @__PURE__ */ new Set(["if", "else", "else-if", "for", "slot"]);
|
|
14846
|
+
function isFragmentTemplate({ tag, props }) {
|
|
14847
|
+
if (tag === "template") {
|
|
13852
14848
|
for (let i = 0; i < props.length; i++) {
|
|
13853
|
-
|
|
13854
|
-
|
|
13855
|
-
if (p.name === "if") {
|
|
13856
|
-
hasIf = true;
|
|
13857
|
-
} else if (p.name === "for") {
|
|
13858
|
-
hasFor = true;
|
|
13859
|
-
}
|
|
13860
|
-
}
|
|
13861
|
-
if (hasIf && hasFor) {
|
|
13862
|
-
warnDeprecation(
|
|
13863
|
-
"COMPILER_V_IF_V_FOR_PRECEDENCE",
|
|
13864
|
-
context,
|
|
13865
|
-
getSelection(context, start)
|
|
13866
|
-
);
|
|
13867
|
-
break;
|
|
13868
|
-
}
|
|
13869
|
-
}
|
|
13870
|
-
}
|
|
13871
|
-
let tagType = 0;
|
|
13872
|
-
if (!context.inVPre) {
|
|
13873
|
-
if (tag === "slot") {
|
|
13874
|
-
tagType = 2;
|
|
13875
|
-
} else if (tag === "template") {
|
|
13876
|
-
if (props.some(
|
|
13877
|
-
(p) => p.type === 7 && isSpecialTemplateDirective(p.name)
|
|
13878
|
-
)) {
|
|
13879
|
-
tagType = 3;
|
|
14849
|
+
if (props[i].type === 7 && specialTemplateDir.has(props[i].name)) {
|
|
14850
|
+
return true;
|
|
13880
14851
|
}
|
|
13881
|
-
} else if (isComponent(tag, props, context)) {
|
|
13882
|
-
tagType = 1;
|
|
13883
14852
|
}
|
|
13884
14853
|
}
|
|
13885
|
-
return
|
|
13886
|
-
type: 1,
|
|
13887
|
-
ns,
|
|
13888
|
-
tag,
|
|
13889
|
-
tagType,
|
|
13890
|
-
props,
|
|
13891
|
-
isSelfClosing,
|
|
13892
|
-
children: [],
|
|
13893
|
-
loc: getSelection(context, start),
|
|
13894
|
-
codegenNode: void 0
|
|
13895
|
-
// to be created during transform phase
|
|
13896
|
-
};
|
|
14854
|
+
return false;
|
|
13897
14855
|
}
|
|
13898
|
-
function isComponent(tag, props
|
|
13899
|
-
|
|
13900
|
-
if (
|
|
14856
|
+
function isComponent({ tag, props }) {
|
|
14857
|
+
var _a;
|
|
14858
|
+
if (currentOptions.isCustomElement(tag)) {
|
|
13901
14859
|
return false;
|
|
13902
14860
|
}
|
|
13903
|
-
if (tag === "component" ||
|
|
14861
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
13904
14862
|
return true;
|
|
13905
14863
|
}
|
|
13906
14864
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -13911,374 +14869,179 @@ function isComponent(tag, props, context) {
|
|
|
13911
14869
|
return true;
|
|
13912
14870
|
} else if (checkCompatEnabled(
|
|
13913
14871
|
"COMPILER_IS_ON_ELEMENT",
|
|
13914
|
-
|
|
14872
|
+
currentOptions,
|
|
13915
14873
|
p.loc
|
|
13916
14874
|
)) {
|
|
13917
14875
|
return true;
|
|
13918
14876
|
}
|
|
13919
14877
|
}
|
|
13920
|
-
} else
|
|
13921
|
-
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
|
|
13925
|
-
|
|
13926
|
-
|
|
13927
|
-
context,
|
|
13928
|
-
p.loc
|
|
13929
|
-
)
|
|
13930
|
-
) {
|
|
13931
|
-
return true;
|
|
13932
|
-
}
|
|
14878
|
+
} else if (// :is on plain element - only treat as component in compat mode
|
|
14879
|
+
p.name === "bind" && isStaticArgOf(p.arg, "is") && checkCompatEnabled(
|
|
14880
|
+
"COMPILER_IS_ON_ELEMENT",
|
|
14881
|
+
currentOptions,
|
|
14882
|
+
p.loc
|
|
14883
|
+
)) {
|
|
14884
|
+
return true;
|
|
13933
14885
|
}
|
|
13934
14886
|
}
|
|
14887
|
+
return false;
|
|
13935
14888
|
}
|
|
13936
|
-
function
|
|
13937
|
-
|
|
13938
|
-
const attributeNames = /* @__PURE__ */ new Set();
|
|
13939
|
-
while (context.source.length > 0 && !startsWith(context.source, ">") && !startsWith(context.source, "/>")) {
|
|
13940
|
-
if (startsWith(context.source, "/")) {
|
|
13941
|
-
emitError(context, 22);
|
|
13942
|
-
advanceBy(context, 1);
|
|
13943
|
-
advanceSpaces(context);
|
|
13944
|
-
continue;
|
|
13945
|
-
}
|
|
13946
|
-
if (type === 1 /* End */) {
|
|
13947
|
-
emitError(context, 3);
|
|
13948
|
-
}
|
|
13949
|
-
const attr = parseAttribute(context, attributeNames);
|
|
13950
|
-
if (attr.type === 6 && attr.value && attr.name === "class") {
|
|
13951
|
-
attr.value.content = attr.value.content.replace(/\s+/g, " ").trim();
|
|
13952
|
-
}
|
|
13953
|
-
if (type === 0 /* Start */) {
|
|
13954
|
-
props.push(attr);
|
|
13955
|
-
}
|
|
13956
|
-
if (/^[^\t\r\n\f />]/.test(context.source)) {
|
|
13957
|
-
emitError(context, 15);
|
|
13958
|
-
}
|
|
13959
|
-
advanceSpaces(context);
|
|
13960
|
-
}
|
|
13961
|
-
return props;
|
|
14889
|
+
function isUpperCase(c) {
|
|
14890
|
+
return c > 64 && c < 91;
|
|
13962
14891
|
}
|
|
13963
|
-
|
|
13964
|
-
|
|
13965
|
-
|
|
13966
|
-
const
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
13981
|
-
|
|
13982
|
-
|
|
13983
|
-
);
|
|
13984
|
-
}
|
|
13985
|
-
}
|
|
13986
|
-
advanceBy(context, name.length);
|
|
13987
|
-
let value = void 0;
|
|
13988
|
-
if (/^[\t\r\n\f ]*=/.test(context.source)) {
|
|
13989
|
-
advanceSpaces(context);
|
|
13990
|
-
advanceBy(context, 1);
|
|
13991
|
-
advanceSpaces(context);
|
|
13992
|
-
value = parseAttributeValue(context);
|
|
13993
|
-
if (!value) {
|
|
13994
|
-
emitError(context, 13);
|
|
13995
|
-
}
|
|
13996
|
-
}
|
|
13997
|
-
const loc = getSelection(context, start);
|
|
13998
|
-
if (!context.inVPre && /^(v-[A-Za-z0-9-]|:|\.|@|#)/.test(name)) {
|
|
13999
|
-
const match2 = /(?:^v-([a-z0-9-]+))?(?:(?::|^\.|^@|^#)(\[[^\]]+\]|[^\.]+))?(.+)?$/i.exec(
|
|
14000
|
-
name
|
|
14001
|
-
);
|
|
14002
|
-
let isPropShorthand = startsWith(name, ".");
|
|
14003
|
-
let dirName = match2[1] || (isPropShorthand || startsWith(name, ":") ? "bind" : startsWith(name, "@") ? "on" : "slot");
|
|
14004
|
-
let arg;
|
|
14005
|
-
if (match2[2]) {
|
|
14006
|
-
const isSlot = dirName === "slot";
|
|
14007
|
-
const startOffset = name.lastIndexOf(
|
|
14008
|
-
match2[2],
|
|
14009
|
-
name.length - (((_a = match2[3]) == null ? void 0 : _a.length) || 0)
|
|
14010
|
-
);
|
|
14011
|
-
const loc2 = getSelection(
|
|
14012
|
-
context,
|
|
14013
|
-
getNewPosition(context, start, startOffset),
|
|
14014
|
-
getNewPosition(
|
|
14015
|
-
context,
|
|
14016
|
-
start,
|
|
14017
|
-
startOffset + match2[2].length + (isSlot && match2[3] || "").length
|
|
14018
|
-
)
|
|
14019
|
-
);
|
|
14020
|
-
let content = match2[2];
|
|
14021
|
-
let isStatic = true;
|
|
14022
|
-
if (content.startsWith("[")) {
|
|
14023
|
-
isStatic = false;
|
|
14024
|
-
if (!content.endsWith("]")) {
|
|
14025
|
-
emitError(
|
|
14026
|
-
context,
|
|
14027
|
-
27
|
|
14028
|
-
);
|
|
14029
|
-
content = content.slice(1);
|
|
14030
|
-
} else {
|
|
14031
|
-
content = content.slice(1, content.length - 1);
|
|
14892
|
+
const windowsNewlineRE = /\r\n/g;
|
|
14893
|
+
function condenseWhitespace(nodes, tag) {
|
|
14894
|
+
var _a, _b;
|
|
14895
|
+
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
14896
|
+
let removedWhitespace = false;
|
|
14897
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
14898
|
+
const node = nodes[i];
|
|
14899
|
+
if (node.type === 2) {
|
|
14900
|
+
if (!inPre) {
|
|
14901
|
+
if (isAllWhitespace(node.content)) {
|
|
14902
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
14903
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
14904
|
+
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
14905
|
+
removedWhitespace = true;
|
|
14906
|
+
nodes[i] = null;
|
|
14907
|
+
} else {
|
|
14908
|
+
node.content = " ";
|
|
14909
|
+
}
|
|
14910
|
+
} else if (shouldCondense) {
|
|
14911
|
+
node.content = condense(node.content);
|
|
14032
14912
|
}
|
|
14033
|
-
} else
|
|
14034
|
-
content
|
|
14035
|
-
}
|
|
14036
|
-
arg = {
|
|
14037
|
-
type: 4,
|
|
14038
|
-
content,
|
|
14039
|
-
isStatic,
|
|
14040
|
-
constType: isStatic ? 3 : 0,
|
|
14041
|
-
loc: loc2
|
|
14042
|
-
};
|
|
14043
|
-
}
|
|
14044
|
-
if (value && value.isQuoted) {
|
|
14045
|
-
const valueLoc = value.loc;
|
|
14046
|
-
valueLoc.start.offset++;
|
|
14047
|
-
valueLoc.start.column++;
|
|
14048
|
-
valueLoc.end = advancePositionWithClone(valueLoc.start, value.content);
|
|
14049
|
-
valueLoc.source = valueLoc.source.slice(1, -1);
|
|
14050
|
-
}
|
|
14051
|
-
const modifiers = match2[3] ? match2[3].slice(1).split(".") : [];
|
|
14052
|
-
if (isPropShorthand)
|
|
14053
|
-
modifiers.push("prop");
|
|
14054
|
-
if (dirName === "bind" && arg) {
|
|
14055
|
-
if (modifiers.includes("sync") && checkCompatEnabled(
|
|
14056
|
-
"COMPILER_V_BIND_SYNC",
|
|
14057
|
-
context,
|
|
14058
|
-
loc,
|
|
14059
|
-
arg.loc.source
|
|
14060
|
-
)) {
|
|
14061
|
-
dirName = "model";
|
|
14062
|
-
modifiers.splice(modifiers.indexOf("sync"), 1);
|
|
14063
|
-
}
|
|
14064
|
-
if (!!(process.env.NODE_ENV !== "production") && modifiers.includes("prop")) {
|
|
14065
|
-
checkCompatEnabled(
|
|
14066
|
-
"COMPILER_V_BIND_PROP",
|
|
14067
|
-
context,
|
|
14068
|
-
loc
|
|
14069
|
-
);
|
|
14913
|
+
} else {
|
|
14914
|
+
node.content = node.content.replace(windowsNewlineRE, "\n");
|
|
14070
14915
|
}
|
|
14071
14916
|
}
|
|
14072
|
-
return {
|
|
14073
|
-
type: 7,
|
|
14074
|
-
name: dirName,
|
|
14075
|
-
exp: value && {
|
|
14076
|
-
type: 4,
|
|
14077
|
-
content: value.content,
|
|
14078
|
-
isStatic: false,
|
|
14079
|
-
// Treat as non-constant by default. This can be potentially set to
|
|
14080
|
-
// other values by `transformExpression` to make it eligible for hoisting.
|
|
14081
|
-
constType: 0,
|
|
14082
|
-
loc: value.loc
|
|
14083
|
-
},
|
|
14084
|
-
arg,
|
|
14085
|
-
modifiers,
|
|
14086
|
-
loc
|
|
14087
|
-
};
|
|
14088
14917
|
}
|
|
14089
|
-
if (
|
|
14090
|
-
|
|
14918
|
+
if (inPre && tag && currentOptions.isPreTag(tag)) {
|
|
14919
|
+
const first = nodes[0];
|
|
14920
|
+
if (first && first.type === 2) {
|
|
14921
|
+
first.content = first.content.replace(/^\r?\n/, "");
|
|
14922
|
+
}
|
|
14091
14923
|
}
|
|
14092
|
-
return
|
|
14093
|
-
type: 6,
|
|
14094
|
-
name,
|
|
14095
|
-
value: value && {
|
|
14096
|
-
type: 2,
|
|
14097
|
-
content: value.content,
|
|
14098
|
-
loc: value.loc
|
|
14099
|
-
},
|
|
14100
|
-
loc
|
|
14101
|
-
};
|
|
14924
|
+
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
14102
14925
|
}
|
|
14103
|
-
function
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
const isQuoted = quote === `"` || quote === `'`;
|
|
14108
|
-
if (isQuoted) {
|
|
14109
|
-
advanceBy(context, 1);
|
|
14110
|
-
const endIndex = context.source.indexOf(quote);
|
|
14111
|
-
if (endIndex === -1) {
|
|
14112
|
-
content = parseTextData(
|
|
14113
|
-
context,
|
|
14114
|
-
context.source.length,
|
|
14115
|
-
4
|
|
14116
|
-
);
|
|
14117
|
-
} else {
|
|
14118
|
-
content = parseTextData(context, endIndex, 4);
|
|
14119
|
-
advanceBy(context, 1);
|
|
14120
|
-
}
|
|
14121
|
-
} else {
|
|
14122
|
-
const match = /^[^\t\r\n\f >]+/.exec(context.source);
|
|
14123
|
-
if (!match) {
|
|
14124
|
-
return void 0;
|
|
14125
|
-
}
|
|
14126
|
-
const unexpectedChars = /["'<=`]/g;
|
|
14127
|
-
let m;
|
|
14128
|
-
while (m = unexpectedChars.exec(match[0])) {
|
|
14129
|
-
emitError(
|
|
14130
|
-
context,
|
|
14131
|
-
18,
|
|
14132
|
-
m.index
|
|
14133
|
-
);
|
|
14926
|
+
function isAllWhitespace(str) {
|
|
14927
|
+
for (let i = 0; i < str.length; i++) {
|
|
14928
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
14929
|
+
return false;
|
|
14134
14930
|
}
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
return { content, isQuoted, loc: getSelection(context, start) };
|
|
14138
|
-
}
|
|
14139
|
-
function parseInterpolation(context, mode) {
|
|
14140
|
-
const [open, close] = context.options.delimiters;
|
|
14141
|
-
const closeIndex = context.source.indexOf(close, open.length);
|
|
14142
|
-
if (closeIndex === -1) {
|
|
14143
|
-
emitError(context, 25);
|
|
14144
|
-
return void 0;
|
|
14145
|
-
}
|
|
14146
|
-
const start = getCursor(context);
|
|
14147
|
-
advanceBy(context, open.length);
|
|
14148
|
-
const innerStart = getCursor(context);
|
|
14149
|
-
const innerEnd = getCursor(context);
|
|
14150
|
-
const rawContentLength = closeIndex - open.length;
|
|
14151
|
-
const rawContent = context.source.slice(0, rawContentLength);
|
|
14152
|
-
const preTrimContent = parseTextData(context, rawContentLength, mode);
|
|
14153
|
-
const content = preTrimContent.trim();
|
|
14154
|
-
const startOffset = preTrimContent.indexOf(content);
|
|
14155
|
-
if (startOffset > 0) {
|
|
14156
|
-
advancePositionWithMutation(innerStart, rawContent, startOffset);
|
|
14157
|
-
}
|
|
14158
|
-
const endOffset = rawContentLength - (preTrimContent.length - content.length - startOffset);
|
|
14159
|
-
advancePositionWithMutation(innerEnd, rawContent, endOffset);
|
|
14160
|
-
advanceBy(context, close.length);
|
|
14161
|
-
return {
|
|
14162
|
-
type: 5,
|
|
14163
|
-
content: {
|
|
14164
|
-
type: 4,
|
|
14165
|
-
isStatic: false,
|
|
14166
|
-
// Set `isConstant` to false by default and will decide in transformExpression
|
|
14167
|
-
constType: 0,
|
|
14168
|
-
content,
|
|
14169
|
-
loc: getSelection(context, innerStart, innerEnd)
|
|
14170
|
-
},
|
|
14171
|
-
loc: getSelection(context, start)
|
|
14172
|
-
};
|
|
14931
|
+
}
|
|
14932
|
+
return true;
|
|
14173
14933
|
}
|
|
14174
|
-
function
|
|
14175
|
-
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
if (index !== -1 && endIndex > index) {
|
|
14180
|
-
endIndex = index;
|
|
14934
|
+
function hasNewlineChar(str) {
|
|
14935
|
+
for (let i = 0; i < str.length; i++) {
|
|
14936
|
+
const c = str.charCodeAt(i);
|
|
14937
|
+
if (c === 10 || c === 13) {
|
|
14938
|
+
return true;
|
|
14181
14939
|
}
|
|
14182
14940
|
}
|
|
14183
|
-
|
|
14184
|
-
const content = parseTextData(context, endIndex, mode);
|
|
14185
|
-
return {
|
|
14186
|
-
type: 2,
|
|
14187
|
-
content,
|
|
14188
|
-
loc: getSelection(context, start)
|
|
14189
|
-
};
|
|
14941
|
+
return false;
|
|
14190
14942
|
}
|
|
14191
|
-
function
|
|
14192
|
-
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14943
|
+
function condense(str) {
|
|
14944
|
+
let ret = "";
|
|
14945
|
+
let prevCharIsWhitespace = false;
|
|
14946
|
+
for (let i = 0; i < str.length; i++) {
|
|
14947
|
+
if (isWhitespace(str.charCodeAt(i))) {
|
|
14948
|
+
if (!prevCharIsWhitespace) {
|
|
14949
|
+
ret += " ";
|
|
14950
|
+
prevCharIsWhitespace = true;
|
|
14951
|
+
}
|
|
14952
|
+
} else {
|
|
14953
|
+
ret += str[i];
|
|
14954
|
+
prevCharIsWhitespace = false;
|
|
14955
|
+
}
|
|
14201
14956
|
}
|
|
14957
|
+
return ret;
|
|
14202
14958
|
}
|
|
14203
|
-
function
|
|
14204
|
-
|
|
14205
|
-
return { column, line, offset };
|
|
14959
|
+
function addNode(node) {
|
|
14960
|
+
(stack[0] || currentRoot).children.push(node);
|
|
14206
14961
|
}
|
|
14207
|
-
function
|
|
14208
|
-
end = end || getCursor(context);
|
|
14962
|
+
function getLoc(start, end) {
|
|
14209
14963
|
return {
|
|
14210
|
-
start,
|
|
14211
|
-
|
|
14212
|
-
|
|
14964
|
+
start: tokenizer.getPos(start),
|
|
14965
|
+
// @ts-expect-error allow late attachment
|
|
14966
|
+
end: end == null ? end : tokenizer.getPos(end),
|
|
14967
|
+
// @ts-expect-error allow late attachment
|
|
14968
|
+
source: end == null ? end : getSlice(start, end)
|
|
14213
14969
|
};
|
|
14214
14970
|
}
|
|
14215
|
-
function
|
|
14216
|
-
|
|
14971
|
+
function setLocEnd(loc, end) {
|
|
14972
|
+
loc.end = tokenizer.getPos(end);
|
|
14973
|
+
loc.source = getSlice(loc.start.offset, end);
|
|
14217
14974
|
}
|
|
14218
|
-
function
|
|
14219
|
-
|
|
14220
|
-
|
|
14221
|
-
|
|
14222
|
-
|
|
14223
|
-
|
|
14224
|
-
|
|
14225
|
-
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
14229
|
-
|
|
14975
|
+
function dirToAttr(dir) {
|
|
14976
|
+
const attr = {
|
|
14977
|
+
type: 6,
|
|
14978
|
+
name: dir.rawName,
|
|
14979
|
+
nameLoc: getLoc(
|
|
14980
|
+
dir.loc.start.offset,
|
|
14981
|
+
dir.loc.start.offset + dir.rawName.length
|
|
14982
|
+
),
|
|
14983
|
+
value: void 0,
|
|
14984
|
+
loc: dir.loc
|
|
14985
|
+
};
|
|
14986
|
+
if (dir.exp) {
|
|
14987
|
+
const loc = dir.exp.loc;
|
|
14988
|
+
if (loc.end.offset < dir.loc.end.offset) {
|
|
14989
|
+
loc.start.offset--;
|
|
14990
|
+
loc.start.column--;
|
|
14991
|
+
loc.end.offset++;
|
|
14992
|
+
loc.end.column++;
|
|
14993
|
+
}
|
|
14994
|
+
attr.value = {
|
|
14995
|
+
type: 2,
|
|
14996
|
+
content: dir.exp.content,
|
|
14997
|
+
loc
|
|
14998
|
+
};
|
|
14230
14999
|
}
|
|
15000
|
+
return attr;
|
|
14231
15001
|
}
|
|
14232
|
-
function
|
|
14233
|
-
|
|
14234
|
-
start,
|
|
14235
|
-
context.originalSource.slice(start.offset, numberOfCharacters),
|
|
14236
|
-
numberOfCharacters
|
|
14237
|
-
);
|
|
15002
|
+
function emitError(code, index) {
|
|
15003
|
+
currentOptions.onError(createCompilerError(code, getLoc(index, index)));
|
|
14238
15004
|
}
|
|
14239
|
-
function
|
|
14240
|
-
|
|
14241
|
-
|
|
14242
|
-
|
|
14243
|
-
|
|
14244
|
-
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
end: loc,
|
|
14248
|
-
source: ""
|
|
14249
|
-
})
|
|
14250
|
-
);
|
|
15005
|
+
function reset() {
|
|
15006
|
+
tokenizer.reset();
|
|
15007
|
+
currentOpenTag = null;
|
|
15008
|
+
currentProp = null;
|
|
15009
|
+
currentAttrValue = "";
|
|
15010
|
+
currentAttrStartIndex = -1;
|
|
15011
|
+
currentAttrEndIndex = -1;
|
|
15012
|
+
stack.length = 0;
|
|
14251
15013
|
}
|
|
14252
|
-
function
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
}
|
|
14262
|
-
}
|
|
14263
|
-
break;
|
|
14264
|
-
case 1:
|
|
14265
|
-
case 2: {
|
|
14266
|
-
const parent = last(ancestors);
|
|
14267
|
-
if (parent && startsWithEndTagOpen(s, parent.tag)) {
|
|
14268
|
-
return true;
|
|
15014
|
+
function baseParse(input, options) {
|
|
15015
|
+
reset();
|
|
15016
|
+
currentInput = input;
|
|
15017
|
+
currentOptions = extend({}, defaultParserOptions);
|
|
15018
|
+
if (options) {
|
|
15019
|
+
let key;
|
|
15020
|
+
for (key in options) {
|
|
15021
|
+
if (options[key] != null) {
|
|
15022
|
+
currentOptions[key] = options[key];
|
|
14269
15023
|
}
|
|
14270
|
-
break;
|
|
14271
15024
|
}
|
|
14272
|
-
case 3:
|
|
14273
|
-
if (startsWith(s, "]]>")) {
|
|
14274
|
-
return true;
|
|
14275
|
-
}
|
|
14276
|
-
break;
|
|
14277
15025
|
}
|
|
14278
|
-
|
|
14279
|
-
|
|
14280
|
-
|
|
14281
|
-
|
|
15026
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
15027
|
+
if (!currentOptions.decodeEntities) {
|
|
15028
|
+
throw new Error(
|
|
15029
|
+
`[@vue/compiler-core] decodeEntities option is required in browser builds.`
|
|
15030
|
+
);
|
|
15031
|
+
}
|
|
15032
|
+
}
|
|
15033
|
+
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
15034
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
15035
|
+
if (delimiters) {
|
|
15036
|
+
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
15037
|
+
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
15038
|
+
}
|
|
15039
|
+
const root = currentRoot = createRoot([], input);
|
|
15040
|
+
tokenizer.parse(currentInput);
|
|
15041
|
+
root.loc = getLoc(0, input.length);
|
|
15042
|
+
root.children = condenseWhitespace(root.children);
|
|
15043
|
+
currentRoot = null;
|
|
15044
|
+
return root;
|
|
14282
15045
|
}
|
|
14283
15046
|
|
|
14284
15047
|
function hoistStatic(root, context) {
|
|
@@ -14691,6 +15454,7 @@ function transform(root, options) {
|
|
|
14691
15454
|
root.hoists = context.hoists;
|
|
14692
15455
|
root.temps = context.temps;
|
|
14693
15456
|
root.cached = context.cached;
|
|
15457
|
+
root.transformed = true;
|
|
14694
15458
|
{
|
|
14695
15459
|
root.filters = [...context.filters];
|
|
14696
15460
|
}
|
|
@@ -14847,7 +15611,7 @@ function createCodegenContext(ast, {
|
|
|
14847
15611
|
ssr,
|
|
14848
15612
|
isTS,
|
|
14849
15613
|
inSSR,
|
|
14850
|
-
source: ast.
|
|
15614
|
+
source: ast.source,
|
|
14851
15615
|
code: ``,
|
|
14852
15616
|
column: 1,
|
|
14853
15617
|
line: 1,
|
|
@@ -14858,7 +15622,7 @@ function createCodegenContext(ast, {
|
|
|
14858
15622
|
helper(key) {
|
|
14859
15623
|
return `_${helperNameMap[key]}`;
|
|
14860
15624
|
},
|
|
14861
|
-
push(code, node) {
|
|
15625
|
+
push(code, newlineIndex = -2 /* None */, node) {
|
|
14862
15626
|
context.code += code;
|
|
14863
15627
|
},
|
|
14864
15628
|
indent() {
|
|
@@ -14876,7 +15640,7 @@ function createCodegenContext(ast, {
|
|
|
14876
15640
|
}
|
|
14877
15641
|
};
|
|
14878
15642
|
function newline(n) {
|
|
14879
|
-
context.push("\n" + ` `.repeat(n));
|
|
15643
|
+
context.push("\n" + ` `.repeat(n), 0 /* Start */);
|
|
14880
15644
|
}
|
|
14881
15645
|
return context;
|
|
14882
15646
|
}
|
|
@@ -14913,9 +15677,11 @@ function generate(ast, options = {}) {
|
|
|
14913
15677
|
push(`with (_ctx) {`);
|
|
14914
15678
|
indent();
|
|
14915
15679
|
if (hasHelpers) {
|
|
14916
|
-
push(
|
|
14917
|
-
|
|
14918
|
-
|
|
15680
|
+
push(
|
|
15681
|
+
`const { ${helpers.map(aliasHelper).join(", ")} } = _Vue
|
|
15682
|
+
`,
|
|
15683
|
+
-1 /* End */
|
|
15684
|
+
);
|
|
14919
15685
|
newline();
|
|
14920
15686
|
}
|
|
14921
15687
|
}
|
|
@@ -14944,7 +15710,7 @@ function generate(ast, options = {}) {
|
|
|
14944
15710
|
}
|
|
14945
15711
|
if (ast.components.length || ast.directives.length || ast.temps) {
|
|
14946
15712
|
push(`
|
|
14947
|
-
|
|
15713
|
+
`, 0 /* Start */);
|
|
14948
15714
|
newline();
|
|
14949
15715
|
}
|
|
14950
15716
|
if (!ssr) {
|
|
@@ -14965,7 +15731,6 @@ function generate(ast, options = {}) {
|
|
|
14965
15731
|
ast,
|
|
14966
15732
|
code: context.code,
|
|
14967
15733
|
preamble: isSetupInlined ? preambleContext.code : ``,
|
|
14968
|
-
// SourceMapGenerator does have toJSON() method but it's not in the types
|
|
14969
15734
|
map: context.map ? context.map.toJSON() : void 0
|
|
14970
15735
|
};
|
|
14971
15736
|
}
|
|
@@ -14984,7 +15749,7 @@ function genFunctionPreamble(ast, context) {
|
|
|
14984
15749
|
if (helpers.length > 0) {
|
|
14985
15750
|
{
|
|
14986
15751
|
push(`const _Vue = ${VueBinding}
|
|
14987
|
-
|
|
15752
|
+
`, -1 /* End */);
|
|
14988
15753
|
if (ast.hoists.length) {
|
|
14989
15754
|
const staticHelpers = [
|
|
14990
15755
|
CREATE_VNODE,
|
|
@@ -14994,7 +15759,7 @@ function genFunctionPreamble(ast, context) {
|
|
|
14994
15759
|
CREATE_STATIC
|
|
14995
15760
|
].filter((helper) => helpers.includes(helper)).map(aliasHelper).join(", ");
|
|
14996
15761
|
push(`const { ${staticHelpers} } = _Vue
|
|
14997
|
-
|
|
15762
|
+
`, -1 /* End */);
|
|
14998
15763
|
}
|
|
14999
15764
|
}
|
|
15000
15765
|
}
|
|
@@ -15055,7 +15820,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
15055
15820
|
for (let i = 0; i < nodes.length; i++) {
|
|
15056
15821
|
const node = nodes[i];
|
|
15057
15822
|
if (isString(node)) {
|
|
15058
|
-
push(node);
|
|
15823
|
+
push(node, -3 /* Unknown */);
|
|
15059
15824
|
} else if (isArray(node)) {
|
|
15060
15825
|
genNodeListAsArray(node, context);
|
|
15061
15826
|
} else {
|
|
@@ -15073,7 +15838,7 @@ function genNodeList(nodes, context, multilines = false, comma = true) {
|
|
|
15073
15838
|
}
|
|
15074
15839
|
function genNode(node, context) {
|
|
15075
15840
|
if (isString(node)) {
|
|
15076
|
-
context.push(node);
|
|
15841
|
+
context.push(node, -3 /* Unknown */);
|
|
15077
15842
|
return;
|
|
15078
15843
|
}
|
|
15079
15844
|
if (isSymbol(node)) {
|
|
@@ -15153,11 +15918,15 @@ function genNode(node, context) {
|
|
|
15153
15918
|
}
|
|
15154
15919
|
}
|
|
15155
15920
|
function genText(node, context) {
|
|
15156
|
-
context.push(JSON.stringify(node.content), node);
|
|
15921
|
+
context.push(JSON.stringify(node.content), -3 /* Unknown */, node);
|
|
15157
15922
|
}
|
|
15158
15923
|
function genExpression(node, context) {
|
|
15159
15924
|
const { content, isStatic } = node;
|
|
15160
|
-
context.push(
|
|
15925
|
+
context.push(
|
|
15926
|
+
isStatic ? JSON.stringify(content) : content,
|
|
15927
|
+
-3 /* Unknown */,
|
|
15928
|
+
node
|
|
15929
|
+
);
|
|
15161
15930
|
}
|
|
15162
15931
|
function genInterpolation(node, context) {
|
|
15163
15932
|
const { push, helper, pure } = context;
|
|
@@ -15171,7 +15940,7 @@ function genCompoundExpression(node, context) {
|
|
|
15171
15940
|
for (let i = 0; i < node.children.length; i++) {
|
|
15172
15941
|
const child = node.children[i];
|
|
15173
15942
|
if (isString(child)) {
|
|
15174
|
-
context.push(child);
|
|
15943
|
+
context.push(child, -3 /* Unknown */);
|
|
15175
15944
|
} else {
|
|
15176
15945
|
genNode(child, context);
|
|
15177
15946
|
}
|
|
@@ -15185,9 +15954,9 @@ function genExpressionAsPropertyKey(node, context) {
|
|
|
15185
15954
|
push(`]`);
|
|
15186
15955
|
} else if (node.isStatic) {
|
|
15187
15956
|
const text = isSimpleIdentifier(node.content) ? node.content : JSON.stringify(node.content);
|
|
15188
|
-
push(text, node);
|
|
15957
|
+
push(text, -2 /* None */, node);
|
|
15189
15958
|
} else {
|
|
15190
|
-
push(`[${node.content}]`, node);
|
|
15959
|
+
push(`[${node.content}]`, -3 /* Unknown */, node);
|
|
15191
15960
|
}
|
|
15192
15961
|
}
|
|
15193
15962
|
function genComment(node, context) {
|
|
@@ -15195,7 +15964,11 @@ function genComment(node, context) {
|
|
|
15195
15964
|
if (pure) {
|
|
15196
15965
|
push(PURE_ANNOTATION);
|
|
15197
15966
|
}
|
|
15198
|
-
push(
|
|
15967
|
+
push(
|
|
15968
|
+
`${helper(CREATE_COMMENT)}(${JSON.stringify(node.content)})`,
|
|
15969
|
+
-3 /* Unknown */,
|
|
15970
|
+
node
|
|
15971
|
+
);
|
|
15199
15972
|
}
|
|
15200
15973
|
function genVNodeCall(node, context) {
|
|
15201
15974
|
const { push, helper, pure } = context;
|
|
@@ -15220,7 +15993,7 @@ function genVNodeCall(node, context) {
|
|
|
15220
15993
|
push(PURE_ANNOTATION);
|
|
15221
15994
|
}
|
|
15222
15995
|
const callHelper = isBlock ? getVNodeBlockHelper(context.inSSR, isComponent) : getVNodeHelper(context.inSSR, isComponent);
|
|
15223
|
-
push(helper(callHelper) + `(`, node);
|
|
15996
|
+
push(helper(callHelper) + `(`, -2 /* None */, node);
|
|
15224
15997
|
genNodeList(
|
|
15225
15998
|
genNullableArgs([tag, props, children, patchFlag, dynamicProps]),
|
|
15226
15999
|
context
|
|
@@ -15249,7 +16022,7 @@ function genCallExpression(node, context) {
|
|
|
15249
16022
|
if (pure) {
|
|
15250
16023
|
push(PURE_ANNOTATION);
|
|
15251
16024
|
}
|
|
15252
|
-
push(callee + `(`, node);
|
|
16025
|
+
push(callee + `(`, -2 /* None */, node);
|
|
15253
16026
|
genNodeList(node.arguments, context);
|
|
15254
16027
|
push(`)`);
|
|
15255
16028
|
}
|
|
@@ -15257,7 +16030,7 @@ function genObjectExpression(node, context) {
|
|
|
15257
16030
|
const { push, indent, deindent, newline } = context;
|
|
15258
16031
|
const { properties } = node;
|
|
15259
16032
|
if (!properties.length) {
|
|
15260
|
-
push(`{}`, node);
|
|
16033
|
+
push(`{}`, -2 /* None */, node);
|
|
15261
16034
|
return;
|
|
15262
16035
|
}
|
|
15263
16036
|
const multilines = properties.length > 1 || !!(process.env.NODE_ENV !== "production") && properties.some((p) => p.value.type !== 4);
|
|
@@ -15285,7 +16058,7 @@ function genFunctionExpression(node, context) {
|
|
|
15285
16058
|
if (isSlot) {
|
|
15286
16059
|
push(`_${helperNameMap[WITH_CTX]}(`);
|
|
15287
16060
|
}
|
|
15288
|
-
push(`(`, node);
|
|
16061
|
+
push(`(`, -2 /* None */, node);
|
|
15289
16062
|
if (isArray(params)) {
|
|
15290
16063
|
genNodeList(params, context);
|
|
15291
16064
|
} else if (params) {
|
|
@@ -15519,7 +16292,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
15519
16292
|
context.removeNode();
|
|
15520
16293
|
const branch = createIfBranch(node, dir);
|
|
15521
16294
|
if (!!(process.env.NODE_ENV !== "production") && comments.length && // #3619 ignore comments if the v-if is direct child of <transition>
|
|
15522
|
-
!(context.parent && context.parent.type === 1 &&
|
|
16295
|
+
!(context.parent && context.parent.type === 1 && (context.parent.tag === "transition" || context.parent.tag === "Transition"))) {
|
|
15523
16296
|
branch.children = [...comments, ...branch.children];
|
|
15524
16297
|
}
|
|
15525
16298
|
if (!!(process.env.NODE_ENV !== "production") || false) {
|
|
@@ -15801,18 +16574,14 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
15801
16574
|
);
|
|
15802
16575
|
return;
|
|
15803
16576
|
}
|
|
15804
|
-
const parseResult =
|
|
15805
|
-
// can only be simple expression because vFor transform is applied
|
|
15806
|
-
// before expression transform.
|
|
15807
|
-
dir.exp,
|
|
15808
|
-
context
|
|
15809
|
-
);
|
|
16577
|
+
const parseResult = dir.forParseResult;
|
|
15810
16578
|
if (!parseResult) {
|
|
15811
16579
|
context.onError(
|
|
15812
16580
|
createCompilerError(32, dir.loc)
|
|
15813
16581
|
);
|
|
15814
16582
|
return;
|
|
15815
16583
|
}
|
|
16584
|
+
finalizeForParseResult(parseResult, context);
|
|
15816
16585
|
const { addIdentifiers, removeIdentifiers, scopes } = context;
|
|
15817
16586
|
const { source, value, key, index } = parseResult;
|
|
15818
16587
|
const forNode = {
|
|
@@ -15834,71 +16603,26 @@ function processFor(node, dir, context, processCodegen) {
|
|
|
15834
16603
|
onExit();
|
|
15835
16604
|
};
|
|
15836
16605
|
}
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
const stripParensRE = /^\(|\)$/g;
|
|
15840
|
-
function parseForExpression(input, context) {
|
|
15841
|
-
const loc = input.loc;
|
|
15842
|
-
const exp = input.content;
|
|
15843
|
-
const inMatch = exp.match(forAliasRE);
|
|
15844
|
-
if (!inMatch)
|
|
16606
|
+
function finalizeForParseResult(result, context) {
|
|
16607
|
+
if (result.finalized)
|
|
15845
16608
|
return;
|
|
15846
|
-
const [, LHS, RHS] = inMatch;
|
|
15847
|
-
const result = {
|
|
15848
|
-
source: createAliasExpression(
|
|
15849
|
-
loc,
|
|
15850
|
-
RHS.trim(),
|
|
15851
|
-
exp.indexOf(RHS, LHS.length)
|
|
15852
|
-
),
|
|
15853
|
-
value: void 0,
|
|
15854
|
-
key: void 0,
|
|
15855
|
-
index: void 0
|
|
15856
|
-
};
|
|
15857
16609
|
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
15858
16610
|
validateBrowserExpression(result.source, context);
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
const keyContent = iteratorMatch[1].trim();
|
|
15866
|
-
let keyOffset;
|
|
15867
|
-
if (keyContent) {
|
|
15868
|
-
keyOffset = exp.indexOf(keyContent, trimmedOffset + valueContent.length);
|
|
15869
|
-
result.key = createAliasExpression(loc, keyContent, keyOffset);
|
|
15870
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
15871
|
-
validateBrowserExpression(
|
|
15872
|
-
result.key,
|
|
15873
|
-
context,
|
|
15874
|
-
true
|
|
15875
|
-
);
|
|
15876
|
-
}
|
|
16611
|
+
if (result.key) {
|
|
16612
|
+
validateBrowserExpression(
|
|
16613
|
+
result.key,
|
|
16614
|
+
context,
|
|
16615
|
+
true
|
|
16616
|
+
);
|
|
15877
16617
|
}
|
|
15878
|
-
if (
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
exp.indexOf(
|
|
15885
|
-
indexContent,
|
|
15886
|
-
result.key ? keyOffset + keyContent.length : trimmedOffset + valueContent.length
|
|
15887
|
-
)
|
|
15888
|
-
);
|
|
15889
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
15890
|
-
validateBrowserExpression(
|
|
15891
|
-
result.index,
|
|
15892
|
-
context,
|
|
15893
|
-
true
|
|
15894
|
-
);
|
|
15895
|
-
}
|
|
15896
|
-
}
|
|
16618
|
+
if (result.index) {
|
|
16619
|
+
validateBrowserExpression(
|
|
16620
|
+
result.index,
|
|
16621
|
+
context,
|
|
16622
|
+
true
|
|
16623
|
+
);
|
|
15897
16624
|
}
|
|
15898
|
-
|
|
15899
|
-
if (valueContent) {
|
|
15900
|
-
result.value = createAliasExpression(loc, valueContent, trimmedOffset);
|
|
15901
|
-
if (!!(process.env.NODE_ENV !== "production") && true) {
|
|
16625
|
+
if (result.value) {
|
|
15902
16626
|
validateBrowserExpression(
|
|
15903
16627
|
result.value,
|
|
15904
16628
|
context,
|
|
@@ -15906,14 +16630,7 @@ function parseForExpression(input, context) {
|
|
|
15906
16630
|
);
|
|
15907
16631
|
}
|
|
15908
16632
|
}
|
|
15909
|
-
|
|
15910
|
-
}
|
|
15911
|
-
function createAliasExpression(range, content, offset) {
|
|
15912
|
-
return createSimpleExpression(
|
|
15913
|
-
content,
|
|
15914
|
-
false,
|
|
15915
|
-
getInnerRange(range, offset, content.length)
|
|
15916
|
-
);
|
|
16633
|
+
result.finalized = true;
|
|
15917
16634
|
}
|
|
15918
16635
|
function createForLoopParams({ value, key, index }, memoArgs = []) {
|
|
15919
16636
|
return createParamsList([value, key, index, ...memoArgs]);
|
|
@@ -16000,12 +16717,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16000
16717
|
hasDynamicSlots = true;
|
|
16001
16718
|
}
|
|
16002
16719
|
const vFor = findDir(slotElement, "for");
|
|
16003
|
-
const slotFunction = buildSlotFn(
|
|
16004
|
-
slotProps,
|
|
16005
|
-
vFor == null ? void 0 : vFor.exp,
|
|
16006
|
-
slotChildren,
|
|
16007
|
-
slotLoc
|
|
16008
|
-
);
|
|
16720
|
+
const slotFunction = buildSlotFn(slotProps, vFor, slotChildren, slotLoc);
|
|
16009
16721
|
let vIf;
|
|
16010
16722
|
let vElse;
|
|
16011
16723
|
if (vIf = findDir(slotElement, "if")) {
|
|
@@ -16054,8 +16766,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
16054
16766
|
}
|
|
16055
16767
|
} else if (vFor) {
|
|
16056
16768
|
hasDynamicSlots = true;
|
|
16057
|
-
const parseResult = vFor.
|
|
16769
|
+
const parseResult = vFor.forParseResult;
|
|
16058
16770
|
if (parseResult) {
|
|
16771
|
+
finalizeForParseResult(parseResult, context);
|
|
16059
16772
|
dynamicSlots.push(
|
|
16060
16773
|
createCallExpression(context.helper(RENDER_LIST), [
|
|
16061
16774
|
parseResult.source,
|
|
@@ -16318,17 +17031,6 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
16318
17031
|
tag = isProp.value.content.slice(4);
|
|
16319
17032
|
}
|
|
16320
17033
|
}
|
|
16321
|
-
const isDir = !isExplicitDynamic && findDir(node, "is");
|
|
16322
|
-
if (isDir && isDir.exp) {
|
|
16323
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
16324
|
-
context.onWarn(
|
|
16325
|
-
createCompilerError(52, isDir.loc)
|
|
16326
|
-
);
|
|
16327
|
-
}
|
|
16328
|
-
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
16329
|
-
isDir.exp
|
|
16330
|
-
]);
|
|
16331
|
-
}
|
|
16332
17034
|
const builtIn = isCoreComponent(tag) || context.isBuiltInComponent(tag);
|
|
16333
17035
|
if (builtIn) {
|
|
16334
17036
|
if (!ssr)
|
|
@@ -16400,7 +17102,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16400
17102
|
for (let i = 0; i < props.length; i++) {
|
|
16401
17103
|
const prop = props[i];
|
|
16402
17104
|
if (prop.type === 6) {
|
|
16403
|
-
const { loc, name, value } = prop;
|
|
17105
|
+
const { loc, name, nameLoc, value } = prop;
|
|
16404
17106
|
let isStatic = true;
|
|
16405
17107
|
if (name === "ref") {
|
|
16406
17108
|
hasRef = true;
|
|
@@ -16421,11 +17123,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16421
17123
|
}
|
|
16422
17124
|
properties.push(
|
|
16423
17125
|
createObjectProperty(
|
|
16424
|
-
createSimpleExpression(
|
|
16425
|
-
name,
|
|
16426
|
-
true,
|
|
16427
|
-
getInnerRange(loc, 0, name.length)
|
|
16428
|
-
),
|
|
17126
|
+
createSimpleExpression(name, true, nameLoc),
|
|
16429
17127
|
createSimpleExpression(
|
|
16430
17128
|
value ? value.content : "",
|
|
16431
17129
|
isStatic,
|
|
@@ -16434,7 +17132,7 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16434
17132
|
)
|
|
16435
17133
|
);
|
|
16436
17134
|
} else {
|
|
16437
|
-
const { name, arg, exp, loc } = prop;
|
|
17135
|
+
const { name, arg, exp, loc, modifiers } = prop;
|
|
16438
17136
|
const isVBind = name === "bind";
|
|
16439
17137
|
const isVOn = name === "on";
|
|
16440
17138
|
if (name === "slot") {
|
|
@@ -16527,6 +17225,9 @@ function buildProps(node, context, props = node.props, isComponent, isDynamicCom
|
|
|
16527
17225
|
}
|
|
16528
17226
|
continue;
|
|
16529
17227
|
}
|
|
17228
|
+
if (isVBind && modifiers.includes("prop")) {
|
|
17229
|
+
patchFlag |= 32;
|
|
17230
|
+
}
|
|
16530
17231
|
const directiveTransform = context.directiveTransforms[name];
|
|
16531
17232
|
if (directiveTransform) {
|
|
16532
17233
|
const { props: props2, needRuntime } = directiveTransform(prop, node, context);
|
|
@@ -16904,8 +17605,13 @@ const transformOn$1 = (dir, node, context, augmentor) => {
|
|
|
16904
17605
|
};
|
|
16905
17606
|
|
|
16906
17607
|
const transformBind = (dir, _node, context) => {
|
|
16907
|
-
const {
|
|
17608
|
+
const { modifiers, loc } = dir;
|
|
16908
17609
|
const arg = dir.arg;
|
|
17610
|
+
let { exp } = dir;
|
|
17611
|
+
if (!exp && arg.type === 4) {
|
|
17612
|
+
const propName = camelize(arg.content);
|
|
17613
|
+
exp = dir.exp = createSimpleExpression(propName, false, arg.loc);
|
|
17614
|
+
}
|
|
16909
17615
|
if (arg.type !== 4) {
|
|
16910
17616
|
arg.children.unshift(`(`);
|
|
16911
17617
|
arg.children.push(`) || ""`);
|
|
@@ -17304,7 +18010,7 @@ function getBaseTransformPreset(prefixIdentifiers) {
|
|
|
17304
18010
|
}
|
|
17305
18011
|
];
|
|
17306
18012
|
}
|
|
17307
|
-
function baseCompile(
|
|
18013
|
+
function baseCompile(source, options = {}) {
|
|
17308
18014
|
const onError = options.onError || defaultOnError;
|
|
17309
18015
|
const isModuleMode = options.mode === "module";
|
|
17310
18016
|
{
|
|
@@ -17321,7 +18027,7 @@ function baseCompile(template, options = {}) {
|
|
|
17321
18027
|
if (options.scopeId && !isModuleMode) {
|
|
17322
18028
|
onError(createCompilerError(50));
|
|
17323
18029
|
}
|
|
17324
|
-
const ast = isString(
|
|
18030
|
+
const ast = isString(source) ? baseParse(source, options) : source;
|
|
17325
18031
|
const [nodeTransforms, directiveTransforms] = getBaseTransformPreset();
|
|
17326
18032
|
transform(
|
|
17327
18033
|
ast,
|
|
@@ -17387,25 +18093,22 @@ function decodeHtmlBrowser(raw, asAttr = false) {
|
|
|
17387
18093
|
}
|
|
17388
18094
|
}
|
|
17389
18095
|
|
|
17390
|
-
const isRawTextContainer = /* @__PURE__ */ makeMap(
|
|
17391
|
-
"style,iframe,script,noscript",
|
|
17392
|
-
true
|
|
17393
|
-
);
|
|
17394
18096
|
const parserOptions = {
|
|
18097
|
+
parseMode: "html",
|
|
17395
18098
|
isVoidTag,
|
|
17396
18099
|
isNativeTag: (tag) => isHTMLTag(tag) || isSVGTag(tag),
|
|
17397
18100
|
isPreTag: (tag) => tag === "pre",
|
|
17398
18101
|
decodeEntities: decodeHtmlBrowser ,
|
|
17399
18102
|
isBuiltInComponent: (tag) => {
|
|
17400
|
-
if (
|
|
18103
|
+
if (tag === "Transition" || tag === "transition") {
|
|
17401
18104
|
return TRANSITION;
|
|
17402
|
-
} else if (
|
|
18105
|
+
} else if (tag === "TransitionGroup" || tag === "transition-group") {
|
|
17403
18106
|
return TRANSITION_GROUP;
|
|
17404
18107
|
}
|
|
17405
18108
|
},
|
|
17406
18109
|
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
|
|
17407
|
-
getNamespace(tag, parent) {
|
|
17408
|
-
let ns = parent ? parent.ns :
|
|
18110
|
+
getNamespace(tag, parent, rootNamespace) {
|
|
18111
|
+
let ns = parent ? parent.ns : rootNamespace;
|
|
17409
18112
|
if (parent && ns === 2) {
|
|
17410
18113
|
if (parent.tag === "annotation-xml") {
|
|
17411
18114
|
if (tag === "svg") {
|
|
@@ -17433,18 +18136,6 @@ const parserOptions = {
|
|
|
17433
18136
|
}
|
|
17434
18137
|
}
|
|
17435
18138
|
return ns;
|
|
17436
|
-
},
|
|
17437
|
-
// https://html.spec.whatwg.org/multipage/parsing.html#parsing-html-fragments
|
|
17438
|
-
getTextMode({ tag, ns }) {
|
|
17439
|
-
if (ns === 0) {
|
|
17440
|
-
if (tag === "textarea" || tag === "title") {
|
|
17441
|
-
return 1;
|
|
17442
|
-
}
|
|
17443
|
-
if (isRawTextContainer(tag)) {
|
|
17444
|
-
return 2;
|
|
17445
|
-
}
|
|
17446
|
-
}
|
|
17447
|
-
return 0;
|
|
17448
18139
|
}
|
|
17449
18140
|
};
|
|
17450
18141
|
|
|
@@ -17559,8 +18250,8 @@ const transformModel = (dir, node, context) => {
|
|
|
17559
18250
|
);
|
|
17560
18251
|
}
|
|
17561
18252
|
function checkDuplicatedValue() {
|
|
17562
|
-
const value =
|
|
17563
|
-
if (value) {
|
|
18253
|
+
const value = findDir(node, "bind");
|
|
18254
|
+
if (value && isStaticArgOf(value.arg, "value")) {
|
|
17564
18255
|
context.onError(
|
|
17565
18256
|
createDOMCompilerError(
|
|
17566
18257
|
60,
|
|
@@ -17765,6 +18456,7 @@ const transformTransition = (node, context) => {
|
|
|
17765
18456
|
node.props.push({
|
|
17766
18457
|
type: 6,
|
|
17767
18458
|
name: "persisted",
|
|
18459
|
+
nameLoc: node.loc,
|
|
17768
18460
|
value: void 0,
|
|
17769
18461
|
loc: node.loc
|
|
17770
18462
|
});
|
|
@@ -17809,9 +18501,9 @@ const DOMDirectiveTransforms = {
|
|
|
17809
18501
|
// override compiler-core
|
|
17810
18502
|
show: transformShow
|
|
17811
18503
|
};
|
|
17812
|
-
function compile(
|
|
18504
|
+
function compile(src, options = {}) {
|
|
17813
18505
|
return baseCompile(
|
|
17814
|
-
|
|
18506
|
+
src,
|
|
17815
18507
|
extend({}, parserOptions, options, {
|
|
17816
18508
|
nodeTransforms: [
|
|
17817
18509
|
// ignore <script> and <tag>
|