@vue/compiler-sfc 3.6.0-rc.13 → 3.6.0-rc.14
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 +2 -2
- package/dist/compiler-sfc.esm-browser.js +747 -597
- 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.14
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -16718,6 +16718,13 @@ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
|
|
|
16718
16718
|
const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
|
|
16719
16719
|
const whitespaceRE = /\s+[.[]\s*|\s*[.[]\s+/g;
|
|
16720
16720
|
const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
|
|
16721
|
+
const asciiIdentifierRE = /^[A-Za-z_$][\w$]*$/;
|
|
16722
|
+
const isReservedWord = /*@__PURE__*/ makeMap("await,break,case,catch,class,const,continue,debugger,default,delete,do,else,enum,export,extends,false,finally,for,function,if,implements,import,in,instanceof,interface,let,new,null,package,private,protected,public,return,static,super,switch,this,throw,true,try,typeof,undefined,var,void,while,with,yield");
|
|
16723
|
+
const isUnparsedIdentifier = (exp) => {
|
|
16724
|
+
if (exp.ast !== null) return false;
|
|
16725
|
+
const content = getExpSource(exp);
|
|
16726
|
+
return asciiIdentifierRE.test(content) && !isReservedWord(content);
|
|
16727
|
+
};
|
|
16721
16728
|
/**
|
|
16722
16729
|
* Simple lexer to check if an expression is a member expression. This is
|
|
16723
16730
|
* lax and only checks validity at the root level (i.e. does not validate exps
|
|
@@ -16775,6 +16782,7 @@ const isMemberExpressionBrowser = (exp) => {
|
|
|
16775
16782
|
return !currentOpenBracketCount && !currentOpenParensCount;
|
|
16776
16783
|
};
|
|
16777
16784
|
const isMemberExpressionNode = (exp, context) => {
|
|
16785
|
+
if (isUnparsedIdentifier(exp)) return true;
|
|
16778
16786
|
try {
|
|
16779
16787
|
let ret = exp.ast || (0, import_lib.parseExpression)(getExpSource(exp), { plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"] });
|
|
16780
16788
|
ret = unwrapTSNode(ret);
|
|
@@ -16787,6 +16795,7 @@ const isMemberExpression$1 = isMemberExpressionNode;
|
|
|
16787
16795
|
const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
|
|
16788
16796
|
const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
|
|
16789
16797
|
const isFnExpressionNode = (exp, context) => {
|
|
16798
|
+
if (isUnparsedIdentifier(exp)) return false;
|
|
16790
16799
|
try {
|
|
16791
16800
|
let ret = exp.ast || (0, import_lib.parseExpression)(getExpSource(exp), { plugins: context.expressionPlugins ? [...context.expressionPlugins, "typescript"] : ["typescript"] });
|
|
16792
16801
|
if (ret.type === "Program") {
|
|
@@ -25053,6 +25062,21 @@ const IRNodeTypes = {
|
|
|
25053
25062
|
var TemplateRegistry = class {
|
|
25054
25063
|
constructor() {
|
|
25055
25064
|
this.entries = [];
|
|
25065
|
+
this.indexes = /* @__PURE__ */ new Map();
|
|
25066
|
+
}
|
|
25067
|
+
intern(content, ns, root, isStatic) {
|
|
25068
|
+
const key = `${ns}:${root ? 1 : 0}${isStatic ? 1 : 0}${content}`;
|
|
25069
|
+
const existing = this.indexes.get(key);
|
|
25070
|
+
if (existing !== void 0) return existing;
|
|
25071
|
+
const index = this.entries.length;
|
|
25072
|
+
this.entries.push({
|
|
25073
|
+
content,
|
|
25074
|
+
ns,
|
|
25075
|
+
root,
|
|
25076
|
+
static: isStatic
|
|
25077
|
+
});
|
|
25078
|
+
this.indexes.set(key, index);
|
|
25079
|
+
return index;
|
|
25056
25080
|
}
|
|
25057
25081
|
keys() {
|
|
25058
25082
|
return this.entries.map(({ content }) => content);
|
|
@@ -25068,6 +25092,22 @@ const DynamicFlag = {
|
|
|
25068
25092
|
"INSERT": 4,
|
|
25069
25093
|
"4": "INSERT"
|
|
25070
25094
|
};
|
|
25095
|
+
/**
|
|
25096
|
+
* How the parent reaches a child codegen holds on to. Decided once the
|
|
25097
|
+
* parent's children are final (`planAccess`), printed by `genChildren`.
|
|
25098
|
+
*/
|
|
25099
|
+
const DynamicAccess = {
|
|
25100
|
+
"REFERENCE": 0,
|
|
25101
|
+
"0": "REFERENCE",
|
|
25102
|
+
"PLACEHOLDER": 1,
|
|
25103
|
+
"1": "PLACEHOLDER",
|
|
25104
|
+
"REUSE": 2,
|
|
25105
|
+
"2": "REUSE",
|
|
25106
|
+
"INLINE": 3,
|
|
25107
|
+
"3": "INLINE",
|
|
25108
|
+
"INLINE_REUSE": 4,
|
|
25109
|
+
"4": "INLINE_REUSE"
|
|
25110
|
+
};
|
|
25071
25111
|
function isBlockOperation(op) {
|
|
25072
25112
|
const type = op.type;
|
|
25073
25113
|
return type === 12 || type === 13 || type === 15 || type === 17 || type === 16;
|
|
@@ -25085,7 +25125,9 @@ const newBlock = (node) => ({
|
|
|
25085
25125
|
effect: [],
|
|
25086
25126
|
operation: [],
|
|
25087
25127
|
returns: [],
|
|
25088
|
-
tempId: 0
|
|
25128
|
+
tempId: 0,
|
|
25129
|
+
deferredOperationIndex: 0,
|
|
25130
|
+
deferredEffectIndex: 0
|
|
25089
25131
|
});
|
|
25090
25132
|
function wrapTemplate(node, dirs) {
|
|
25091
25133
|
if (node.tagType === 3) {
|
|
@@ -25113,8 +25155,10 @@ function wrapTemplate(node, dirs) {
|
|
|
25113
25155
|
const reserved = [];
|
|
25114
25156
|
const pass = [];
|
|
25115
25157
|
node.props.forEach((prop) => {
|
|
25116
|
-
if (prop.type === 7 && (dirs.includes(prop.name) || prop.name === "bind" && prop.arg && prop.arg.type === 4 && prop.arg.content === "key" && dirs.includes("key")))
|
|
25117
|
-
|
|
25158
|
+
if (prop.type === 7 && (dirs.includes(prop.name) || prop.name === "bind" && prop.arg && prop.arg.type === 4 && prop.arg.content === "key" && dirs.includes("key"))) {
|
|
25159
|
+
reserved.push(prop);
|
|
25160
|
+
if (prop.name === "bind" && node.tagType === 2) pass.push(prop);
|
|
25161
|
+
} else pass.push(prop);
|
|
25118
25162
|
});
|
|
25119
25163
|
return extend({}, node, {
|
|
25120
25164
|
type: 1,
|
|
@@ -25211,10 +25255,10 @@ function isBuiltInComponent(tag) {
|
|
|
25211
25255
|
else if (isTransitionGroupTag(tag)) return "VaporTransitionGroup";
|
|
25212
25256
|
}
|
|
25213
25257
|
function getBlockShape(block) {
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
return
|
|
25258
|
+
const { node } = block;
|
|
25259
|
+
if (node.type !== 1) return 1;
|
|
25260
|
+
const child = node.children.length === 1 ? node.children[0] : void 0;
|
|
25261
|
+
return child && child.type === 1 && !findDir(child, "if") ? 1 : 2;
|
|
25218
25262
|
}
|
|
25219
25263
|
/** the number of `v-if` / `v-else-if` nodes in the chain starting at `head` */
|
|
25220
25264
|
function getIfChainLength(head) {
|
|
@@ -25232,73 +25276,118 @@ function isLongIfChain(head) {
|
|
|
25232
25276
|
function isSlotTemplate(node) {
|
|
25233
25277
|
return node.type === 1 && isTemplateNode(node) && node.props.some(isVSlot);
|
|
25234
25278
|
}
|
|
25279
|
+
function isVModelOperation(oper) {
|
|
25280
|
+
return oper.type === 14 && oper.builtin === true && oper.name === "model";
|
|
25281
|
+
}
|
|
25282
|
+
function isVModelListener(oper, modelElements) {
|
|
25283
|
+
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);
|
|
25284
|
+
}
|
|
25235
25285
|
//#endregion
|
|
25236
25286
|
//#region packages/compiler-vapor/src/transform.ts
|
|
25237
25287
|
init_objectSpread2();
|
|
25238
|
-
const
|
|
25239
|
-
|
|
25288
|
+
const idWithTrailingDigitsRE = /^([A-Za-z_$][\w$]*?)(\d+)$/;
|
|
25289
|
+
function collectReservedNames(bindingMetadata) {
|
|
25290
|
+
const names = new Set(bindingMetadata ? Object.keys(bindingMetadata) : []);
|
|
25291
|
+
const ids = /* @__PURE__ */ new Map();
|
|
25292
|
+
for (const name of names) {
|
|
25293
|
+
const m = idWithTrailingDigitsRE.exec(name);
|
|
25294
|
+
if (!m) continue;
|
|
25295
|
+
let set = ids.get(m[1]);
|
|
25296
|
+
if (!set) ids.set(m[1], set = /* @__PURE__ */ new Set());
|
|
25297
|
+
set.add(Number(m[2]));
|
|
25298
|
+
}
|
|
25299
|
+
return {
|
|
25300
|
+
names,
|
|
25301
|
+
ids
|
|
25302
|
+
};
|
|
25303
|
+
}
|
|
25304
|
+
const ORDER_STRIDE = 1 << 20;
|
|
25240
25305
|
var TransformContext = class TransformContext {
|
|
25241
|
-
constructor(ir, node, options =
|
|
25306
|
+
constructor(ir, node, options = EMPTY_OBJ, parent = null, index = 0) {
|
|
25242
25307
|
this.ir = ir;
|
|
25243
25308
|
this.node = node;
|
|
25244
|
-
this.
|
|
25245
|
-
this.
|
|
25246
|
-
|
|
25247
|
-
|
|
25248
|
-
|
|
25309
|
+
this.parent = parent;
|
|
25310
|
+
this.index = index;
|
|
25311
|
+
if (parent) {
|
|
25312
|
+
this.root = parent.root;
|
|
25313
|
+
this.options = parent.options;
|
|
25314
|
+
this.selfName = parent.selfName;
|
|
25315
|
+
this.block = parent.block;
|
|
25316
|
+
this.dynamic = newDynamic();
|
|
25317
|
+
this.imports = parent.imports;
|
|
25318
|
+
this.inVOnce = parent.inVOnce && !isComponentNode(parent.node);
|
|
25319
|
+
this.inVFor = parent.inVFor;
|
|
25320
|
+
this.comment = parent.comment;
|
|
25321
|
+
this.slots = parent.slots;
|
|
25322
|
+
this.ifHeads = parent.ifHeads;
|
|
25323
|
+
this.effectOrder = parent.effectOrder;
|
|
25324
|
+
this.templateCloseTags = parent.templateCloseTags;
|
|
25325
|
+
this.templateCloseBlocks = parent.templateCloseBlocks;
|
|
25326
|
+
let effectiveParent = parent;
|
|
25327
|
+
while (effectiveParent && effectiveParent.node.type === 1 && effectiveParent.node.tagType === 3) effectiveParent = effectiveParent.parent;
|
|
25328
|
+
this.effectiveParent = effectiveParent;
|
|
25329
|
+
const childInfo = parent.getChildContextInfo();
|
|
25330
|
+
const isLastEffectiveChild = childInfo.isLastEffectiveChild[index];
|
|
25331
|
+
this.isLastEffectiveChild = isLastEffectiveChild;
|
|
25332
|
+
this.isOnRightmostPath = parent.isOnRightmostPath && isLastEffectiveChild;
|
|
25333
|
+
this.isSingleRoot = parent.isSingleRootChild(childInfo);
|
|
25334
|
+
this.isSlotRoot = parent.isSlotRootChild(childInfo);
|
|
25335
|
+
} else {
|
|
25336
|
+
this.root = this;
|
|
25337
|
+
this.options = extend({}, defaultOptions, options);
|
|
25338
|
+
this.selfName = options.filename ? getSelfName(options.filename) : null;
|
|
25339
|
+
this.block = ir.block;
|
|
25340
|
+
this.dynamic = ir.block.dynamic;
|
|
25341
|
+
this.imports = [];
|
|
25342
|
+
this.inVOnce = false;
|
|
25343
|
+
this.inVFor = 0;
|
|
25344
|
+
this.comment = [];
|
|
25345
|
+
this.slots = [];
|
|
25346
|
+
this.ifHeads = /* @__PURE__ */ new Map();
|
|
25347
|
+
this.effectOrder = /* @__PURE__ */ new Map();
|
|
25348
|
+
this.templateCloseTags = void 0;
|
|
25349
|
+
this.templateCloseBlocks = false;
|
|
25350
|
+
this.effectiveParent = null;
|
|
25351
|
+
this.isLastEffectiveChild = true;
|
|
25352
|
+
this.isOnRightmostPath = true;
|
|
25353
|
+
this.isSingleRoot = false;
|
|
25354
|
+
this.isSlotRoot = false;
|
|
25355
|
+
}
|
|
25249
25356
|
this.template = "";
|
|
25250
25357
|
this.templateRoot = false;
|
|
25251
|
-
this.templateIndexMap = /* @__PURE__ */ new Map();
|
|
25252
25358
|
this.childrenTemplate = [];
|
|
25253
|
-
this.
|
|
25254
|
-
this.
|
|
25255
|
-
this.inVOnce = false;
|
|
25256
|
-
this.inVFor = 0;
|
|
25257
|
-
this.comment = [];
|
|
25258
|
-
this.component = this.ir.component;
|
|
25259
|
-
this.directive = this.ir.directive;
|
|
25260
|
-
this.slots = [];
|
|
25359
|
+
this.component = ir.component;
|
|
25360
|
+
this.directive = ir.directive;
|
|
25261
25361
|
this.effectIndex = this.block.effect.length;
|
|
25262
25362
|
this.operationIndex = this.block.operation.length;
|
|
25263
|
-
this.isLastEffectiveChild = true;
|
|
25264
|
-
this.isOnRightmostPath = true;
|
|
25265
|
-
this.isSingleRoot = false;
|
|
25266
|
-
this.isSlotRoot = false;
|
|
25267
|
-
this.templateCloseTags = void 0;
|
|
25268
|
-
this.templateCloseBlocks = false;
|
|
25269
25363
|
this.templateScope = 0;
|
|
25364
|
+
this.ifHead = null;
|
|
25365
|
+
this.ifTail = null;
|
|
25270
25366
|
this.globalId = 0;
|
|
25271
25367
|
this.nextIdMap = null;
|
|
25272
25368
|
this.ifIndex = 0;
|
|
25273
|
-
this.
|
|
25274
|
-
this.
|
|
25275
|
-
|
|
25276
|
-
|
|
25277
|
-
return id;
|
|
25278
|
-
};
|
|
25279
|
-
this.options = extend({}, defaultOptions, options);
|
|
25280
|
-
this.root = this;
|
|
25281
|
-
if (options.filename) this.selfName = getSelfName(options.filename);
|
|
25282
|
-
this.initNextIdMap();
|
|
25369
|
+
this.nextOrder = 0;
|
|
25370
|
+
this.childInfo = null;
|
|
25371
|
+
this.order = this.allocateOrder();
|
|
25372
|
+
if (!parent) this.initNextIdMap();
|
|
25283
25373
|
}
|
|
25284
25374
|
enterBlock(ir, isVFor = false) {
|
|
25285
|
-
const { block, template, templateRoot,
|
|
25375
|
+
const { block, template, templateRoot, dynamic, childrenTemplate, slots, effectIndex, operationIndex } = this;
|
|
25286
25376
|
this.block = ir;
|
|
25287
25377
|
this.dynamic = ir.dynamic;
|
|
25288
25378
|
this.template = "";
|
|
25289
25379
|
this.templateRoot = false;
|
|
25290
|
-
this.templateIndexMap = templateIndexMap;
|
|
25291
25380
|
this.childrenTemplate = [];
|
|
25292
25381
|
this.slots = [];
|
|
25293
25382
|
this.effectIndex = ir.effect.length;
|
|
25294
25383
|
this.operationIndex = ir.operation.length;
|
|
25295
25384
|
isVFor && this.inVFor++;
|
|
25296
25385
|
return () => {
|
|
25386
|
+
this.finalizeBlock(ir);
|
|
25297
25387
|
this.registerTemplate();
|
|
25298
25388
|
this.block = block;
|
|
25299
25389
|
this.template = template;
|
|
25300
25390
|
this.templateRoot = templateRoot;
|
|
25301
|
-
this.templateIndexMap = templateIndexMap;
|
|
25302
25391
|
this.dynamic = dynamic;
|
|
25303
25392
|
this.childrenTemplate = childrenTemplate;
|
|
25304
25393
|
this.slots = slots;
|
|
@@ -25307,17 +25396,26 @@ var TransformContext = class TransformContext {
|
|
|
25307
25396
|
isVFor && this.inVFor--;
|
|
25308
25397
|
};
|
|
25309
25398
|
}
|
|
25399
|
+
allocateOrder() {
|
|
25400
|
+
const root = this.root;
|
|
25401
|
+
const order = root.nextOrder;
|
|
25402
|
+
root.nextOrder += ORDER_STRIDE;
|
|
25403
|
+
return order;
|
|
25404
|
+
}
|
|
25405
|
+
increaseId() {
|
|
25406
|
+
const root = this.root;
|
|
25407
|
+
const id = getNextId(root.nextIdMap, root.globalId);
|
|
25408
|
+
root.globalId = getNextId(root.nextIdMap, id + 1);
|
|
25409
|
+
return id;
|
|
25410
|
+
}
|
|
25310
25411
|
initNextIdMap() {
|
|
25311
|
-
const
|
|
25312
|
-
|
|
25313
|
-
|
|
25314
|
-
|
|
25315
|
-
|
|
25316
|
-
|
|
25317
|
-
|
|
25318
|
-
if (m) numbers.add(Number(m[1]));
|
|
25319
|
-
}
|
|
25320
|
-
if (numbers.size === 0) return;
|
|
25412
|
+
const { ids } = this.ir.reservedNames;
|
|
25413
|
+
const numbers = [
|
|
25414
|
+
...ids.get("n") || [],
|
|
25415
|
+
...ids.get("x") || [],
|
|
25416
|
+
...ids.get("r") || []
|
|
25417
|
+
];
|
|
25418
|
+
if (numbers.length === 0) return;
|
|
25321
25419
|
this.globalId = getNextId(this.nextIdMap = buildNextIdMap(numbers), 0);
|
|
25322
25420
|
}
|
|
25323
25421
|
reference() {
|
|
@@ -25326,8 +25424,9 @@ var TransformContext = class TransformContext {
|
|
|
25326
25424
|
return this.dynamic.id = this.increaseId();
|
|
25327
25425
|
}
|
|
25328
25426
|
nextIfIndex(count = 1) {
|
|
25329
|
-
const
|
|
25330
|
-
|
|
25427
|
+
const root = this.root;
|
|
25428
|
+
const index = root.ifIndex;
|
|
25429
|
+
root.ifIndex += count;
|
|
25331
25430
|
return index;
|
|
25332
25431
|
}
|
|
25333
25432
|
getTemplateNamespace() {
|
|
@@ -25343,24 +25442,7 @@ var TransformContext = class TransformContext {
|
|
|
25343
25442
|
return this.node.type === 1 && this.node.tagType === 0 && !(this.options.isCustomElement(this.node.tag) || this.node.tag === "template");
|
|
25344
25443
|
}
|
|
25345
25444
|
pushTemplate(content, { root = false, static: isStatic = false } = {}) {
|
|
25346
|
-
|
|
25347
|
-
this.getTemplateNamespace(),
|
|
25348
|
-
root,
|
|
25349
|
-
isStatic,
|
|
25350
|
-
content
|
|
25351
|
-
]);
|
|
25352
|
-
const existingIndex = this.templateIndexMap.get(templateKey);
|
|
25353
|
-
if (existingIndex !== void 0) return existingIndex;
|
|
25354
|
-
const ns = this.getTemplateNamespace();
|
|
25355
|
-
const newIndex = this.ir.template.entries.length;
|
|
25356
|
-
this.ir.template.entries.push({
|
|
25357
|
-
content,
|
|
25358
|
-
ns,
|
|
25359
|
-
root,
|
|
25360
|
-
static: isStatic
|
|
25361
|
-
});
|
|
25362
|
-
this.templateIndexMap.set(templateKey, newIndex);
|
|
25363
|
-
return newIndex;
|
|
25445
|
+
return this.ir.template.intern(content, this.getTemplateNamespace(), root, isStatic);
|
|
25364
25446
|
}
|
|
25365
25447
|
registerTemplate() {
|
|
25366
25448
|
if (!this.template) return -1;
|
|
@@ -25370,8 +25452,8 @@ var TransformContext = class TransformContext {
|
|
|
25370
25452
|
});
|
|
25371
25453
|
return this.dynamic.template = id;
|
|
25372
25454
|
}
|
|
25373
|
-
registerEffect(expressions, operation,
|
|
25374
|
-
const operations = [operation]
|
|
25455
|
+
registerEffect(expressions, operation, getOrder, preserveOrder = false) {
|
|
25456
|
+
const operations = isArray$3(operation) ? operation : [operation];
|
|
25375
25457
|
expressions = expressions.filter((exp) => !isConstantExpression(exp, this.root.options.bindingMetadata));
|
|
25376
25458
|
const once = expressions.every((e) => isConstantBinding$1(e, this.root.options.bindingMetadata));
|
|
25377
25459
|
const needsEffect = operations.some((op) => op.type === 4 && op.listeners);
|
|
@@ -25379,12 +25461,12 @@ var TransformContext = class TransformContext {
|
|
|
25379
25461
|
this.registerOperation(...operations);
|
|
25380
25462
|
return false;
|
|
25381
25463
|
}
|
|
25382
|
-
const
|
|
25383
|
-
this.block.effect.splice(index, 0, _objectSpread2({
|
|
25464
|
+
const effect = _objectSpread2({
|
|
25384
25465
|
expressions,
|
|
25385
25466
|
operations
|
|
25386
|
-
}, once && !needsEffect ? { once: true } : {})
|
|
25387
|
-
|
|
25467
|
+
}, once && !needsEffect ? { once: true } : {});
|
|
25468
|
+
this.effectOrder.set(effect, getOrder ? getOrder() : this.allocateOrder());
|
|
25469
|
+
this.block.effect.push(effect);
|
|
25388
25470
|
return true;
|
|
25389
25471
|
}
|
|
25390
25472
|
registerOperation(...node) {
|
|
@@ -25393,43 +25475,58 @@ var TransformContext = class TransformContext {
|
|
|
25393
25475
|
effectBoundary() {
|
|
25394
25476
|
return {
|
|
25395
25477
|
operationIndex: this.operationIndex,
|
|
25396
|
-
effectIndex: this.
|
|
25478
|
+
effectIndex: this.order
|
|
25397
25479
|
};
|
|
25398
25480
|
}
|
|
25399
|
-
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
|
|
25403
|
-
const
|
|
25404
|
-
const
|
|
25405
|
-
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
25422
|
-
|
|
25423
|
-
|
|
25424
|
-
|
|
25425
|
-
|
|
25426
|
-
|
|
25427
|
-
|
|
25481
|
+
finalizeBlock(block) {
|
|
25482
|
+
const { effect, operation } = block;
|
|
25483
|
+
const { effectOrder } = this;
|
|
25484
|
+
effect.sort((a, b) => effectOrder.get(a) - effectOrder.get(b));
|
|
25485
|
+
const modelElements = /* @__PURE__ */ new Set();
|
|
25486
|
+
for (const oper of operation) if (isVModelOperation(oper)) modelElements.add(oper.element);
|
|
25487
|
+
let operationIndexes;
|
|
25488
|
+
if (modelElements.size) {
|
|
25489
|
+
const immediate = [];
|
|
25490
|
+
const models = [];
|
|
25491
|
+
const listeners = [];
|
|
25492
|
+
operationIndexes = [];
|
|
25493
|
+
for (const oper of operation) {
|
|
25494
|
+
operationIndexes.push(immediate.length);
|
|
25495
|
+
(isVModelOperation(oper) ? models : isVModelListener(oper, modelElements) ? listeners : immediate).push(oper);
|
|
25496
|
+
}
|
|
25497
|
+
operationIndexes.push(immediate.length);
|
|
25498
|
+
operation.length = 0;
|
|
25499
|
+
operation.push(...immediate, ...models, ...listeners);
|
|
25500
|
+
block.deferredOperationIndex = immediate.length;
|
|
25501
|
+
const immediateEffects = [];
|
|
25502
|
+
const listenerEffects = [];
|
|
25503
|
+
for (const e of effect) (e.operations.every((oper) => isVModelListener(oper, modelElements)) ? listenerEffects : immediateEffects).push(e);
|
|
25504
|
+
effect.length = 0;
|
|
25505
|
+
effect.push(...immediateEffects, ...listenerEffects);
|
|
25506
|
+
block.deferredEffectIndex = immediateEffects.length;
|
|
25507
|
+
} else {
|
|
25508
|
+
block.deferredOperationIndex = operation.length;
|
|
25509
|
+
block.deferredEffectIndex = effect.length;
|
|
25510
|
+
}
|
|
25511
|
+
const resolveBoundaries = (dynamic) => {
|
|
25512
|
+
const oper = dynamic.operation;
|
|
25513
|
+
if (oper && isBlockOperation(oper) && oper.effectIndex !== void 0) {
|
|
25514
|
+
let lo = 0;
|
|
25515
|
+
let hi = block.deferredEffectIndex;
|
|
25516
|
+
while (lo < hi) {
|
|
25517
|
+
const mid = lo + hi >> 1;
|
|
25518
|
+
if (effectOrder.get(effect[mid]) < oper.effectIndex) lo = mid + 1;
|
|
25519
|
+
else hi = mid;
|
|
25520
|
+
}
|
|
25521
|
+
oper.effectIndex = lo;
|
|
25522
|
+
if (operationIndexes) oper.operationIndex = operationIndexes[oper.operationIndex];
|
|
25523
|
+
}
|
|
25524
|
+
for (const child of dynamic.children) resolveBoundaries(child);
|
|
25525
|
+
};
|
|
25526
|
+
resolveBoundaries(block.dynamic);
|
|
25428
25527
|
}
|
|
25429
|
-
|
|
25430
|
-
|
|
25431
|
-
if (operation && isBlockOperation(operation) && operation.effectIndex !== void 0 && operation.effectIndex >= index) operation.effectIndex++;
|
|
25432
|
-
for (const child of dynamic.children) this.shiftEffectBoundaries(index, child);
|
|
25528
|
+
create(node, index) {
|
|
25529
|
+
return new TransformContext(this.ir, node, EMPTY_OBJ, this, index);
|
|
25433
25530
|
}
|
|
25434
25531
|
getChildContextInfo() {
|
|
25435
25532
|
const node = this.node;
|
|
@@ -25439,7 +25536,7 @@ var TransformContext = class TransformContext {
|
|
|
25439
25536
|
hasSingleSlotRootChild: false,
|
|
25440
25537
|
isLastEffectiveChild: []
|
|
25441
25538
|
};
|
|
25442
|
-
const cached =
|
|
25539
|
+
const cached = this.childInfo;
|
|
25443
25540
|
if (cached && cached.node === node) return cached;
|
|
25444
25541
|
const { children } = node;
|
|
25445
25542
|
const isLastEffectiveChild = new Array(children.length);
|
|
@@ -25455,7 +25552,7 @@ var TransformContext = class TransformContext {
|
|
|
25455
25552
|
hasSingleSlotRootChild: node.type === 1 && node.tagType === 1 && !isBuiltInComponent(node.tag) && (children.some(isSlotTemplate) ? hasSingleRootChild(children.filter((child) => !isSlotTemplate(child))) : hasSingleRoot),
|
|
25456
25553
|
isLastEffectiveChild
|
|
25457
25554
|
};
|
|
25458
|
-
|
|
25555
|
+
this.childInfo = childInfo;
|
|
25459
25556
|
return childInfo;
|
|
25460
25557
|
}
|
|
25461
25558
|
isSlotRootChild(childInfo) {
|
|
@@ -25528,12 +25625,15 @@ function transform(node, options = {}) {
|
|
|
25528
25625
|
component: /* @__PURE__ */ new Set(),
|
|
25529
25626
|
directive: /* @__PURE__ */ new Set(),
|
|
25530
25627
|
block: newBlock(node),
|
|
25531
|
-
hasTemplateRef: false
|
|
25628
|
+
hasTemplateRef: false,
|
|
25629
|
+
reservedNames: collectReservedNames(options.bindingMetadata)
|
|
25532
25630
|
};
|
|
25533
25631
|
const context = new TransformContext(ir, node, options);
|
|
25534
25632
|
transformNode(context);
|
|
25535
25633
|
finalizeIfChains(context);
|
|
25634
|
+
context.finalizeBlock(ir.block);
|
|
25536
25635
|
ir.node.imports = context.imports;
|
|
25636
|
+
ir.node.transformed = true;
|
|
25537
25637
|
return ir;
|
|
25538
25638
|
}
|
|
25539
25639
|
function finalizeIfChains(context) {
|
|
@@ -25615,7 +25715,7 @@ function isComponentNode(node) {
|
|
|
25615
25715
|
* effects at a v-once site has them run once like compiled ones do.
|
|
25616
25716
|
*/
|
|
25617
25717
|
function genOnce(call, context) {
|
|
25618
|
-
return genCall(context.helper("withOnce"), ["() => ",
|
|
25718
|
+
return genCall(context.helper("withOnce"), ["() => ", call]);
|
|
25619
25719
|
}
|
|
25620
25720
|
const IMPORT_EXP_START = "__IMPORT_EXP_START__";
|
|
25621
25721
|
const IMPORT_EXP_END = "__IMPORT_EXP_END__";
|
|
@@ -25625,6 +25725,9 @@ const NEWLINE = Symbol(`newline`);
|
|
|
25625
25725
|
const LF = Symbol(`line feed`);
|
|
25626
25726
|
const INDENT_START = Symbol(`indent start`);
|
|
25627
25727
|
const INDENT_END = Symbol(`indent end`);
|
|
25728
|
+
function isNestedFragments(frag) {
|
|
25729
|
+
return isArray$3(frag) && typeof frag[1] !== "number";
|
|
25730
|
+
}
|
|
25628
25731
|
function buildCodeFragment(...frag) {
|
|
25629
25732
|
return [
|
|
25630
25733
|
frag,
|
|
@@ -25633,21 +25736,24 @@ function buildCodeFragment(...frag) {
|
|
|
25633
25736
|
];
|
|
25634
25737
|
}
|
|
25635
25738
|
function genMulti([left, right, seg, placeholder], ...frags) {
|
|
25636
|
-
|
|
25637
|
-
|
|
25638
|
-
|
|
25639
|
-
} else frags = frags.filter(Boolean);
|
|
25640
|
-
const frag = [];
|
|
25641
|
-
push(left);
|
|
25642
|
-
for (let [i, fn] of frags.entries()) {
|
|
25643
|
-
push(fn);
|
|
25644
|
-
if (i < frags.length - 1) push(seg);
|
|
25645
|
-
}
|
|
25646
|
-
push(right);
|
|
25739
|
+
const frag = [left];
|
|
25740
|
+
pushJoined(frag, frags, seg, placeholder);
|
|
25741
|
+
frag.push(right);
|
|
25647
25742
|
return frag;
|
|
25648
|
-
|
|
25649
|
-
|
|
25650
|
-
|
|
25743
|
+
}
|
|
25744
|
+
function pushJoined(frag, frags, seg, placeholder) {
|
|
25745
|
+
let end = frags.length;
|
|
25746
|
+
if (placeholder) while (end > 0 && !frags[end - 1]) end--;
|
|
25747
|
+
let first = true;
|
|
25748
|
+
for (let i = 0; i < end; i++) {
|
|
25749
|
+
let fn = frags[i];
|
|
25750
|
+
if (!fn) {
|
|
25751
|
+
if (!placeholder) continue;
|
|
25752
|
+
fn = placeholder;
|
|
25753
|
+
}
|
|
25754
|
+
if (!first) frag.push(seg);
|
|
25755
|
+
frag.push(fn);
|
|
25756
|
+
first = false;
|
|
25651
25757
|
}
|
|
25652
25758
|
}
|
|
25653
25759
|
const DELIMITERS_ARRAY = [
|
|
@@ -25688,12 +25794,12 @@ const DELIMITERS_OBJECT_NEWLINE = [
|
|
|
25688
25794
|
];
|
|
25689
25795
|
function genCall(name, ...frags) {
|
|
25690
25796
|
const hasPlaceholder = isArray$3(name);
|
|
25691
|
-
|
|
25692
|
-
|
|
25693
|
-
|
|
25694
|
-
|
|
25695
|
-
|
|
25696
|
-
|
|
25797
|
+
const fnName = hasPlaceholder ? name[0] : name;
|
|
25798
|
+
const placeholder = hasPlaceholder ? name[1] : "null";
|
|
25799
|
+
const frag = [fnName, "("];
|
|
25800
|
+
pushJoined(frag, frags, ", ", placeholder);
|
|
25801
|
+
frag.push(")");
|
|
25802
|
+
return frag;
|
|
25697
25803
|
}
|
|
25698
25804
|
function getParserOptions(plugins) {
|
|
25699
25805
|
return { plugins: plugins ? plugins.some((plugin) => plugin === "typescript") ? plugins : [...plugins, "typescript"] : ["typescript"] };
|
|
@@ -25713,40 +25819,58 @@ function codeFragmentToString(code, context) {
|
|
|
25713
25819
|
offset: 0
|
|
25714
25820
|
};
|
|
25715
25821
|
let indentLevel = 0;
|
|
25716
|
-
|
|
25717
|
-
|
|
25718
|
-
|
|
25719
|
-
|
|
25720
|
-
|
|
25721
|
-
|
|
25722
|
-
|
|
25723
|
-
|
|
25724
|
-
|
|
25725
|
-
|
|
25726
|
-
|
|
25727
|
-
|
|
25728
|
-
|
|
25729
|
-
|
|
25730
|
-
|
|
25731
|
-
|
|
25732
|
-
|
|
25733
|
-
|
|
25734
|
-
|
|
25735
|
-
if (
|
|
25736
|
-
|
|
25822
|
+
emit(code);
|
|
25823
|
+
return [codegen, map];
|
|
25824
|
+
function emit(code) {
|
|
25825
|
+
for (let frag of code) {
|
|
25826
|
+
if (!frag) continue;
|
|
25827
|
+
if (isNestedFragments(frag)) {
|
|
25828
|
+
emit(frag);
|
|
25829
|
+
continue;
|
|
25830
|
+
}
|
|
25831
|
+
let code;
|
|
25832
|
+
let newlineIndex = -2;
|
|
25833
|
+
let loc;
|
|
25834
|
+
let name;
|
|
25835
|
+
if (frag === NEWLINE) {
|
|
25836
|
+
code = `\n${` `.repeat(indentLevel)}`;
|
|
25837
|
+
newlineIndex = 0;
|
|
25838
|
+
} else if (frag === INDENT_START) {
|
|
25839
|
+
indentLevel++;
|
|
25840
|
+
continue;
|
|
25841
|
+
} else if (frag === INDENT_END) {
|
|
25842
|
+
indentLevel--;
|
|
25843
|
+
continue;
|
|
25844
|
+
} else if (frag === LF) {
|
|
25845
|
+
pos.line++;
|
|
25846
|
+
pos.column = 0;
|
|
25847
|
+
pos.offset++;
|
|
25848
|
+
continue;
|
|
25849
|
+
} else if (isString$1(frag)) code = frag;
|
|
25737
25850
|
else {
|
|
25738
|
-
|
|
25739
|
-
|
|
25851
|
+
const mapped = frag;
|
|
25852
|
+
code = mapped[0];
|
|
25853
|
+
newlineIndex = mapped[1];
|
|
25854
|
+
loc = mapped[2];
|
|
25855
|
+
name = mapped[3];
|
|
25856
|
+
}
|
|
25857
|
+
codegen += code;
|
|
25858
|
+
if (map) {
|
|
25859
|
+
if (loc) addMapping(loc.start, name);
|
|
25860
|
+
if (newlineIndex === -3) advancePositionWithMutation(pos, code);
|
|
25740
25861
|
else {
|
|
25741
|
-
|
|
25742
|
-
pos.
|
|
25743
|
-
|
|
25862
|
+
pos.offset += code.length;
|
|
25863
|
+
if (newlineIndex === -2) pos.column += code.length;
|
|
25864
|
+
else {
|
|
25865
|
+
if (newlineIndex === -1) newlineIndex = code.length - 1;
|
|
25866
|
+
pos.line++;
|
|
25867
|
+
pos.column = code.length - newlineIndex;
|
|
25868
|
+
}
|
|
25744
25869
|
}
|
|
25870
|
+
if (loc && loc !== locStub) addMapping(loc.end);
|
|
25745
25871
|
}
|
|
25746
|
-
if (loc && loc !== locStub) addMapping(loc.end);
|
|
25747
25872
|
}
|
|
25748
25873
|
}
|
|
25749
|
-
return [codegen, map];
|
|
25750
25874
|
function addMapping(loc, name = null) {
|
|
25751
25875
|
const { _names, _mappings } = map;
|
|
25752
25876
|
if (name !== null && !_names.has(name)) _names.add(name);
|
|
@@ -25769,7 +25893,7 @@ function genFlags(flags, names) {
|
|
|
25769
25893
|
function genInsertNode({ parent, elements, anchor }, { helper }) {
|
|
25770
25894
|
let element = elements.map((el) => `n${el}`).join(", ");
|
|
25771
25895
|
if (elements.length > 1) element = `[${element}]`;
|
|
25772
|
-
return [NEWLINE,
|
|
25896
|
+
return [NEWLINE, genCall(helper("insert"), element, `n${parent}`, anchor === void 0 ? void 0 : `n${anchor}`)];
|
|
25773
25897
|
}
|
|
25774
25898
|
//#endregion
|
|
25775
25899
|
//#region packages/compiler-vapor/src/generators/expression.ts
|
|
@@ -25825,7 +25949,7 @@ function genExpression(node, context, assignment, asParams = false) {
|
|
|
25825
25949
|
if (start < lastEnd) return;
|
|
25826
25950
|
const leadingText = content.slice(lastEnd, start);
|
|
25827
25951
|
if (leadingText.length) push([leadingText, -3]);
|
|
25828
|
-
push(
|
|
25952
|
+
push(genIdentifier(asParams ? id.name : source, context, {
|
|
25829
25953
|
start: advancePositionWithClone(node.loc.start, source, start),
|
|
25830
25954
|
end: advancePositionWithClone(node.loc.start, source, end),
|
|
25831
25955
|
source
|
|
@@ -25867,7 +25991,7 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25867
25991
|
]];
|
|
25868
25992
|
} else {
|
|
25869
25993
|
const exp = genExpression(replacement, context, assignment);
|
|
25870
|
-
if (parent && parent.type === "ObjectProperty" && parent.shorthand) return [`${name}: `,
|
|
25994
|
+
if (parent && parent.type === "ObjectProperty" && parent.shorthand) return [`${name}: `, exp];
|
|
25871
25995
|
return exp;
|
|
25872
25996
|
}
|
|
25873
25997
|
}
|
|
@@ -25896,7 +26020,7 @@ function genIdentifier(raw, context, loc, assignment, id, parent, parentStack, s
|
|
|
25896
26020
|
return [
|
|
25897
26021
|
prefix,
|
|
25898
26022
|
`${helper("isRef")}(${raw}) ? ${raw}.value ${operator} `,
|
|
25899
|
-
|
|
26023
|
+
genExpression(rightExp, context),
|
|
25900
26024
|
` : `,
|
|
25901
26025
|
[
|
|
25902
26026
|
raw,
|
|
@@ -26282,14 +26406,14 @@ function genDeclarations(declarations, context, shouldDeclare) {
|
|
|
26282
26406
|
if (isIdentifier) {
|
|
26283
26407
|
const varName = ids[name] = context.getUniqueLocalName(`_${name}`, varNames);
|
|
26284
26408
|
if (shouldDeclare) push(`const `);
|
|
26285
|
-
push(`${varName} = `,
|
|
26409
|
+
push(`${varName} = `, genExpression(value, context), NEWLINE);
|
|
26286
26410
|
}
|
|
26287
26411
|
});
|
|
26288
26412
|
declarations.forEach(({ name, isIdentifier, value }) => {
|
|
26289
26413
|
if (!isIdentifier) {
|
|
26290
26414
|
const varName = context.getUniqueLocalName(`_${name}`, varNames);
|
|
26291
26415
|
if (shouldDeclare) push(`const `);
|
|
26292
|
-
push(`${varName} = `,
|
|
26416
|
+
push(`${varName} = `, context.withId(() => genExpression(value, context), ids), NEWLINE);
|
|
26293
26417
|
ids[name] = varName;
|
|
26294
26418
|
}
|
|
26295
26419
|
});
|
|
@@ -26370,19 +26494,19 @@ function genSetEvent(oper, context) {
|
|
|
26370
26494
|
if (!context.block.operation.some(isSameDelegateEvent)) return [
|
|
26371
26495
|
NEWLINE,
|
|
26372
26496
|
`n${element}.$evt${key.content} = `,
|
|
26373
|
-
|
|
26497
|
+
genDirectHandler()
|
|
26374
26498
|
];
|
|
26375
26499
|
}
|
|
26376
26500
|
const name = genName();
|
|
26377
26501
|
const eventOptions = genEventOptions();
|
|
26378
|
-
return [NEWLINE,
|
|
26502
|
+
return [NEWLINE, genCall(helper(effect ? "onBinding" : delegate ? "delegate" : "on"), `n${element}`, name, genHandler(), eventOptions)];
|
|
26379
26503
|
function genHandler() {
|
|
26380
26504
|
return handler || (handler = genEventHandler(context, [value], modifiers, { hoisted: oper }));
|
|
26381
26505
|
}
|
|
26382
26506
|
function genInvoker() {
|
|
26383
26507
|
return [
|
|
26384
26508
|
`${helper("createInvoker")}(`,
|
|
26385
|
-
|
|
26509
|
+
genHandler(),
|
|
26386
26510
|
`)`
|
|
26387
26511
|
];
|
|
26388
26512
|
}
|
|
@@ -26396,13 +26520,13 @@ function genSetEvent(oper, context) {
|
|
|
26396
26520
|
const replacement = JSON.stringify(keyOverride[1]);
|
|
26397
26521
|
const wrapped = [
|
|
26398
26522
|
"(",
|
|
26399
|
-
|
|
26523
|
+
expr,
|
|
26400
26524
|
")"
|
|
26401
26525
|
];
|
|
26402
26526
|
return [
|
|
26403
|
-
|
|
26527
|
+
wrapped,
|
|
26404
26528
|
` === ${find} ? ${replacement} : `,
|
|
26405
|
-
|
|
26529
|
+
wrapped
|
|
26406
26530
|
];
|
|
26407
26531
|
} else return genExpression(key, context);
|
|
26408
26532
|
}
|
|
@@ -26417,15 +26541,14 @@ function genSetEvent(oper, context) {
|
|
|
26417
26541
|
}
|
|
26418
26542
|
function genSetDynamicEvents(oper, context) {
|
|
26419
26543
|
const { helper } = context;
|
|
26420
|
-
return [NEWLINE,
|
|
26544
|
+
return [NEWLINE, genCall(helper("setDynamicEvents"), `n${oper.element}`, genExpression(oper.event, context))];
|
|
26421
26545
|
}
|
|
26422
|
-
const hoistedHandlers = /* @__PURE__ */ new WeakMap();
|
|
26423
26546
|
function genHoistedHandlers(effects, context) {
|
|
26424
26547
|
const [frag, push] = buildCodeFragment();
|
|
26425
26548
|
const declare = (node, key, values, modifiers) => {
|
|
26426
26549
|
const name = getUniqueHandlerName(context, `_on_${key.content.replace(/-/g, "_")}`);
|
|
26427
|
-
hoistedHandlers.set(node, name);
|
|
26428
|
-
push(NEWLINE, `const ${name} = `,
|
|
26550
|
+
context.hoistedHandlers.set(node, name);
|
|
26551
|
+
push(NEWLINE, `const ${name} = `, genEventHandler(context, values, modifiers));
|
|
26429
26552
|
};
|
|
26430
26553
|
for (const { operations } of effects) for (const oper of operations) if (oper.type === 7) declare(oper, oper.key, [oper.value], oper.modifiers);
|
|
26431
26554
|
else if (oper.type === 4) for (const props of oper.props) {
|
|
@@ -26442,7 +26565,7 @@ function genEventHandler(context, values, modifiers = {
|
|
|
26442
26565
|
keys: []
|
|
26443
26566
|
}, options = {}) {
|
|
26444
26567
|
const { asComponentProp = false, extraWrap = false, modifierHelper = "runtime", hoisted } = options;
|
|
26445
|
-
const hoistedName = hoisted && hoistedHandlers.get(hoisted);
|
|
26568
|
+
const hoistedName = hoisted && context.hoistedHandlers.get(hoisted);
|
|
26446
26569
|
if (hoistedName) return [hoistedName];
|
|
26447
26570
|
const useVaporModifierHelper = modifierHelper === "vapor";
|
|
26448
26571
|
let handlerExp = [];
|
|
@@ -26457,7 +26580,7 @@ function genEventHandler(context, values, modifiers = {
|
|
|
26457
26580
|
exp = [
|
|
26458
26581
|
`e => `,
|
|
26459
26582
|
isTSNode ? "(" : "",
|
|
26460
|
-
|
|
26583
|
+
exp,
|
|
26461
26584
|
isTSNode ? ")" : "",
|
|
26462
26585
|
`(e)`
|
|
26463
26586
|
];
|
|
@@ -26470,16 +26593,16 @@ function genEventHandler(context, values, modifiers = {
|
|
|
26470
26593
|
exp = [
|
|
26471
26594
|
referencesEvent ? "$event => " : "() => ",
|
|
26472
26595
|
hasMultipleStatements ? "{" : "(",
|
|
26473
|
-
|
|
26596
|
+
expr,
|
|
26474
26597
|
hasMultipleStatements ? "}" : ")"
|
|
26475
26598
|
];
|
|
26476
26599
|
}
|
|
26477
|
-
handlerExp = handlerExp.concat([index !== 0 ? ", " : "",
|
|
26600
|
+
handlerExp = handlerExp.concat([index !== 0 ? ", " : "", exp]);
|
|
26478
26601
|
}
|
|
26479
26602
|
});
|
|
26480
26603
|
if (values.length > 1) handlerExp = [
|
|
26481
26604
|
"[",
|
|
26482
|
-
|
|
26605
|
+
handlerExp,
|
|
26483
26606
|
"]"
|
|
26484
26607
|
];
|
|
26485
26608
|
}
|
|
@@ -26508,7 +26631,7 @@ function genFor(oper, context) {
|
|
|
26508
26631
|
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot, wrappedRows } = oper;
|
|
26509
26632
|
const sourceExpr = [
|
|
26510
26633
|
"() => (",
|
|
26511
|
-
|
|
26634
|
+
genExpression(source, context),
|
|
26512
26635
|
")"
|
|
26513
26636
|
];
|
|
26514
26637
|
const plugins = context.options.expressionPlugins;
|
|
@@ -26537,23 +26660,23 @@ function genFor(oper, context) {
|
|
|
26537
26660
|
const selectorName = (i) => selectorPatterns.length > 1 ? `_selector${id}_${i}` : `_selector${id}`;
|
|
26538
26661
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
26539
26662
|
const { selector } = selectorPatterns[i];
|
|
26540
|
-
selectorDeclarations.push(`const ${selectorName(i)} = `,
|
|
26663
|
+
selectorDeclarations.push(`const ${selectorName(i)} = `, genCall(helper("createSelector"), [`() => `, genExpression(selector, context)]), NEWLINE);
|
|
26541
26664
|
}
|
|
26542
26665
|
const blockFn = context.withId(() => {
|
|
26543
26666
|
const frag = [];
|
|
26544
|
-
frag.push("(",
|
|
26545
|
-
if (selectorPatterns.length || keyOnlyBindingPatterns.length) frag.push(
|
|
26667
|
+
frag.push("(", args, ") => {", INDENT_START);
|
|
26668
|
+
if (selectorPatterns.length || keyOnlyBindingPatterns.length) frag.push(genBlockContent(render, context, false, () => {
|
|
26546
26669
|
const patternFrag = [];
|
|
26547
26670
|
for (let i = 0; i < selectorPatterns.length; i++) {
|
|
26548
26671
|
const { effect } = selectorPatterns[i];
|
|
26549
|
-
patternFrag.push(NEWLINE, `${selectorName(i)}(`,
|
|
26550
|
-
for (const oper of effect.operations) patternFrag.push(
|
|
26672
|
+
patternFrag.push(NEWLINE, `${selectorName(i)}(`, genExpression(keyProp, context), `, () => {`, INDENT_START);
|
|
26673
|
+
for (const oper of effect.operations) patternFrag.push(genOperation(oper, context));
|
|
26551
26674
|
patternFrag.push(INDENT_END, NEWLINE, `})`);
|
|
26552
26675
|
}
|
|
26553
|
-
for (const { effect } of keyOnlyBindingPatterns) for (const oper of effect.operations) patternFrag.push(
|
|
26676
|
+
for (const { effect } of keyOnlyBindingPatterns) for (const oper of effect.operations) patternFrag.push(genOperation(oper, context));
|
|
26554
26677
|
return patternFrag;
|
|
26555
26678
|
}, skippedEffectIndexes));
|
|
26556
|
-
else frag.push(
|
|
26679
|
+
else frag.push(genBlockContent(render, context));
|
|
26557
26680
|
frag.push(INDENT_END, NEWLINE, "}");
|
|
26558
26681
|
return frag;
|
|
26559
26682
|
}, idMap);
|
|
@@ -26563,17 +26686,17 @@ function genFor(oper, context) {
|
|
|
26563
26686
|
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
26564
26687
|
return [
|
|
26565
26688
|
NEWLINE,
|
|
26566
|
-
|
|
26689
|
+
selectorDeclarations,
|
|
26567
26690
|
`const n${id} = `,
|
|
26568
|
-
|
|
26569
|
-
|
|
26691
|
+
genCall([helper("createFor"), "undefined"], sourceExpr, blockFn, genCallback(keyProp), flags),
|
|
26692
|
+
onResetCalls
|
|
26570
26693
|
];
|
|
26571
26694
|
function genCallback(expr) {
|
|
26572
26695
|
if (!expr) return false;
|
|
26573
26696
|
return context.withId(() => [
|
|
26574
|
-
|
|
26697
|
+
genAliasParams(value, key, index, context),
|
|
26575
26698
|
" => (",
|
|
26576
|
-
|
|
26699
|
+
genExpression(expr, context),
|
|
26577
26700
|
")"
|
|
26578
26701
|
], genSimpleIdMap());
|
|
26579
26702
|
}
|
|
@@ -26628,7 +26751,7 @@ function isFragmentBlock(block) {
|
|
|
26628
26751
|
const child = getSingleReturnedChild(block);
|
|
26629
26752
|
const operation = child && child.operation;
|
|
26630
26753
|
if (!operation) return false;
|
|
26631
|
-
return operation.type === 13 || operation.type === 16 || operation.type === 17 || operation.type === 15 && !operation.once || operation.type === 12 && !!operation.dynamic && !operation.dynamic.isStatic;
|
|
26754
|
+
return operation.type === 13 || operation.type === 16 || operation.type === 17 || operation.type === 15 && !operation.once || operation.type === 12 && !operation.once && !!operation.dynamic && !operation.dynamic.isStatic;
|
|
26632
26755
|
}
|
|
26633
26756
|
function getSingleReturnedChild(block) {
|
|
26634
26757
|
if (block.returns.length !== 1) return;
|
|
@@ -26781,10 +26904,8 @@ function matchSelectorPattern(effect, key, idMap, context) {
|
|
|
26781
26904
|
if (typeof node === "object" && node && node.type === "BinaryExpression" && node.operator === "===" && node.left.type !== "PrivateName") {
|
|
26782
26905
|
const { left, right } = node;
|
|
26783
26906
|
for (const [a, b] of [[left, right], [right, left]]) {
|
|
26784
|
-
|
|
26785
|
-
|
|
26786
|
-
const bVars = analyzeVariableScopes(b, idMap);
|
|
26787
|
-
if (aIsKey && !bIsKey && !bVars.length) matcheds.push([a, b]);
|
|
26907
|
+
if (content.slice(a.start - 1, a.end - 1) !== key) continue;
|
|
26908
|
+
if (!isKeyOnlyBinding(b, key, content) && !analyzeVariableScopes(b, idMap).length) matcheds.push([a, b]);
|
|
26788
26909
|
}
|
|
26789
26910
|
}
|
|
26790
26911
|
} });
|
|
@@ -26836,7 +26957,7 @@ function isKeyOnlyBinding(expr, key, source) {
|
|
|
26836
26957
|
function genSetHtml(oper, context) {
|
|
26837
26958
|
const { helper } = context;
|
|
26838
26959
|
const { value, element } = oper;
|
|
26839
|
-
return [NEWLINE,
|
|
26960
|
+
return [NEWLINE, genCall(helper("setHtml"), `n${element}`, genExpression(value, context))];
|
|
26840
26961
|
}
|
|
26841
26962
|
//#endregion
|
|
26842
26963
|
//#region packages/compiler-vapor/src/generators/if.ts
|
|
@@ -26848,17 +26969,17 @@ function genIf(oper, context, isNested = false) {
|
|
|
26848
26969
|
const flags = genIfFlags(blockShape, once, slotRoot, negative ? index : void 0);
|
|
26849
26970
|
const conditionExpr = [
|
|
26850
26971
|
"() => (",
|
|
26851
|
-
|
|
26972
|
+
genExpression(condition, context),
|
|
26852
26973
|
")"
|
|
26853
26974
|
];
|
|
26854
26975
|
let positiveArg = genBlock(positive, context);
|
|
26855
26976
|
let negativeArg = false;
|
|
26856
26977
|
if (negative) {
|
|
26857
26978
|
if (negative.type === 1) negativeArg = genBlock(negative, context);
|
|
26858
|
-
else negativeArg = ["() => ",
|
|
26979
|
+
else negativeArg = ["() => ", genIf(negative, context, true)];
|
|
26859
26980
|
}
|
|
26860
26981
|
if (!isNested) push(NEWLINE, `const n${oper.id} = `);
|
|
26861
|
-
push(
|
|
26982
|
+
push(genCall(helper("createIf"), conditionExpr, positiveArg, negativeArg, flags));
|
|
26862
26983
|
return frag;
|
|
26863
26984
|
}
|
|
26864
26985
|
function genIfFlags(blockShape, once, slotRoot, index) {
|
|
@@ -26886,6 +27007,7 @@ function genBlockShapeName(flags) {
|
|
|
26886
27007
|
case 0: return "EMPTY";
|
|
26887
27008
|
case 1: return "SINGLE_ROOT";
|
|
26888
27009
|
case 2: return "MULTI_ROOT";
|
|
27010
|
+
case 3: return "ELSE_IF";
|
|
26889
27011
|
}
|
|
26890
27012
|
return "UNKNOWN";
|
|
26891
27013
|
}
|
|
@@ -26899,7 +27021,7 @@ function genIfChain(oper, context) {
|
|
|
26899
27021
|
let node = oper;
|
|
26900
27022
|
for (let i = 0;; i++) {
|
|
26901
27023
|
if (i > 0) selector.push(NEWLINE, ": ");
|
|
26902
|
-
selector.push("(",
|
|
27024
|
+
selector.push("(", genExpression(node.condition, context), `) ? ${i}`);
|
|
26903
27025
|
blocks.push(genBlock(node.positive, context));
|
|
26904
27026
|
branchFlags.push(node.blockShape & 35);
|
|
26905
27027
|
if (node.slotRoot) slotRoot = true;
|
|
@@ -26913,7 +27035,7 @@ function genIfChain(oper, context) {
|
|
|
26913
27035
|
branchFlags.push(node.blockShape >> 2 & 3 | (node.blockShape & 64 ? 32 : 0));
|
|
26914
27036
|
break;
|
|
26915
27037
|
}
|
|
26916
|
-
push(NEWLINE, `const n${oper.id} = `,
|
|
27038
|
+
push(NEWLINE, `const n${oper.id} = `, genCall(helper("createIfChain"), selector, genMulti(DELIMITERS_ARRAY, ...blocks), genIfChainBranchFlags(branchFlags, blocks.length), genIfChainFlags(oper.once, slotRoot, oper.index)));
|
|
26917
27039
|
return frag;
|
|
26918
27040
|
}
|
|
26919
27041
|
function genIfChainBranchFlags(branchFlags, blockCount) {
|
|
@@ -26973,7 +27095,7 @@ function genSetProp(oper, context) {
|
|
|
26973
27095
|
}
|
|
26974
27096
|
const propValue = genPropValue(values, context);
|
|
26975
27097
|
const call = genCall([helper(resolvedHelper.name), null], `n${oper.element}`, resolvedHelper.needKey ? genExpression(key, context) : false, propValue, resolvedHelper.isSVG && "true");
|
|
26976
|
-
return [NEWLINE,
|
|
27098
|
+
return [NEWLINE, oper.once ? genOnce(call, context) : call];
|
|
26977
27099
|
}
|
|
26978
27100
|
const optionsModifierRE = /(Once|Passive|Capture)$/;
|
|
26979
27101
|
const optionsModifierEventRE = /^on:?(?:Once|Passive|Capture)$/;
|
|
@@ -26981,7 +27103,7 @@ function genSetListener(oper, context) {
|
|
|
26981
27103
|
const { helper } = context;
|
|
26982
27104
|
const { element, effect, prop } = oper;
|
|
26983
27105
|
const value = genPropValue(prop.values, context);
|
|
26984
|
-
if (effect) return [NEWLINE,
|
|
27106
|
+
if (effect) return [NEWLINE, genCall(helper("setListener"), `n${element}`, JSON.stringify(prop.key.content), value)];
|
|
26985
27107
|
let name = prop.key.content;
|
|
26986
27108
|
const options = [];
|
|
26987
27109
|
let m;
|
|
@@ -26990,7 +27112,7 @@ function genSetListener(oper, context) {
|
|
|
26990
27112
|
options.push([`${m[1].toLowerCase()}: true`]);
|
|
26991
27113
|
}
|
|
26992
27114
|
const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2));
|
|
26993
|
-
return [NEWLINE,
|
|
27115
|
+
return [NEWLINE, genCall(helper("on"), `n${element}`, JSON.stringify(event), value, options.length ? genMulti(DELIMITERS_OBJECT, ...options) : void 0)];
|
|
26994
27116
|
}
|
|
26995
27117
|
const MAX_CLASS_NAME_ENTRIES = 31;
|
|
26996
27118
|
function genSetClassName(oper, context) {
|
|
@@ -27000,7 +27122,7 @@ function genSetClassName(oper, context) {
|
|
|
27000
27122
|
const flags = genClassFlags(info.entries, context);
|
|
27001
27123
|
const classFragments = info.entries.map((entry) => JSON.stringify(!info.prefix && info.entries.length === 1 ? entry.className : ` ${entry.className}`));
|
|
27002
27124
|
const fragments = classFragments.length === 1 ? classFragments[0] : genMulti(DELIMITERS_ARRAY, ...classFragments);
|
|
27003
|
-
return [NEWLINE,
|
|
27125
|
+
return [NEWLINE, genCall([helper("setClassName"), "\"\""], `n${oper.element}`, flags, fragments, info.prefix && JSON.stringify(info.prefix), info.suffix && JSON.stringify(info.suffix))];
|
|
27004
27126
|
}
|
|
27005
27127
|
function resolveClassName(values, context) {
|
|
27006
27128
|
let prefix = "";
|
|
@@ -27081,7 +27203,7 @@ function genClassFlags(entries, context) {
|
|
|
27081
27203
|
values.push(entry.value ? String(bit) : "0");
|
|
27082
27204
|
return;
|
|
27083
27205
|
}
|
|
27084
|
-
values.push("((",
|
|
27206
|
+
values.push("((", genExpression(entry.condition, context), ")", entry.negate ? ` ? 0 : ${bit}` : ` ? ${bit} : 0`, ")");
|
|
27085
27207
|
});
|
|
27086
27208
|
return values;
|
|
27087
27209
|
}
|
|
@@ -27123,10 +27245,10 @@ function genDynamicProps$1(oper, context) {
|
|
|
27123
27245
|
return props.handler ? genCall(helper("toHandlers"), value, "true") : value;
|
|
27124
27246
|
});
|
|
27125
27247
|
const call = genCall(helper("setDynamicProps"), `n${oper.element}`, genMulti(DELIMITERS_ARRAY, ...values), genDynamicPropNames$1(oper, context), oper.isSVG && "true");
|
|
27126
|
-
return [NEWLINE,
|
|
27248
|
+
return [NEWLINE, oper.once ? genOnce(call, context) : call];
|
|
27127
27249
|
}
|
|
27128
27250
|
function genSyncSelectValue(oper, context) {
|
|
27129
|
-
return [NEWLINE,
|
|
27251
|
+
return [NEWLINE, genCall(context.helper("syncSelectValue"), `n${oper.element}`, genDynamicPropNames$1(oper, context))];
|
|
27130
27252
|
}
|
|
27131
27253
|
function genDynamicPropNames$1(oper, context) {
|
|
27132
27254
|
const { bindingMetadata } = context.options;
|
|
@@ -27137,14 +27259,17 @@ function genDynamicPropNames$1(oper, context) {
|
|
|
27137
27259
|
if (!id) context.dynamicPropNames.set(json, id = context.kName(context.dynamicPropNames.size));
|
|
27138
27260
|
return id;
|
|
27139
27261
|
}
|
|
27140
|
-
function genLiteralObjectProps(props, context) {
|
|
27262
|
+
function genLiteralObjectProps(props, context, isComponent = false) {
|
|
27141
27263
|
const entries = [];
|
|
27142
27264
|
const listeners = createHandlerGroups(entries);
|
|
27143
|
-
for (const prop of props) if (isListenerProp(prop)) listeners.add(getStaticPropKeyName(prop,
|
|
27265
|
+
for (const prop of props) if (isListenerProp(prop)) listeners.add(getStaticPropKeyName(prop, !isComponent), genPropKey(prop, context, !isComponent), prop.handler ? genEventHandler(context, prop.values, prop.handlerModifiers, {
|
|
27266
|
+
hoisted: prop,
|
|
27267
|
+
asComponentProp: isComponent
|
|
27268
|
+
}) : genPropValue(prop.values, context));
|
|
27144
27269
|
else entries.push([
|
|
27145
|
-
|
|
27270
|
+
genPropKey(prop, context),
|
|
27146
27271
|
`: `,
|
|
27147
|
-
|
|
27272
|
+
genPropValue(prop.values, context)
|
|
27148
27273
|
]);
|
|
27149
27274
|
listeners.fill();
|
|
27150
27275
|
return genMulti(DELIMITERS_OBJECT, ...entries);
|
|
@@ -27169,10 +27294,10 @@ function createHandlerGroups(entries, prefix = "", delimiters = DELIMITERS_ARRAY
|
|
|
27169
27294
|
},
|
|
27170
27295
|
fill() {
|
|
27171
27296
|
for (const { keyFrag, handlers, index } of groups.values()) entries[index] = [
|
|
27172
|
-
|
|
27297
|
+
keyFrag,
|
|
27173
27298
|
": ",
|
|
27174
27299
|
prefix,
|
|
27175
|
-
|
|
27300
|
+
handlers.length > 1 ? genMulti(delimiters, ...handlers) : handlers[0]
|
|
27176
27301
|
];
|
|
27177
27302
|
}
|
|
27178
27303
|
};
|
|
@@ -27201,20 +27326,20 @@ function genPropKey(prop, context, preserveCase = false) {
|
|
|
27201
27326
|
key = genCall(helper("camelize"), key);
|
|
27202
27327
|
} else if (modifier) key = [
|
|
27203
27328
|
"(",
|
|
27204
|
-
|
|
27329
|
+
key,
|
|
27205
27330
|
" || \"\"",
|
|
27206
27331
|
")"
|
|
27207
27332
|
];
|
|
27208
|
-
else if (!handler && !model) key = node.ast === null ? [
|
|
27333
|
+
else if (!handler && !model) key = node.ast === null ? [key, " || \"\""] : [
|
|
27209
27334
|
"(",
|
|
27210
|
-
|
|
27335
|
+
key,
|
|
27211
27336
|
") || \"\""
|
|
27212
27337
|
];
|
|
27213
27338
|
if (handler) key = genCall(helper("toHandlerKey"), key);
|
|
27214
27339
|
return [
|
|
27215
27340
|
"[",
|
|
27216
27341
|
modifier && `${JSON.stringify(modifier)} + `,
|
|
27217
|
-
|
|
27342
|
+
key,
|
|
27218
27343
|
handlerModifierPostfix ? ` + ${JSON.stringify(handlerModifierPostfix)}` : void 0,
|
|
27219
27344
|
"]"
|
|
27220
27345
|
];
|
|
@@ -27250,14 +27375,14 @@ function genSetTemplateRef(oper, context) {
|
|
|
27250
27375
|
const [refValue, refKey] = genRefValue(oper.value, context);
|
|
27251
27376
|
if (!oper.effect && !oper.refFor && oper.value.isStatic) return genSetStaticTemplateRef(oper, refValue, refKey, context);
|
|
27252
27377
|
context.needsTemplateRefSetter = true;
|
|
27253
|
-
return [NEWLINE,
|
|
27378
|
+
return [NEWLINE, genCall(setTemplateRefIdent, `n${oper.element}`, refValue, oper.refFor && "true", refKey)];
|
|
27254
27379
|
}
|
|
27255
27380
|
function genSetStaticTemplateRef(oper, refValue, refKey, context) {
|
|
27256
|
-
return [NEWLINE,
|
|
27381
|
+
return [NEWLINE, genCall(context.helper("setStaticTemplateRef"), `n${oper.element}`, refValue, oper.refFor && "true", refKey)];
|
|
27257
27382
|
}
|
|
27258
27383
|
function genSetTemplateRefBinding(oper, context) {
|
|
27259
27384
|
const [refValue, refKey] = genRefValue(oper.value, context);
|
|
27260
|
-
return [NEWLINE,
|
|
27385
|
+
return [NEWLINE, genCall([context.helper("setTemplateRefBinding"), "undefined"], `n${oper.element}`, ["() => ", refValue], ...oper.refFor || refKey ? [oper.refFor && "true", refKey] : [])];
|
|
27261
27386
|
}
|
|
27262
27387
|
function genRefValue(value, context) {
|
|
27263
27388
|
if (value && context.options.inline) {
|
|
@@ -27272,7 +27397,7 @@ function genSetText(oper, context) {
|
|
|
27272
27397
|
const { helper } = context;
|
|
27273
27398
|
const { element, values, generated } = oper;
|
|
27274
27399
|
const texts = combineValues(values, context);
|
|
27275
|
-
return [NEWLINE,
|
|
27400
|
+
return [NEWLINE, genCall(helper("setText"), `${generated ? "x" : "n"}${element}`, texts)];
|
|
27276
27401
|
}
|
|
27277
27402
|
function combineValues(values, context) {
|
|
27278
27403
|
return values.flatMap((value, i) => {
|
|
@@ -27303,14 +27428,14 @@ function genVModel(oper, context) {
|
|
|
27303
27428
|
const { modelType, element, dir: { exp, modifiers } } = oper;
|
|
27304
27429
|
return genCall(context.helper(helperMap[modelType]), `n${element}`, [
|
|
27305
27430
|
`() => (`,
|
|
27306
|
-
|
|
27431
|
+
genExpression(exp, context),
|
|
27307
27432
|
`)`
|
|
27308
27433
|
], genModelHandler(exp, context), modifiers.length ? `{ ${genDirectiveModifiers(modifiers.map((e) => e.content))} }` : void 0);
|
|
27309
27434
|
}
|
|
27310
27435
|
function genModelHandler(exp, context) {
|
|
27311
27436
|
return [
|
|
27312
27437
|
`${context.options.isTS ? `(_value: any)` : `_value`} => (`,
|
|
27313
|
-
|
|
27438
|
+
genExpression(exp, context, "_value"),
|
|
27314
27439
|
")"
|
|
27315
27440
|
];
|
|
27316
27441
|
}
|
|
@@ -27339,22 +27464,22 @@ function genCreateComponent(operation, context) {
|
|
|
27339
27464
|
return [
|
|
27340
27465
|
...acc,
|
|
27341
27466
|
`const ${name} = `,
|
|
27342
|
-
|
|
27467
|
+
handler,
|
|
27343
27468
|
NEWLINE
|
|
27344
27469
|
];
|
|
27345
27470
|
}, []);
|
|
27346
27471
|
return [
|
|
27347
27472
|
NEWLINE,
|
|
27348
|
-
|
|
27349
|
-
|
|
27473
|
+
inlineHandlers,
|
|
27474
|
+
slotDeclarations.length ? genMulti([
|
|
27350
27475
|
"let ",
|
|
27351
27476
|
NEWLINE,
|
|
27352
27477
|
", "
|
|
27353
27478
|
], ...slotDeclarations) : [],
|
|
27354
27479
|
`const n${operation.id} = `,
|
|
27355
|
-
|
|
27480
|
+
genCall(isRuntimeDynamicComponent ? helper("createDynamicComponent") : operation.useCreateElement ? helper("createPlainElement") : useAssetComponentHelper ? helper("createAssetComponent") : operation.asset ? helper("createComponentWithFallback") : helper("createComponent"), tag, rawProps, rawSlots, isRuntimeDynamicComponent ? dynamicComponentFlags : root && (root === true ? "true" : genFlags(root, ["SLOT"])), isRuntimeDynamicComponent ? operation.key && [
|
|
27356
27481
|
"() => (",
|
|
27357
|
-
|
|
27482
|
+
genExpression(operation.key, context),
|
|
27358
27483
|
")"
|
|
27359
27484
|
] : once && "true", useAssetComponentHelper ? maybeSelfReference && "true" : nsArg, useAssetComponentHelper && nsArg)
|
|
27360
27485
|
];
|
|
@@ -27364,7 +27489,7 @@ function genCreateComponent(operation, context) {
|
|
|
27364
27489
|
if (operation.dynamic.isStatic) return genCall(helper("resolveDynamicComponent"), genExpression(operation.dynamic, context));
|
|
27365
27490
|
else return [
|
|
27366
27491
|
"() => (",
|
|
27367
|
-
|
|
27492
|
+
genExpression(operation.dynamic, context),
|
|
27368
27493
|
")"
|
|
27369
27494
|
];
|
|
27370
27495
|
} else if (useAssetComponentHelper) {
|
|
@@ -27372,13 +27497,13 @@ function genCreateComponent(operation, context) {
|
|
|
27372
27497
|
return JSON.stringify(name);
|
|
27373
27498
|
} else if (operation.asset) return toValidAssetId(operation.tag, "component");
|
|
27374
27499
|
else {
|
|
27375
|
-
const { tag
|
|
27500
|
+
const { tag } = operation;
|
|
27376
27501
|
const builtInTag = isBuiltInComponent(tag);
|
|
27377
27502
|
if (builtInTag) {
|
|
27378
27503
|
helper(builtInTag);
|
|
27379
27504
|
return `_${builtInTag}`;
|
|
27380
27505
|
}
|
|
27381
|
-
return
|
|
27506
|
+
return genExpression(extend(createSimpleExpression(tag, false), { ast: null }), context);
|
|
27382
27507
|
}
|
|
27383
27508
|
}
|
|
27384
27509
|
}
|
|
@@ -27452,7 +27577,7 @@ function genStaticProps(props, context, dynamicProps, directStaticLiteralProps =
|
|
|
27452
27577
|
if (!prop.handler) {
|
|
27453
27578
|
handlerGroups.add(keyName, keyFrag, [
|
|
27454
27579
|
"(",
|
|
27455
|
-
|
|
27580
|
+
genPropValue(prop.values, context),
|
|
27456
27581
|
")"
|
|
27457
27582
|
]);
|
|
27458
27583
|
continue;
|
|
@@ -27475,29 +27600,29 @@ function genStaticProps(props, context, dynamicProps, directStaticLiteralProps =
|
|
|
27475
27600
|
} else {
|
|
27476
27601
|
const keyFrag = [
|
|
27477
27602
|
"[\"onUpdate:\" + ",
|
|
27478
|
-
|
|
27603
|
+
genExpression(prop.key, context),
|
|
27479
27604
|
"]"
|
|
27480
27605
|
];
|
|
27481
27606
|
args.push([
|
|
27482
|
-
|
|
27607
|
+
keyFrag,
|
|
27483
27608
|
": () => ",
|
|
27484
|
-
|
|
27609
|
+
genModelHandler(prop.values[0], context)
|
|
27485
27610
|
]);
|
|
27486
27611
|
}
|
|
27487
27612
|
const { key, modelModifiers } = prop;
|
|
27488
27613
|
if (modelModifiers && modelModifiers.length) {
|
|
27489
27614
|
const modifiersKey = key.isStatic ? genStaticModifierPropKey(key.content) : [
|
|
27490
27615
|
"[",
|
|
27491
|
-
|
|
27616
|
+
genExpression(key, context),
|
|
27492
27617
|
" + \"Modifiers\"]"
|
|
27493
27618
|
];
|
|
27494
27619
|
const modifiersVal = genDirectiveModifiers(modelModifiers);
|
|
27495
|
-
args.push([
|
|
27620
|
+
args.push([modifiersKey, directStaticLiteralProps ? `: { ${modifiersVal} }` : `: () => ({ ${modifiersVal} })`]);
|
|
27496
27621
|
}
|
|
27497
27622
|
}
|
|
27498
27623
|
}
|
|
27499
27624
|
handlerGroups.fill();
|
|
27500
|
-
if (dynamicProps) args.push([`$: `,
|
|
27625
|
+
if (dynamicProps) args.push([`$: `, dynamicProps]);
|
|
27501
27626
|
return genMulti(args.length > 1 ? DELIMITERS_OBJECT_NEWLINE : DELIMITERS_OBJECT, ...args);
|
|
27502
27627
|
}
|
|
27503
27628
|
function genDynamicProps(props, context, directStaticLiteralProps = false) {
|
|
@@ -27513,23 +27638,23 @@ function genDynamicProps(props, context, directStaticLiteralProps = false) {
|
|
|
27513
27638
|
const entries = [genProp(p, context)];
|
|
27514
27639
|
const updateKey = p.key.isStatic ? [JSON.stringify(`onUpdate:${camelize(p.key.content)}`)] : [
|
|
27515
27640
|
"[\"onUpdate:\" + ",
|
|
27516
|
-
|
|
27641
|
+
genExpression(p.key, context),
|
|
27517
27642
|
"]"
|
|
27518
27643
|
];
|
|
27519
27644
|
entries.push([
|
|
27520
|
-
|
|
27645
|
+
updateKey,
|
|
27521
27646
|
": ",
|
|
27522
|
-
|
|
27647
|
+
genModelHandler(p.values[0], context)
|
|
27523
27648
|
]);
|
|
27524
27649
|
const { modelModifiers } = p;
|
|
27525
27650
|
if (modelModifiers && modelModifiers.length) {
|
|
27526
27651
|
const modifiersKey = p.key.isStatic ? genStaticModifierPropKey(p.key.content) : [
|
|
27527
27652
|
"[",
|
|
27528
|
-
|
|
27653
|
+
genExpression(p.key, context),
|
|
27529
27654
|
" + \"Modifiers\"]"
|
|
27530
27655
|
];
|
|
27531
27656
|
const modifiersVal = genDirectiveModifiers(modelModifiers);
|
|
27532
|
-
entries.push([
|
|
27657
|
+
entries.push([modifiersKey, `: { ${modifiersVal} }`]);
|
|
27533
27658
|
}
|
|
27534
27659
|
expr = genMulti(DELIMITERS_OBJECT_NEWLINE, ...entries);
|
|
27535
27660
|
} else expr = genMulti(DELIMITERS_OBJECT, genProp(p, context, false, false));
|
|
@@ -27539,7 +27664,7 @@ function genDynamicProps(props, context, directStaticLiteralProps = false) {
|
|
|
27539
27664
|
}
|
|
27540
27665
|
frags.push([
|
|
27541
27666
|
"() => (",
|
|
27542
|
-
|
|
27667
|
+
expr,
|
|
27543
27668
|
")"
|
|
27544
27669
|
]);
|
|
27545
27670
|
}
|
|
@@ -27547,16 +27672,17 @@ function genDynamicProps(props, context, directStaticLiteralProps = false) {
|
|
|
27547
27672
|
}
|
|
27548
27673
|
function genProp(prop, context, isStatic, wrapHandler = true, directStaticLiteral = false) {
|
|
27549
27674
|
let values = genPropValue(prop.values, context);
|
|
27675
|
+
if (prop.normalize) values = genCall(context.helper(prop.normalize === "class" ? "normalizeClass" : "normalizeStyle"), values);
|
|
27550
27676
|
if (prop.toDisplayString) values = genCall(context.helper("toDisplayString"), values);
|
|
27551
27677
|
return [
|
|
27552
|
-
|
|
27678
|
+
genPropKey(prop, context),
|
|
27553
27679
|
": ",
|
|
27554
|
-
|
|
27680
|
+
prop.handler ? genEventHandler(context, prop.values, prop.handlerModifiers, {
|
|
27555
27681
|
asComponentProp: true,
|
|
27556
27682
|
extraWrap: wrapHandler
|
|
27557
27683
|
}) : isStatic ? directStaticLiteral ? values : [
|
|
27558
27684
|
"() => (",
|
|
27559
|
-
|
|
27685
|
+
values,
|
|
27560
27686
|
")"
|
|
27561
27687
|
] : values
|
|
27562
27688
|
];
|
|
@@ -27624,8 +27750,8 @@ function getSingleDefaultSlot({ slots }) {
|
|
|
27624
27750
|
return names.length === 1 && names[0] === "default" ? slots.default : void 0;
|
|
27625
27751
|
}
|
|
27626
27752
|
function genStaticSlots({ slots }, context, slotDeclarations, dynamicSlots) {
|
|
27627
|
-
const args = Object.keys(slots).map((name) => [`${JSON.stringify(name)}: `,
|
|
27628
|
-
if (dynamicSlots) args.push([`$: `,
|
|
27753
|
+
const args = Object.keys(slots).map((name) => [`${JSON.stringify(name)}: `, genSlotBlockWithProps(slots[name], context)]);
|
|
27754
|
+
if (dynamicSlots) args.push([`$: `, genDynamicSlots(dynamicSlots, context, slotDeclarations)]);
|
|
27629
27755
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ...args);
|
|
27630
27756
|
}
|
|
27631
27757
|
function genDynamicSlots(slots, context, slotDeclarations) {
|
|
@@ -27645,7 +27771,7 @@ function genDynamicSlot(slot, context, slotDeclarations, withFunction = false) {
|
|
|
27645
27771
|
if (!withFunction) return frag;
|
|
27646
27772
|
return [
|
|
27647
27773
|
"() => (",
|
|
27648
|
-
|
|
27774
|
+
frag,
|
|
27649
27775
|
")"
|
|
27650
27776
|
];
|
|
27651
27777
|
}
|
|
@@ -27653,9 +27779,9 @@ function genBasicDynamicSlot(slot, context, slotDeclarations) {
|
|
|
27653
27779
|
const { name, fn } = slot;
|
|
27654
27780
|
const slotName = context.getUniqueLocalName("s");
|
|
27655
27781
|
slotDeclarations.push(slotName);
|
|
27656
|
-
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ",
|
|
27782
|
+
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", genExpression(name, context)], [
|
|
27657
27783
|
`fn: ${slotName} || (${slotName} = `,
|
|
27658
|
-
|
|
27784
|
+
genSlotBlockWithProps(fn, context, false),
|
|
27659
27785
|
")"
|
|
27660
27786
|
]);
|
|
27661
27787
|
}
|
|
@@ -27684,13 +27810,13 @@ function genLoopSlot(slot, context) {
|
|
|
27684
27810
|
idMap[indexVar] = null;
|
|
27685
27811
|
}
|
|
27686
27812
|
const renderSlot = [
|
|
27687
|
-
|
|
27813
|
+
genMulti([
|
|
27688
27814
|
"(",
|
|
27689
27815
|
")",
|
|
27690
27816
|
", "
|
|
27691
27817
|
], ...args),
|
|
27692
27818
|
" => ",
|
|
27693
|
-
|
|
27819
|
+
context.withId(() => genSlotBlockWithProps(fn, context, false), idMap)
|
|
27694
27820
|
];
|
|
27695
27821
|
exitScope();
|
|
27696
27822
|
const rawIdMap = {};
|
|
@@ -27700,34 +27826,34 @@ function genLoopSlot(slot, context) {
|
|
|
27700
27826
|
collect(indexToPathMap);
|
|
27701
27827
|
const rawParams = context.withId(() => genAliasParams(value, key, index, context), rawIdMap);
|
|
27702
27828
|
const getName = [
|
|
27703
|
-
|
|
27829
|
+
rawParams,
|
|
27704
27830
|
" => (",
|
|
27705
|
-
|
|
27831
|
+
context.withId(() => genExpression(name, context), rawIdMap),
|
|
27706
27832
|
")"
|
|
27707
27833
|
];
|
|
27708
27834
|
const getKey = keyProp && [
|
|
27709
|
-
|
|
27835
|
+
rawParams,
|
|
27710
27836
|
" => (",
|
|
27711
|
-
|
|
27837
|
+
context.withId(() => genExpression(keyProp, context), rawIdMap),
|
|
27712
27838
|
")"
|
|
27713
27839
|
];
|
|
27714
|
-
return [
|
|
27840
|
+
return [genCall(context.helper("createForSlots"), [
|
|
27715
27841
|
"() => (",
|
|
27716
|
-
|
|
27842
|
+
genExpression(source, context),
|
|
27717
27843
|
")"
|
|
27718
27844
|
], renderSlot, getName, getKey)];
|
|
27719
27845
|
}
|
|
27720
27846
|
function genConditionalSlot(slot, context, slotDeclarations) {
|
|
27721
27847
|
const { condition, positive, negative } = slot;
|
|
27722
27848
|
return [
|
|
27723
|
-
|
|
27849
|
+
genExpression(condition, context),
|
|
27724
27850
|
INDENT_START,
|
|
27725
27851
|
NEWLINE,
|
|
27726
27852
|
"? ",
|
|
27727
|
-
|
|
27853
|
+
genDynamicSlot(positive, context, slotDeclarations),
|
|
27728
27854
|
NEWLINE,
|
|
27729
27855
|
": ",
|
|
27730
|
-
|
|
27856
|
+
negative ? genDynamicSlot(negative, context, slotDeclarations) : ["void 0"],
|
|
27731
27857
|
INDENT_END
|
|
27732
27858
|
];
|
|
27733
27859
|
}
|
|
@@ -27746,8 +27872,7 @@ function genSlotBlockWithProps(oper, context, emitNonStableFlag = true) {
|
|
|
27746
27872
|
const idMap = idToPathMap.size ? buildDestructureIdMap(idToPathMap, propsName || "", context.options.expressionPlugins) : {};
|
|
27747
27873
|
if (propsName) idMap[propsName] = null;
|
|
27748
27874
|
const exitSlotBlock = context.enterSlotBlock();
|
|
27749
|
-
const hasStableRoot =
|
|
27750
|
-
if (!hasStableRoot) markSlotRootOperations(oper, context);
|
|
27875
|
+
const hasStableRoot = markSlotRootOperations(oper, context);
|
|
27751
27876
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
27752
27877
|
if (emitNonStableFlag && !hasStableRoot) blockFn = genCall(context.helper("extend"), blockFn, [`{ _: ${genFlags(1, ["NON_STABLE"])} }`]);
|
|
27753
27878
|
exitSlotBlock();
|
|
@@ -27766,15 +27891,36 @@ function genSlotOutlet(oper, context) {
|
|
|
27766
27891
|
fallbackArg = genBlock(fallback, context);
|
|
27767
27892
|
}
|
|
27768
27893
|
const createSlot = helper("createSlot");
|
|
27769
|
-
const rawPropsArg =
|
|
27894
|
+
const rawPropsArg = genSlotProps(oper.props, context);
|
|
27770
27895
|
const nameArg = name.isStatic && name.content === "default" && !rawPropsArg && !fallbackArg && !flags ? void 0 : name.isStatic ? genExpression(name, context) : [
|
|
27771
27896
|
"() => (",
|
|
27772
|
-
|
|
27897
|
+
genExpression(name, context),
|
|
27773
27898
|
")"
|
|
27774
27899
|
];
|
|
27775
|
-
push(NEWLINE, `const n${id} = `,
|
|
27900
|
+
push(NEWLINE, `const n${id} = `, genCall(createSlot, nameArg, rawPropsArg, fallbackArg, genSlotFlags(flags)));
|
|
27776
27901
|
return frag;
|
|
27777
27902
|
}
|
|
27903
|
+
function genSlotProps(props, context) {
|
|
27904
|
+
if (!props.length) return;
|
|
27905
|
+
const first = props[0];
|
|
27906
|
+
if (props.length === 1 && isArray$3(first) && first.every((prop) => prop.key.isStatic)) return genRawProps(props, context, true);
|
|
27907
|
+
const { helper } = context;
|
|
27908
|
+
const groups = props.map((group) => {
|
|
27909
|
+
if (isArray$3(group)) return genLiteralObjectProps(group, context, true);
|
|
27910
|
+
const value = genExpression(group.value, context);
|
|
27911
|
+
return group.handler ? genCall(helper("toHandlers"), value) : value;
|
|
27912
|
+
});
|
|
27913
|
+
let value = groups[0];
|
|
27914
|
+
if (groups.length > 1) value = genCall(helper("mergeProps"), ...groups);
|
|
27915
|
+
else if (isArray$3(first)) {
|
|
27916
|
+
if (first.some((prop) => !prop.key.isStatic && !prop.handler)) value = genCall(helper("normalizeProps"), value);
|
|
27917
|
+
} else if (!first.handler) value = genCall(helper("normalizeProps"), genCall(helper("guardReactiveProps"), value));
|
|
27918
|
+
return [
|
|
27919
|
+
"{ $: [() => (",
|
|
27920
|
+
value,
|
|
27921
|
+
")] }"
|
|
27922
|
+
];
|
|
27923
|
+
}
|
|
27778
27924
|
function genSlotFlags(flags) {
|
|
27779
27925
|
if (!flags) return;
|
|
27780
27926
|
const names = [];
|
|
@@ -27789,7 +27935,7 @@ function genVShow(oper, context) {
|
|
|
27789
27935
|
const { element } = oper;
|
|
27790
27936
|
return genCall(context.helper("applyVShow"), `n${element}`, [
|
|
27791
27937
|
`() => (`,
|
|
27792
|
-
|
|
27938
|
+
genExpression(oper.dir.exp, context),
|
|
27793
27939
|
`)`
|
|
27794
27940
|
]);
|
|
27795
27941
|
}
|
|
@@ -27806,7 +27952,7 @@ function genBuiltinDirective(oper, context) {
|
|
|
27806
27952
|
break;
|
|
27807
27953
|
default: return [];
|
|
27808
27954
|
}
|
|
27809
|
-
return [NEWLINE,
|
|
27955
|
+
return [NEWLINE, oper.once ? genOnce(call, context) : call];
|
|
27810
27956
|
}
|
|
27811
27957
|
/**
|
|
27812
27958
|
* user directives via `withVaporDirectives`, emitted at the end of the block
|
|
@@ -27820,7 +27966,7 @@ function genCustomDirectives(operations, context) {
|
|
|
27820
27966
|
else byElement.set(oper.element, [oper]);
|
|
27821
27967
|
}
|
|
27822
27968
|
const [frag, push] = buildCodeFragment();
|
|
27823
|
-
for (const dirs of byElement.values()) push(
|
|
27969
|
+
for (const dirs of byElement.values()) push(genElementDirectives(dirs, context));
|
|
27824
27970
|
return frag;
|
|
27825
27971
|
}
|
|
27826
27972
|
function genElementDirectives(opers, context) {
|
|
@@ -27829,17 +27975,17 @@ function genElementDirectives(opers, context) {
|
|
|
27829
27975
|
const directiveItems = opers.map(genDirectiveItem);
|
|
27830
27976
|
const directives = genMulti(DELIMITERS_ARRAY, ...directiveItems);
|
|
27831
27977
|
const call = genCall(helper("withVaporDirectives"), element, directives);
|
|
27832
|
-
return [NEWLINE,
|
|
27978
|
+
return [NEWLINE, opers[0].once ? genOnce(call, context) : call];
|
|
27833
27979
|
function genDirectiveItem({ dir, name, asset }) {
|
|
27834
27980
|
const directiveVar = asset ? toValidAssetId(name, "directive") : genExpression(extend(createSimpleExpression(name, false), { ast: null }), context);
|
|
27835
27981
|
const value = dir.exp && [
|
|
27836
27982
|
"() => (",
|
|
27837
|
-
|
|
27983
|
+
genExpression(dir.exp, context),
|
|
27838
27984
|
")"
|
|
27839
27985
|
];
|
|
27840
27986
|
const argument = dir.arg && [
|
|
27841
27987
|
"() => (",
|
|
27842
|
-
|
|
27988
|
+
genExpression(dir.arg, context),
|
|
27843
27989
|
")"
|
|
27844
27990
|
];
|
|
27845
27991
|
const modifiers = !!dir.modifiers.length && [
|
|
@@ -27856,27 +28002,27 @@ function genKey(oper, context) {
|
|
|
27856
28002
|
const { id, value, block, slotRoot } = oper;
|
|
27857
28003
|
const [frag, push] = buildCodeFragment();
|
|
27858
28004
|
const blockFn = genBlock(block, context);
|
|
27859
|
-
push(NEWLINE, `const n${id} = `,
|
|
28005
|
+
push(NEWLINE, `const n${id} = `, genCall(context.helper("createKeyedFragment"), [
|
|
27860
28006
|
`() => (`,
|
|
27861
|
-
|
|
28007
|
+
genExpression(value, context),
|
|
27862
28008
|
")"
|
|
27863
28009
|
], blockFn, slotRoot ? "true" : false));
|
|
27864
28010
|
return frag;
|
|
27865
28011
|
}
|
|
27866
28012
|
function genSetBlockKey(oper, context) {
|
|
27867
|
-
return [NEWLINE,
|
|
28013
|
+
return [NEWLINE, genCall(context.helper("setBlockKey"), `n${oper.element}`, genExpression(oper.value, context))];
|
|
27868
28014
|
}
|
|
27869
28015
|
//#endregion
|
|
27870
28016
|
//#region packages/compiler-vapor/src/generators/operation.ts
|
|
27871
28017
|
function genOperations(opers, context) {
|
|
27872
28018
|
const [frag, push] = buildCodeFragment();
|
|
27873
|
-
for (const operation of opers) push(
|
|
28019
|
+
for (const operation of opers) push(genOperationWithInsertionState(operation, context));
|
|
27874
28020
|
return frag;
|
|
27875
28021
|
}
|
|
27876
28022
|
function genOperationWithInsertionState(oper, context) {
|
|
27877
28023
|
const [frag, push] = buildCodeFragment();
|
|
27878
|
-
if (isBlockOperation(oper) && oper.parent) push(
|
|
27879
|
-
push(
|
|
28024
|
+
if (isBlockOperation(oper) && oper.parent) push(genInsertionState(oper, context));
|
|
28025
|
+
push(genOperation(oper, context));
|
|
27880
28026
|
return frag;
|
|
27881
28027
|
}
|
|
27882
28028
|
function genOperation(oper, context) {
|
|
@@ -27907,12 +28053,12 @@ function genEffects(effects, context, genExtraFrag) {
|
|
|
27907
28053
|
for (let i = 0; i < effects.length; i++) {
|
|
27908
28054
|
const effect = effects[i];
|
|
27909
28055
|
if (effect.once) {
|
|
27910
|
-
push(
|
|
27911
|
-
push(
|
|
28056
|
+
push(genReactiveEffects(effects.slice(start, i), context));
|
|
28057
|
+
push(genOperations(effect.operations, context));
|
|
27912
28058
|
start = i + 1;
|
|
27913
28059
|
}
|
|
27914
28060
|
}
|
|
27915
|
-
push(
|
|
28061
|
+
push(genReactiveEffects(effects.slice(start), context, genExtraFrag));
|
|
27916
28062
|
return frag;
|
|
27917
28063
|
}
|
|
27918
28064
|
function genReactiveEffects(effects, context, genExtraFrag) {
|
|
@@ -27929,16 +28075,18 @@ function genReactiveEffects(effects, context, genExtraFrag) {
|
|
|
27929
28075
|
}
|
|
27930
28076
|
const handlerFrags = genHoistedHandlers(effects, context);
|
|
27931
28077
|
return context.withExpressionReplacements(expressionReplacements, () => {
|
|
27932
|
-
push(
|
|
27933
|
-
|
|
27934
|
-
|
|
27935
|
-
|
|
27936
|
-
|
|
27937
|
-
|
|
27938
|
-
|
|
27939
|
-
|
|
27940
|
-
|
|
27941
|
-
|
|
28078
|
+
push(declarationFrags);
|
|
28079
|
+
context.withId(() => {
|
|
28080
|
+
for (let i = 0; i < effects.length; i++) {
|
|
28081
|
+
const effect = effects[i];
|
|
28082
|
+
operationsCount += effect.operations.length;
|
|
28083
|
+
const frags = genEffect(effect, context);
|
|
28084
|
+
i > 0 && push(NEWLINE);
|
|
28085
|
+
if (lastFragment(frag) === ")" && firstFragment(frags) === "(") push(";");
|
|
28086
|
+
push(frags);
|
|
28087
|
+
}
|
|
28088
|
+
}, ids);
|
|
28089
|
+
if (countNewlines(frag) > 1 || operationsCount > 1 || declarationFrags.length > 0) {
|
|
27942
28090
|
unshift(`{`, INDENT_START, NEWLINE);
|
|
27943
28091
|
push(INDENT_END, NEWLINE, "}");
|
|
27944
28092
|
if (!effects.length) unshift(NEWLINE);
|
|
@@ -27948,21 +28096,53 @@ function genReactiveEffects(effects, context, genExtraFrag) {
|
|
|
27948
28096
|
push(`)`);
|
|
27949
28097
|
}
|
|
27950
28098
|
if (!shouldDeclare && varNames.length) unshift(NEWLINE, `let `, varNames.join(", "));
|
|
27951
|
-
if (genExtraFrag) push(
|
|
27952
|
-
unshift(
|
|
28099
|
+
if (genExtraFrag) push(context.withId(genExtraFrag, ids));
|
|
28100
|
+
unshift(handlerFrags);
|
|
27953
28101
|
return frag;
|
|
27954
28102
|
});
|
|
27955
28103
|
}
|
|
27956
28104
|
function genEffect({ operations }, context) {
|
|
27957
28105
|
const [frag, push] = buildCodeFragment();
|
|
27958
28106
|
const operationsExps = genOperations(operations, context);
|
|
27959
|
-
if (operationsExps
|
|
27960
|
-
else push(
|
|
28107
|
+
if (countNewlines(operationsExps) > 1) push(operationsExps);
|
|
28108
|
+
else push(withoutNewlines(operationsExps));
|
|
27961
28109
|
return frag;
|
|
27962
28110
|
}
|
|
28111
|
+
const NO_FRAGMENT = Symbol();
|
|
28112
|
+
function firstFragment(frags) {
|
|
28113
|
+
for (const frag of frags) if (isNestedFragments(frag)) {
|
|
28114
|
+
const inner = firstFragment(frag);
|
|
28115
|
+
if (inner !== NO_FRAGMENT) return inner;
|
|
28116
|
+
} else return frag;
|
|
28117
|
+
return NO_FRAGMENT;
|
|
28118
|
+
}
|
|
28119
|
+
function lastFragment(frags) {
|
|
28120
|
+
for (let i = frags.length - 1; i >= 0; i--) {
|
|
28121
|
+
const frag = frags[i];
|
|
28122
|
+
if (isNestedFragments(frag)) {
|
|
28123
|
+
const inner = lastFragment(frag);
|
|
28124
|
+
if (inner !== NO_FRAGMENT) return inner;
|
|
28125
|
+
} else return frag;
|
|
28126
|
+
}
|
|
28127
|
+
return NO_FRAGMENT;
|
|
28128
|
+
}
|
|
28129
|
+
function countNewlines(frags) {
|
|
28130
|
+
let count = 0;
|
|
28131
|
+
for (const frag of frags) if (frag === NEWLINE) count++;
|
|
28132
|
+
else if (isNestedFragments(frag)) count += countNewlines(frag);
|
|
28133
|
+
return count;
|
|
28134
|
+
}
|
|
28135
|
+
function withoutNewlines(frags, out = []) {
|
|
28136
|
+
for (const frag of frags) {
|
|
28137
|
+
if (frag === NEWLINE) continue;
|
|
28138
|
+
if (isNestedFragments(frag)) withoutNewlines(frag, out);
|
|
28139
|
+
else out.push(frag);
|
|
28140
|
+
}
|
|
28141
|
+
return out;
|
|
28142
|
+
}
|
|
27963
28143
|
function genInsertionState(operation, context) {
|
|
27964
28144
|
const { parent, anchor, appendIndex } = operation;
|
|
27965
|
-
return [NEWLINE,
|
|
28145
|
+
return [NEWLINE, genCall(context.helper("setInsertionState"), `n${parent}`, anchor != null ? `n${anchor}` : appendIndex ? String(appendIndex) : void 0)];
|
|
27966
28146
|
}
|
|
27967
28147
|
//#endregion
|
|
27968
28148
|
//#region packages/compiler-vapor/src/generators/template.ts
|
|
@@ -27981,88 +28161,52 @@ function genSelf(dynamic, context, flushBeforeDynamic) {
|
|
|
27981
28161
|
const [frag, push] = buildCodeFragment();
|
|
27982
28162
|
const { id, template, operation, hasDynamicChild } = dynamic;
|
|
27983
28163
|
if (id !== void 0 && template !== void 0) {
|
|
27984
|
-
if (operation && operation.type === 11 && operation.appendIndex !== void 0) push(
|
|
28164
|
+
if (operation && operation.type === 11 && operation.appendIndex !== void 0) push(genInsertionState(operation, context));
|
|
27985
28165
|
push(NEWLINE, `const n${id} = ${context.tName(template)}()`);
|
|
27986
28166
|
}
|
|
27987
|
-
if (operation) push(
|
|
27988
|
-
if (hasDynamicChild) push(
|
|
28167
|
+
if (operation) push(genOperationWithInsertionState(operation, context));
|
|
28168
|
+
if (hasDynamicChild) push(genChildren(dynamic, context, push, `n${id}`, flushBeforeDynamic));
|
|
27989
28169
|
return frag;
|
|
27990
28170
|
}
|
|
27991
28171
|
function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flushBeforeDynamic) {
|
|
27992
28172
|
const [frag, push] = buildCodeFragment();
|
|
27993
|
-
const { children } = dynamic;
|
|
27994
|
-
let offset = 0;
|
|
27995
|
-
/**
|
|
27996
|
-
* `reusable` means the previous access target is a p* cursor that can be
|
|
27997
|
-
* reassigned by the next lookup. Referenced n* variables must stay stable.
|
|
27998
|
-
*/
|
|
27999
28173
|
let prev;
|
|
28000
|
-
for (const
|
|
28001
|
-
|
|
28002
|
-
if (
|
|
28003
|
-
if (child.anchor !== void 0) {
|
|
28004
|
-
const elementIndex = index + offset;
|
|
28005
|
-
const variable = `n${child.anchor}`;
|
|
28006
|
-
pushBlock(NEWLINE, `const ${variable} = `, ...genAccessPath(context, from, elementIndex, prev));
|
|
28007
|
-
prev = [
|
|
28008
|
-
variable,
|
|
28009
|
-
elementIndex,
|
|
28010
|
-
false
|
|
28011
|
-
];
|
|
28012
|
-
}
|
|
28013
|
-
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
28014
|
-
push(...genSelf(child, context, flushBeforeDynamic));
|
|
28015
|
-
continue;
|
|
28016
|
-
}
|
|
28017
|
-
const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
|
|
28018
|
-
const ownsSubtree = child.operation !== void 0;
|
|
28019
|
-
if (id === void 0 && (!child.hasDynamicChild || ownsSubtree)) {
|
|
28174
|
+
for (const child of dynamic.children) {
|
|
28175
|
+
const { access } = child;
|
|
28176
|
+
if (!access) {
|
|
28020
28177
|
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
28021
|
-
push(
|
|
28178
|
+
push(genSelf(child, context, flushBeforeDynamic));
|
|
28022
28179
|
continue;
|
|
28023
28180
|
}
|
|
28024
|
-
const
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
|
|
28028
|
-
|
|
28029
|
-
|
|
28181
|
+
const accessPath = genAccessPath(context, from, access, prev, child.isText);
|
|
28182
|
+
switch (access.kind) {
|
|
28183
|
+
case 3:
|
|
28184
|
+
push(genChildren(child, context, pushBlock, accessPath, flushBeforeDynamic));
|
|
28185
|
+
continue;
|
|
28186
|
+
case 4:
|
|
28187
|
+
push(genChildren(child, context, pushBlock, [
|
|
28030
28188
|
"(",
|
|
28031
|
-
prev
|
|
28189
|
+
prev,
|
|
28032
28190
|
" = ",
|
|
28033
|
-
|
|
28191
|
+
accessPath,
|
|
28034
28192
|
")"
|
|
28035
28193
|
], flushBeforeDynamic));
|
|
28036
|
-
prev = [
|
|
28037
|
-
prev[0],
|
|
28038
|
-
elementIndex,
|
|
28039
|
-
true
|
|
28040
|
-
];
|
|
28041
28194
|
continue;
|
|
28042
|
-
|
|
28043
|
-
|
|
28044
|
-
|
|
28045
|
-
|
|
28046
|
-
|
|
28047
|
-
|
|
28048
|
-
|
|
28049
|
-
|
|
28050
|
-
|
|
28051
|
-
|
|
28052
|
-
} else {
|
|
28053
|
-
variable = id === void 0 ? context.pName(context.block.tempId++) : `n${id}`;
|
|
28054
|
-
pushBlock(NEWLINE, id === void 0 ? `let ${variable} = ` : `const ${variable} = `, ...accessPath);
|
|
28195
|
+
case 2:
|
|
28196
|
+
pushBlock(NEWLINE, `${prev} = `, accessPath);
|
|
28197
|
+
break;
|
|
28198
|
+
case 1:
|
|
28199
|
+
prev = context.pName(context.block.tempId++);
|
|
28200
|
+
pushBlock(NEWLINE, `let ${prev} = `, accessPath);
|
|
28201
|
+
break;
|
|
28202
|
+
case 0:
|
|
28203
|
+
prev = `n${access.id}`;
|
|
28204
|
+
pushBlock(NEWLINE, `const ${prev} = `, accessPath);
|
|
28055
28205
|
}
|
|
28056
|
-
if (
|
|
28206
|
+
if (child.operation) {
|
|
28057
28207
|
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
28058
|
-
push(
|
|
28059
|
-
}
|
|
28060
|
-
prev = [
|
|
28061
|
-
variable,
|
|
28062
|
-
elementIndex,
|
|
28063
|
-
id === void 0
|
|
28064
|
-
];
|
|
28065
|
-
if (!ownsSubtree) push(...genChildren(child, context, pushBlock, variable, flushBeforeDynamic));
|
|
28208
|
+
push(genSelf(child, context, flushBeforeDynamic));
|
|
28209
|
+
} else if (child.hasDynamicChild) push(genChildren(child, context, pushBlock, prev, flushBeforeDynamic));
|
|
28066
28210
|
}
|
|
28067
28211
|
return frag;
|
|
28068
28212
|
}
|
|
@@ -28070,80 +28214,25 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
|
|
|
28070
28214
|
* Build one DOM lookup path while preserving the fast sibling walk:
|
|
28071
28215
|
* adjacent nodes use _next(prev), otherwise fall back to _nthChild(parent).
|
|
28072
28216
|
*/
|
|
28073
|
-
function genAccessPath({ helper }, from,
|
|
28217
|
+
function genAccessPath({ helper }, from, { index, adjacent }, prev, isText) {
|
|
28074
28218
|
const textHint = isText ? "true" : void 0;
|
|
28075
|
-
if (
|
|
28076
|
-
if (
|
|
28077
|
-
if (
|
|
28219
|
+
if (adjacent) return genCall(helper("next"), prev, textHint);
|
|
28220
|
+
if (index === 0) return genCall(helper("child"), from, textHint);
|
|
28221
|
+
if (index === 1) {
|
|
28078
28222
|
const firstChild = genCall(helper("child"), from);
|
|
28079
28223
|
return genCall(helper("next"), firstChild, textHint);
|
|
28080
28224
|
}
|
|
28081
|
-
return genCall(helper("nthChild"), from, String(
|
|
28082
|
-
}
|
|
28083
|
-
/**
|
|
28084
|
-
* Only inline a placeholder when materializing it would not save a parent
|
|
28085
|
-
* lookup. If its child tree needs the parent more than once, keep p* so the
|
|
28086
|
-
* generated code does not duplicate _child/_nthChild work.
|
|
28087
|
-
*/
|
|
28088
|
-
function canInlinePlaceholder(dynamic) {
|
|
28089
|
-
return dynamic.hasDynamicChild === true && countParentAccessUsages(dynamic) === 1;
|
|
28090
|
-
}
|
|
28091
|
-
/**
|
|
28092
|
-
* A following access can reuse the current placeholder cursor only when it is
|
|
28093
|
-
* the next DOM sibling. Gapped siblings need _nthChild(parent, index) instead.
|
|
28094
|
-
* Kept in lockstep with genChildren's traversal rules.
|
|
28095
|
-
*/
|
|
28096
|
-
function hasAdjacentFollowingAccessChild(children, index, elementIndex, offset) {
|
|
28097
|
-
let futureOffset = offset;
|
|
28098
|
-
for (let i = index + 1; i < children.length; i++) {
|
|
28099
|
-
const child = children[i];
|
|
28100
|
-
if (child.flags & 2) futureOffset--;
|
|
28101
|
-
if (child.flags & 4 && child.anchor === void 0) continue;
|
|
28102
|
-
if (!!(child.flags & 1) || child.hasDynamicChild) return i + futureOffset - elementIndex === 1;
|
|
28103
|
-
}
|
|
28104
|
-
return false;
|
|
28105
|
-
}
|
|
28106
|
-
/**
|
|
28107
|
-
* Mirrors genChildren's traversal closely enough to count how many emitted
|
|
28108
|
-
* access paths would start from this placeholder's parent. This is the guard
|
|
28109
|
-
* that keeps inline placeholders from duplicating parent lookups.
|
|
28110
|
-
*/
|
|
28111
|
-
function countParentAccessUsages(dynamic) {
|
|
28112
|
-
let usages = 0;
|
|
28113
|
-
let offset = 0;
|
|
28114
|
-
let prev;
|
|
28115
|
-
for (const [index, child] of dynamic.children.entries()) {
|
|
28116
|
-
if (child.flags & 2) offset--;
|
|
28117
|
-
if (child.flags & 4 && child.template != null && child.anchor === void 0) continue;
|
|
28118
|
-
const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
|
|
28119
|
-
if (id === void 0 && !child.hasDynamicChild) continue;
|
|
28120
|
-
const elementIndex = index + offset;
|
|
28121
|
-
const usesParent = !prev || elementIndex - prev[0] !== 1;
|
|
28122
|
-
if (id === void 0 && canInlinePlaceholder(child) && child.template == null && child.operation === void 0 && !(child.flags & 6)) {
|
|
28123
|
-
if (prev && prev[1]) {
|
|
28124
|
-
if (usesParent) usages++;
|
|
28125
|
-
prev = [elementIndex, true];
|
|
28126
|
-
continue;
|
|
28127
|
-
}
|
|
28128
|
-
if (!hasAdjacentFollowingAccessChild(dynamic.children, index, elementIndex, offset)) {
|
|
28129
|
-
if (usesParent) usages++;
|
|
28130
|
-
continue;
|
|
28131
|
-
}
|
|
28132
|
-
}
|
|
28133
|
-
if (usesParent) usages++;
|
|
28134
|
-
prev = [elementIndex, id === void 0];
|
|
28135
|
-
}
|
|
28136
|
-
return usages;
|
|
28225
|
+
return genCall(helper("nthChild"), from, String(index), textHint);
|
|
28137
28226
|
}
|
|
28138
28227
|
//#endregion
|
|
28139
28228
|
//#region packages/compiler-vapor/src/generators/block.ts
|
|
28140
28229
|
function genBlock(oper, context, args = [], root) {
|
|
28141
28230
|
return [
|
|
28142
28231
|
"(",
|
|
28143
|
-
|
|
28232
|
+
args,
|
|
28144
28233
|
") => {",
|
|
28145
28234
|
INDENT_START,
|
|
28146
|
-
|
|
28235
|
+
genBlockContent(oper, context, root),
|
|
28147
28236
|
INDENT_END,
|
|
28148
28237
|
NEWLINE,
|
|
28149
28238
|
"}"
|
|
@@ -28151,17 +28240,9 @@ function genBlock(oper, context, args = [], root) {
|
|
|
28151
28240
|
}
|
|
28152
28241
|
function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffectIndexes) {
|
|
28153
28242
|
const [frag, push] = buildCodeFragment();
|
|
28154
|
-
const { dynamic, effect, operation, returns } = block;
|
|
28155
|
-
const modelOperations = operation.filter(isVModelOperation);
|
|
28156
|
-
const modelElements = new Set(modelOperations.map((oper) => oper.element));
|
|
28157
|
-
const isModelListener = (oper) => isVModelListener(oper, modelElements);
|
|
28158
|
-
const isDeferred = (oper) => isVModelOperation(oper) || isModelListener(oper);
|
|
28159
|
-
const modelListenerEffects = [];
|
|
28160
|
-
if (modelElements.size) {
|
|
28161
|
-
for (let i = 0; i < effect.length; i++) if (!(skippedEffectIndexes && skippedEffectIndexes.has(i)) && effect[i].operations.every(isModelListener)) modelListenerEffects.push(effect[i]);
|
|
28162
|
-
}
|
|
28243
|
+
const { dynamic, effect, operation, returns, deferredOperationIndex, deferredEffectIndex } = block;
|
|
28163
28244
|
const resetBlock = context.enterBlock(block);
|
|
28164
|
-
const singleUseAssetComponentNames = root ? collectSingleUseAssetComponents(block) : void 0;
|
|
28245
|
+
const singleUseAssetComponentNames = root ? collectSingleUseAssetComponents(block, context.ir.component) : void 0;
|
|
28165
28246
|
const prevSingleUseAssetComponentNames = context.singleUseAssetComponentNames;
|
|
28166
28247
|
if (singleUseAssetComponentNames) context.singleUseAssetComponentNames = singleUseAssetComponentNames;
|
|
28167
28248
|
if (root) {
|
|
@@ -28170,7 +28251,7 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
28170
28251
|
const id = toValidAssetId(name, "component");
|
|
28171
28252
|
const maybeSelfReference = name.endsWith("__self");
|
|
28172
28253
|
if (maybeSelfReference) name = name.slice(0, -6);
|
|
28173
|
-
push(NEWLINE, `const ${id} = `,
|
|
28254
|
+
push(NEWLINE, `const ${id} = `, genCall(context.helper("resolveComponent"), JSON.stringify(name), maybeSelfReference ? "true" : void 0));
|
|
28174
28255
|
}
|
|
28175
28256
|
genResolveAssets("directive", "resolveDirective");
|
|
28176
28257
|
}
|
|
@@ -28178,12 +28259,11 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
28178
28259
|
let effectIndex = 0;
|
|
28179
28260
|
const flushPendingOperations = (operationEnd, effectEnd, push) => {
|
|
28180
28261
|
while (operationIndex < operationEnd) {
|
|
28181
|
-
|
|
28182
|
-
if (!isDeferred(oper)) push(...genOperationWithInsertionState(oper, context));
|
|
28262
|
+
push(genOperationWithInsertionState(operation[operationIndex], context));
|
|
28183
28263
|
operationIndex++;
|
|
28184
28264
|
}
|
|
28185
28265
|
if (effectIndex < effectEnd) {
|
|
28186
|
-
push(
|
|
28266
|
+
push(genEffectRange(effectIndex, effectEnd));
|
|
28187
28267
|
effectIndex = effectEnd;
|
|
28188
28268
|
}
|
|
28189
28269
|
};
|
|
@@ -28193,45 +28273,36 @@ function genBlockContent(block, context, root, genEffectsExtraFrag, skippedEffec
|
|
|
28193
28273
|
};
|
|
28194
28274
|
for (const child of dynamic.children) {
|
|
28195
28275
|
flushBeforeDynamic(child, push);
|
|
28196
|
-
push(
|
|
28197
|
-
}
|
|
28198
|
-
|
|
28199
|
-
if (
|
|
28200
|
-
if (
|
|
28201
|
-
|
|
28202
|
-
if (
|
|
28203
|
-
|
|
28204
|
-
push(...genOperations(operation.filter(isModelListener), context));
|
|
28205
|
-
if (modelListenerEffects.length) push(...genEffects(modelListenerEffects, context));
|
|
28206
|
-
}
|
|
28207
|
-
push(...genCustomDirectives(operation, context));
|
|
28276
|
+
push(genSelf(child, context, flushBeforeDynamic));
|
|
28277
|
+
}
|
|
28278
|
+
if (operationIndex < deferredOperationIndex) push(genOperations(operation.slice(operationIndex, deferredOperationIndex), context));
|
|
28279
|
+
if (effectIndex < deferredEffectIndex) push(genEffectRange(effectIndex, deferredEffectIndex, genEffectsExtraFrag));
|
|
28280
|
+
else if (genEffectsExtraFrag) push(genEffects([], context, genEffectsExtraFrag));
|
|
28281
|
+
if (deferredOperationIndex < operation.length) push(genOperations(operation.slice(deferredOperationIndex), context));
|
|
28282
|
+
if (deferredEffectIndex < effect.length) push(genEffectRange(deferredEffectIndex, effect.length));
|
|
28283
|
+
push(genCustomDirectives(operation, context));
|
|
28208
28284
|
push(NEWLINE, `return `);
|
|
28209
28285
|
const returnNodes = returns.map((n) => `n${n}`);
|
|
28210
|
-
push(
|
|
28286
|
+
push(returnNodes.length > 1 ? genMulti(DELIMITERS_ARRAY, ...returnNodes) : [returnNodes[0] || "[]"]);
|
|
28211
28287
|
resetBlock();
|
|
28212
28288
|
context.singleUseAssetComponentNames = prevSingleUseAssetComponentNames;
|
|
28213
28289
|
return frag;
|
|
28214
28290
|
function genEffectRange(start, end, genExtraFrag) {
|
|
28215
|
-
if (!skippedEffectIndexes
|
|
28291
|
+
if (!skippedEffectIndexes) return genEffects(effect.slice(start, end), context, genExtraFrag);
|
|
28216
28292
|
const effects = [];
|
|
28217
|
-
for (let i = start; i < end; i++) if (!
|
|
28293
|
+
for (let i = start; i < end; i++) if (!skippedEffectIndexes.has(i)) effects.push(effect[i]);
|
|
28218
28294
|
if (effects.length || genExtraFrag) return genEffects(effects, context, genExtraFrag);
|
|
28219
28295
|
return [];
|
|
28220
28296
|
}
|
|
28221
28297
|
function genResolveAssets(kind, helper) {
|
|
28222
|
-
for (const name of context.ir[kind]) push(NEWLINE, `const ${toValidAssetId(name, kind)} = `,
|
|
28298
|
+
for (const name of context.ir[kind]) push(NEWLINE, `const ${toValidAssetId(name, kind)} = `, genCall(context.helper(helper), JSON.stringify(name)));
|
|
28223
28299
|
}
|
|
28224
28300
|
}
|
|
28225
|
-
function isVModelOperation(oper) {
|
|
28226
|
-
return oper.type === 14 && oper.builtin === true && oper.name === "model";
|
|
28227
|
-
}
|
|
28228
|
-
function isVModelListener(oper, modelElements) {
|
|
28229
|
-
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);
|
|
28230
|
-
}
|
|
28231
28301
|
function markSlotRootOperations(block, context) {
|
|
28232
|
-
|
|
28233
|
-
|
|
28234
|
-
|
|
28302
|
+
const roots = getReturnedDynamics(block);
|
|
28303
|
+
if (hasStableSlotRoot(roots, context)) return true;
|
|
28304
|
+
for (let i = 0; i < roots.length; i++) {
|
|
28305
|
+
const child = roots[i];
|
|
28235
28306
|
const operation = child && child.operation;
|
|
28236
28307
|
if (!operation) continue;
|
|
28237
28308
|
if (operation.type === 15) markSlotRootIf(operation, context);
|
|
@@ -28242,6 +28313,7 @@ function markSlotRootOperations(block, context) {
|
|
|
28242
28313
|
} else if (operation.type === 12) markSlotRootComponent(operation);
|
|
28243
28314
|
else if (operation.type === 13) operation.flags |= 4;
|
|
28244
28315
|
}
|
|
28316
|
+
return false;
|
|
28245
28317
|
}
|
|
28246
28318
|
function markSlotRootIf(operation, context) {
|
|
28247
28319
|
if (!operation.once) operation.slotRoot = true;
|
|
@@ -28258,52 +28330,47 @@ function markSlotRootFor(operation, context) {
|
|
|
28258
28330
|
function markSlotRootComponent(operation) {
|
|
28259
28331
|
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
28260
28332
|
}
|
|
28261
|
-
function
|
|
28262
|
-
|
|
28263
|
-
|
|
28264
|
-
|
|
28333
|
+
function getReturnedDynamics(block) {
|
|
28334
|
+
const { children } = block.dynamic;
|
|
28335
|
+
const byId = /* @__PURE__ */ new Map();
|
|
28336
|
+
for (let i = 0; i < children.length; i++) {
|
|
28337
|
+
const child = children[i];
|
|
28338
|
+
if (child.id !== void 0) byId.set(child.id, child);
|
|
28265
28339
|
}
|
|
28340
|
+
return block.returns.map((id) => byId.get(id));
|
|
28266
28341
|
}
|
|
28267
28342
|
const commentOnlyTemplateRE = /^(?:<!--[\s\S]*?-->)+$/;
|
|
28268
|
-
function hasStableSlotRoot(
|
|
28269
|
-
let
|
|
28270
|
-
|
|
28271
|
-
const id = block.returns[i];
|
|
28272
|
-
const child = findReturnedDynamic$1(block, id);
|
|
28343
|
+
function hasStableSlotRoot(roots, context) {
|
|
28344
|
+
for (let i = 0; i < roots.length; i++) {
|
|
28345
|
+
const child = roots[i];
|
|
28273
28346
|
const operation = child && child.operation;
|
|
28274
28347
|
if (!operation) {
|
|
28275
|
-
if (child && isStableTemplateSlotRoot(child, context))
|
|
28348
|
+
if (child && isStableTemplateSlotRoot(child, context)) return true;
|
|
28276
28349
|
continue;
|
|
28277
28350
|
}
|
|
28278
28351
|
switch (operation.type) {
|
|
28279
28352
|
case 12:
|
|
28280
|
-
if (!operation.dynamic || operation.dynamic.isStatic)
|
|
28281
|
-
hasValidRoot = true;
|
|
28282
|
-
continue;
|
|
28283
|
-
}
|
|
28353
|
+
if (!operation.dynamic || operation.dynamic.isStatic) return true;
|
|
28284
28354
|
continue;
|
|
28285
28355
|
case 17:
|
|
28286
|
-
if (hasStableSlotRoot(operation.block, context))
|
|
28287
|
-
hasValidRoot = true;
|
|
28288
|
-
continue;
|
|
28289
|
-
}
|
|
28356
|
+
if (hasStableSlotRoot(getReturnedDynamics(operation.block), context)) return true;
|
|
28290
28357
|
continue;
|
|
28291
28358
|
default: continue;
|
|
28292
28359
|
}
|
|
28293
28360
|
}
|
|
28294
|
-
return
|
|
28361
|
+
return false;
|
|
28295
28362
|
}
|
|
28296
28363
|
function isStableTemplateSlotRoot(child, context) {
|
|
28297
28364
|
if (child.template == null) return false;
|
|
28298
28365
|
const content = context.ir.template.entries[child.template].content;
|
|
28299
28366
|
return content !== "" && !commentOnlyTemplateRE.test(content.trim());
|
|
28300
28367
|
}
|
|
28301
|
-
function collectSingleUseAssetComponents(block) {
|
|
28368
|
+
function collectSingleUseAssetComponents(block, assetComponents) {
|
|
28302
28369
|
const usageMap = /* @__PURE__ */ new Map();
|
|
28303
28370
|
const seenOperations = /* @__PURE__ */ new Set();
|
|
28304
28371
|
visitBlock(block, true);
|
|
28305
28372
|
const names = /* @__PURE__ */ new Set();
|
|
28306
|
-
for (const [name, usage] of usageMap) if (usage.count === 1 && usage.root) names.add(name);
|
|
28373
|
+
for (const [name, usage] of usageMap) if (usage.count === 1 && usage.root && assetComponents.has(name)) names.add(name);
|
|
28307
28374
|
return names;
|
|
28308
28375
|
function visitBlock(block, rootCandidate) {
|
|
28309
28376
|
visitDynamic(block.dynamic, rootCandidate);
|
|
@@ -28364,7 +28431,6 @@ function collectSingleUseAssetComponents(block) {
|
|
|
28364
28431
|
}
|
|
28365
28432
|
//#endregion
|
|
28366
28433
|
//#region packages/compiler-vapor/src/generate.ts
|
|
28367
|
-
const idWithTrailingDigitsRE = /^([A-Za-z_$][\w$]*)(\d+)$/;
|
|
28368
28434
|
const helperNameAliases = {
|
|
28369
28435
|
withVaporKeys: "withKeys",
|
|
28370
28436
|
withVaporModifiers: "withModifiers"
|
|
@@ -28394,7 +28460,7 @@ var CodegenContext = class {
|
|
|
28394
28460
|
identifiers[id].unshift(map[id] || id);
|
|
28395
28461
|
}
|
|
28396
28462
|
const ret = fn();
|
|
28397
|
-
|
|
28463
|
+
for (const id of ids) identifiers[id].shift();
|
|
28398
28464
|
return ret;
|
|
28399
28465
|
}
|
|
28400
28466
|
enterBlock(block) {
|
|
@@ -28421,8 +28487,7 @@ var CodegenContext = class {
|
|
|
28421
28487
|
if (name === "_ctx" || name === setTemplateRefIdent) return false;
|
|
28422
28488
|
if (this.bindingNames.has(name) || reservedNames.has(name)) return false;
|
|
28423
28489
|
if ((_this$identifiers$nam = this.identifiers[name]) === null || _this$identifiers$nam === void 0 ? void 0 : _this$identifiers$nam.length) return false;
|
|
28424
|
-
|
|
28425
|
-
return true;
|
|
28490
|
+
return !this.helperAliases.has(name);
|
|
28426
28491
|
}
|
|
28427
28492
|
findAvailableName(base, reservedNames) {
|
|
28428
28493
|
if (this.isNameAvailable(base, reservedNames)) return base;
|
|
@@ -28435,20 +28500,6 @@ var CodegenContext = class {
|
|
|
28435
28500
|
next = id + 1;
|
|
28436
28501
|
}
|
|
28437
28502
|
}
|
|
28438
|
-
initNextIdMap() {
|
|
28439
|
-
if (this.bindingNames.size === 0) return;
|
|
28440
|
-
const map = /* @__PURE__ */ new Map();
|
|
28441
|
-
for (const name of this.bindingNames) {
|
|
28442
|
-
const m = idWithTrailingDigitsRE.exec(name);
|
|
28443
|
-
if (!m) continue;
|
|
28444
|
-
const prefix = m[1];
|
|
28445
|
-
const num = Number(m[2]);
|
|
28446
|
-
let set = map.get(prefix);
|
|
28447
|
-
if (!set) map.set(prefix, set = /* @__PURE__ */ new Set());
|
|
28448
|
-
set.add(num);
|
|
28449
|
-
}
|
|
28450
|
-
for (const [prefix, nums] of map) this.nextIdMap.set(prefix, buildNextIdMap(nums));
|
|
28451
|
-
}
|
|
28452
28503
|
tName(i) {
|
|
28453
28504
|
let name = this.templateVars.get(i);
|
|
28454
28505
|
if (name) return name;
|
|
@@ -28473,8 +28524,9 @@ var CodegenContext = class {
|
|
|
28473
28524
|
}
|
|
28474
28525
|
constructor(ir, options) {
|
|
28475
28526
|
this.ir = ir;
|
|
28476
|
-
this.bindingNames = /* @__PURE__ */ new Set();
|
|
28477
28527
|
this.helpers = /* @__PURE__ */ new Map();
|
|
28528
|
+
this.helperAliases = /* @__PURE__ */ new Set();
|
|
28529
|
+
this.hoistedHandlers = /* @__PURE__ */ new Map();
|
|
28478
28530
|
this.needsTemplateRefSetter = false;
|
|
28479
28531
|
this.inSlotBlock = false;
|
|
28480
28532
|
this.helper = (name) => {
|
|
@@ -28482,6 +28534,7 @@ var CodegenContext = class {
|
|
|
28482
28534
|
const base = `_${helperNameAliases[name] || name}`;
|
|
28483
28535
|
const alias = this.findAvailableName(base, this.generatedLocalNames);
|
|
28484
28536
|
this.helpers.set(name, alias);
|
|
28537
|
+
this.helperAliases.add(alias);
|
|
28485
28538
|
return alias;
|
|
28486
28539
|
};
|
|
28487
28540
|
this.delegates = /* @__PURE__ */ new Set();
|
|
@@ -28512,8 +28565,8 @@ var CodegenContext = class {
|
|
|
28512
28565
|
};
|
|
28513
28566
|
this.options = extend(defaultOptions, options);
|
|
28514
28567
|
this.block = ir.block;
|
|
28515
|
-
this.bindingNames =
|
|
28516
|
-
this.
|
|
28568
|
+
this.bindingNames = ir.reservedNames.names;
|
|
28569
|
+
for (const [prefix, nums] of ir.reservedNames.ids) this.nextIdMap.set(prefix, buildNextIdMap(nums));
|
|
28517
28570
|
}
|
|
28518
28571
|
};
|
|
28519
28572
|
function generate(ir, options = {}) {
|
|
@@ -28529,15 +28582,21 @@ function generate(ir, options = {}) {
|
|
|
28529
28582
|
const templateRefSetterHelper = ir.hasTemplateRef ? context.helper("createTemplateRefSetter") : void 0;
|
|
28530
28583
|
const body = genBlockContent(ir.block, context, true);
|
|
28531
28584
|
if (context.needsTemplateRefSetter) push(NEWLINE, `const ${setTemplateRefIdent} = ${templateRefSetterHelper}()`);
|
|
28532
|
-
else if (templateRefSetterHelper)
|
|
28533
|
-
|
|
28585
|
+
else if (templateRefSetterHelper) {
|
|
28586
|
+
context.helpers.delete("createTemplateRefSetter");
|
|
28587
|
+
context.helperAliases.delete(templateRefSetterHelper);
|
|
28588
|
+
}
|
|
28589
|
+
push(body);
|
|
28534
28590
|
push(INDENT_END, NEWLINE);
|
|
28535
28591
|
if (!inline) push("}");
|
|
28536
28592
|
const delegates = genDelegates(context);
|
|
28537
28593
|
const templates = genTemplates(ir.template.entries, context);
|
|
28538
28594
|
const preamble = genHelperImports(context) + genAssetImports(context) + templates + genDynamicPropNames(context) + delegates;
|
|
28539
|
-
|
|
28540
|
-
|
|
28595
|
+
if (!inline) {
|
|
28596
|
+
let newlineCount = 0;
|
|
28597
|
+
for (let i = preamble.indexOf("\n"); i !== -1; i = preamble.indexOf("\n", i + 1)) newlineCount++;
|
|
28598
|
+
if (newlineCount) frag.unshift(...new Array(newlineCount).fill(LF));
|
|
28599
|
+
}
|
|
28541
28600
|
let [code, map] = codeFragmentToString(frag, context);
|
|
28542
28601
|
if (!inline) code = preamble + code;
|
|
28543
28602
|
return {
|
|
@@ -28554,7 +28613,7 @@ function genDynamicPropNames({ dynamicPropNames }) {
|
|
|
28554
28613
|
return code;
|
|
28555
28614
|
}
|
|
28556
28615
|
function genDelegates({ delegates, helper }) {
|
|
28557
|
-
return delegates.size ?
|
|
28616
|
+
return delegates.size ? `${helper("delegateEvents")}(${Array.from(delegates).map((v) => `"${v}"`).join(", ")})\n` : "";
|
|
28558
28617
|
}
|
|
28559
28618
|
function genHelperImports({ helpers, options }) {
|
|
28560
28619
|
let imports = "";
|
|
@@ -28679,10 +28738,10 @@ const transformVBind = (dir, node, context) => {
|
|
|
28679
28738
|
context.options.onError(createCompilerError(34, loc));
|
|
28680
28739
|
exp = createSimpleExpression("", true, loc);
|
|
28681
28740
|
}
|
|
28682
|
-
arg = resolveExpression(arg);
|
|
28741
|
+
if (node.tagType !== 2) arg = resolveExpression(arg);
|
|
28683
28742
|
const excludeNumber = node.tagType === 1 || node.tagType === 2 || !!context.options.isCustomElement(node.tag) || modifiersString.includes("prop") || !arg.isStatic || isSpecialBooleanAttr(arg.content) || isCheckboxValueProp(node, arg.content) || !modifiersString.includes("attr") && (isFoldableBooleanAttr(arg.content) || isModelValueProp(node, arg.content));
|
|
28684
28743
|
exp = resolveExpression(exp, excludeNumber);
|
|
28685
|
-
if (arg.isStatic && isReservedProp(arg.content)) return;
|
|
28744
|
+
if (arg.isStatic && isReservedProp(arg.content) && !(arg.content === "key" && node.tagType === 2)) return;
|
|
28686
28745
|
let camel = false;
|
|
28687
28746
|
if (modifiersString.includes("camel")) {
|
|
28688
28747
|
if (arg.isStatic) arg = extend({}, arg, { content: camelize(arg.content) });
|
|
@@ -28709,6 +28768,8 @@ const transformKey = (node, context) => {
|
|
|
28709
28768
|
}
|
|
28710
28769
|
const dir = findProp(node, "key", true, true);
|
|
28711
28770
|
if (!dir || dir.type === 6) return;
|
|
28771
|
+
const parent = context.parent && context.parent.node;
|
|
28772
|
+
if (node.tagType === 2 && parent && parent.type === 1 && parent.props.includes(dir)) return;
|
|
28712
28773
|
let value;
|
|
28713
28774
|
value = dir.exp || normalizeBindShorthand(dir.arg, context);
|
|
28714
28775
|
if (isStaticExpression(value, context.options.bindingMetadata)) return;
|
|
@@ -28811,8 +28872,8 @@ function isFoldableBooleanAttr(key) {
|
|
|
28811
28872
|
return isBooleanAttr(key) || key === "hidden";
|
|
28812
28873
|
}
|
|
28813
28874
|
const transformElement = (node, context) => {
|
|
28814
|
-
let
|
|
28815
|
-
const
|
|
28875
|
+
let effectOrder = context.order;
|
|
28876
|
+
const getEffectOrder = () => ++effectOrder;
|
|
28816
28877
|
if (node.type === 1 && node.children.length) ignoreVHtmlChildren(node, context, "node");
|
|
28817
28878
|
let parentSlots;
|
|
28818
28879
|
if (node.type === 1 && (node.tagType === 1 || shouldUseCreateElement(node, context))) {
|
|
@@ -28826,10 +28887,10 @@ const transformElement = (node, context) => {
|
|
|
28826
28887
|
const isComponent = node.tagType === 1 || useCreateElement;
|
|
28827
28888
|
const isDynamicComponent = isComponentTag(node.tag);
|
|
28828
28889
|
const staticKey = dynamicComponentKeys.has(node) ? void 0 : resolveStaticKey(node, context, isComponent);
|
|
28829
|
-
const propsResult = buildProps(node, context, isComponent, isDynamicComponent,
|
|
28890
|
+
const propsResult = buildProps(node, context, isComponent, isDynamicComponent, getEffectOrder);
|
|
28830
28891
|
const singleRoot = context.isSingleRoot;
|
|
28831
28892
|
if (isComponent) transformComponentElement(node, propsResult, staticKey, singleRoot || context.isSlotRoot && !useCreateElement && 2, context, isDynamicComponent, useCreateElement);
|
|
28832
|
-
else transformNativeElement(node, propsResult, staticKey, singleRoot, context,
|
|
28893
|
+
else transformNativeElement(node, propsResult, staticKey, singleRoot, context, getEffectOrder, context.root === context.effectiveParent || canOmitEndTag(node, context));
|
|
28833
28894
|
if (parentSlots) context.slots = parentSlots;
|
|
28834
28895
|
};
|
|
28835
28896
|
};
|
|
@@ -28869,14 +28930,14 @@ function getTemplateParent(context) {
|
|
|
28869
28930
|
if (parentNode.type === 1 && parentNode.tagType === 0 && !shouldUseCreateElement(parentNode, parent)) return parent;
|
|
28870
28931
|
}
|
|
28871
28932
|
function transformComponentElement(node, propsResult, staticKey, root, context, isDynamicComponent, useCreateElement) {
|
|
28872
|
-
|
|
28933
|
+
let dynamicComponent = isDynamicComponent ? resolveDynamicComponent(node) : void 0;
|
|
28873
28934
|
let { tag } = node;
|
|
28874
28935
|
let asset = !useCreateElement;
|
|
28875
|
-
let slotScopeNamespace;
|
|
28876
28936
|
if (!dynamicComponent && !useCreateElement) {
|
|
28877
28937
|
const isProp = findProp(node, "is");
|
|
28878
28938
|
if (isProp && isProp.type === 6 && isVueIsValue(isProp)) tag = isProp.value.content.slice(4);
|
|
28879
|
-
const
|
|
28939
|
+
const slotScopeTag = resolveSlotScopeReference(tag, context);
|
|
28940
|
+
const resolved = slotScopeTag || resolveSetupReference(tag, context);
|
|
28880
28941
|
if (resolved) {
|
|
28881
28942
|
tag = resolved;
|
|
28882
28943
|
asset = false;
|
|
@@ -28886,6 +28947,7 @@ function transformComponentElement(node, propsResult, staticKey, root, context,
|
|
|
28886
28947
|
tag = builtInTag;
|
|
28887
28948
|
asset = false;
|
|
28888
28949
|
}
|
|
28950
|
+
let slotScopeNamespace;
|
|
28889
28951
|
const dotIndex = tag.indexOf(".");
|
|
28890
28952
|
if (dotIndex > 0) {
|
|
28891
28953
|
slotScopeNamespace = resolveSlotScopeReference(tag.slice(0, dotIndex), context);
|
|
@@ -28895,6 +28957,10 @@ function transformComponentElement(node, propsResult, staticKey, root, context,
|
|
|
28895
28957
|
asset = false;
|
|
28896
28958
|
}
|
|
28897
28959
|
}
|
|
28960
|
+
if (slotScopeTag && !builtInTag || slotScopeNamespace) {
|
|
28961
|
+
dynamicComponent = createSimpleExpression(tag, false, node.loc);
|
|
28962
|
+
dynamicComponent.ast = isSimpleIdentifier(tag) ? null : (0, import_lib.parseExpression)(`(${tag})`, getParserOptions(context.options.expressionPlugins));
|
|
28963
|
+
}
|
|
28898
28964
|
if (asset) {
|
|
28899
28965
|
if (context.selfName && capitalize(camelize(tag)) === context.selfName) tag += `__self`;
|
|
28900
28966
|
context.component.add(tag);
|
|
@@ -28916,7 +28982,6 @@ function transformComponentElement(node, propsResult, staticKey, root, context,
|
|
|
28916
28982
|
id
|
|
28917
28983
|
}, context.effectBoundary()), {}, {
|
|
28918
28984
|
tag,
|
|
28919
|
-
slotScopeNamespace,
|
|
28920
28985
|
props,
|
|
28921
28986
|
asset,
|
|
28922
28987
|
root,
|
|
@@ -28996,7 +29061,7 @@ const inputValueDepKeys = [
|
|
|
28996
29061
|
const NEEDS_QUOTES_RE = /[\s"'`=<>]/;
|
|
28997
29062
|
const LEADING_NEWLINE_RE = /^\r?\n/;
|
|
28998
29063
|
const UNSAFE_ATTR_NAME_RE = /[\u0000-\u0020"'<=/>]/;
|
|
28999
|
-
function transformNativeElement(node, propsResult, staticKey, singleRoot, context,
|
|
29064
|
+
function transformNativeElement(node, propsResult, staticKey, singleRoot, context, getEffectOrder, omitEndTag) {
|
|
29000
29065
|
const { tag } = node;
|
|
29001
29066
|
const { scopeId } = context.options;
|
|
29002
29067
|
const isSVG = node.ns === 1;
|
|
@@ -29013,7 +29078,7 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
29013
29078
|
props: dynamicArgs,
|
|
29014
29079
|
isSVG,
|
|
29015
29080
|
once: isSelect && context.inVOnce
|
|
29016
|
-
},
|
|
29081
|
+
}, getEffectOrder);
|
|
29017
29082
|
if (isSelect && !context.inVOnce) context.registerEffect([], {
|
|
29018
29083
|
type: 5,
|
|
29019
29084
|
element: context.reference(),
|
|
@@ -29047,7 +29112,7 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
29047
29112
|
tag,
|
|
29048
29113
|
isSVG
|
|
29049
29114
|
};
|
|
29050
|
-
operation.effect = context.registerEffect(values, operation,
|
|
29115
|
+
operation.effect = context.registerEffect(values, operation, getEffectOrder, needsOrderedProps && hasEffect);
|
|
29051
29116
|
hasEffect = operation.effect || hasEffect;
|
|
29052
29117
|
}
|
|
29053
29118
|
} 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}"`;
|
|
@@ -29068,7 +29133,7 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
29068
29133
|
tag,
|
|
29069
29134
|
isSVG,
|
|
29070
29135
|
once: isSelectValue && (context.inVOnce || !hasDynamicKeys && values.every((exp) => isConstantBinding$1(exp, context.options.bindingMetadata)))
|
|
29071
|
-
}, isSelectValue ? void 0 :
|
|
29136
|
+
}, isSelectValue ? void 0 : getEffectOrder, isSelectValue || (needsOrderedProps || tag === "input" && prop === valueProp) && hasEffect) || hasEffect;
|
|
29072
29137
|
if (tag === "input" && inputValueDepKeys.includes(key.content)) hasValueDep = true;
|
|
29073
29138
|
}
|
|
29074
29139
|
}
|
|
@@ -29077,7 +29142,7 @@ function transformNativeElement(node, propsResult, staticKey, singleRoot, contex
|
|
|
29077
29142
|
element: context.reference(),
|
|
29078
29143
|
props: [nativeOnProps],
|
|
29079
29144
|
isSVG
|
|
29080
|
-
},
|
|
29145
|
+
}, getEffectOrder);
|
|
29081
29146
|
}
|
|
29082
29147
|
let children = context.childrenTemplate.join("");
|
|
29083
29148
|
if (node.ns === 0 && parserOptions.isIgnoreNewlineTag(tag) && LEADING_NEWLINE_RE.test(children)) children = `\n` + children;
|
|
@@ -29240,21 +29305,18 @@ function createSetBlockKey(element, value) {
|
|
|
29240
29305
|
value
|
|
29241
29306
|
};
|
|
29242
29307
|
}
|
|
29243
|
-
function buildProps(node, context, isComponent, isDynamicComponent,
|
|
29308
|
+
function buildProps(node, context, isComponent, isDynamicComponent, getEffectOrder) {
|
|
29244
29309
|
const props = node.props;
|
|
29310
|
+
const isSlot = node.tagType === 2;
|
|
29245
29311
|
if (props.length === 0) return [false, []];
|
|
29246
29312
|
const dynamicArgs = [];
|
|
29247
29313
|
const dynamicExpr = [];
|
|
29248
29314
|
let results = [];
|
|
29249
|
-
let resolvedBind;
|
|
29250
|
-
let resolvedBindProps;
|
|
29251
29315
|
const deferListeners = !isComponent && !!findDir(node, "model") && props.some((prop) => prop.type === 7 && prop.name === "on" && !prop.arg) && mergesListeners(node, context) && props.every((prop) => {
|
|
29252
29316
|
if (prop.type !== 7 || prop.name !== "bind") return true;
|
|
29253
29317
|
if (prop.arg) return prop.arg.type === 4 && prop.arg.isStatic;
|
|
29254
29318
|
if (!prop.exp) return false;
|
|
29255
|
-
|
|
29256
|
-
resolvedBindProps = resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
29257
|
-
return !!resolvedBindProps;
|
|
29319
|
+
return !!resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
29258
29320
|
});
|
|
29259
29321
|
let listenerResults = [];
|
|
29260
29322
|
function pushMergeArg(listeners = false) {
|
|
@@ -29275,7 +29337,7 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
29275
29337
|
if (prop.type === 7 && !prop.arg) {
|
|
29276
29338
|
if (prop.name === "bind") {
|
|
29277
29339
|
if (prop.exp) {
|
|
29278
|
-
const objectLiteralProps = isComponent ? resolveComponentObjectLiteralBindProps(prop.exp, context, props, prop) :
|
|
29340
|
+
const objectLiteralProps = isSlot ? void 0 : isComponent ? resolveComponentObjectLiteralBindProps(prop.exp, context, props, prop) : resolveNativeObjectLiteralBindProps(prop.exp, context, props, prop);
|
|
29279
29341
|
if (objectLiteralProps) {
|
|
29280
29342
|
if (isComponent) pushStaticObjectLiteralProps(objectLiteralProps);
|
|
29281
29343
|
else {
|
|
@@ -29298,7 +29360,7 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
29298
29360
|
continue;
|
|
29299
29361
|
} else if (prop.name === "on") {
|
|
29300
29362
|
if (prop.exp) {
|
|
29301
|
-
const objectLiteralProps = isComponent ? resolveComponentObjectLiteralOnProps(prop.exp, context, props, prop) : void 0;
|
|
29363
|
+
const objectLiteralProps = isComponent && !isSlot ? resolveComponentObjectLiteralOnProps(prop.exp, context, props, prop) : void 0;
|
|
29302
29364
|
if (objectLiteralProps) pushStaticObjectLiteralProps(objectLiteralProps);
|
|
29303
29365
|
else if (isComponent || mergesListeners(node, context)) {
|
|
29304
29366
|
dynamicExpr.push(prop.exp);
|
|
@@ -29312,7 +29374,7 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
29312
29374
|
type: 8,
|
|
29313
29375
|
element: context.reference(),
|
|
29314
29376
|
event: prop.exp
|
|
29315
|
-
},
|
|
29377
|
+
}, getEffectOrder);
|
|
29316
29378
|
} else context.options.onError(createCompilerError(35, prop.loc));
|
|
29317
29379
|
continue;
|
|
29318
29380
|
}
|
|
@@ -29327,7 +29389,10 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
29327
29389
|
dynamicExpr.push(result.key);
|
|
29328
29390
|
if (!result.handler) dynamicExpr.push(result.value);
|
|
29329
29391
|
if (deferListeners) listenerResults.push(result);
|
|
29330
|
-
else if (
|
|
29392
|
+
else if (isSlot && result.handler && !result.key.isStatic) {
|
|
29393
|
+
pushMergeArg();
|
|
29394
|
+
dynamicArgs.push([resolveDirectiveResult(result)]);
|
|
29395
|
+
} else if (isComponent && !isSlot && !result.key.isStatic) {
|
|
29331
29396
|
pushMergeArg();
|
|
29332
29397
|
dynamicArgs.push(extend(resolveDirectiveResult(result), { kind: 1 }));
|
|
29333
29398
|
} else results.push(result);
|
|
@@ -29341,7 +29406,7 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
29341
29406
|
props: dynamicArgs,
|
|
29342
29407
|
isSVG: node.ns === 1,
|
|
29343
29408
|
listeners: true
|
|
29344
|
-
},
|
|
29409
|
+
}, getEffectOrder);
|
|
29345
29410
|
return [false, dedupeProperties(results)];
|
|
29346
29411
|
}
|
|
29347
29412
|
if (dynamicArgs.length || results.some(({ key }) => !key.isStatic)) {
|
|
@@ -29354,10 +29419,10 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
29354
29419
|
}
|
|
29355
29420
|
return [false, dedupeProperties(results)];
|
|
29356
29421
|
}
|
|
29357
|
-
function
|
|
29422
|
+
function resolveObjectLiteralKeys(exp, keyTransform, isValidKey) {
|
|
29358
29423
|
const ast = exp.ast;
|
|
29359
29424
|
if (!ast || ast.type !== "ObjectExpression") return;
|
|
29360
|
-
const
|
|
29425
|
+
const keys = [];
|
|
29361
29426
|
const knownKeys = /* @__PURE__ */ new Set();
|
|
29362
29427
|
for (const property of ast.properties) {
|
|
29363
29428
|
if (property.type !== "ObjectProperty" || property.computed) return;
|
|
@@ -29367,17 +29432,21 @@ function resolveObjectLiteralProps(exp, context, keyTransform, isValidKey) {
|
|
|
29367
29432
|
if (keyTransform) key = keyTransform(key);
|
|
29368
29433
|
if (knownKeys.has(key)) return;
|
|
29369
29434
|
knownKeys.add(key);
|
|
29370
|
-
|
|
29371
|
-
key: createSimpleExpression(key, true),
|
|
29372
|
-
values: [resolveExpression(createObjectBindSubExpression(exp, property.value, context), true)]
|
|
29373
|
-
});
|
|
29435
|
+
keys.push(key);
|
|
29374
29436
|
}
|
|
29375
|
-
return
|
|
29437
|
+
return keys;
|
|
29438
|
+
}
|
|
29439
|
+
function materializeObjectLiteralProps(exp, keys, context) {
|
|
29440
|
+
const properties = exp.ast.properties;
|
|
29441
|
+
return keys.map((key, i) => ({
|
|
29442
|
+
key: createSimpleExpression(key, true),
|
|
29443
|
+
values: [resolveExpression(createObjectBindSubExpression(exp, properties[i].value, context), true)]
|
|
29444
|
+
}));
|
|
29376
29445
|
}
|
|
29377
29446
|
function resolveComponentObjectLiteralBindProps(exp, context, nodeProps, currentProp) {
|
|
29378
|
-
const
|
|
29379
|
-
if (!
|
|
29380
|
-
return
|
|
29447
|
+
const keys = resolveObjectLiteralKeys(exp, void 0, isSafeObjectLiteralBindKey);
|
|
29448
|
+
if (!keys || hasComponentObjectLiteralBindConflict(nodeProps, currentProp, keys)) return;
|
|
29449
|
+
return materializeObjectLiteralProps(exp, keys, context);
|
|
29381
29450
|
}
|
|
29382
29451
|
const listenerMerge = /* @__PURE__ */ new WeakMap();
|
|
29383
29452
|
function mergesListeners(node, context) {
|
|
@@ -29408,15 +29477,20 @@ function resolveListenerMerge(node, context) {
|
|
|
29408
29477
|
}
|
|
29409
29478
|
return hasVOnObject && hasStaticListener;
|
|
29410
29479
|
}
|
|
29480
|
+
const nativeObjectLiteralBindProps = /* @__PURE__ */ new WeakMap();
|
|
29411
29481
|
function resolveNativeObjectLiteralBindProps(exp, context, nodeProps, currentProp) {
|
|
29412
|
-
|
|
29413
|
-
if (
|
|
29414
|
-
|
|
29482
|
+
let props = nativeObjectLiteralBindProps.get(currentProp);
|
|
29483
|
+
if (props === void 0) {
|
|
29484
|
+
const keys = resolveObjectLiteralKeys(exp, void 0, isSafeNativeObjectLiteralBindKey);
|
|
29485
|
+
props = keys && !hasNativeObjectLiteralBindConflict(nodeProps, currentProp, keys) ? materializeObjectLiteralProps(exp, keys, context) : null;
|
|
29486
|
+
nativeObjectLiteralBindProps.set(currentProp, props);
|
|
29487
|
+
}
|
|
29488
|
+
return props || void 0;
|
|
29415
29489
|
}
|
|
29416
29490
|
function resolveComponentObjectLiteralOnProps(exp, context, nodeProps, currentProp) {
|
|
29417
|
-
const
|
|
29418
|
-
if (!
|
|
29419
|
-
return
|
|
29491
|
+
const keys = resolveObjectLiteralKeys(exp, toHandlerKey);
|
|
29492
|
+
if (!keys || hasComponentObjectLiteralBindConflict(nodeProps, currentProp, keys)) return;
|
|
29493
|
+
return materializeObjectLiteralProps(exp, keys, context);
|
|
29420
29494
|
}
|
|
29421
29495
|
function isSafeNativeObjectLiteralBindKey(key) {
|
|
29422
29496
|
return key !== "" && !UNSAFE_ATTR_NAME_RE.test(key) && isSafeObjectLiteralBindKey(key) && !isOn(key) && key.charCodeAt(0) !== 46 && key.charCodeAt(0) !== 94;
|
|
@@ -29424,8 +29498,8 @@ function isSafeNativeObjectLiteralBindKey(key) {
|
|
|
29424
29498
|
function isSafeObjectLiteralBindKey(key) {
|
|
29425
29499
|
return !isReservedProp(key);
|
|
29426
29500
|
}
|
|
29427
|
-
function hasComponentObjectLiteralBindConflict(props, currentProp,
|
|
29428
|
-
const keys = createComponentConflictKeySet(
|
|
29501
|
+
function hasComponentObjectLiteralBindConflict(props, currentProp, objectLiteralKeys) {
|
|
29502
|
+
const keys = createComponentConflictKeySet(objectLiteralKeys);
|
|
29429
29503
|
for (const prop of props) {
|
|
29430
29504
|
if (prop === currentProp) continue;
|
|
29431
29505
|
let key;
|
|
@@ -29451,8 +29525,8 @@ function hasComponentModelKey(keys, prop) {
|
|
|
29451
29525
|
const key = arg ? arg.content : "modelValue";
|
|
29452
29526
|
return hasComponentKey(keys, key) || hasComponentKey(keys, `onUpdate:${camelize(key)}`) || prop.modifiers.length > 0 && hasComponentKey(keys, getModifierPropName(key));
|
|
29453
29527
|
}
|
|
29454
|
-
function hasNativeObjectLiteralBindConflict(props, currentProp,
|
|
29455
|
-
const keys = new Set(
|
|
29528
|
+
function hasNativeObjectLiteralBindConflict(props, currentProp, objectLiteralKeys) {
|
|
29529
|
+
const keys = new Set(objectLiteralKeys);
|
|
29456
29530
|
for (const prop of props) {
|
|
29457
29531
|
if (prop === currentProp) continue;
|
|
29458
29532
|
let key;
|
|
@@ -29537,7 +29611,7 @@ function createStaticStyleExpression(value, context) {
|
|
|
29537
29611
|
function transformProp(prop, node, context) {
|
|
29538
29612
|
let { name } = prop;
|
|
29539
29613
|
if (prop.type === 6) {
|
|
29540
|
-
if (isReservedProp(name)) return;
|
|
29614
|
+
if (isReservedProp(name) && !(name === "key" && node.tagType === 2)) return;
|
|
29541
29615
|
return {
|
|
29542
29616
|
key: createSimpleExpression(prop.name, true, prop.nameLoc),
|
|
29543
29617
|
value: prop.value ? name === "style" && node.tagType === 1 ? createStaticStyleExpression(prop.value, context) : createSimpleExpression(prop.value.content, true, prop.value.loc) : EMPTY_EXPRESSION
|
|
@@ -29668,6 +29742,52 @@ function processDynamicChildren(context, useCreateElement) {
|
|
|
29668
29742
|
}
|
|
29669
29743
|
unitIndex++;
|
|
29670
29744
|
} else if (!(child.flags & 2)) unitIndex++;
|
|
29745
|
+
if (context.dynamic.hasDynamicChild) planAccess(children);
|
|
29746
|
+
}
|
|
29747
|
+
/**
|
|
29748
|
+
* Decide how codegen reaches each child it has to hold on to, now that the
|
|
29749
|
+
* children's flags, anchors and own plans are final. Static, absent and
|
|
29750
|
+
* appended children need no lookup; a child created by its own operation is
|
|
29751
|
+
* reached through its anchor at most. Adjacent lookups chain off the previous
|
|
29752
|
+
* one with `next()`; a placeholder gets a variable only when a lookup chains
|
|
29753
|
+
* off it, otherwise it is written inline into its single descendant lookup.
|
|
29754
|
+
*/
|
|
29755
|
+
function planAccess(children) {
|
|
29756
|
+
let index = 0;
|
|
29757
|
+
let prev;
|
|
29758
|
+
let pending;
|
|
29759
|
+
for (const child of children) {
|
|
29760
|
+
if (child.flags & 2) continue;
|
|
29761
|
+
const id = child.anchor !== void 0 ? child.anchor : child.id;
|
|
29762
|
+
let uses = 0;
|
|
29763
|
+
if (id === void 0 && child.hasDynamicChild) {
|
|
29764
|
+
for (const c of child.children) if (c.access && !c.access.adjacent) uses++;
|
|
29765
|
+
}
|
|
29766
|
+
if (id === void 0 && uses === 0) {
|
|
29767
|
+
pending = void 0;
|
|
29768
|
+
index++;
|
|
29769
|
+
continue;
|
|
29770
|
+
}
|
|
29771
|
+
if (pending) {
|
|
29772
|
+
pending.kind = 1;
|
|
29773
|
+
prev = pending;
|
|
29774
|
+
pending = void 0;
|
|
29775
|
+
}
|
|
29776
|
+
const reusable = prev !== void 0 && prev.kind !== 0;
|
|
29777
|
+
let kind;
|
|
29778
|
+
if (id !== void 0) kind = 0;
|
|
29779
|
+
else if (uses > 1) kind = reusable ? 2 : 1;
|
|
29780
|
+
else kind = reusable ? 4 : 3;
|
|
29781
|
+
const access = child.access = {
|
|
29782
|
+
kind,
|
|
29783
|
+
index,
|
|
29784
|
+
adjacent: prev !== void 0 && index === prev.index + 1,
|
|
29785
|
+
id
|
|
29786
|
+
};
|
|
29787
|
+
if (kind === 3) pending = access;
|
|
29788
|
+
else prev = access;
|
|
29789
|
+
index++;
|
|
29790
|
+
}
|
|
29671
29791
|
}
|
|
29672
29792
|
//#endregion
|
|
29673
29793
|
//#region packages/compiler-vapor/src/transforms/vOnce.ts
|
|
@@ -29696,7 +29816,7 @@ function getSiblingIf(context, reverse) {
|
|
|
29696
29816
|
if (!parent) return;
|
|
29697
29817
|
const siblings = parent.node.children;
|
|
29698
29818
|
let sibling;
|
|
29699
|
-
let i =
|
|
29819
|
+
let i = context.index;
|
|
29700
29820
|
while (reverse ? --i >= 0 : ++i < siblings.length) {
|
|
29701
29821
|
sibling = siblings[i];
|
|
29702
29822
|
if (!isCommentOrWhitespace(sibling)) break;
|
|
@@ -29970,7 +30090,7 @@ const transformVOn = (dir, node, context) => {
|
|
|
29970
30090
|
} else if (nonDelegateModifiers) nonDelegateModifiers.push(modifier);
|
|
29971
30091
|
}
|
|
29972
30092
|
if (nonDelegateModifiers) modifiers = nonDelegateModifiers;
|
|
29973
|
-
arg = resolveExpression(arg);
|
|
30093
|
+
arg = isSlotOutlet ? arg : resolveExpression(arg);
|
|
29974
30094
|
if (arg.isStatic && arg.content.startsWith("vue:")) {
|
|
29975
30095
|
if (node.tagType === 0) {
|
|
29976
30096
|
context.options.onWarn(createVaporCompilerError(102, loc));
|
|
@@ -30214,25 +30334,18 @@ function processIf(node, dir, context) {
|
|
|
30214
30334
|
});
|
|
30215
30335
|
context.dynamic.operation = operation;
|
|
30216
30336
|
context.root.ifHeads.set(operation, context.inVOnce);
|
|
30337
|
+
const parent = context.parent;
|
|
30338
|
+
parent.ifHead = parent.ifTail = operation;
|
|
30217
30339
|
};
|
|
30218
30340
|
} else {
|
|
30219
30341
|
const siblingIf = getSiblingIf(context, true);
|
|
30220
|
-
const
|
|
30221
|
-
|
|
30222
|
-
if (
|
|
30223
|
-
let i = siblings.length;
|
|
30224
|
-
while (i--) if (siblings[i].operation && siblings[i].operation.type === 15) {
|
|
30225
|
-
lastIfNode = siblings[i].operation;
|
|
30226
|
-
break;
|
|
30227
|
-
}
|
|
30228
|
-
}
|
|
30229
|
-
if (!siblingIf || !lastIfNode || lastIfNode.type !== 15) {
|
|
30342
|
+
const parent = context.parent;
|
|
30343
|
+
const head = parent && parent.ifHead;
|
|
30344
|
+
if (!siblingIf || !head) {
|
|
30230
30345
|
context.options.onError(createCompilerError(30, node.loc));
|
|
30231
30346
|
return;
|
|
30232
30347
|
}
|
|
30233
|
-
const
|
|
30234
|
-
while (lastIfNode.negative && lastIfNode.negative.type === 15) lastIfNode = lastIfNode.negative;
|
|
30235
|
-
const parent = context.parent;
|
|
30348
|
+
const lastIfNode = parent.ifTail;
|
|
30236
30349
|
context.inVOnce = parent.inVOnce && !isComponentNode(parent.node) || !!context.root.ifHeads.get(head);
|
|
30237
30350
|
if (dir.name === "else-if" && lastIfNode.negative) context.options.onError(createCompilerError(30, node.loc));
|
|
30238
30351
|
checkSameKey(node, context);
|
|
@@ -30246,8 +30359,9 @@ function processIf(node, dir, context) {
|
|
|
30246
30359
|
comments.length = 0;
|
|
30247
30360
|
}
|
|
30248
30361
|
const [branch, onExit] = createIfBranch(node, context);
|
|
30249
|
-
|
|
30250
|
-
else
|
|
30362
|
+
let negative;
|
|
30363
|
+
if (dir.name === "else") negative = branch;
|
|
30364
|
+
else negative = parent.ifTail = {
|
|
30251
30365
|
type: 15,
|
|
30252
30366
|
id: -1,
|
|
30253
30367
|
condition: dir.exp,
|
|
@@ -30256,10 +30370,11 @@ function processIf(node, dir, context) {
|
|
|
30256
30370
|
blockShape: 0,
|
|
30257
30371
|
once: context.inVOnce || isStaticExpression(dir.exp, context.options.bindingMetadata)
|
|
30258
30372
|
};
|
|
30373
|
+
lastIfNode.negative = negative;
|
|
30259
30374
|
return () => {
|
|
30260
30375
|
onExit();
|
|
30261
|
-
if (
|
|
30262
|
-
lastIfNode.blockShape = encodeIfBlockShape(lastIfNode.positive, forceMultiRoot,
|
|
30376
|
+
if (negative.type === 15) negative.blockShape = encodeIfBlockShape(negative.positive, forceMultiRoot, void 0, allowNoScope);
|
|
30377
|
+
lastIfNode.blockShape = encodeIfBlockShape(lastIfNode.positive, forceMultiRoot, negative, allowNoScope);
|
|
30263
30378
|
};
|
|
30264
30379
|
}
|
|
30265
30380
|
}
|
|
@@ -30275,14 +30390,14 @@ function createIfBranch(node, context) {
|
|
|
30275
30390
|
return [branch, exitBlock];
|
|
30276
30391
|
}
|
|
30277
30392
|
function encodeIfBlockShape(positive, forceMultiRoot = false, negative, allowNoScope = true) {
|
|
30278
|
-
if (forceMultiRoot) return
|
|
30393
|
+
if (forceMultiRoot) return 2 | (negative && negative.type === 15 ? 3 : 2) << 2;
|
|
30279
30394
|
const positiveNoScope = allowNoScope && canSkipIfBranchScope(positive);
|
|
30280
30395
|
const negativeNoScope = allowNoScope && negative && negative.type !== 15 && canSkipIfBranchScope(negative);
|
|
30281
30396
|
return getBlockShape(positive) | getNegativeIfBranchShape(negative) << 2 | (positiveNoScope ? 32 : 0) | (negativeNoScope ? 64 : 0);
|
|
30282
30397
|
}
|
|
30283
30398
|
function getNegativeIfBranchShape(negative) {
|
|
30284
30399
|
if (!negative) return 0;
|
|
30285
|
-
return negative.type === 15 ?
|
|
30400
|
+
return negative.type === 15 ? 3 : getBlockShape(negative);
|
|
30286
30401
|
}
|
|
30287
30402
|
function canSkipIfBranchScope(block) {
|
|
30288
30403
|
if (block.effect.length || block.operation.length) return false;
|
|
@@ -30421,6 +30536,15 @@ const transformSlotOutlet = (node, context) => {
|
|
|
30421
30536
|
if (slotProps.length) {
|
|
30422
30537
|
const [isDynamic, props] = buildProps(extend({}, node, { props: slotProps }), context, true);
|
|
30423
30538
|
irProps = isDynamic ? props : [props];
|
|
30539
|
+
if (!isDynamic) for (const prop of props) {
|
|
30540
|
+
const name = prop.key.content;
|
|
30541
|
+
if (prop.key.isStatic && !prop.handler && !prop.modifier && (name === "class" || name === "style")) {
|
|
30542
|
+
const value = prop.values[0];
|
|
30543
|
+
if (prop.values.length === 1 && value.isStatic) {
|
|
30544
|
+
if (name === "class") value.content = value.content.trim();
|
|
30545
|
+
} else prop.normalize = name;
|
|
30546
|
+
}
|
|
30547
|
+
}
|
|
30424
30548
|
}
|
|
30425
30549
|
return () => {
|
|
30426
30550
|
exitBlock && exitBlock();
|
|
@@ -30669,6 +30793,7 @@ function getBaseTransformPreset() {
|
|
|
30669
30793
|
//#region packages/compiler-vapor/src/index.ts
|
|
30670
30794
|
var src_exports$1 = /* @__PURE__ */ __exportAll({
|
|
30671
30795
|
CodegenContext: () => CodegenContext,
|
|
30796
|
+
DynamicAccess: () => DynamicAccess,
|
|
30672
30797
|
DynamicFlag: () => DynamicFlag,
|
|
30673
30798
|
IRDynamicPropsKind: () => IRDynamicPropsKind,
|
|
30674
30799
|
IRNodeTypes: () => IRNodeTypes,
|
|
@@ -30755,22 +30880,47 @@ registerRuntimeHelpers(ssrHelpers);
|
|
|
30755
30880
|
//#region packages/compiler-ssr/src/transforms/ssrVIf.ts
|
|
30756
30881
|
const ssrTransformIf = createStructuralDirectiveTransform$1(/^(?:if|else|else-if)$/, processIf$1);
|
|
30757
30882
|
function ssrProcessIf(node, context, disableNestedFragments = false, disableComment = false) {
|
|
30758
|
-
const
|
|
30759
|
-
const
|
|
30883
|
+
const { branches } = node;
|
|
30884
|
+
const ranged = !!context.options.vapor && hasLookalikeBranches(branches);
|
|
30885
|
+
const [rootBranch] = branches;
|
|
30886
|
+
const ifStatement = createIfStatement(rootBranch.condition, processIfBranch(rootBranch, context, disableNestedFragments, ranged && 0));
|
|
30760
30887
|
context.pushStatement(ifStatement);
|
|
30761
30888
|
let currentIf = ifStatement;
|
|
30762
|
-
for (let i = 1; i <
|
|
30763
|
-
const branch =
|
|
30764
|
-
const branchBlockStatement = processIfBranch(branch, context, disableNestedFragments);
|
|
30889
|
+
for (let i = 1; i < branches.length; i++) {
|
|
30890
|
+
const branch = branches[i];
|
|
30891
|
+
const branchBlockStatement = processIfBranch(branch, context, disableNestedFragments, ranged && i);
|
|
30765
30892
|
if (branch.condition) currentIf = currentIf.alternate = createIfStatement(branch.condition, branchBlockStatement);
|
|
30766
30893
|
else currentIf.alternate = branchBlockStatement;
|
|
30767
30894
|
}
|
|
30768
30895
|
if (!currentIf.alternate && (!disableComment || context.options.vapor)) currentIf.alternate = createBlockStatement([createCallExpression(`_push`, ["`<!---->`"])]);
|
|
30769
30896
|
}
|
|
30770
|
-
function processIfBranch(branch, context, disableNestedFragments = false) {
|
|
30897
|
+
function processIfBranch(branch, context, disableNestedFragments = false, index = false) {
|
|
30898
|
+
if (index !== false) {
|
|
30899
|
+
const childContext = createChildContext(context);
|
|
30900
|
+
childContext.pushStringPart(`<!--[${index}-->`);
|
|
30901
|
+
processChildren(branch, childContext);
|
|
30902
|
+
childContext.pushStringPart(`<!--]-->`);
|
|
30903
|
+
return createBlockStatement(childContext.body);
|
|
30904
|
+
}
|
|
30771
30905
|
const { children } = branch;
|
|
30772
30906
|
return processChildrenAsStatement(branch, context, !disableNestedFragments && (children.length !== 1 || children[0].type !== 1) && !(children.length === 1 && children[0].type === 11));
|
|
30773
30907
|
}
|
|
30908
|
+
/**
|
|
30909
|
+
* Whether two branches of a chain could start with the same node. Branches
|
|
30910
|
+
* that each render one plain element, all of different tags, are told apart
|
|
30911
|
+
* by the tag.
|
|
30912
|
+
*/
|
|
30913
|
+
function hasLookalikeBranches(branches) {
|
|
30914
|
+
if (branches.length < 2) return false;
|
|
30915
|
+
const tags = /* @__PURE__ */ new Set();
|
|
30916
|
+
for (const { children } of branches) {
|
|
30917
|
+
const nodes = children.filter((child) => child.type !== 3);
|
|
30918
|
+
const root = nodes.length === 1 ? nodes[0] : void 0;
|
|
30919
|
+
if (!root || root.type !== 1 || root.tagType !== 0 || tags.has(root.tag)) return true;
|
|
30920
|
+
tags.add(root.tag);
|
|
30921
|
+
}
|
|
30922
|
+
return false;
|
|
30923
|
+
}
|
|
30774
30924
|
//#endregion
|
|
30775
30925
|
//#region packages/compiler-ssr/src/transforms/ssrVFor.ts
|
|
30776
30926
|
const ssrTransformFor = createStructuralDirectiveTransform$1("for", processFor$1);
|
|
@@ -44541,7 +44691,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
44541
44691
|
//#endregion
|
|
44542
44692
|
//#region packages/compiler-sfc/src/index.ts
|
|
44543
44693
|
init_objectSpread2();
|
|
44544
|
-
const version = "3.6.0-rc.
|
|
44694
|
+
const version = "3.6.0-rc.14";
|
|
44545
44695
|
const parseCache = parseCache$1;
|
|
44546
44696
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
44547
44697
|
const walk = walk$2;
|