@vue/compiler-sfc 3.6.0-rc.10 → 3.6.0-rc.11
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/compiler-sfc.cjs.js +1064 -1304
- package/dist/compiler-sfc.esm-browser.js +435 -247
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.11
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -21256,11 +21256,11 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
21256
21256
|
return builtIn;
|
|
21257
21257
|
}
|
|
21258
21258
|
{
|
|
21259
|
-
const fromScope = resolveSlotScopeReference(tag, context);
|
|
21259
|
+
const fromScope = resolveSlotScopeReference$1(tag, context);
|
|
21260
21260
|
if (fromScope) return fromScope;
|
|
21261
21261
|
const dotIndex = tag.indexOf(".");
|
|
21262
21262
|
if (dotIndex > 0) {
|
|
21263
|
-
const ns = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
|
|
21263
|
+
const ns = resolveSlotScopeReference$1(tag.slice(0, dotIndex), context);
|
|
21264
21264
|
if (ns) return ns + tag.slice(dotIndex);
|
|
21265
21265
|
}
|
|
21266
21266
|
}
|
|
@@ -21282,7 +21282,7 @@ function resolveComponentType(node, context, ssr = false) {
|
|
|
21282
21282
|
context.components.add(tag);
|
|
21283
21283
|
return toValidAssetId(tag, `component`);
|
|
21284
21284
|
}
|
|
21285
|
-
function resolveSlotScopeReference(name, context) {
|
|
21285
|
+
function resolveSlotScopeReference$1(name, context) {
|
|
21286
21286
|
const camelName = camelize(name);
|
|
21287
21287
|
const PascalName = capitalize(camelName);
|
|
21288
21288
|
const isInSlotScope = (reference) => context.isSlotScopeIdentifier(reference);
|
|
@@ -23292,15 +23292,18 @@ function parse(source, options = {}) {
|
|
|
23292
23292
|
shouldForceReload: (prevImports) => hmrShouldReload(prevImports, descriptor)
|
|
23293
23293
|
};
|
|
23294
23294
|
const errors = [];
|
|
23295
|
-
compiler.parse(source, _objectSpread2(_objectSpread2({
|
|
23295
|
+
const ast = compiler.parse(source, _objectSpread2(_objectSpread2({
|
|
23296
23296
|
parseMode: "sfc",
|
|
23297
23297
|
prefixIdentifiers: true
|
|
23298
23298
|
}, templateParseOptions), {}, { onError: (e) => {
|
|
23299
23299
|
errors.push(e);
|
|
23300
|
-
} }))
|
|
23300
|
+
} }));
|
|
23301
|
+
let emptyScriptSetup;
|
|
23302
|
+
ast.children.forEach((node) => {
|
|
23301
23303
|
if (node.type !== 1) return;
|
|
23302
23304
|
if (ignoreEmpty && node.tag !== "template" && isEmpty(node) && !hasAttr(node, "src")) {
|
|
23303
23305
|
descriptor.vapor || (descriptor.vapor = hasAttr(node, "vapor"));
|
|
23306
|
+
if (node.tag === "script" && (hasAttr(node, "setup") || hasAttr(node, "vapor"))) emptyScriptSetup = node;
|
|
23304
23307
|
return;
|
|
23305
23308
|
}
|
|
23306
23309
|
switch (node.tag) {
|
|
@@ -23338,6 +23341,14 @@ function parse(source, options = {}) {
|
|
|
23338
23341
|
default: descriptor.customBlocks.push(createBlock(node, source, pad));
|
|
23339
23342
|
}
|
|
23340
23343
|
});
|
|
23344
|
+
if (descriptor.vapor && descriptor.script && !descriptor.scriptSetup) {
|
|
23345
|
+
if (emptyScriptSetup) descriptor.scriptSetup = createBlock(emptyScriptSetup, source, pad);
|
|
23346
|
+
else {
|
|
23347
|
+
const err = /* @__PURE__ */ new SyntaxError(`Vapor components with a normal <script> must also include <script setup>, <script vapor>, or <script setup vapor>.`);
|
|
23348
|
+
err.loc = descriptor.script.loc;
|
|
23349
|
+
errors.push(err);
|
|
23350
|
+
}
|
|
23351
|
+
}
|
|
23341
23352
|
if (!descriptor.template && !descriptor.script && !descriptor.scriptSetup) errors.push(/* @__PURE__ */ new SyntaxError(`At least one <template> or <script> is required in a single file component. ${descriptor.filename}`));
|
|
23342
23353
|
if (descriptor.scriptSetup) {
|
|
23343
23354
|
if (descriptor.scriptSetup.src) {
|
|
@@ -24977,32 +24988,34 @@ const IRNodeTypes = {
|
|
|
24977
24988
|
"3": "SET_PROP",
|
|
24978
24989
|
"SET_DYNAMIC_PROPS": 4,
|
|
24979
24990
|
"4": "SET_DYNAMIC_PROPS",
|
|
24980
|
-
"
|
|
24981
|
-
"5": "
|
|
24982
|
-
"
|
|
24983
|
-
"6": "
|
|
24984
|
-
"
|
|
24985
|
-
"7": "
|
|
24986
|
-
"
|
|
24987
|
-
"8": "
|
|
24988
|
-
"
|
|
24989
|
-
"9": "
|
|
24990
|
-
"
|
|
24991
|
-
"10": "
|
|
24992
|
-
"
|
|
24993
|
-
"11": "
|
|
24994
|
-
"
|
|
24995
|
-
"12": "
|
|
24996
|
-
"
|
|
24997
|
-
"13": "
|
|
24998
|
-
"
|
|
24999
|
-
"14": "
|
|
25000
|
-
"
|
|
25001
|
-
"15": "
|
|
25002
|
-
"
|
|
25003
|
-
"16": "
|
|
25004
|
-
"
|
|
25005
|
-
"17": "
|
|
24991
|
+
"SYNC_SELECT_VALUE": 5,
|
|
24992
|
+
"5": "SYNC_SELECT_VALUE",
|
|
24993
|
+
"SET_TEXT": 6,
|
|
24994
|
+
"6": "SET_TEXT",
|
|
24995
|
+
"SET_EVENT": 7,
|
|
24996
|
+
"7": "SET_EVENT",
|
|
24997
|
+
"SET_DYNAMIC_EVENTS": 8,
|
|
24998
|
+
"8": "SET_DYNAMIC_EVENTS",
|
|
24999
|
+
"SET_HTML": 9,
|
|
25000
|
+
"9": "SET_HTML",
|
|
25001
|
+
"SET_TEMPLATE_REF": 10,
|
|
25002
|
+
"10": "SET_TEMPLATE_REF",
|
|
25003
|
+
"INSERT_NODE": 11,
|
|
25004
|
+
"11": "INSERT_NODE",
|
|
25005
|
+
"CREATE_COMPONENT_NODE": 12,
|
|
25006
|
+
"12": "CREATE_COMPONENT_NODE",
|
|
25007
|
+
"SLOT_OUTLET_NODE": 13,
|
|
25008
|
+
"13": "SLOT_OUTLET_NODE",
|
|
25009
|
+
"DIRECTIVE": 14,
|
|
25010
|
+
"14": "DIRECTIVE",
|
|
25011
|
+
"IF": 15,
|
|
25012
|
+
"15": "IF",
|
|
25013
|
+
"FOR": 16,
|
|
25014
|
+
"16": "FOR",
|
|
25015
|
+
"KEY": 17,
|
|
25016
|
+
"17": "KEY",
|
|
25017
|
+
"GET_TEXT_CHILD": 18,
|
|
25018
|
+
"18": "GET_TEXT_CHILD"
|
|
25006
25019
|
};
|
|
25007
25020
|
var TemplateRegistry = class {
|
|
25008
25021
|
constructor() {
|
|
@@ -25024,7 +25037,7 @@ const DynamicFlag = {
|
|
|
25024
25037
|
};
|
|
25025
25038
|
function isBlockOperation(op) {
|
|
25026
25039
|
const type = op.type;
|
|
25027
|
-
return type ===
|
|
25040
|
+
return type === 12 || type === 13 || type === 15 || type === 17 || type === 16;
|
|
25028
25041
|
}
|
|
25029
25042
|
//#endregion
|
|
25030
25043
|
//#region packages/compiler-vapor/src/transforms/utils.ts
|
|
@@ -25087,11 +25100,11 @@ const findDir = findDir$1;
|
|
|
25087
25100
|
function propToExpression(prop) {
|
|
25088
25101
|
return prop.type === 6 ? prop.value ? createSimpleExpression(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION : prop.exp;
|
|
25089
25102
|
}
|
|
25090
|
-
function isConstantExpression(exp) {
|
|
25091
|
-
return isLiteralWhitelisted(exp.content) || isGloballyAllowed(exp.content) || getLiteralExpressionValue(exp) !== null;
|
|
25103
|
+
function isConstantExpression(exp, bindings) {
|
|
25104
|
+
return isLiteralWhitelisted(exp.content) || isGloballyAllowed(exp.content) && !(bindings && bindings[exp.content]) || getLiteralExpressionValue(exp) !== null;
|
|
25092
25105
|
}
|
|
25093
25106
|
function isConstantBinding$1(exp, bindings) {
|
|
25094
|
-
return isConstantExpression(exp) || isStaticExpression(exp, bindings);
|
|
25107
|
+
return isConstantExpression(exp, bindings) || isStaticExpression(exp, bindings);
|
|
25095
25108
|
}
|
|
25096
25109
|
function isStaticExpression(node, bindings) {
|
|
25097
25110
|
if (node.ast) return isConstantNode(node.ast, bindings);
|
|
@@ -25167,7 +25180,7 @@ function isBuiltInComponent(tag) {
|
|
|
25167
25180
|
function getBlockShape(block) {
|
|
25168
25181
|
if (block.returns.length !== 1) return 2;
|
|
25169
25182
|
const root = block.dynamic.children.find((c) => c.id === block.returns[0]);
|
|
25170
|
-
if (root && root.operation && root.operation.type ===
|
|
25183
|
+
if (root && root.operation && root.operation.type === 15) return 2;
|
|
25171
25184
|
return block.node.type === 1 && block.node.children.every((child) => child.type === 2 || child.type === 5) ? 2 : 1;
|
|
25172
25185
|
}
|
|
25173
25186
|
//#endregion
|
|
@@ -25305,7 +25318,7 @@ var TransformContext = class TransformContext {
|
|
|
25305
25318
|
}
|
|
25306
25319
|
registerEffect(expressions, operation, getIndex, preserveOrder = false) {
|
|
25307
25320
|
const operations = [operation].flat();
|
|
25308
|
-
expressions = expressions.filter((exp) => !isConstantExpression(exp));
|
|
25321
|
+
expressions = expressions.filter((exp) => !isConstantExpression(exp, this.root.options.bindingMetadata));
|
|
25309
25322
|
const once = expressions.every((e) => isConstantBinding$1(e, this.root.options.bindingMetadata));
|
|
25310
25323
|
const needsEffect = operations.some((op) => op.type === 4 && op.listeners);
|
|
25311
25324
|
if (this.inVOnce || once && !preserveOrder && !needsEffect) {
|
|
@@ -25694,12 +25707,19 @@ function genExpression(node, context, assignment, asParams = false) {
|
|
|
25694
25707
|
-2,
|
|
25695
25708
|
loc
|
|
25696
25709
|
]];
|
|
25697
|
-
if (!
|
|
25710
|
+
if (!content.trim()) return [[
|
|
25711
|
+
"void 0",
|
|
25712
|
+
-2,
|
|
25713
|
+
loc
|
|
25714
|
+
]];
|
|
25715
|
+
if (ast === false || ast === void 0 || isConstantExpression(node, options.bindingMetadata)) return [[
|
|
25698
25716
|
content,
|
|
25699
25717
|
-2,
|
|
25700
25718
|
loc
|
|
25701
25719
|
], assignment && ` = ${assignment}`];
|
|
25702
25720
|
if (ast === null) return genIdentifier(content, context, loc, assignment);
|
|
25721
|
+
const target = assignment ? unwrapTSNode(ast) : void 0;
|
|
25722
|
+
const isMemberTarget = (target === null || target === void 0 ? void 0 : target.type) === "MemberExpression" || (target === null || target === void 0 ? void 0 : target.type) === "OptionalMemberExpression";
|
|
25703
25723
|
const ids = [];
|
|
25704
25724
|
const parentStackMap = /* @__PURE__ */ new Map();
|
|
25705
25725
|
const parentStack = [];
|
|
@@ -25710,7 +25730,6 @@ function genExpression(node, context, assignment, asParams = false) {
|
|
|
25710
25730
|
ids.push(id);
|
|
25711
25731
|
parentStackMap.set(id, parentStack.slice());
|
|
25712
25732
|
}, asParams, parentStack);
|
|
25713
|
-
let hasMemberExpression = false;
|
|
25714
25733
|
if (ids.length) {
|
|
25715
25734
|
const [frag, push] = buildCodeFragment();
|
|
25716
25735
|
let lastEnd = 0;
|
|
@@ -25729,16 +25748,21 @@ function genExpression(node, context, assignment, asParams = false) {
|
|
|
25729
25748
|
if (start < lastEnd) return;
|
|
25730
25749
|
const leadingText = content.slice(lastEnd, start);
|
|
25731
25750
|
if (leadingText.length) push([leadingText, -3]);
|
|
25732
|
-
hasMemberExpression || (hasMemberExpression = parent && (parent.type === "MemberExpression" || parent.type === "OptionalMemberExpression"));
|
|
25733
25751
|
push(...genIdentifier(asParams ? id.name : source, context, {
|
|
25734
25752
|
start: advancePositionWithClone(node.loc.start, source, start),
|
|
25735
25753
|
end: advancePositionWithClone(node.loc.start, source, end),
|
|
25736
25754
|
source
|
|
25737
|
-
},
|
|
25755
|
+
}, isMemberTarget ? void 0 : assignment, id, parent, parentStack, node));
|
|
25738
25756
|
lastEnd = end;
|
|
25739
25757
|
});
|
|
25740
25758
|
if (lastEnd < content.length) push([content.slice(lastEnd), -3]);
|
|
25741
|
-
if (assignment &&
|
|
25759
|
+
if (assignment && isMemberTarget) {
|
|
25760
|
+
if (TS_NODE_TYPES.includes(ast.type)) {
|
|
25761
|
+
frag.unshift("(");
|
|
25762
|
+
push(")");
|
|
25763
|
+
}
|
|
25764
|
+
push(` = ${assignment}`);
|
|
25765
|
+
}
|
|
25742
25766
|
return frag;
|
|
25743
25767
|
} else return [[
|
|
25744
25768
|
content,
|
|
@@ -25767,7 +25791,8 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25767
25791
|
} else return genExpression(replacement, context, assignment);
|
|
25768
25792
|
}
|
|
25769
25793
|
let prefix;
|
|
25770
|
-
|
|
25794
|
+
let type = bindingMetadata && bindingMetadata[raw];
|
|
25795
|
+
if (inline && !type && raw[0] !== "$" && isSimpleIdentifier(raw) && canPrefix(raw)) type = "props";
|
|
25771
25796
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack || []);
|
|
25772
25797
|
const isAssignmentLVal = parent && parent.type === "AssignmentExpression" && parent.left === id;
|
|
25773
25798
|
const isUpdateArg = parent && parent.type === "UpdateExpression" && parent.argument === id;
|
|
@@ -25786,7 +25811,7 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25786
25811
|
end: advancePositionWithClone(source.loc.start, sourceContent, rightEnd),
|
|
25787
25812
|
source: rightContent
|
|
25788
25813
|
});
|
|
25789
|
-
rightExp.ast =
|
|
25814
|
+
rightExp.ast = isSimpleIdentifier(rightContent) ? null : (0, import_lib.parseExpression)(`(${rightContent})`, _objectSpread2(_objectSpread2({}, getParserOptions(context.options.expressionPlugins)), {}, { sourceType: "module" }));
|
|
25790
25815
|
return [
|
|
25791
25816
|
prefix,
|
|
25792
25817
|
`${helper("isRef")}(${raw}) ? ${raw}.value ${operator} `,
|
|
@@ -25821,7 +25846,7 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25821
25846
|
default: raw = withAssignment(raw);
|
|
25822
25847
|
}
|
|
25823
25848
|
else {
|
|
25824
|
-
if (canPrefix(raw)) {
|
|
25849
|
+
if (type || canPrefix(raw)) {
|
|
25825
25850
|
if (type === "props-aliased") raw = `$props['${bindingMetadata.__propsAliases[raw]}']`;
|
|
25826
25851
|
else raw = `${type === "props" ? "$props" : "_ctx"}.${raw}`;
|
|
25827
25852
|
}
|
|
@@ -25837,7 +25862,8 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25837
25862
|
return assignment ? `${s} = ${assignment}` : s;
|
|
25838
25863
|
}
|
|
25839
25864
|
function unref() {
|
|
25840
|
-
|
|
25865
|
+
const wrapped = `${helper("unref")}(${raw})`;
|
|
25866
|
+
return parentStack && isInNewExpression(parentStack) ? `(${wrapped})` : wrapped;
|
|
25841
25867
|
}
|
|
25842
25868
|
}
|
|
25843
25869
|
function canPrefix(name) {
|
|
@@ -26157,10 +26183,15 @@ function getIdentifierRanges(exp) {
|
|
|
26157
26183
|
return identifiers;
|
|
26158
26184
|
}
|
|
26159
26185
|
function applyContentReplacements(content, replacements) {
|
|
26160
|
-
replacements.sort((a, b) =>
|
|
26161
|
-
|
|
26162
|
-
|
|
26163
|
-
|
|
26186
|
+
replacements.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
26187
|
+
let result = "";
|
|
26188
|
+
let offset = 0;
|
|
26189
|
+
for (const { start, end, content: replacement } of replacements) {
|
|
26190
|
+
if (start < offset) continue;
|
|
26191
|
+
result += content.slice(offset, start) + replacement;
|
|
26192
|
+
offset = end;
|
|
26193
|
+
}
|
|
26194
|
+
return result + content.slice(offset);
|
|
26164
26195
|
}
|
|
26165
26196
|
function genDeclarations(declarations, context, shouldDeclare) {
|
|
26166
26197
|
const [frag, push] = buildCodeFragment();
|
|
@@ -26191,7 +26222,7 @@ function parseExp(context, content) {
|
|
|
26191
26222
|
return (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
26192
26223
|
}
|
|
26193
26224
|
function genVarName(exp) {
|
|
26194
|
-
return `${exp.replace(/[^a-zA-Z0-9]/g, "_").replace(/_+/g, "_").replace(/_+$/, "")}`;
|
|
26225
|
+
return `${exp.replace(/[^a-zA-Z0-9]/g, "_").replace(/_+/g, "_").replace(/_+$/, "").replace(/^\d/, "_$&")}`;
|
|
26195
26226
|
}
|
|
26196
26227
|
function getUniqueDeclarationName(baseName, reservedNames) {
|
|
26197
26228
|
const normalizedBase = baseName || "exp";
|
|
@@ -26265,7 +26296,7 @@ function genSetEvent(oper, context) {
|
|
|
26265
26296
|
const eventOptions = genEventOptions();
|
|
26266
26297
|
return [NEWLINE, ...genCall(helper(effect ? "onBinding" : delegate ? "delegate" : "on"), `n${element}`, name, genHandler(), eventOptions)];
|
|
26267
26298
|
function genHandler() {
|
|
26268
|
-
return handler || (handler = genEventHandler(context, [value], modifiers));
|
|
26299
|
+
return handler || (handler = genEventHandler(context, [value], modifiers, { hoisted: oper }));
|
|
26269
26300
|
}
|
|
26270
26301
|
function genInvoker() {
|
|
26271
26302
|
return [
|
|
@@ -26300,18 +26331,38 @@ function genSetEvent(oper, context) {
|
|
|
26300
26331
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ...options.map((option) => [`${option}: true`]));
|
|
26301
26332
|
}
|
|
26302
26333
|
function isSameDelegateEvent(op) {
|
|
26303
|
-
if (op.type ===
|
|
26334
|
+
if (op.type === 7 && op !== oper && op.delegate && op.element === oper.element && op.key.content === key.content) return true;
|
|
26304
26335
|
}
|
|
26305
26336
|
}
|
|
26306
26337
|
function genSetDynamicEvents(oper, context) {
|
|
26307
26338
|
const { helper } = context;
|
|
26308
26339
|
return [NEWLINE, ...genCall(helper("setDynamicEvents"), `n${oper.element}`, genExpression(oper.event, context))];
|
|
26309
26340
|
}
|
|
26341
|
+
const hoistedHandlers = /* @__PURE__ */ new WeakMap();
|
|
26342
|
+
function genHoistedHandlers(effects, context) {
|
|
26343
|
+
const [frag, push] = buildCodeFragment();
|
|
26344
|
+
const declare = (node, key, values, modifiers) => {
|
|
26345
|
+
const name = getUniqueHandlerName(context, `_on_${key.content.replace(/-/g, "_")}`);
|
|
26346
|
+
hoistedHandlers.set(node, name);
|
|
26347
|
+
push(NEWLINE, `const ${name} = `, ...genEventHandler(context, values, modifiers));
|
|
26348
|
+
};
|
|
26349
|
+
for (const { operations } of effects) for (const oper of operations) if (oper.type === 7) declare(oper, oper.key, [oper.value], oper.modifiers);
|
|
26350
|
+
else if (oper.type === 4) for (const props of oper.props) {
|
|
26351
|
+
if (!isArray$3(props)) continue;
|
|
26352
|
+
for (const prop of props) if (prop.handler) declare(prop, prop.key, prop.values, prop.handlerModifiers);
|
|
26353
|
+
}
|
|
26354
|
+
return frag;
|
|
26355
|
+
}
|
|
26356
|
+
function getUniqueHandlerName(context, name) {
|
|
26357
|
+
return context.getUniqueLocalName(genVarName(name));
|
|
26358
|
+
}
|
|
26310
26359
|
function genEventHandler(context, values, modifiers = {
|
|
26311
26360
|
nonKeys: [],
|
|
26312
26361
|
keys: []
|
|
26313
26362
|
}, options = {}) {
|
|
26314
|
-
const { asComponentProp = false, extraWrap = false, modifierHelper = "runtime" } = options;
|
|
26363
|
+
const { asComponentProp = false, extraWrap = false, modifierHelper = "runtime", hoisted } = options;
|
|
26364
|
+
const hoistedName = hoisted && hoistedHandlers.get(hoisted);
|
|
26365
|
+
if (hoistedName) return [hoistedName];
|
|
26315
26366
|
const useVaporModifierHelper = modifierHelper === "vapor";
|
|
26316
26367
|
let handlerExp = [];
|
|
26317
26368
|
if (values) {
|
|
@@ -26496,7 +26547,7 @@ function isFragmentBlock(block) {
|
|
|
26496
26547
|
const child = getSingleReturnedChild(block);
|
|
26497
26548
|
const operation = child && child.operation;
|
|
26498
26549
|
if (!operation) return false;
|
|
26499
|
-
return operation.type ===
|
|
26550
|
+
return operation.type === 13 || operation.type === 16 || operation.type === 17 || operation.type === 15 && !operation.once || operation.type === 12 && !!operation.dynamic && !operation.dynamic.isStatic;
|
|
26500
26551
|
}
|
|
26501
26552
|
function getSingleReturnedChild(block) {
|
|
26502
26553
|
if (block.returns.length !== 1) return;
|
|
@@ -26514,50 +26565,53 @@ function parseValueDestructure(value, context) {
|
|
|
26514
26565
|
const map = /* @__PURE__ */ new Map();
|
|
26515
26566
|
if (value) {
|
|
26516
26567
|
const rawValue = value.content;
|
|
26517
|
-
if (value.ast)
|
|
26518
|
-
|
|
26519
|
-
|
|
26520
|
-
|
|
26521
|
-
|
|
26522
|
-
|
|
26523
|
-
|
|
26524
|
-
|
|
26525
|
-
|
|
26526
|
-
|
|
26527
|
-
|
|
26528
|
-
|
|
26529
|
-
|
|
26530
|
-
path += `[${
|
|
26531
|
-
|
|
26532
|
-
} else if (parent.type === "ArrayPattern") {
|
|
26533
|
-
const index = parent.elements.indexOf(child);
|
|
26534
|
-
if (child.type === "RestElement") path += `.slice(${index})`;
|
|
26535
|
-
else path += `[${index}]`;
|
|
26536
|
-
} else if (parent.type === "ObjectPattern" && child.type === "RestElement") {
|
|
26537
|
-
helper = context.helper("getRestElement");
|
|
26538
|
-
helperArgs = "[" + parent.properties.filter((p) => p.type === "ObjectProperty").map((p) => {
|
|
26539
|
-
if (p.key.type === "StringLiteral") return JSON.stringify(p.key.value);
|
|
26540
|
-
else if (p.computed) {
|
|
26568
|
+
if (value.ast) {
|
|
26569
|
+
const bindings = /* @__PURE__ */ new Set();
|
|
26570
|
+
walkFunctionParams(value.ast, (id) => bindings.add(id));
|
|
26571
|
+
walkIdentifiers(value.ast, (id, _, parentStack) => {
|
|
26572
|
+
if (bindings.has(id)) {
|
|
26573
|
+
let path = "";
|
|
26574
|
+
let isDynamic = false;
|
|
26575
|
+
let helper;
|
|
26576
|
+
let helperArgs;
|
|
26577
|
+
for (let i = 0; i < parentStack.length; i++) {
|
|
26578
|
+
const parent = parentStack[i];
|
|
26579
|
+
const child = parentStack[i + 1] || id;
|
|
26580
|
+
if (parent.type === "ObjectProperty" && parent.value === child) {
|
|
26581
|
+
if (parent.key.type === "StringLiteral") path += `[${JSON.stringify(parent.key.value)}]`;
|
|
26582
|
+
else if (parent.computed) {
|
|
26541
26583
|
isDynamic = true;
|
|
26542
|
-
|
|
26543
|
-
} else
|
|
26544
|
-
}
|
|
26545
|
-
|
|
26546
|
-
|
|
26547
|
-
|
|
26548
|
-
|
|
26549
|
-
|
|
26584
|
+
path += `[${rawValue.slice(parent.key.start - 1, parent.key.end - 1)}]`;
|
|
26585
|
+
} else path += `.${parent.key.name}`;
|
|
26586
|
+
} else if (parent.type === "ArrayPattern") {
|
|
26587
|
+
const index = parent.elements.indexOf(child);
|
|
26588
|
+
if (child.type === "RestElement") path += `.slice(${index})`;
|
|
26589
|
+
else path += `[${index}]`;
|
|
26590
|
+
} else if (parent.type === "ObjectPattern" && child.type === "RestElement") {
|
|
26591
|
+
helper = context.helper("getRestElement");
|
|
26592
|
+
helperArgs = "[" + parent.properties.filter((p) => p.type === "ObjectProperty").map((p) => {
|
|
26593
|
+
if (p.key.type === "StringLiteral") return JSON.stringify(p.key.value);
|
|
26594
|
+
else if (p.computed) {
|
|
26595
|
+
isDynamic = true;
|
|
26596
|
+
return rawValue.slice(p.key.start - 1, p.key.end - 1);
|
|
26597
|
+
} else return JSON.stringify(p.key.name);
|
|
26598
|
+
}).join(", ") + "]";
|
|
26599
|
+
}
|
|
26600
|
+
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern" || parent.type === "ArrowFunctionExpression" && child.left === id)) {
|
|
26601
|
+
isDynamic = true;
|
|
26602
|
+
helper = context.helper("getDefaultValue");
|
|
26603
|
+
helperArgs = `() => (${rawValue.slice(child.right.start - 1, child.right.end - 1)})`;
|
|
26604
|
+
}
|
|
26550
26605
|
}
|
|
26606
|
+
map.set(id.name, {
|
|
26607
|
+
path,
|
|
26608
|
+
dynamic: isDynamic,
|
|
26609
|
+
helper,
|
|
26610
|
+
helperArgs
|
|
26611
|
+
});
|
|
26551
26612
|
}
|
|
26552
|
-
|
|
26553
|
-
|
|
26554
|
-
dynamic: isDynamic,
|
|
26555
|
-
helper,
|
|
26556
|
-
helperArgs
|
|
26557
|
-
});
|
|
26558
|
-
}
|
|
26559
|
-
}, true);
|
|
26560
|
-
else if (rawValue) map.set(rawValue, null);
|
|
26613
|
+
}, true);
|
|
26614
|
+
} else if (rawValue) map.set(rawValue, null);
|
|
26561
26615
|
}
|
|
26562
26616
|
return map;
|
|
26563
26617
|
}
|
|
@@ -26579,11 +26633,14 @@ function buildDestructureIdMap(idToPathMap, baseAccessor, plugins) {
|
|
|
26579
26633
|
});
|
|
26580
26634
|
return idMap;
|
|
26581
26635
|
}
|
|
26636
|
+
function isSelectValueEffect(effect) {
|
|
26637
|
+
return !!effect.once && effect.operations.some((oper) => oper.type === 5 || oper.type === 3 && oper.tag === "select" && oper.prop.key.content === "value");
|
|
26638
|
+
}
|
|
26582
26639
|
function matchPatterns(render, keyProp, idMap, context) {
|
|
26583
26640
|
const selectorPatterns = [];
|
|
26584
26641
|
const keyOnlyBindingPatterns = [];
|
|
26585
26642
|
let skippedEffectIndexes;
|
|
26586
|
-
if (keyProp === void 0) return {
|
|
26643
|
+
if (keyProp === void 0 || render.effect.some(isSelectValueEffect)) return {
|
|
26587
26644
|
keyOnlyBindingPatterns,
|
|
26588
26645
|
selectorPatterns,
|
|
26589
26646
|
skippedEffectIndexes
|
|
@@ -26780,7 +26837,8 @@ function genSetProp(oper, context) {
|
|
|
26780
26837
|
if (className) return className;
|
|
26781
26838
|
}
|
|
26782
26839
|
const propValue = genPropValue(values, context);
|
|
26783
|
-
|
|
26840
|
+
const call = genCall([helper(resolvedHelper.name), null], `n${oper.element}`, resolvedHelper.needKey ? genExpression(key, context) : false, propValue, resolvedHelper.isSVG && "true");
|
|
26841
|
+
return [NEWLINE, ...oper.once ? genOnce(call, context) : call];
|
|
26784
26842
|
}
|
|
26785
26843
|
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
26786
26844
|
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
@@ -26929,7 +26987,11 @@ function genDynamicProps$1(oper, context) {
|
|
|
26929
26987
|
const value = genExpression(props.value, context);
|
|
26930
26988
|
return props.handler ? genCall(helper("toHandlers"), value, "true") : value;
|
|
26931
26989
|
});
|
|
26932
|
-
|
|
26990
|
+
const call = genCall(helper("setDynamicProps"), `n${oper.element}`, genMulti(DELIMITERS_ARRAY, ...values), genDynamicPropNames$1(oper, context), oper.isSVG && "true");
|
|
26991
|
+
return [NEWLINE, ...oper.once ? genOnce(call, context) : call];
|
|
26992
|
+
}
|
|
26993
|
+
function genSyncSelectValue(oper, context) {
|
|
26994
|
+
return [NEWLINE, ...genCall(context.helper("syncSelectValue"), `n${oper.element}`, genDynamicPropNames$1(oper, context))];
|
|
26933
26995
|
}
|
|
26934
26996
|
function genDynamicPropNames$1(oper, context) {
|
|
26935
26997
|
const { bindingMetadata } = context.options;
|
|
@@ -26943,7 +27005,7 @@ function genDynamicPropNames$1(oper, context) {
|
|
|
26943
27005
|
function genLiteralObjectProps(props, context) {
|
|
26944
27006
|
const entries = [];
|
|
26945
27007
|
const listeners = createHandlerGroups(entries);
|
|
26946
|
-
for (const prop of props) if (isListenerProp(prop)) listeners.add(getStaticPropKeyName(prop, true), genPropKey(prop, context, true), prop.handler ? genEventHandler(context, prop.values, prop.handlerModifiers) : genPropValue(prop.values, context));
|
|
27008
|
+
for (const prop of props) if (isListenerProp(prop)) listeners.add(getStaticPropKeyName(prop, true), genPropKey(prop, context, true), prop.handler ? genEventHandler(context, prop.values, prop.handlerModifiers, { hoisted: prop }) : genPropValue(prop.values, context));
|
|
26947
27009
|
else entries.push([
|
|
26948
27010
|
...genPropKey(prop, context),
|
|
26949
27011
|
`: `,
|
|
@@ -27175,13 +27237,13 @@ function genCreateComponent(operation, context) {
|
|
|
27175
27237
|
return JSON.stringify(name);
|
|
27176
27238
|
} else if (operation.asset) return toValidAssetId(operation.tag, "component");
|
|
27177
27239
|
else {
|
|
27178
|
-
const { tag } = operation;
|
|
27240
|
+
const { tag, slotScopeNamespace } = operation;
|
|
27179
27241
|
const builtInTag = isBuiltInComponent(tag);
|
|
27180
27242
|
if (builtInTag) {
|
|
27181
27243
|
helper(builtInTag);
|
|
27182
27244
|
return `_${builtInTag}`;
|
|
27183
27245
|
}
|
|
27184
|
-
return genExpression(extend(createSimpleExpression(tag, false), { ast: null }), context);
|
|
27246
|
+
return [...genExpression(extend(createSimpleExpression(slotScopeNamespace || tag, false), { ast: null }), context), slotScopeNamespace && tag.slice(slotScopeNamespace.length)];
|
|
27185
27247
|
}
|
|
27186
27248
|
}
|
|
27187
27249
|
}
|
|
@@ -27210,13 +27272,6 @@ function genDynamicComponentFlags(root, once, slotRoot, ns) {
|
|
|
27210
27272
|
if (!flags) return false;
|
|
27211
27273
|
return genFlags(flags, names);
|
|
27212
27274
|
}
|
|
27213
|
-
function getUniqueHandlerName(context, name) {
|
|
27214
|
-
const { seenInlineHandlerNames } = context;
|
|
27215
|
-
name = genVarName(name);
|
|
27216
|
-
const count = seenInlineHandlerNames[name] || 0;
|
|
27217
|
-
seenInlineHandlerNames[name] = count + 1;
|
|
27218
|
-
return count === 0 ? name : `${name}${count}`;
|
|
27219
|
-
}
|
|
27220
27275
|
function processInlineHandlers(props, context) {
|
|
27221
27276
|
const ids = Object.create(null);
|
|
27222
27277
|
const handlers = [];
|
|
@@ -27622,7 +27677,7 @@ function genBuiltinDirective(oper, context) {
|
|
|
27622
27677
|
*/
|
|
27623
27678
|
function genCustomDirectives(operations, context) {
|
|
27624
27679
|
const byElement = /* @__PURE__ */ new Map();
|
|
27625
|
-
for (const oper of operations) if (oper.type ===
|
|
27680
|
+
for (const oper of operations) if (oper.type === 14 && !oper.builtin) {
|
|
27626
27681
|
const dirs = byElement.get(oper.element);
|
|
27627
27682
|
if (dirs) dirs.push(oper);
|
|
27628
27683
|
else byElement.set(oper.element, [oper]);
|
|
@@ -27692,19 +27747,20 @@ function genOperation(oper, context) {
|
|
|
27692
27747
|
case 2: return genSetBlockKey(oper, context);
|
|
27693
27748
|
case 3: return genSetProp(oper, context);
|
|
27694
27749
|
case 4: return genDynamicProps$1(oper, context);
|
|
27695
|
-
case 5: return
|
|
27696
|
-
case 6: return
|
|
27697
|
-
case 7: return
|
|
27698
|
-
case 8: return
|
|
27699
|
-
case 9: return
|
|
27700
|
-
case 10: return
|
|
27701
|
-
case
|
|
27702
|
-
case 15: return
|
|
27703
|
-
case 16: return
|
|
27704
|
-
case
|
|
27705
|
-
case 12: return
|
|
27706
|
-
case 13: return
|
|
27707
|
-
case
|
|
27750
|
+
case 5: return genSyncSelectValue(oper, context);
|
|
27751
|
+
case 6: return genSetText(oper, context);
|
|
27752
|
+
case 7: return genSetEvent(oper, context);
|
|
27753
|
+
case 8: return genSetDynamicEvents(oper, context);
|
|
27754
|
+
case 9: return genSetHtml(oper, context);
|
|
27755
|
+
case 10: return genSetTemplateRef(oper, context);
|
|
27756
|
+
case 11: return genInsertNode(oper, context);
|
|
27757
|
+
case 15: return genIf(oper, context);
|
|
27758
|
+
case 16: return genFor(oper, context);
|
|
27759
|
+
case 17: return genKey(oper, context);
|
|
27760
|
+
case 12: return genCreateComponent(oper, context);
|
|
27761
|
+
case 13: return genSlotOutlet(oper, context);
|
|
27762
|
+
case 14: return genBuiltinDirective(oper, context);
|
|
27763
|
+
case 18: return genGetTextChild(oper, context);
|
|
27708
27764
|
default: throw new Error(`Unhandled operation type in genOperation: ${oper}`);
|
|
27709
27765
|
}
|
|
27710
27766
|
}
|
|
@@ -27732,8 +27788,9 @@ function genReactiveEffects(effects, context, genExtraFrag) {
|
|
|
27732
27788
|
if (shouldDeclare && !declarationFrags.length && !varNames.length) {
|
|
27733
27789
|
const effect = effects.length === 1 ? effects[0] : void 0;
|
|
27734
27790
|
const operation = effect && effect.operations.length === 1 ? effect.operations[0] : void 0;
|
|
27735
|
-
if (operation && operation.type ===
|
|
27791
|
+
if (operation && operation.type === 10 && operation.effect && !operation.refFor) return context.withExpressionReplacements(expressionReplacements, () => context.withId(() => genSetTemplateRefBinding(operation, context), ids));
|
|
27736
27792
|
}
|
|
27793
|
+
const handlerFrags = genHoistedHandlers(effects, context);
|
|
27737
27794
|
return context.withExpressionReplacements(expressionReplacements, () => {
|
|
27738
27795
|
push(...declarationFrags);
|
|
27739
27796
|
for (let i = 0; i < effects.length; i++) {
|
|
@@ -27755,6 +27812,7 @@ function genReactiveEffects(effects, context, genExtraFrag) {
|
|
|
27755
27812
|
}
|
|
27756
27813
|
if (!shouldDeclare && varNames.length) unshift(NEWLINE, `let `, varNames.join(", "));
|
|
27757
27814
|
if (genExtraFrag) push(...context.withId(genExtraFrag, ids));
|
|
27815
|
+
unshift(...handlerFrags);
|
|
27758
27816
|
return frag;
|
|
27759
27817
|
});
|
|
27760
27818
|
}
|
|
@@ -27786,7 +27844,7 @@ function genSelf(dynamic, context, flushBeforeDynamic) {
|
|
|
27786
27844
|
const [frag, push] = buildCodeFragment();
|
|
27787
27845
|
const { id, template, operation, hasDynamicChild } = dynamic;
|
|
27788
27846
|
if (id !== void 0 && template !== void 0) {
|
|
27789
|
-
if (operation && operation.type ===
|
|
27847
|
+
if (operation && operation.type === 11 && operation.appendIndex !== void 0) push(...genInsertionState(operation, context));
|
|
27790
27848
|
push(NEWLINE, `const n${id} = ${context.tName(template)}()`);
|
|
27791
27849
|
}
|
|
27792
27850
|
if (operation) push(...genOperationWithInsertionState(operation, context));
|
|
@@ -28028,10 +28086,10 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
28028
28086
|
}
|
|
28029
28087
|
}
|
|
28030
28088
|
function isVModelOperation(oper) {
|
|
28031
|
-
return oper.type ===
|
|
28089
|
+
return oper.type === 14 && oper.builtin === true && oper.name === "model";
|
|
28032
28090
|
}
|
|
28033
28091
|
function isVModelListener(oper, modelElements) {
|
|
28034
|
-
return (oper.type ===
|
|
28092
|
+
return (oper.type === 7 || oper.type === 8 || oper.type === 4 && oper.listeners || oper.type === 3 && !oper.prop.modifier && isOn(oper.prop.key.content)) && modelElements.has(oper.element);
|
|
28035
28093
|
}
|
|
28036
28094
|
function markSlotRootOperations(block, context, sharedFallback = false) {
|
|
28037
28095
|
if (hasStableSlotRoot(block, context)) return;
|
|
@@ -28040,13 +28098,13 @@ function markSlotRootOperations(block, context, sharedFallback = false) {
|
|
|
28040
28098
|
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
28041
28099
|
const operation = child && child.operation;
|
|
28042
28100
|
if (!operation) continue;
|
|
28043
|
-
if (operation.type ===
|
|
28044
|
-
else if (operation.type ===
|
|
28045
|
-
else if (operation.type ===
|
|
28101
|
+
if (operation.type === 15) markSlotRootIf(operation, context, sharedFallback);
|
|
28102
|
+
else if (operation.type === 16) markSlotRootFor(operation, context);
|
|
28103
|
+
else if (operation.type === 17) {
|
|
28046
28104
|
operation.slotRoot = true;
|
|
28047
28105
|
markSlotRootOperations(operation.block, context, sharedFallback);
|
|
28048
|
-
} else if (operation.type ===
|
|
28049
|
-
else if (operation.type ===
|
|
28106
|
+
} else if (operation.type === 12) markSlotRootComponent(operation);
|
|
28107
|
+
else if (operation.type === 13) {
|
|
28050
28108
|
operation.flags |= 4;
|
|
28051
28109
|
if (sharedFallback) operation.flags |= 8;
|
|
28052
28110
|
}
|
|
@@ -28057,7 +28115,7 @@ function markSlotRootIf(operation, context, sharedFallback) {
|
|
|
28057
28115
|
markSlotRootOperations(operation.positive, context, sharedFallback);
|
|
28058
28116
|
const negative = operation.negative;
|
|
28059
28117
|
if (!negative) return;
|
|
28060
|
-
if (negative.type ===
|
|
28118
|
+
if (negative.type === 15) markSlotRootIf(negative, context, sharedFallback);
|
|
28061
28119
|
else markSlotRootOperations(negative, context, sharedFallback);
|
|
28062
28120
|
}
|
|
28063
28121
|
function markSlotRootFor(operation, context) {
|
|
@@ -28093,13 +28151,13 @@ function hasStableSlotRoot(block, context) {
|
|
|
28093
28151
|
continue;
|
|
28094
28152
|
}
|
|
28095
28153
|
switch (operation.type) {
|
|
28096
|
-
case
|
|
28154
|
+
case 12:
|
|
28097
28155
|
if (!operation.dynamic || operation.dynamic.isStatic) {
|
|
28098
28156
|
hasValidRoot = true;
|
|
28099
28157
|
continue;
|
|
28100
28158
|
}
|
|
28101
28159
|
continue;
|
|
28102
|
-
case
|
|
28160
|
+
case 17:
|
|
28103
28161
|
if (hasStableSlotRoot(operation.block, context)) {
|
|
28104
28162
|
hasValidRoot = true;
|
|
28105
28163
|
continue;
|
|
@@ -28134,7 +28192,7 @@ function collectSingleUseAssetComponents(block) {
|
|
|
28134
28192
|
function visitOperation(operation, rootCandidate) {
|
|
28135
28193
|
if (seenOperations.has(operation)) return;
|
|
28136
28194
|
seenOperations.add(operation);
|
|
28137
|
-
if (operation.type ===
|
|
28195
|
+
if (operation.type === 12) {
|
|
28138
28196
|
if (operation.asset) {
|
|
28139
28197
|
const usage = usageMap.get(operation.tag) || {
|
|
28140
28198
|
count: 0,
|
|
@@ -28148,20 +28206,20 @@ function collectSingleUseAssetComponents(block) {
|
|
|
28148
28206
|
return;
|
|
28149
28207
|
}
|
|
28150
28208
|
switch (operation.type) {
|
|
28151
|
-
case
|
|
28209
|
+
case 15:
|
|
28152
28210
|
visitBlock(operation.positive, false);
|
|
28153
28211
|
if (operation.negative) {
|
|
28154
|
-
if (operation.negative.type ===
|
|
28212
|
+
if (operation.negative.type === 15) visitOperation(operation.negative, false);
|
|
28155
28213
|
else visitBlock(operation.negative, false);
|
|
28156
28214
|
}
|
|
28157
28215
|
break;
|
|
28158
|
-
case
|
|
28216
|
+
case 16:
|
|
28159
28217
|
visitBlock(operation.render, false);
|
|
28160
28218
|
break;
|
|
28161
|
-
case
|
|
28219
|
+
case 17:
|
|
28162
28220
|
visitBlock(operation.block, false);
|
|
28163
28221
|
break;
|
|
28164
|
-
case
|
|
28222
|
+
case 13: if (operation.fallback) visitBlock(operation.fallback, false);
|
|
28165
28223
|
}
|
|
28166
28224
|
}
|
|
28167
28225
|
function visitSlots(slots) {
|
|
@@ -28235,6 +28293,7 @@ var CodegenContext = class {
|
|
|
28235
28293
|
}
|
|
28236
28294
|
isNameAvailable(name, reservedNames) {
|
|
28237
28295
|
var _this$identifiers$nam;
|
|
28296
|
+
if (name === "_ctx" || name === setTemplateRefIdent) return false;
|
|
28238
28297
|
if (this.bindingNames.has(name) || reservedNames.has(name)) return false;
|
|
28239
28298
|
if ((_this$identifiers$nam = this.identifiers[name]) === null || _this$identifiers$nam === void 0 ? void 0 : _this$identifiers$nam.length) return false;
|
|
28240
28299
|
for (const alias of this.helpers.values()) if (alias === name) return false;
|
|
@@ -28304,7 +28363,6 @@ var CodegenContext = class {
|
|
|
28304
28363
|
this.dynamicPropNames = /* @__PURE__ */ new Map();
|
|
28305
28364
|
this.identifiers = Object.create(null);
|
|
28306
28365
|
this.expressionReplacements = [];
|
|
28307
|
-
this.seenInlineHandlerNames = Object.create(null);
|
|
28308
28366
|
this.scopeLevel = 0;
|
|
28309
28367
|
this.templateVars = /* @__PURE__ */ new Map();
|
|
28310
28368
|
this.nextIdMap = /* @__PURE__ */ new Map();
|
|
@@ -28449,7 +28507,7 @@ const transformKey = (node, context) => {
|
|
|
28449
28507
|
return () => {
|
|
28450
28508
|
exitBlock();
|
|
28451
28509
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
28452
|
-
type:
|
|
28510
|
+
type: 17,
|
|
28453
28511
|
id
|
|
28454
28512
|
}, context.effectBoundary()), {}, {
|
|
28455
28513
|
value,
|
|
@@ -28479,7 +28537,7 @@ const transformVHtml = (dir, node, context) => {
|
|
|
28479
28537
|
value: exp
|
|
28480
28538
|
};
|
|
28481
28539
|
context.registerEffect([exp], {
|
|
28482
|
-
type:
|
|
28540
|
+
type: 9,
|
|
28483
28541
|
element: context.reference(),
|
|
28484
28542
|
value: exp
|
|
28485
28543
|
});
|
|
@@ -28544,7 +28602,7 @@ const transformElement = (node, context) => {
|
|
|
28544
28602
|
const getEffectIndex = () => effectIndex++;
|
|
28545
28603
|
if (node.type === 1 && node.children.length) ignoreVHtmlChildren(node, context, "node");
|
|
28546
28604
|
let parentSlots;
|
|
28547
|
-
if (node.type === 1 && (node.tagType === 1 ||
|
|
28605
|
+
if (node.type === 1 && (node.tagType === 1 || shouldUseCreateElement(node, context))) {
|
|
28548
28606
|
parentSlots = context.slots;
|
|
28549
28607
|
context.slots = [];
|
|
28550
28608
|
}
|
|
@@ -28599,12 +28657,13 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28599
28657
|
const dynamicComponent = isDynamicComponent ? resolveDynamicComponent(node) : void 0;
|
|
28600
28658
|
let { tag } = node;
|
|
28601
28659
|
let asset = true;
|
|
28660
|
+
let slotScopeNamespace;
|
|
28602
28661
|
if (!dynamicComponent && !useCreateElement) {
|
|
28603
28662
|
const isProp = findProp(node, "is");
|
|
28604
28663
|
if (isProp && isProp.type === 6 && isVueIsValue(isProp)) tag = isProp.value.content.slice(4);
|
|
28605
|
-
const
|
|
28606
|
-
if (
|
|
28607
|
-
tag =
|
|
28664
|
+
const resolved = resolveSlotScopeReference(tag, context) || resolveSetupReference(tag, context);
|
|
28665
|
+
if (resolved) {
|
|
28666
|
+
tag = resolved;
|
|
28608
28667
|
asset = false;
|
|
28609
28668
|
}
|
|
28610
28669
|
const builtInTag = isBuiltInComponent(tag);
|
|
@@ -28614,7 +28673,8 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28614
28673
|
}
|
|
28615
28674
|
const dotIndex = tag.indexOf(".");
|
|
28616
28675
|
if (dotIndex > 0) {
|
|
28617
|
-
|
|
28676
|
+
slotScopeNamespace = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
|
|
28677
|
+
const ns = slotScopeNamespace || resolveSetupReference(tag.slice(0, dotIndex), context);
|
|
28618
28678
|
if (ns) {
|
|
28619
28679
|
tag = ns + tag.slice(dotIndex);
|
|
28620
28680
|
asset = false;
|
|
@@ -28637,10 +28697,11 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28637
28697
|
context.dynamic.flags |= 6;
|
|
28638
28698
|
const id = context.reference();
|
|
28639
28699
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
28640
|
-
type:
|
|
28700
|
+
type: 12,
|
|
28641
28701
|
id
|
|
28642
28702
|
}, context.effectBoundary()), {}, {
|
|
28643
28703
|
tag,
|
|
28704
|
+
slotScopeNamespace,
|
|
28644
28705
|
props,
|
|
28645
28706
|
asset,
|
|
28646
28707
|
root: singleRoot,
|
|
@@ -28663,12 +28724,45 @@ function resolveDynamicComponent(node) {
|
|
|
28663
28724
|
if (isProp.type === 6) return isProp.value && createSimpleExpression(isProp.value.content, true);
|
|
28664
28725
|
else return isProp.exp || extend(createSimpleExpression(`is`, false, isProp.arg.loc), { ast: null });
|
|
28665
28726
|
}
|
|
28727
|
+
function resolveSlotScopeReference(name, context) {
|
|
28728
|
+
const camelName = camelize(name);
|
|
28729
|
+
for (const reference of [
|
|
28730
|
+
name,
|
|
28731
|
+
camelName,
|
|
28732
|
+
capitalize(camelName)
|
|
28733
|
+
]) {
|
|
28734
|
+
let parent = context.parent;
|
|
28735
|
+
while (parent) {
|
|
28736
|
+
const { node } = parent;
|
|
28737
|
+
if (node.type === 1) {
|
|
28738
|
+
const slot = findDir(node, "slot");
|
|
28739
|
+
if (slot && hasScopeBinding(reference, slot.exp)) return reference;
|
|
28740
|
+
const vFor = findDir(node, "for");
|
|
28741
|
+
const aliases = vFor && vFor.forParseResult;
|
|
28742
|
+
if (aliases && [
|
|
28743
|
+
aliases.value,
|
|
28744
|
+
aliases.key,
|
|
28745
|
+
aliases.index
|
|
28746
|
+
].some((exp) => hasScopeBinding(reference, exp))) break;
|
|
28747
|
+
}
|
|
28748
|
+
parent = parent.parent;
|
|
28749
|
+
}
|
|
28750
|
+
}
|
|
28751
|
+
}
|
|
28752
|
+
function hasScopeBinding(name, exp) {
|
|
28753
|
+
return exp && (exp.ast ? exp.ast.params.some((param) => extractIdentifiers(param).some((id) => id.name === name)) : exp.content === name);
|
|
28754
|
+
}
|
|
28666
28755
|
function resolveSetupReference(name, context) {
|
|
28667
28756
|
const bindings = context.options.bindingMetadata;
|
|
28668
28757
|
if (!bindings || bindings.__isScriptSetup === false) return;
|
|
28669
28758
|
const camelName = camelize(name);
|
|
28670
28759
|
const PascalName = capitalize(camelName);
|
|
28671
|
-
|
|
28760
|
+
const checkType = (type) => {
|
|
28761
|
+
if (bindings[name] === type) return name;
|
|
28762
|
+
if (bindings[camelName] === type) return camelName;
|
|
28763
|
+
if (bindings[PascalName] === type) return PascalName;
|
|
28764
|
+
};
|
|
28765
|
+
return checkType("setup-const") || checkType("setup-reactive-const") || checkType("literal-const") || checkType("setup-let") || checkType("setup-ref") || checkType("setup-maybe-ref") || checkType("props");
|
|
28672
28766
|
}
|
|
28673
28767
|
const dynamicKeys = [
|
|
28674
28768
|
"indeterminate",
|
|
@@ -28678,6 +28772,12 @@ const dynamicKeys = [
|
|
|
28678
28772
|
"currentTime",
|
|
28679
28773
|
"valueAsNumber"
|
|
28680
28774
|
];
|
|
28775
|
+
const inputValueDepKeys = [
|
|
28776
|
+
"type",
|
|
28777
|
+
"min",
|
|
28778
|
+
"max",
|
|
28779
|
+
"step"
|
|
28780
|
+
];
|
|
28681
28781
|
const NEEDS_QUOTES_RE = /[\s"'`=<>]/;
|
|
28682
28782
|
const LEADING_NEWLINE_RE = /^\r?\n/;
|
|
28683
28783
|
const UNSAFE_ATTR_NAME_RE = /[\u0000-\u0020"'<=/>]/;
|
|
@@ -28685,6 +28785,8 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28685
28785
|
const { tag } = node;
|
|
28686
28786
|
const { scopeId } = context.options;
|
|
28687
28787
|
const isSVG = node.ns === 1;
|
|
28788
|
+
const isSelect = tag === "select";
|
|
28789
|
+
const hasDynamicKeys = isSelect && node.props.some((prop) => prop.type === 7 && (prop.name === "bind" || prop.name === "on") && (!prop.arg || !isStaticExp(prop.arg)));
|
|
28688
28790
|
let template = "";
|
|
28689
28791
|
template += `<${tag}`;
|
|
28690
28792
|
if (scopeId) template += ` ${scopeId}`;
|
|
@@ -28694,8 +28796,14 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28694
28796
|
type: 4,
|
|
28695
28797
|
element: context.reference(),
|
|
28696
28798
|
props: dynamicArgs,
|
|
28697
|
-
isSVG
|
|
28799
|
+
isSVG,
|
|
28800
|
+
once: isSelect && context.inVOnce
|
|
28698
28801
|
}, getEffectIndex);
|
|
28802
|
+
if (isSelect && !context.inVOnce) context.registerEffect([], {
|
|
28803
|
+
type: 5,
|
|
28804
|
+
element: context.reference(),
|
|
28805
|
+
props: dynamicArgs
|
|
28806
|
+
}, void 0, true);
|
|
28699
28807
|
} else {
|
|
28700
28808
|
const appendTemplateProp = (key, value = "") => {
|
|
28701
28809
|
template += ` ${key}`;
|
|
@@ -28706,8 +28814,12 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28706
28814
|
};
|
|
28707
28815
|
const needsOrderedProps = tag === "input" && propsResult[1].some(({ key, modifier }) => key.content === "valueAsNumber" && modifier !== "^");
|
|
28708
28816
|
const nativeOnProps = [];
|
|
28817
|
+
let props = propsResult[1];
|
|
28818
|
+
const valueProp = props.find(({ key, modifier }) => key.isStatic && key.content === "value" && (!modifier || isSelect && modifier === "."));
|
|
28819
|
+
if (valueProp) props = [...props.filter((p) => p !== valueProp), valueProp];
|
|
28709
28820
|
let hasEffect = false;
|
|
28710
|
-
|
|
28821
|
+
let hasValueDep = false;
|
|
28822
|
+
for (const prop of props) {
|
|
28711
28823
|
const { key, values } = prop;
|
|
28712
28824
|
const canStringifyAttrName = key.isStatic && !UNSAFE_ATTR_NAME_RE.test(key.content);
|
|
28713
28825
|
let foldedValue;
|
|
@@ -28720,25 +28832,30 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
28720
28832
|
tag,
|
|
28721
28833
|
isSVG
|
|
28722
28834
|
};
|
|
28723
|
-
|
|
28724
|
-
operation.effect
|
|
28835
|
+
operation.effect = context.registerEffect(values, operation, getEffectIndex, needsOrderedProps && hasEffect);
|
|
28836
|
+
hasEffect = operation.effect || hasEffect;
|
|
28725
28837
|
}
|
|
28726
28838
|
} else if (canStringifyAttrName && context.imports.some((imported) => values[0].content.includes(imported.exp.content))) template += ` ${key.content}="${IMPORT_EXP_START}${values[0].content}${IMPORT_EXP_END}"`;
|
|
28727
|
-
else if (canStringifyAttrName && prop.modifier !== "." && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content) && !isRuntimeOnlyProp(node, key.content)) {
|
|
28839
|
+
else if (canStringifyAttrName && prop.modifier !== "." && values.length === 1 && (values[0].isStatic || values[0].content === "''") && !dynamicKeys.includes(key.content) && !isRuntimeOnlyProp(node, key.content) && !(prop === valueProp && hasValueDep)) {
|
|
28728
28840
|
const value = values[0].content === "''" ? "" : values[0].content;
|
|
28729
28841
|
appendTemplateProp(key.content, value);
|
|
28730
28842
|
} else if (canStringifyAttrName && !prop.modifier && isFoldableBooleanAttr(key.content) && (foldedValue = foldBooleanAttrValue(key.content, values)) != null) {
|
|
28731
28843
|
if (foldedValue) appendTemplateProp(key.content);
|
|
28732
28844
|
} else if (canStringifyAttrName && !prop.modifier && hasBoundValue(values) && (foldedValue = key.content === "class" ? foldClassValues(values) : key.content === "style" ? foldStyleValues(values) : void 0) != null) {
|
|
28733
28845
|
if (foldedValue) appendTemplateProp(key.content, foldedValue);
|
|
28734
|
-
} else if (
|
|
28735
|
-
else
|
|
28736
|
-
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
|
|
28741
|
-
|
|
28846
|
+
} else if (!prop.modifier && isNativeOn(key.content)) nativeOnProps.push(prop);
|
|
28847
|
+
else {
|
|
28848
|
+
const isSelectValue = isSelect && prop === valueProp;
|
|
28849
|
+
hasEffect = context.registerEffect(values, {
|
|
28850
|
+
type: 3,
|
|
28851
|
+
element: context.reference(),
|
|
28852
|
+
prop,
|
|
28853
|
+
tag,
|
|
28854
|
+
isSVG,
|
|
28855
|
+
once: isSelectValue && (context.inVOnce || !hasDynamicKeys && values.every((exp) => isConstantBinding$1(exp, context.options.bindingMetadata)))
|
|
28856
|
+
}, isSelectValue ? void 0 : getEffectIndex, isSelectValue || (needsOrderedProps || tag === "input" && prop === valueProp) && hasEffect) || hasEffect;
|
|
28857
|
+
if (tag === "input" && inputValueDepKeys.includes(key.content)) hasValueDep = true;
|
|
28858
|
+
}
|
|
28742
28859
|
}
|
|
28743
28860
|
if (nativeOnProps.length) context.registerEffect(nativeOnProps.flatMap(({ values }) => values), {
|
|
28744
28861
|
type: 4,
|
|
@@ -28914,7 +29031,16 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28914
29031
|
const dynamicArgs = [];
|
|
28915
29032
|
const dynamicExpr = [];
|
|
28916
29033
|
let results = [];
|
|
28917
|
-
|
|
29034
|
+
let resolvedBind;
|
|
29035
|
+
let resolvedBindProps;
|
|
29036
|
+
const deferListeners = !isComponent && !!findDir(node, "model") && props.some((prop) => prop.type === 7 && prop.name === "on" && !prop.arg) && mergesListeners(node, context) && props.every((prop) => {
|
|
29037
|
+
if (prop.type !== 7 || prop.name !== "bind") return true;
|
|
29038
|
+
if (prop.arg) return prop.arg.type === 4 && prop.arg.isStatic;
|
|
29039
|
+
if (!prop.exp) return false;
|
|
29040
|
+
resolvedBind = prop;
|
|
29041
|
+
resolvedBindProps = resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
29042
|
+
return !!resolvedBindProps;
|
|
29043
|
+
});
|
|
28918
29044
|
let listenerResults = [];
|
|
28919
29045
|
function pushMergeArg(listeners = false) {
|
|
28920
29046
|
const props = listeners ? listenerResults : results;
|
|
@@ -28934,12 +29060,16 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28934
29060
|
if (prop.type === 7 && !prop.arg) {
|
|
28935
29061
|
if (prop.name === "bind") {
|
|
28936
29062
|
if (prop.exp) {
|
|
28937
|
-
const objectLiteralProps = isComponent ? resolveComponentObjectLiteralBindProps(prop.exp, context, props, prop) : resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
29063
|
+
const objectLiteralProps = isComponent ? resolveComponentObjectLiteralBindProps(prop.exp, context, props, prop) : prop === resolvedBind ? resolvedBindProps : resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
28938
29064
|
if (objectLiteralProps) {
|
|
28939
29065
|
if (isComponent) pushStaticObjectLiteralProps(objectLiteralProps);
|
|
28940
29066
|
else {
|
|
28941
29067
|
dynamicExpr.push(prop.exp);
|
|
28942
|
-
|
|
29068
|
+
for (const boundProp of objectLiteralProps) {
|
|
29069
|
+
const result = toDirectiveResult(boundProp);
|
|
29070
|
+
if (deferListeners && isNativeOn(boundProp.key.content)) listenerResults.push(result);
|
|
29071
|
+
else results.push(result);
|
|
29072
|
+
}
|
|
28943
29073
|
}
|
|
28944
29074
|
} else {
|
|
28945
29075
|
dynamicExpr.push(prop.exp);
|
|
@@ -28964,7 +29094,7 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28964
29094
|
handler: true
|
|
28965
29095
|
});
|
|
28966
29096
|
} else context.registerEffect([prop.exp], {
|
|
28967
|
-
type:
|
|
29097
|
+
type: 8,
|
|
28968
29098
|
element: context.reference(),
|
|
28969
29099
|
event: prop.exp
|
|
28970
29100
|
}, getEffectIndex);
|
|
@@ -28975,12 +29105,12 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28975
29105
|
if (prop.type === 6 ? prop.name === "is" && (isDynamicComponent || isVueIsValue(prop)) : isDynamicComponent && prop.name === "bind" && isStaticArgOf(prop.arg, "is")) continue;
|
|
28976
29106
|
const result = transformProp(prop, node, context);
|
|
28977
29107
|
if (result) {
|
|
28978
|
-
if (deferListeners && !result.handler && (result.modifier || !isOn(result.key.content))) {
|
|
29108
|
+
if (deferListeners && !result.handler && (result.modifier || !isOn(result.key.content) && !isNativeOn(result.key.content))) {
|
|
28979
29109
|
results.push(result);
|
|
28980
29110
|
continue;
|
|
28981
29111
|
}
|
|
28982
29112
|
dynamicExpr.push(result.key);
|
|
28983
|
-
if (!
|
|
29113
|
+
if (!result.handler) dynamicExpr.push(result.value);
|
|
28984
29114
|
if (deferListeners) listenerResults.push(result);
|
|
28985
29115
|
else if (isComponent && !result.key.isStatic) {
|
|
28986
29116
|
pushMergeArg();
|
|
@@ -29052,10 +29182,10 @@ function resolveListenerMerge(node, context) {
|
|
|
29052
29182
|
if (p.exp) {
|
|
29053
29183
|
const bindProps = resolveNativeObjectLiteralBindProps(p.exp, context, props, p);
|
|
29054
29184
|
if (!bindProps) return true;
|
|
29055
|
-
if (
|
|
29185
|
+
if (bindProps.some(({ key }) => isNativeOn(key.content))) hasStaticListener = true;
|
|
29056
29186
|
}
|
|
29057
29187
|
} else if (!arg.isStatic) return true;
|
|
29058
|
-
else if ((isOn(arg.content) ||
|
|
29188
|
+
else if ((isOn(arg.content) || isNativeOn(arg.content)) && !isModelListener(arg.content) && !p.modifiers.some((m) => m.content === "prop" || m.content === "attr")) hasStaticListener = true;
|
|
29059
29189
|
} else if (p.name === "on") {
|
|
29060
29190
|
if (!arg) hasVOnObject = true;
|
|
29061
29191
|
else if (arg.isStatic && !p.modifiers.some((m) => m.content === "delegate")) hasStaticListener = true;
|
|
@@ -29183,13 +29313,19 @@ function createObjectBindSubExpression(source, node, context) {
|
|
|
29183
29313
|
expression.ast = isSimpleIdentifier(content) ? null : (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
29184
29314
|
return expression;
|
|
29185
29315
|
}
|
|
29316
|
+
function createStaticStyleExpression(value, context) {
|
|
29317
|
+
const content = JSON.stringify(parseStringStyle(value.content));
|
|
29318
|
+
const expression = createSimpleExpression(content, false, value.loc);
|
|
29319
|
+
expression.ast = (0, import_lib.parseExpression)(`(${content})`, getParserOptions(context.options.expressionPlugins));
|
|
29320
|
+
return expression;
|
|
29321
|
+
}
|
|
29186
29322
|
function transformProp(prop, node, context) {
|
|
29187
29323
|
let { name } = prop;
|
|
29188
29324
|
if (prop.type === 6) {
|
|
29189
29325
|
if (isReservedProp(name)) return;
|
|
29190
29326
|
return {
|
|
29191
29327
|
key: createSimpleExpression(prop.name, true, prop.nameLoc),
|
|
29192
|
-
value: prop.value ? createSimpleExpression(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION
|
|
29328
|
+
value: prop.value ? name === "style" && node.tagType === 1 ? createStaticStyleExpression(prop.value, context) : createSimpleExpression(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION
|
|
29193
29329
|
};
|
|
29194
29330
|
}
|
|
29195
29331
|
const directiveTransform = context.options.directiveTransforms[name];
|
|
@@ -29203,7 +29339,7 @@ function transformProp(prop, node, context) {
|
|
|
29203
29339
|
if (fromSetup) name = fromSetup;
|
|
29204
29340
|
else context.directive.add(name);
|
|
29205
29341
|
context.registerOperation({
|
|
29206
|
-
type:
|
|
29342
|
+
type: 14,
|
|
29207
29343
|
element: context.reference(),
|
|
29208
29344
|
dir: prop,
|
|
29209
29345
|
name,
|
|
@@ -29300,7 +29436,7 @@ function processDynamicChildren(context, useCreateElement) {
|
|
|
29300
29436
|
anchor = child.anchor = context.increaseId();
|
|
29301
29437
|
}
|
|
29302
29438
|
if (child.template != null) child.operation = {
|
|
29303
|
-
type:
|
|
29439
|
+
type: 11,
|
|
29304
29440
|
elements: [child.id],
|
|
29305
29441
|
parent: context.reference(),
|
|
29306
29442
|
anchor,
|
|
@@ -29320,6 +29456,35 @@ const transformVOnce = (node, context) => {
|
|
|
29320
29456
|
if (node.type === 1 && findDir$1(node, "once", true)) context.inVOnce = true;
|
|
29321
29457
|
};
|
|
29322
29458
|
//#endregion
|
|
29459
|
+
//#region packages/compiler-vapor/src/transforms/transformComment.ts
|
|
29460
|
+
const ignoredComments = /* @__PURE__ */ new WeakMap();
|
|
29461
|
+
function ignoreComment(node, context) {
|
|
29462
|
+
let ignored = ignoredComments.get(context.root);
|
|
29463
|
+
if (!ignored) ignoredComments.set(context.root, ignored = /* @__PURE__ */ new WeakSet());
|
|
29464
|
+
ignored.add(node);
|
|
29465
|
+
}
|
|
29466
|
+
const transformComment = (node, context) => {
|
|
29467
|
+
var _ignoredComments$get;
|
|
29468
|
+
if (node.type !== 3) return;
|
|
29469
|
+
if ((_ignoredComments$get = ignoredComments.get(context.root)) === null || _ignoredComments$get === void 0 ? void 0 : _ignoredComments$get.has(node)) context.dynamic.flags |= 2;
|
|
29470
|
+
else if (getSiblingIf(context)) {
|
|
29471
|
+
context.comment.push(node);
|
|
29472
|
+
context.dynamic.flags |= 2;
|
|
29473
|
+
} else context.template += `<!--${node.content}-->`;
|
|
29474
|
+
};
|
|
29475
|
+
function getSiblingIf(context, reverse) {
|
|
29476
|
+
const parent = context.parent;
|
|
29477
|
+
if (!parent) return;
|
|
29478
|
+
const siblings = parent.node.children;
|
|
29479
|
+
let sibling;
|
|
29480
|
+
let i = siblings.indexOf(context.node);
|
|
29481
|
+
while (reverse ? --i >= 0 : ++i < siblings.length) {
|
|
29482
|
+
sibling = siblings[i];
|
|
29483
|
+
if (!isCommentOrWhitespace(sibling)) break;
|
|
29484
|
+
}
|
|
29485
|
+
if (sibling && sibling.type === 1 && !(sibling.tagType === 3 && sibling.props.some(isVSlot)) && sibling.props.some(({ type, name }) => type === 7 && ["else-if", reverse ? "if" : "else"].includes(name))) return sibling;
|
|
29486
|
+
}
|
|
29487
|
+
//#endregion
|
|
29323
29488
|
//#region packages/compiler-vapor/src/transforms/transformText.ts
|
|
29324
29489
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
29325
29490
|
function markNonTemplate(node, context) {
|
|
@@ -29354,6 +29519,10 @@ const transformText = (node, context) => {
|
|
|
29354
29519
|
} else if (node.type === 5) processInterpolation(context);
|
|
29355
29520
|
else if (node.type === 2) {
|
|
29356
29521
|
var _context$parent;
|
|
29522
|
+
if (!node.content.trim() && getSiblingIf(context)) {
|
|
29523
|
+
context.dynamic.flags |= 2;
|
|
29524
|
+
return;
|
|
29525
|
+
}
|
|
29357
29526
|
const parent = (_context$parent = context.parent) === null || _context$parent === void 0 ? void 0 : _context$parent.node;
|
|
29358
29527
|
const createElementParent = parent && parent.type === 1 && shouldUseCreateElement(parent, context.parent);
|
|
29359
29528
|
const isRootText = !parent || parent.type === 0 || parent.type === 1 && (parent.tagType === 3 || parent.tagType === 1);
|
|
@@ -29386,7 +29555,7 @@ function processInterpolation(context) {
|
|
|
29386
29555
|
context.dynamic.isText = isElementChild;
|
|
29387
29556
|
if (values.length === 0) return;
|
|
29388
29557
|
context.registerEffect(values, {
|
|
29389
|
-
type:
|
|
29558
|
+
type: 6,
|
|
29390
29559
|
element: id,
|
|
29391
29560
|
values
|
|
29392
29561
|
});
|
|
@@ -29410,11 +29579,11 @@ function processTextContainer(children, context) {
|
|
|
29410
29579
|
else {
|
|
29411
29580
|
context.childrenTemplate = [" "];
|
|
29412
29581
|
context.registerOperation({
|
|
29413
|
-
type:
|
|
29582
|
+
type: 18,
|
|
29414
29583
|
parent: context.reference()
|
|
29415
29584
|
});
|
|
29416
29585
|
context.registerEffect(values, {
|
|
29417
|
-
type:
|
|
29586
|
+
type: 6,
|
|
29418
29587
|
element: context.reference(),
|
|
29419
29588
|
values,
|
|
29420
29589
|
generated: true
|
|
@@ -29431,7 +29600,7 @@ function registerSyntheticTextChild(context, template, values) {
|
|
|
29431
29600
|
};
|
|
29432
29601
|
context.dynamic.hasDynamicChild = true;
|
|
29433
29602
|
if (values && values.length) context.registerEffect(values, {
|
|
29434
|
-
type:
|
|
29603
|
+
type: 6,
|
|
29435
29604
|
element: id,
|
|
29436
29605
|
values
|
|
29437
29606
|
});
|
|
@@ -29445,7 +29614,7 @@ function materializeLiteralTextNode(value, context) {
|
|
|
29445
29614
|
context.dynamic.flags |= 6;
|
|
29446
29615
|
context.dynamic.template = context.pushTemplate("");
|
|
29447
29616
|
context.registerEffect([value], {
|
|
29448
|
-
type:
|
|
29617
|
+
type: 6,
|
|
29449
29618
|
element: id,
|
|
29450
29619
|
values: [value]
|
|
29451
29620
|
});
|
|
@@ -29490,7 +29659,7 @@ const transformVText = (dir, node, context) => {
|
|
|
29490
29659
|
if (useCreateElement || isRawTextContainer(node.tag)) {
|
|
29491
29660
|
const id = registerSyntheticTextChild(context, "", [exp]);
|
|
29492
29661
|
context.registerOperation({
|
|
29493
|
-
type:
|
|
29662
|
+
type: 11,
|
|
29494
29663
|
elements: [id],
|
|
29495
29664
|
parent: context.reference()
|
|
29496
29665
|
});
|
|
@@ -29500,19 +29669,19 @@ const transformVText = (dir, node, context) => {
|
|
|
29500
29669
|
if (useCreateElement) {
|
|
29501
29670
|
id = registerSyntheticTextChild(context, "");
|
|
29502
29671
|
context.registerOperation({
|
|
29503
|
-
type:
|
|
29672
|
+
type: 11,
|
|
29504
29673
|
elements: [id],
|
|
29505
29674
|
parent: context.reference()
|
|
29506
29675
|
});
|
|
29507
29676
|
} else {
|
|
29508
29677
|
context.childrenTemplate = [" "];
|
|
29509
29678
|
context.registerOperation({
|
|
29510
|
-
type:
|
|
29679
|
+
type: 18,
|
|
29511
29680
|
parent: context.reference()
|
|
29512
29681
|
});
|
|
29513
29682
|
}
|
|
29514
29683
|
context.registerEffect([exp], {
|
|
29515
|
-
type:
|
|
29684
|
+
type: 6,
|
|
29516
29685
|
element: useCreateElement ? id : context.reference(),
|
|
29517
29686
|
values: [exp],
|
|
29518
29687
|
generated: !useCreateElement
|
|
@@ -29520,7 +29689,7 @@ const transformVText = (dir, node, context) => {
|
|
|
29520
29689
|
}
|
|
29521
29690
|
};
|
|
29522
29691
|
function isConstantVTextExpression(exp, bindings) {
|
|
29523
|
-
if (isConstantExpression(exp)) return true;
|
|
29692
|
+
if (isConstantExpression(exp, bindings)) return true;
|
|
29524
29693
|
if (exp.ast === null) {
|
|
29525
29694
|
const type = bindings[exp.content];
|
|
29526
29695
|
return type === "setup-const" || type === "literal-const";
|
|
@@ -29529,11 +29698,32 @@ function isConstantVTextExpression(exp, bindings) {
|
|
|
29529
29698
|
let isConstant = true;
|
|
29530
29699
|
walkIdentifiers(exp.ast, (id, parent, _parentStack, isReferenced) => {
|
|
29531
29700
|
if (parent && isStaticPropertyKey(id, parent)) return;
|
|
29532
|
-
if (isReferenced && !isGloballyAllowed(id.name) && id.name !== "require" || (parent === null || parent === void 0 ? void 0 : parent.type) === "CallExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "NewExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "MemberExpression") isConstant = false;
|
|
29701
|
+
if (isReferenced && (bindings[id.name] || !isGloballyAllowed(id.name) && id.name !== "require") || (parent === null || parent === void 0 ? void 0 : parent.type) === "CallExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "NewExpression" || (parent === null || parent === void 0 ? void 0 : parent.type) === "MemberExpression") isConstant = false;
|
|
29533
29702
|
}, true);
|
|
29534
29703
|
return isConstant;
|
|
29535
29704
|
}
|
|
29536
29705
|
//#endregion
|
|
29706
|
+
//#region packages/compiler-vapor/src/errors.ts
|
|
29707
|
+
function createVaporCompilerError(code, loc) {
|
|
29708
|
+
return createCompilerError(code, loc, VaporErrorMessages);
|
|
29709
|
+
}
|
|
29710
|
+
const VaporErrorCodes = {
|
|
29711
|
+
"X_V_PLACEHOLDER": 100,
|
|
29712
|
+
"100": "X_V_PLACEHOLDER",
|
|
29713
|
+
"X_V_MEMO_NOT_SUPPORTED": 101,
|
|
29714
|
+
"101": "X_V_MEMO_NOT_SUPPORTED",
|
|
29715
|
+
"X_VNODE_HOOKS_NOT_SUPPORTED": 102,
|
|
29716
|
+
"102": "X_VNODE_HOOKS_NOT_SUPPORTED",
|
|
29717
|
+
"__EXTEND_POINT__": 103,
|
|
29718
|
+
"103": "__EXTEND_POINT__"
|
|
29719
|
+
};
|
|
29720
|
+
const VaporErrorMessages = {
|
|
29721
|
+
[100]: `[placeholder]`,
|
|
29722
|
+
[101]: "v-memo is not supported in Vapor mode and will be ignored.",
|
|
29723
|
+
[102]: "@vue:xxx per-element lifecycle events are not supported in Vapor mode and will be ignored.",
|
|
29724
|
+
[103]: ``
|
|
29725
|
+
};
|
|
29726
|
+
//#endregion
|
|
29537
29727
|
//#region packages/compiler-vapor/src/transforms/vOn.ts
|
|
29538
29728
|
const delegatedEvents = /*#__PURE__*/ makeMap("beforeinput,click,dblclick,contextmenu,focusin,focusout,input,keydown,keyup,mousedown,mousemove,mouseout,mouseover,mouseup,pointerdown,pointermove,pointerout,pointerover,pointerup,touchend,touchmove,touchstart");
|
|
29539
29729
|
const transformVOn = (dir, node, context) => {
|
|
@@ -29552,7 +29742,13 @@ const transformVOn = (dir, node, context) => {
|
|
|
29552
29742
|
}
|
|
29553
29743
|
if (nonDelegateModifiers) modifiers = nonDelegateModifiers;
|
|
29554
29744
|
arg = resolveExpression(arg);
|
|
29555
|
-
if (arg.isStatic && arg.content.startsWith("vue:"))
|
|
29745
|
+
if (arg.isStatic && arg.content.startsWith("vue:")) {
|
|
29746
|
+
if (node.tagType === 0) {
|
|
29747
|
+
context.options.onWarn(createVaporCompilerError(102, loc));
|
|
29748
|
+
return;
|
|
29749
|
+
}
|
|
29750
|
+
arg = extend({}, arg, { content: `vnode-${arg.content.slice(4)}` });
|
|
29751
|
+
}
|
|
29556
29752
|
const { keyModifiers, nonKeyModifiers, eventOptionModifiers } = resolveModifiers(arg.isStatic ? `on${arg.content}` : arg, modifiers, null, loc);
|
|
29557
29753
|
let keyOverride;
|
|
29558
29754
|
const isStaticClick = arg.isStatic && arg.content.toLowerCase() === "click";
|
|
@@ -29582,7 +29778,7 @@ const transformVOn = (dir, node, context) => {
|
|
|
29582
29778
|
else if (delegateModifier && !isDelegatableEvent) warnDelegate(context, delegateModifier, `.delegate modifier is not supported on the "${arg.content}" event. The listener will be attached directly.`);
|
|
29583
29779
|
const delegate = isDelegatableEvent && !eventOptionModifiers.length && !hasStopHandler;
|
|
29584
29780
|
const operation = {
|
|
29585
|
-
type:
|
|
29781
|
+
type: 7,
|
|
29586
29782
|
element: context.reference(),
|
|
29587
29783
|
key: arg,
|
|
29588
29784
|
value: exp,
|
|
@@ -29632,7 +29828,7 @@ const transformVShow = (dir, node, context) => {
|
|
|
29632
29828
|
return;
|
|
29633
29829
|
}
|
|
29634
29830
|
context.registerOperation({
|
|
29635
|
-
type:
|
|
29831
|
+
type: 14,
|
|
29636
29832
|
element: context.reference(),
|
|
29637
29833
|
dir,
|
|
29638
29834
|
name: "show",
|
|
@@ -29652,9 +29848,9 @@ const transformTemplateRef = (node, context) => {
|
|
|
29652
29848
|
else value = dir.value ? createSimpleExpression(dir.value.content, true, dir.value.loc) : EMPTY_EXPRESSION;
|
|
29653
29849
|
return () => {
|
|
29654
29850
|
const id = context.reference();
|
|
29655
|
-
const effect = !isConstantExpression(value);
|
|
29851
|
+
const effect = !isConstantExpression(value, context.options.bindingMetadata);
|
|
29656
29852
|
context.registerEffect([value], {
|
|
29657
|
-
type:
|
|
29853
|
+
type: 10,
|
|
29658
29854
|
element: id,
|
|
29659
29855
|
value,
|
|
29660
29856
|
refFor: !!context.inVFor,
|
|
@@ -29676,12 +29872,20 @@ const transformVModel = (dir, node, context) => {
|
|
|
29676
29872
|
context.options.onError(createCompilerError(44, exp.loc));
|
|
29677
29873
|
return;
|
|
29678
29874
|
}
|
|
29875
|
+
if (bindingType === "literal-const" || bindingType === "setup-const") {
|
|
29876
|
+
context.options.onError(createCompilerError(45, exp.loc));
|
|
29877
|
+
return;
|
|
29878
|
+
}
|
|
29679
29879
|
const expString = exp.content;
|
|
29680
29880
|
const maybeRef = context.options.inline && (bindingType === "setup-let" || bindingType === "setup-ref" || bindingType === "setup-maybe-ref");
|
|
29681
29881
|
if (!expString.trim() || !isMemberExpression$1(exp, context.options) && !maybeRef) {
|
|
29682
29882
|
context.options.onError(createCompilerError(42, exp.loc));
|
|
29683
29883
|
return;
|
|
29684
29884
|
}
|
|
29885
|
+
if (isScopeVariable(expString.trim(), context)) {
|
|
29886
|
+
context.options.onError(createCompilerError(43, exp.loc));
|
|
29887
|
+
return;
|
|
29888
|
+
}
|
|
29685
29889
|
if (node.tagType === 1) return {
|
|
29686
29890
|
key: arg ? arg : createSimpleExpression("modelValue", true),
|
|
29687
29891
|
value: exp,
|
|
@@ -29716,7 +29920,7 @@ const transformVModel = (dir, node, context) => {
|
|
|
29716
29920
|
else checkDuplicatedValue();
|
|
29717
29921
|
} else context.options.onError(createDOMCompilerError(58, dir.loc));
|
|
29718
29922
|
if (modelType) context.registerOperation({
|
|
29719
|
-
type:
|
|
29923
|
+
type: 14,
|
|
29720
29924
|
element: context.reference(),
|
|
29721
29925
|
dir,
|
|
29722
29926
|
name: "model",
|
|
@@ -29729,34 +29933,22 @@ const transformVModel = (dir, node, context) => {
|
|
|
29729
29933
|
if (value && isStaticArgOf(value.arg, "value")) context.options.onError(createDOMCompilerError(61, value.loc));
|
|
29730
29934
|
}
|
|
29731
29935
|
};
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
const
|
|
29735
|
-
|
|
29736
|
-
|
|
29737
|
-
|
|
29738
|
-
|
|
29739
|
-
|
|
29740
|
-
|
|
29741
|
-
|
|
29742
|
-
|
|
29743
|
-
|
|
29744
|
-
|
|
29745
|
-
|
|
29746
|
-
context.dynamic.flags |= 2;
|
|
29747
|
-
} else context.template += `<!--${node.content}-->`;
|
|
29748
|
-
};
|
|
29749
|
-
function getSiblingIf(context, reverse) {
|
|
29750
|
-
const parent = context.parent;
|
|
29751
|
-
if (!parent) return;
|
|
29752
|
-
const siblings = parent.node.children;
|
|
29753
|
-
let sibling;
|
|
29754
|
-
let i = siblings.indexOf(context.node);
|
|
29755
|
-
while (reverse ? --i >= 0 : ++i < siblings.length) {
|
|
29756
|
-
sibling = siblings[i];
|
|
29757
|
-
if (!isCommentOrWhitespace(sibling)) break;
|
|
29936
|
+
function isScopeVariable(name, context) {
|
|
29937
|
+
for (let parent = context.parent; parent; parent = parent.parent) {
|
|
29938
|
+
const { node } = parent;
|
|
29939
|
+
if (node.type !== 1) continue;
|
|
29940
|
+
const vFor = findDir$1(node, "for");
|
|
29941
|
+
const aliases = vFor && vFor.forParseResult;
|
|
29942
|
+
const scopes = aliases ? [
|
|
29943
|
+
aliases.value,
|
|
29944
|
+
aliases.key,
|
|
29945
|
+
aliases.index
|
|
29946
|
+
] : [];
|
|
29947
|
+
const slot = findDir$1(node, "slot");
|
|
29948
|
+
if (slot) scopes.push(slot.exp);
|
|
29949
|
+
if (scopes.some((exp) => hasScopeBinding(name, exp))) return true;
|
|
29758
29950
|
}
|
|
29759
|
-
|
|
29951
|
+
return false;
|
|
29760
29952
|
}
|
|
29761
29953
|
//#endregion
|
|
29762
29954
|
//#region packages/compiler-vapor/src/transforms/vIf.ts
|
|
@@ -29782,7 +29974,7 @@ function processIf(node, dir, context) {
|
|
|
29782
29974
|
return () => {
|
|
29783
29975
|
onExit();
|
|
29784
29976
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29785
|
-
type:
|
|
29977
|
+
type: 15,
|
|
29786
29978
|
id
|
|
29787
29979
|
}, context.effectBoundary()), {}, {
|
|
29788
29980
|
blockShape: encodeIfBlockShape(branch, forceMultiRoot, void 0, allowNoScope),
|
|
@@ -29798,16 +29990,16 @@ function processIf(node, dir, context) {
|
|
|
29798
29990
|
let lastIfNode;
|
|
29799
29991
|
if (siblings) {
|
|
29800
29992
|
let i = siblings.length;
|
|
29801
|
-
while (i--) if (siblings[i].operation && siblings[i].operation.type ===
|
|
29993
|
+
while (i--) if (siblings[i].operation && siblings[i].operation.type === 15) {
|
|
29802
29994
|
lastIfNode = siblings[i].operation;
|
|
29803
29995
|
break;
|
|
29804
29996
|
}
|
|
29805
29997
|
}
|
|
29806
|
-
if (!siblingIf || !lastIfNode || lastIfNode.type !==
|
|
29998
|
+
if (!siblingIf || !lastIfNode || lastIfNode.type !== 15) {
|
|
29807
29999
|
context.options.onError(createCompilerError(30, node.loc));
|
|
29808
30000
|
return;
|
|
29809
30001
|
}
|
|
29810
|
-
while (lastIfNode.negative && lastIfNode.negative.type ===
|
|
30002
|
+
while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
|
|
29811
30003
|
if (dir.name === "else-if" && lastIfNode.negative) context.options.onError(createCompilerError(30, node.loc));
|
|
29812
30004
|
checkSameKey(node, context);
|
|
29813
30005
|
const comments = context.comment;
|
|
@@ -29821,7 +30013,7 @@ function processIf(node, dir, context) {
|
|
|
29821
30013
|
const [branch, onExit] = createIfBranch(node, context);
|
|
29822
30014
|
if (dir.name === "else") lastIfNode.negative = branch;
|
|
29823
30015
|
else lastIfNode.negative = {
|
|
29824
|
-
type:
|
|
30016
|
+
type: 15,
|
|
29825
30017
|
id: -1,
|
|
29826
30018
|
condition: dir.exp,
|
|
29827
30019
|
positive: branch,
|
|
@@ -29831,7 +30023,7 @@ function processIf(node, dir, context) {
|
|
|
29831
30023
|
};
|
|
29832
30024
|
return () => {
|
|
29833
30025
|
onExit();
|
|
29834
|
-
if (lastIfNode.negative.type ===
|
|
30026
|
+
if (lastIfNode.negative.type === 15) lastIfNode.negative.blockShape = encodeIfBlockShape(lastIfNode.negative.positive, forceMultiRoot, void 0, allowNoScope);
|
|
29835
30027
|
lastIfNode.blockShape = encodeIfBlockShape(lastIfNode.positive, forceMultiRoot, lastIfNode.negative, allowNoScope);
|
|
29836
30028
|
};
|
|
29837
30029
|
}
|
|
@@ -29850,12 +30042,12 @@ function createIfBranch(node, context) {
|
|
|
29850
30042
|
function encodeIfBlockShape(positive, forceMultiRoot = false, negative, allowNoScope = true) {
|
|
29851
30043
|
if (forceMultiRoot) return 10;
|
|
29852
30044
|
const positiveNoScope = allowNoScope && canSkipIfBranchScope(positive);
|
|
29853
|
-
const negativeNoScope = allowNoScope && negative && negative.type !==
|
|
30045
|
+
const negativeNoScope = allowNoScope && negative && negative.type !== 15 && canSkipIfBranchScope(negative);
|
|
29854
30046
|
return getBlockShape(positive) | getNegativeIfBranchShape(negative) << 2 | (positiveNoScope ? 32 : 0) | (negativeNoScope ? 64 : 0);
|
|
29855
30047
|
}
|
|
29856
30048
|
function getNegativeIfBranchShape(negative) {
|
|
29857
30049
|
if (!negative) return 0;
|
|
29858
|
-
return negative.type ===
|
|
30050
|
+
return negative.type === 15 ? 1 : getBlockShape(negative);
|
|
29859
30051
|
}
|
|
29860
30052
|
function canSkipIfBranchScope(block) {
|
|
29861
30053
|
if (block.effect.length || block.operation.length) return false;
|
|
@@ -29941,7 +30133,7 @@ function processFor(node, dir, context) {
|
|
|
29941
30133
|
const { parent } = context;
|
|
29942
30134
|
const isOnlyChild = parent && parent.block.node !== parent.node && parent.node.children.length === 1;
|
|
29943
30135
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29944
|
-
type:
|
|
30136
|
+
type: 16,
|
|
29945
30137
|
id
|
|
29946
30138
|
}, context.effectBoundary()), {}, {
|
|
29947
30139
|
source,
|
|
@@ -30001,7 +30193,7 @@ const transformSlotOutlet = (node, context) => {
|
|
|
30001
30193
|
if (context.options.scopeId && !context.options.slotted) flags |= 1;
|
|
30002
30194
|
if (context.inVOnce) flags |= 2;
|
|
30003
30195
|
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
30004
|
-
type:
|
|
30196
|
+
type: 13,
|
|
30005
30197
|
id
|
|
30006
30198
|
}, context.effectBoundary()), {}, {
|
|
30007
30199
|
name: slotName,
|
|
@@ -30192,6 +30384,13 @@ function hasMultipleChildren(node) {
|
|
|
30192
30384
|
return children.length !== 1;
|
|
30193
30385
|
}
|
|
30194
30386
|
//#endregion
|
|
30387
|
+
//#region packages/compiler-vapor/src/transforms/vMemo.ts
|
|
30388
|
+
const transformVMemo = (node, context) => {
|
|
30389
|
+
if (node.type !== 1) return;
|
|
30390
|
+
const memo = findDir$1(node, "memo", true);
|
|
30391
|
+
if (memo) context.options.onWarn(createVaporCompilerError(101, memo.loc));
|
|
30392
|
+
};
|
|
30393
|
+
//#endregion
|
|
30195
30394
|
//#region packages/compiler-vapor/src/compile.ts
|
|
30196
30395
|
function compile$1(source, options = {}) {
|
|
30197
30396
|
const resolvedOptions = extend({}, options);
|
|
@@ -30216,6 +30415,7 @@ function getBaseTransformPreset() {
|
|
|
30216
30415
|
transformVIf,
|
|
30217
30416
|
transformVFor,
|
|
30218
30417
|
transformKey,
|
|
30418
|
+
transformVMemo,
|
|
30219
30419
|
transformSlotOutlet,
|
|
30220
30420
|
transformTemplateRef,
|
|
30221
30421
|
transformElement,
|
|
@@ -30233,21 +30433,6 @@ function getBaseTransformPreset() {
|
|
|
30233
30433
|
}];
|
|
30234
30434
|
}
|
|
30235
30435
|
//#endregion
|
|
30236
|
-
//#region packages/compiler-vapor/src/errors.ts
|
|
30237
|
-
function createVaporCompilerError(code, loc) {
|
|
30238
|
-
return createCompilerError(code, loc, VaporErrorMessages);
|
|
30239
|
-
}
|
|
30240
|
-
const VaporErrorCodes = {
|
|
30241
|
-
"X_V_PLACEHOLDER": 100,
|
|
30242
|
-
"100": "X_V_PLACEHOLDER",
|
|
30243
|
-
"__EXTEND_POINT__": 101,
|
|
30244
|
-
"101": "__EXTEND_POINT__"
|
|
30245
|
-
};
|
|
30246
|
-
const VaporErrorMessages = {
|
|
30247
|
-
[100]: `[placeholder]`,
|
|
30248
|
-
[101]: ``
|
|
30249
|
-
};
|
|
30250
|
-
//#endregion
|
|
30251
30436
|
//#region packages/compiler-vapor/src/index.ts
|
|
30252
30437
|
var src_exports$1 = /* @__PURE__ */ __exportAll({
|
|
30253
30438
|
CodegenContext: () => CodegenContext,
|
|
@@ -30427,7 +30612,7 @@ function ssrProcessSuspense(node, context) {
|
|
|
30427
30612
|
const { slotsExp, wipSlots } = wipEntry;
|
|
30428
30613
|
for (let i = 0; i < wipSlots.length; i++) {
|
|
30429
30614
|
const slot = wipSlots[i];
|
|
30430
|
-
slot.fn.body = processChildrenAsStatement(slot, context);
|
|
30615
|
+
slot.fn.body = processChildrenAsStatement(slot, context, !!context.options.vapor);
|
|
30431
30616
|
}
|
|
30432
30617
|
context.pushStatement(createCallExpression(context.helper(SSR_RENDER_SUSPENSE), [`_push`, slotsExp]));
|
|
30433
30618
|
}
|
|
@@ -42435,6 +42620,7 @@ function resolveExt(filename, fs) {
|
|
|
42435
42620
|
const tsConfigCache = createCache();
|
|
42436
42621
|
const tsConfigRefMap = /* @__PURE__ */ new Map();
|
|
42437
42622
|
const extendedConfigCache = /* @__PURE__ */ new Map();
|
|
42623
|
+
const matcherCache = /* @__PURE__ */ new Map();
|
|
42438
42624
|
const fileToScopeCache = createCache();
|
|
42439
42625
|
const fileToGlobalScopeCache = createCache();
|
|
42440
42626
|
/**
|
|
@@ -42448,6 +42634,7 @@ function invalidateTypeCache(filename) {
|
|
|
42448
42634
|
if (filename.endsWith(".json")) {
|
|
42449
42635
|
extendedConfigCache.clear();
|
|
42450
42636
|
tsConfigCache.clear();
|
|
42637
|
+
matcherCache.clear();
|
|
42451
42638
|
}
|
|
42452
42639
|
const affectedConfig = tsConfigRefMap.get(filename);
|
|
42453
42640
|
if (affectedConfig) tsConfigCache.delete(affectedConfig);
|
|
@@ -43521,6 +43708,7 @@ function compileScript(sfc, options) {
|
|
|
43521
43708
|
if (script && scriptSetup && scriptLang !== scriptSetupLang) throw new Error("[@vue/compiler-sfc] <script> and <script setup> must have the same language type.");
|
|
43522
43709
|
if (!scriptSetup) {
|
|
43523
43710
|
if (!script) throw new Error(`[@vue/compiler-sfc] SFC contains no <script> tags.`);
|
|
43711
|
+
if (vapor) throw new Error(`[@vue/compiler-sfc] Vapor components with a normal <script> must also include <script setup>, <script vapor>, or <script setup vapor>.`);
|
|
43524
43712
|
if (script.lang && !isJSOrTS) return script;
|
|
43525
43713
|
return processNormalScript(new ScriptCompileContext(sfc, options), scopeId);
|
|
43526
43714
|
}
|
|
@@ -44047,7 +44235,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
44047
44235
|
//#endregion
|
|
44048
44236
|
//#region packages/compiler-sfc/src/index.ts
|
|
44049
44237
|
init_objectSpread2();
|
|
44050
|
-
const version = "3.6.0-rc.
|
|
44238
|
+
const version = "3.6.0-rc.11";
|
|
44051
44239
|
const parseCache = parseCache$1;
|
|
44052
44240
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
44053
44241
|
const walk = walk$2;
|