@vue/compiler-sfc 3.6.0-rc.6 → 3.6.0-rc.8
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 +3 -3
- package/dist/compiler-sfc.esm-browser.js +131 -78
- package/package.json +6 -6
package/dist/compiler-sfc.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.8
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -15943,7 +15943,7 @@ function compileScript(sfc, options) {
|
|
|
15943
15943
|
}
|
|
15944
15944
|
if (preamble) ctx.s.prepend(preamble);
|
|
15945
15945
|
if (helpers && (helpers.has(_vue_compiler_dom.UNREF) || helpers.has("unref"))) ctx.helperImports.delete("unref");
|
|
15946
|
-
returned = code;
|
|
15946
|
+
returned = vapor && !ssr && hasAwait ? `return () => {${code}}` : code;
|
|
15947
15947
|
} else returned = `() => {}`;
|
|
15948
15948
|
if (!inlineMode && true) ctx.s.appendRight(endOffset, `\nconst __returned__ = ${returned}\nObject.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\nreturn __returned__\n}\n\n`);
|
|
15949
15949
|
else ctx.s.appendRight(endOffset, `\n${vapor && !ssr ? `` : `return `}${returned}\n}\n\n`);
|
|
@@ -16121,7 +16121,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
16121
16121
|
}
|
|
16122
16122
|
//#endregion
|
|
16123
16123
|
//#region packages/compiler-sfc/src/index.ts
|
|
16124
|
-
const version = "3.6.0-rc.
|
|
16124
|
+
const version = "3.6.0-rc.8";
|
|
16125
16125
|
const parseCache = parseCache$1;
|
|
16126
16126
|
const errorMessages = {
|
|
16127
16127
|
..._vue_compiler_dom.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-rc.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-rc.8
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -25050,6 +25050,10 @@ function isInTransition(context) {
|
|
|
25050
25050
|
function isTransitionNode(node) {
|
|
25051
25051
|
return node.type === 1 && isTransitionTag(node.tag);
|
|
25052
25052
|
}
|
|
25053
|
+
/** Transition or TransitionGroup: hosts whose children render specially. */
|
|
25054
|
+
function isTransitionHostNode(node) {
|
|
25055
|
+
return node.type === 1 && (isTransitionTag(node.tag) || isTransitionGroupTag(node.tag));
|
|
25056
|
+
}
|
|
25053
25057
|
function isTransitionTag(tag) {
|
|
25054
25058
|
tag = tag.toLowerCase();
|
|
25055
25059
|
return tag === "transition" || tag === "vaportransition";
|
|
@@ -25066,6 +25070,9 @@ function isTeleportTag(tag) {
|
|
|
25066
25070
|
tag = tag.toLowerCase();
|
|
25067
25071
|
return tag === "teleport" || tag === "vaporteleport";
|
|
25068
25072
|
}
|
|
25073
|
+
function isComponentTag(tag) {
|
|
25074
|
+
return tag === "component" || tag === "Component";
|
|
25075
|
+
}
|
|
25069
25076
|
function isBuiltInComponent(tag) {
|
|
25070
25077
|
if (isTeleportTag(tag)) return "VaporTeleport";
|
|
25071
25078
|
else if (tag === "Suspense" || tag === "suspense") return "Suspense";
|
|
@@ -25240,6 +25247,7 @@ var TransformContext = class TransformContext {
|
|
|
25240
25247
|
node,
|
|
25241
25248
|
parent: this,
|
|
25242
25249
|
index,
|
|
25250
|
+
inVOnce: this.inVOnce && !isComponentNode(this.node),
|
|
25243
25251
|
template: "",
|
|
25244
25252
|
templateRoot: false,
|
|
25245
25253
|
childrenTemplate: [],
|
|
@@ -25414,8 +25422,18 @@ function getNextId(map, n) {
|
|
|
25414
25422
|
if (map && map.has(n)) return map.get(n);
|
|
25415
25423
|
return n;
|
|
25416
25424
|
}
|
|
25425
|
+
function isComponentNode(node) {
|
|
25426
|
+
return node.type === 1 && node.tagType === 1;
|
|
25427
|
+
}
|
|
25417
25428
|
//#endregion
|
|
25418
25429
|
//#region packages/compiler-vapor/src/generators/utils.ts
|
|
25430
|
+
/**
|
|
25431
|
+
* Run a helper call inside the once ambient: a helper that creates its own
|
|
25432
|
+
* effects at a v-once site has them run once like compiled ones do.
|
|
25433
|
+
*/
|
|
25434
|
+
function genOnce(call, context) {
|
|
25435
|
+
return genCall(context.helper("withOnce"), ["() => ", ...call]);
|
|
25436
|
+
}
|
|
25419
25437
|
const IMPORT_EXP_START = "__IMPORT_EXP_START__";
|
|
25420
25438
|
const IMPORT_EXP_END = "__IMPORT_EXP_END__";
|
|
25421
25439
|
const IMPORT_EXPR_RE = new RegExp(`${IMPORT_EXP_START}(.*?)${IMPORT_EXP_END}`, "g");
|
|
@@ -25559,6 +25577,10 @@ function codeFragmentToString(code, context) {
|
|
|
25559
25577
|
});
|
|
25560
25578
|
}
|
|
25561
25579
|
}
|
|
25580
|
+
/** Formats a numeric flags argument with its dev-only name annotation. */
|
|
25581
|
+
function genFlags(flags, names) {
|
|
25582
|
+
return `${flags} /* ${names.join(", ")} */`;
|
|
25583
|
+
}
|
|
25562
25584
|
//#endregion
|
|
25563
25585
|
//#region packages/compiler-vapor/src/generators/dom.ts
|
|
25564
25586
|
function genInsertNode({ parent, elements, anchor }, { helper }) {
|
|
@@ -26198,7 +26220,7 @@ function isConstantBinding(value, context) {
|
|
|
26198
26220
|
//#region packages/compiler-vapor/src/generators/for.ts
|
|
26199
26221
|
function genFor(oper, context) {
|
|
26200
26222
|
const { helper } = context;
|
|
26201
|
-
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot } = oper;
|
|
26223
|
+
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot, wrappedRows } = oper;
|
|
26202
26224
|
const rawValue = value && value.content;
|
|
26203
26225
|
const rawKey = key && key.content;
|
|
26204
26226
|
const rawIndex = index && index.content;
|
|
@@ -26251,7 +26273,7 @@ function genFor(oper, context) {
|
|
|
26251
26273
|
return frag;
|
|
26252
26274
|
}, idMap);
|
|
26253
26275
|
exitScope();
|
|
26254
|
-
const flags = genForFlags(onlyChild, component, isFragmentBlock(render), !component && isSingleNodeBlock(render), once, slotRoot);
|
|
26276
|
+
const flags = genForFlags(onlyChild, component, isFragmentBlock(render), !component && isSingleNodeBlock(render), once, slotRoot, wrappedRows);
|
|
26255
26277
|
const onResetCalls = [];
|
|
26256
26278
|
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
26257
26279
|
return [
|
|
@@ -26283,7 +26305,7 @@ function genFor(oper, context) {
|
|
|
26283
26305
|
return idMap;
|
|
26284
26306
|
}
|
|
26285
26307
|
}
|
|
26286
|
-
function genForFlags(onlyChild, component, isFragment, isSingleNode, once, slotRoot) {
|
|
26308
|
+
function genForFlags(onlyChild, component, isFragment, isSingleNode, once, slotRoot, wrappedRows) {
|
|
26287
26309
|
let flags = 0;
|
|
26288
26310
|
const names = [];
|
|
26289
26311
|
if (onlyChild) {
|
|
@@ -26310,8 +26332,12 @@ function genForFlags(onlyChild, component, isFragment, isSingleNode, once, slotR
|
|
|
26310
26332
|
flags |= 32;
|
|
26311
26333
|
names.push("SLOT_ROOT");
|
|
26312
26334
|
}
|
|
26335
|
+
if (wrappedRows) {
|
|
26336
|
+
flags |= 64;
|
|
26337
|
+
names.push("WRAPPED_ROWS");
|
|
26338
|
+
}
|
|
26313
26339
|
if (!flags) return;
|
|
26314
|
-
return
|
|
26340
|
+
return genFlags(flags, names);
|
|
26315
26341
|
}
|
|
26316
26342
|
function isSingleNodeBlock(block) {
|
|
26317
26343
|
const child = getSingleReturnedChild(block);
|
|
@@ -26532,7 +26558,7 @@ function genIfFlags(blockShape, once, slotRoot, index) {
|
|
|
26532
26558
|
if (once) flags |= 16;
|
|
26533
26559
|
else if (index !== void 0) flags |= index + 1 << 8;
|
|
26534
26560
|
if (flags === 1) return false;
|
|
26535
|
-
return
|
|
26561
|
+
return genFlags(flags, genIfFlagNames(once, slotRoot, index, blockShape));
|
|
26536
26562
|
}
|
|
26537
26563
|
function genIfFlagNames(once, slotRoot, index, blockShape) {
|
|
26538
26564
|
const names = [`TRUE_${genBlockShapeName(blockShape)}`];
|
|
@@ -26544,7 +26570,7 @@ function genIfFlagNames(once, slotRoot, index, blockShape) {
|
|
|
26544
26570
|
if (once) names.push("ONCE");
|
|
26545
26571
|
if (slotRoot) names.push("SLOT_ROOT");
|
|
26546
26572
|
if (!once && index !== void 0) names.push(`KEYED_INDEX_${index}`);
|
|
26547
|
-
return names
|
|
26573
|
+
return names;
|
|
26548
26574
|
}
|
|
26549
26575
|
function genBlockShapeName(flags) {
|
|
26550
26576
|
switch (flags & 3) {
|
|
@@ -26823,11 +26849,11 @@ function genGetTextChild(oper, context) {
|
|
|
26823
26849
|
//#region packages/compiler-vapor/src/generators/vShow.ts
|
|
26824
26850
|
function genVShow(oper, context) {
|
|
26825
26851
|
const { element } = oper;
|
|
26826
|
-
return
|
|
26852
|
+
return genCall(context.helper("applyVShow"), `n${element}`, [
|
|
26827
26853
|
`() => (`,
|
|
26828
26854
|
...genExpression(oper.dir.exp, context),
|
|
26829
26855
|
`)`
|
|
26830
|
-
])
|
|
26856
|
+
]);
|
|
26831
26857
|
}
|
|
26832
26858
|
//#endregion
|
|
26833
26859
|
//#region packages/compiler-vapor/src/generators/modifier.ts
|
|
@@ -26845,11 +26871,11 @@ const helperMap = {
|
|
|
26845
26871
|
};
|
|
26846
26872
|
function genVModel(oper, context) {
|
|
26847
26873
|
const { modelType, element, dir: { exp, modifiers } } = oper;
|
|
26848
|
-
return
|
|
26874
|
+
return genCall(context.helper(helperMap[modelType]), `n${element}`, [
|
|
26849
26875
|
`() => (`,
|
|
26850
26876
|
...genExpression(exp, context),
|
|
26851
26877
|
`)`
|
|
26852
|
-
], genModelHandler(exp, context), modifiers.length ? `{ ${genDirectiveModifiers(modifiers.map((e) => e.content))} }` : void 0)
|
|
26878
|
+
], genModelHandler(exp, context), modifiers.length ? `{ ${genDirectiveModifiers(modifiers.map((e) => e.content))} }` : void 0);
|
|
26853
26879
|
}
|
|
26854
26880
|
function genModelHandler(exp, context) {
|
|
26855
26881
|
return [
|
|
@@ -26861,11 +26887,17 @@ function genModelHandler(exp, context) {
|
|
|
26861
26887
|
//#endregion
|
|
26862
26888
|
//#region packages/compiler-vapor/src/generators/directive.ts
|
|
26863
26889
|
function genBuiltinDirective(oper, context) {
|
|
26890
|
+
let call;
|
|
26864
26891
|
switch (oper.name) {
|
|
26865
|
-
case "show":
|
|
26866
|
-
|
|
26892
|
+
case "show":
|
|
26893
|
+
call = genVShow(oper, context);
|
|
26894
|
+
break;
|
|
26895
|
+
case "model":
|
|
26896
|
+
call = genVModel(oper, context);
|
|
26897
|
+
break;
|
|
26867
26898
|
default: return [];
|
|
26868
26899
|
}
|
|
26900
|
+
return [NEWLINE, ...oper.once ? genOnce(call, context) : call];
|
|
26869
26901
|
}
|
|
26870
26902
|
/**
|
|
26871
26903
|
* user directives via `withVaporDirectives`
|
|
@@ -26879,7 +26911,8 @@ function genCustomDirectives(opers, context) {
|
|
|
26879
26911
|
const element = `n${opers[0].element}`;
|
|
26880
26912
|
const directiveItems = opers.map(genDirectiveItem);
|
|
26881
26913
|
const directives = genMulti(DELIMITERS_ARRAY, ...directiveItems);
|
|
26882
|
-
|
|
26914
|
+
const call = genCall(helper("withVaporDirectives"), element, directives);
|
|
26915
|
+
return [NEWLINE, ...opers[0].once ? genOnce(call, context) : call];
|
|
26883
26916
|
function genDirectiveItem({ dir, name, asset }) {
|
|
26884
26917
|
const directiveVar = asset ? toValidAssetId(name, "directive") : genExpression(extend(createSimpleExpression(name, false), { ast: null }), context);
|
|
26885
26918
|
const value = dir.exp && [
|
|
@@ -26913,7 +26946,8 @@ function genCreateComponent(operation, context) {
|
|
|
26913
26946
|
const tag = genTag();
|
|
26914
26947
|
const { root, props, slots, once, slotRoot } = operation;
|
|
26915
26948
|
const isRuntimeDynamicComponent = !!(operation.dynamic && !operation.dynamic.isStatic);
|
|
26916
|
-
const dynamicComponentFlags = isRuntimeDynamicComponent ? genDynamicComponentFlags(root, once, slotRoot) : false;
|
|
26949
|
+
const dynamicComponentFlags = isRuntimeDynamicComponent ? genDynamicComponentFlags(root, once, slotRoot, operation.ns) : false;
|
|
26950
|
+
const nsArg = !isRuntimeDynamicComponent && (operation.useCreateElement || operation.asset || !!operation.dynamic) && operation.ns ? String(operation.ns) : false;
|
|
26917
26951
|
const rawSlots = genRawSlots(slots, context);
|
|
26918
26952
|
const [ids, handlers] = processInlineHandlers(props, context);
|
|
26919
26953
|
const rawProps = context.withId(() => genRawProps(props, context, true), ids);
|
|
@@ -26930,7 +26964,11 @@ function genCreateComponent(operation, context) {
|
|
|
26930
26964
|
NEWLINE,
|
|
26931
26965
|
...inlineHandlers,
|
|
26932
26966
|
`const n${operation.id} = `,
|
|
26933
|
-
...genCall(isRuntimeDynamicComponent ? helper("createDynamicComponent") : operation.useCreateElement ? helper("createPlainElement") : useAssetComponentHelper ? helper("createAssetComponent") : operation.asset ? helper("createComponentWithFallback") : helper("createComponent"), tag, rawProps, rawSlots, isRuntimeDynamicComponent ? dynamicComponentFlags : root ? "true" : false, isRuntimeDynamicComponent ?
|
|
26967
|
+
...genCall(isRuntimeDynamicComponent ? helper("createDynamicComponent") : operation.useCreateElement ? helper("createPlainElement") : useAssetComponentHelper ? helper("createAssetComponent") : operation.asset ? helper("createComponentWithFallback") : helper("createComponent"), tag, rawProps, rawSlots, isRuntimeDynamicComponent ? dynamicComponentFlags : root ? "true" : false, isRuntimeDynamicComponent ? operation.key && [
|
|
26968
|
+
"() => (",
|
|
26969
|
+
...genExpression(operation.key, context),
|
|
26970
|
+
")"
|
|
26971
|
+
] : once && "true", useAssetComponentHelper ? maybeSelfReference && "true" : nsArg, useAssetComponentHelper && nsArg),
|
|
26934
26972
|
...genDirectivesForElement(operation.id, context)
|
|
26935
26973
|
];
|
|
26936
26974
|
function genTag() {
|
|
@@ -26957,7 +26995,7 @@ function genCreateComponent(operation, context) {
|
|
|
26957
26995
|
}
|
|
26958
26996
|
}
|
|
26959
26997
|
}
|
|
26960
|
-
function genDynamicComponentFlags(root, once, slotRoot) {
|
|
26998
|
+
function genDynamicComponentFlags(root, once, slotRoot, ns) {
|
|
26961
26999
|
let flags = 0;
|
|
26962
27000
|
const names = [];
|
|
26963
27001
|
if (root) {
|
|
@@ -26972,8 +27010,15 @@ function genDynamicComponentFlags(root, once, slotRoot) {
|
|
|
26972
27010
|
flags |= 4;
|
|
26973
27011
|
names.push("SLOT_ROOT");
|
|
26974
27012
|
}
|
|
27013
|
+
if (ns === 1) {
|
|
27014
|
+
flags |= 8;
|
|
27015
|
+
names.push("NS_SVG");
|
|
27016
|
+
} else if (ns === 2) {
|
|
27017
|
+
flags |= 16;
|
|
27018
|
+
names.push("NS_MATHML");
|
|
27019
|
+
}
|
|
26975
27020
|
if (!flags) return false;
|
|
26976
|
-
return
|
|
27021
|
+
return genFlags(flags, names);
|
|
26977
27022
|
}
|
|
26978
27023
|
function getUniqueHandlerName(context, name) {
|
|
26979
27024
|
const { seenInlineHandlerNames } = context;
|
|
@@ -27329,19 +27374,11 @@ function genSlotBlockWithProps(oper, context, emitNonStableFlag = true) {
|
|
|
27329
27374
|
const hasStableRoot = hasStableSlotRoot(oper, context);
|
|
27330
27375
|
if (!hasStableRoot) markSlotRootOperations(oper, context);
|
|
27331
27376
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
27332
|
-
if (emitNonStableFlag && !hasStableRoot) blockFn = genCall(context.helper("extend"), blockFn, [`{ _: ${
|
|
27377
|
+
if (emitNonStableFlag && !hasStableRoot) blockFn = genCall(context.helper("extend"), blockFn, [`{ _: ${genFlags(1, ["NON_STABLE"])} }`]);
|
|
27333
27378
|
exitSlotBlock();
|
|
27334
27379
|
exitScope && exitScope();
|
|
27335
27380
|
return blockFn;
|
|
27336
27381
|
}
|
|
27337
|
-
function genSlotFlags$1(flags) {
|
|
27338
|
-
const names = [];
|
|
27339
|
-
if (flags & 1) names.push("NO_SLOTTED");
|
|
27340
|
-
if (flags & 2) names.push("ONCE");
|
|
27341
|
-
if (flags & 4) names.push("SLOT_ROOT");
|
|
27342
|
-
if (flags & 8) names.push("NON_STABLE");
|
|
27343
|
-
return `${flags} /* ${names.join(", ")} */`;
|
|
27344
|
-
}
|
|
27345
27382
|
//#endregion
|
|
27346
27383
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
27347
27384
|
function genSlotOutlet(oper, context) {
|
|
@@ -27368,10 +27405,9 @@ function genSlotFlags(flags) {
|
|
|
27368
27405
|
const names = [];
|
|
27369
27406
|
if (flags & 1) names.push("NO_SLOTTED");
|
|
27370
27407
|
if (flags & 2) names.push("ONCE");
|
|
27371
|
-
if (flags & 4) names.push("
|
|
27372
|
-
if (flags &
|
|
27373
|
-
|
|
27374
|
-
return `${flags} /* ${names.join(", ")} */`;
|
|
27408
|
+
if (flags & 4) names.push("FORWARDED");
|
|
27409
|
+
if (flags & 8) names.push("SHARED_FALLBACK");
|
|
27410
|
+
return genFlags(flags, names);
|
|
27375
27411
|
}
|
|
27376
27412
|
//#endregion
|
|
27377
27413
|
//#region packages/compiler-vapor/src/generators/key.ts
|
|
@@ -27521,7 +27557,8 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
|
|
|
27521
27557
|
continue;
|
|
27522
27558
|
}
|
|
27523
27559
|
const id = child.flags & 1 ? child.flags & 4 ? child.anchor : child.id : void 0;
|
|
27524
|
-
|
|
27560
|
+
const ownsSubtree = child.operation !== void 0;
|
|
27561
|
+
if (id === void 0 && (!child.hasDynamicChild || ownsSubtree)) {
|
|
27525
27562
|
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
27526
27563
|
push(...genSelf(child, context, flushBeforeDynamic));
|
|
27527
27564
|
continue;
|
|
@@ -27558,7 +27595,7 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
|
|
|
27558
27595
|
variable = id === void 0 ? context.pName(context.block.tempId++) : `n${id}`;
|
|
27559
27596
|
pushBlock(NEWLINE, id === void 0 ? `let ${variable} = ` : `const ${variable} = `, ...accessPath);
|
|
27560
27597
|
}
|
|
27561
|
-
if (id === child.anchor && !child.hasDynamicChild) {
|
|
27598
|
+
if (id === child.anchor && (!child.hasDynamicChild || ownsSubtree)) {
|
|
27562
27599
|
flushBeforeDynamic && flushBeforeDynamic(child, push);
|
|
27563
27600
|
push(...genSelf(child, context, flushBeforeDynamic));
|
|
27564
27601
|
}
|
|
@@ -27568,7 +27605,7 @@ function genChildren(dynamic, context, pushBlock, from = `n${dynamic.id}`, flush
|
|
|
27568
27605
|
elementIndex,
|
|
27569
27606
|
id === void 0
|
|
27570
27607
|
];
|
|
27571
|
-
push(...genChildren(child, context, pushBlock, variable, flushBeforeDynamic));
|
|
27608
|
+
if (!ownsSubtree) push(...genChildren(child, context, pushBlock, variable, flushBeforeDynamic));
|
|
27572
27609
|
}
|
|
27573
27610
|
return frag;
|
|
27574
27611
|
}
|
|
@@ -27732,9 +27769,8 @@ function markSlotRootOperations(block, context, sharedFallback = false) {
|
|
|
27732
27769
|
markSlotRootOperations(operation.block, context, sharedFallback);
|
|
27733
27770
|
} else if (operation.type === 11) markSlotRootComponent(operation);
|
|
27734
27771
|
else if (operation.type === 12) {
|
|
27735
|
-
|
|
27736
|
-
if (sharedFallback) operation.flags |=
|
|
27737
|
-
else operation.flags |= 32;
|
|
27772
|
+
operation.flags |= 4;
|
|
27773
|
+
if (sharedFallback) operation.flags |= 8;
|
|
27738
27774
|
}
|
|
27739
27775
|
}
|
|
27740
27776
|
}
|
|
@@ -28098,6 +28134,37 @@ const transformVBind = (dir, node, context) => {
|
|
|
28098
28134
|
};
|
|
28099
28135
|
};
|
|
28100
28136
|
//#endregion
|
|
28137
|
+
//#region packages/compiler-vapor/src/transforms/transformKey.ts
|
|
28138
|
+
init_objectSpread2();
|
|
28139
|
+
const dynamicComponentKeys = /* @__PURE__ */ new WeakMap();
|
|
28140
|
+
const transformKey = (node, context) => {
|
|
28141
|
+
if (node.type !== 1 || context.inVOnce || findDir(node, "for")) return;
|
|
28142
|
+
const dir = findProp(node, "key", true, true);
|
|
28143
|
+
if (!dir || dir.type === 6) return;
|
|
28144
|
+
let value;
|
|
28145
|
+
value = dir.exp || normalizeBindShorthand(dir.arg, context);
|
|
28146
|
+
if (isStaticExpression(value, context.options.bindingMetadata)) return;
|
|
28147
|
+
if (isComponentTag(node.tag) && findProp(node, "is", true, true)) {
|
|
28148
|
+
dynamicComponentKeys.set(node, value);
|
|
28149
|
+
return;
|
|
28150
|
+
}
|
|
28151
|
+
let id = context.reference();
|
|
28152
|
+
context.dynamic.flags |= 6;
|
|
28153
|
+
context.node = node = wrapTemplate(node, ["key"]);
|
|
28154
|
+
const block = newBlock(node);
|
|
28155
|
+
const exitBlock = context.enterBlock(block);
|
|
28156
|
+
return () => {
|
|
28157
|
+
exitBlock();
|
|
28158
|
+
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
28159
|
+
type: 16,
|
|
28160
|
+
id
|
|
28161
|
+
}, context.effectBoundary()), {}, {
|
|
28162
|
+
value,
|
|
28163
|
+
block
|
|
28164
|
+
});
|
|
28165
|
+
};
|
|
28166
|
+
};
|
|
28167
|
+
//#endregion
|
|
28101
28168
|
//#region packages/compiler-vapor/src/transforms/vHtml.ts
|
|
28102
28169
|
function ignoreVHtmlChildren(node, context, clear) {
|
|
28103
28170
|
if (!node.children.length) return;
|
|
@@ -28189,6 +28256,8 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28189
28256
|
let { tag } = node;
|
|
28190
28257
|
let asset = true;
|
|
28191
28258
|
if (!dynamicComponent && !useCreateElement) {
|
|
28259
|
+
const isProp = findProp(node, "is");
|
|
28260
|
+
if (isProp && isProp.type === 6 && isVueIsValue(isProp)) tag = isProp.value.content.slice(4);
|
|
28192
28261
|
const fromSetup = resolveSetupReference(tag, context);
|
|
28193
28262
|
if (fromSetup) {
|
|
28194
28263
|
tag = fromSetup;
|
|
@@ -28225,11 +28294,16 @@ function transformComponentElement(node, propsResult, staticKey, singleRoot, con
|
|
|
28225
28294
|
slots: [...context.slots],
|
|
28226
28295
|
once: context.inVOnce,
|
|
28227
28296
|
dynamic: dynamicComponent,
|
|
28228
|
-
useCreateElement
|
|
28297
|
+
useCreateElement,
|
|
28298
|
+
ns: node.ns || void 0,
|
|
28299
|
+
key: dynamicComponentKeys.get(node)
|
|
28229
28300
|
});
|
|
28230
28301
|
if (staticKey) context.registerOperation(createSetBlockKey(id, staticKey));
|
|
28231
28302
|
context.slots = [];
|
|
28232
28303
|
}
|
|
28304
|
+
function isVueIsValue(prop) {
|
|
28305
|
+
return !!prop.value && prop.value.content.startsWith("vue:");
|
|
28306
|
+
}
|
|
28233
28307
|
function resolveDynamicComponent(node) {
|
|
28234
28308
|
const isProp = findProp(node, "is", false, true);
|
|
28235
28309
|
if (!isProp) return;
|
|
@@ -28489,7 +28563,7 @@ function buildProps(node, context, isComponent, isDynamicComponent, getEffectInd
|
|
|
28489
28563
|
continue;
|
|
28490
28564
|
}
|
|
28491
28565
|
}
|
|
28492
|
-
if (
|
|
28566
|
+
if (prop.type === 6 ? prop.name === "is" && (isDynamicComponent || isVueIsValue(prop)) : isDynamicComponent && prop.name === "bind" && isStaticArgOf(prop.arg, "is")) continue;
|
|
28493
28567
|
const result = transformProp(prop, node, context);
|
|
28494
28568
|
if (result) {
|
|
28495
28569
|
dynamicExpr.push(result.key, result.value);
|
|
@@ -28674,7 +28748,8 @@ function transformProp(prop, node, context) {
|
|
|
28674
28748
|
element: context.reference(),
|
|
28675
28749
|
dir: prop,
|
|
28676
28750
|
name,
|
|
28677
|
-
asset: !fromSetup
|
|
28751
|
+
asset: !fromSetup,
|
|
28752
|
+
once: context.inVOnce
|
|
28678
28753
|
});
|
|
28679
28754
|
}
|
|
28680
28755
|
}
|
|
@@ -28715,9 +28790,6 @@ function mergePropValues(existing, incoming) {
|
|
|
28715
28790
|
const newValues = incoming.values;
|
|
28716
28791
|
existing.values.push(...newValues);
|
|
28717
28792
|
}
|
|
28718
|
-
function isComponentTag(tag) {
|
|
28719
|
-
return tag === "component" || tag === "Component";
|
|
28720
|
-
}
|
|
28721
28793
|
function shouldUseCreateElement(node, context) {
|
|
28722
28794
|
return context.options.isCustomElement(node.tag) || node.tagType === 0 && node.tag === "template";
|
|
28723
28795
|
}
|
|
@@ -28834,13 +28906,13 @@ function processInterpolation(context) {
|
|
|
28834
28906
|
const values = processTextLikeChildren(collectAdjacentText(context), context);
|
|
28835
28907
|
if (values.length === 0 && parentNode.type !== 0) return;
|
|
28836
28908
|
const literalValues = values.map((v) => getLiteralExpressionValue(v));
|
|
28837
|
-
|
|
28838
|
-
|
|
28909
|
+
const text = literalValues.every((v) => v != null) ? literalValues.join("") : null;
|
|
28910
|
+
const isElementChild = parentNode.type === 1 && parentNode.tagType === 0;
|
|
28911
|
+
if (text !== null && parentNode.type !== 0 && (isElementChild || text !== "")) {
|
|
28839
28912
|
if (parentNode.type === 1 && shouldUseCreateElement(parentNode, context.parent) && text[0] === "<") {
|
|
28840
28913
|
materializeLiteralTextNode(createSimpleExpression(text, true, context.node.loc), context);
|
|
28841
28914
|
return;
|
|
28842
28915
|
}
|
|
28843
|
-
const isElementChild = parentNode.type === 1 && parentNode.tagType === 0;
|
|
28844
28916
|
context.template += isElementChild ? escapeHtml(text) : text;
|
|
28845
28917
|
return;
|
|
28846
28918
|
}
|
|
@@ -29098,7 +29170,8 @@ const transformVShow = (dir, node, context) => {
|
|
|
29098
29170
|
element: context.reference(),
|
|
29099
29171
|
dir,
|
|
29100
29172
|
name: "show",
|
|
29101
|
-
builtin: true
|
|
29173
|
+
builtin: true,
|
|
29174
|
+
once: context.inVOnce
|
|
29102
29175
|
});
|
|
29103
29176
|
};
|
|
29104
29177
|
//#endregion
|
|
@@ -29182,7 +29255,8 @@ const transformVModel = (dir, node, context) => {
|
|
|
29182
29255
|
dir,
|
|
29183
29256
|
name: "model",
|
|
29184
29257
|
modelType,
|
|
29185
|
-
builtin: true
|
|
29258
|
+
builtin: true,
|
|
29259
|
+
once: context.inVOnce
|
|
29186
29260
|
});
|
|
29187
29261
|
function checkDuplicatedValue() {
|
|
29188
29262
|
const value = findDir$1(node, "bind");
|
|
@@ -29360,6 +29434,8 @@ function processFor(node, dir, context) {
|
|
|
29360
29434
|
const keyProp = findProp(node, "key");
|
|
29361
29435
|
const keyProperty = keyProp && propToExpression(keyProp);
|
|
29362
29436
|
const isComponent = node.tagType === 1 || isTemplateWithSingleComponent(node);
|
|
29437
|
+
const parentNode = context.parent && context.parent.node;
|
|
29438
|
+
const wrappedRows = node.tagType === 3 && !(parentNode && isTransitionHostNode(parentNode)) && (node.children.length !== 1 || node.children[0].type !== 1 || !!findDir(node.children[0], ROW_FRAGMENT_DIR_RE));
|
|
29363
29439
|
context.node = node = wrapTemplate(node, ["for", "key"]);
|
|
29364
29440
|
context.dynamic.flags |= 6;
|
|
29365
29441
|
const id = context.reference();
|
|
@@ -29382,10 +29458,12 @@ function processFor(node, dir, context) {
|
|
|
29382
29458
|
render,
|
|
29383
29459
|
once: context.inVOnce || isStaticExpression(source, context.options.bindingMetadata),
|
|
29384
29460
|
component: isComponent,
|
|
29385
|
-
onlyChild: !!isOnlyChild
|
|
29461
|
+
onlyChild: !!isOnlyChild,
|
|
29462
|
+
wrappedRows
|
|
29386
29463
|
});
|
|
29387
29464
|
};
|
|
29388
29465
|
}
|
|
29466
|
+
const ROW_FRAGMENT_DIR_RE = /^(?:if|for)$/;
|
|
29389
29467
|
function isTemplateWithSingleComponent(node) {
|
|
29390
29468
|
if (node.tag !== "template") return false;
|
|
29391
29469
|
const nonCommentChildren = node.children.filter((c) => c.type !== 3);
|
|
@@ -29472,10 +29550,11 @@ function transformComponentSlot(node, dir, context) {
|
|
|
29472
29550
|
const { children } = node;
|
|
29473
29551
|
const arg = dir && dir.arg;
|
|
29474
29552
|
const hasTemplateSlots = children.some(isSlotTemplateChild);
|
|
29553
|
+
const isTransitionHost = isTransitionHostNode(node);
|
|
29475
29554
|
const emptyTextNodes = [];
|
|
29476
29555
|
const nonSlotTemplateChildren = children.filter((n) => {
|
|
29477
29556
|
if (isSlotTemplateChild(n)) return false;
|
|
29478
|
-
if (n.type === 3 && hasTemplateSlots) {
|
|
29557
|
+
if (n.type === 3 && (hasTemplateSlots || isTransitionHost)) {
|
|
29479
29558
|
ignoreComment(n, context);
|
|
29480
29559
|
return false;
|
|
29481
29560
|
}
|
|
@@ -29620,32 +29699,6 @@ function hasMultipleChildren(node) {
|
|
|
29620
29699
|
return children.length !== 1;
|
|
29621
29700
|
}
|
|
29622
29701
|
//#endregion
|
|
29623
|
-
//#region packages/compiler-vapor/src/transforms/transformKey.ts
|
|
29624
|
-
init_objectSpread2();
|
|
29625
|
-
const transformKey = (node, context) => {
|
|
29626
|
-
if (node.type !== 1 || context.inVOnce || findDir(node, "for")) return;
|
|
29627
|
-
const dir = findProp(node, "key", true, true);
|
|
29628
|
-
if (!dir || dir.type === 6) return;
|
|
29629
|
-
let value;
|
|
29630
|
-
value = dir.exp || normalizeBindShorthand(dir.arg, context);
|
|
29631
|
-
if (isStaticExpression(value, context.options.bindingMetadata)) return;
|
|
29632
|
-
let id = context.reference();
|
|
29633
|
-
context.dynamic.flags |= 6;
|
|
29634
|
-
context.node = node = wrapTemplate(node, ["key"]);
|
|
29635
|
-
const block = newBlock(node);
|
|
29636
|
-
const exitBlock = context.enterBlock(block);
|
|
29637
|
-
return () => {
|
|
29638
|
-
exitBlock();
|
|
29639
|
-
context.dynamic.operation = _objectSpread2(_objectSpread2({
|
|
29640
|
-
type: 16,
|
|
29641
|
-
id
|
|
29642
|
-
}, context.effectBoundary()), {}, {
|
|
29643
|
-
value,
|
|
29644
|
-
block
|
|
29645
|
-
});
|
|
29646
|
-
};
|
|
29647
|
-
};
|
|
29648
|
-
//#endregion
|
|
29649
29702
|
//#region packages/compiler-vapor/src/compile.ts
|
|
29650
29703
|
function compile$1(source, options = {}) {
|
|
29651
29704
|
const resolvedOptions = extend({}, options);
|
|
@@ -43240,7 +43293,7 @@ function compileScript(sfc, options) {
|
|
|
43240
43293
|
}
|
|
43241
43294
|
if (preamble) ctx.s.prepend(preamble);
|
|
43242
43295
|
if (helpers && (helpers.has(UNREF) || helpers.has("unref"))) ctx.helperImports.delete("unref");
|
|
43243
|
-
returned = code;
|
|
43296
|
+
returned = vapor && !ssr && hasAwait ? `return () => {${code}}` : code;
|
|
43244
43297
|
} else returned = `() => {}`;
|
|
43245
43298
|
if (!inlineMode && true) ctx.s.appendRight(endOffset, `\nconst __returned__ = ${returned}\nObject.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true })\nreturn __returned__\n}\n\n`);
|
|
43246
43299
|
else ctx.s.appendRight(endOffset, `\n${vapor && !ssr ? `` : `return `}${returned}\n}\n\n`);
|
|
@@ -43418,7 +43471,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
43418
43471
|
//#endregion
|
|
43419
43472
|
//#region packages/compiler-sfc/src/index.ts
|
|
43420
43473
|
init_objectSpread2();
|
|
43421
|
-
const version = "3.6.0-rc.
|
|
43474
|
+
const version = "3.6.0-rc.8";
|
|
43422
43475
|
const parseCache = parseCache$1;
|
|
43423
43476
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
43424
43477
|
const walk = walk$2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.6.0-rc.
|
|
3
|
+
"version": "3.6.0-rc.8",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"magic-string": "^0.30.21",
|
|
48
48
|
"postcss": "^8.5.19",
|
|
49
49
|
"source-map-js": "^1.2.1",
|
|
50
|
-
"@vue/compiler-core": "3.6.0-rc.
|
|
51
|
-
"@vue/compiler-dom": "3.6.0-rc.
|
|
52
|
-
"@vue/compiler-vapor": "3.6.0-rc.
|
|
53
|
-
"@vue/shared": "3.6.0-rc.
|
|
54
|
-
"@vue/compiler-ssr": "3.6.0-rc.
|
|
50
|
+
"@vue/compiler-core": "3.6.0-rc.8",
|
|
51
|
+
"@vue/compiler-dom": "3.6.0-rc.8",
|
|
52
|
+
"@vue/compiler-vapor": "3.6.0-rc.8",
|
|
53
|
+
"@vue/shared": "3.6.0-rc.8",
|
|
54
|
+
"@vue/compiler-ssr": "3.6.0-rc.8"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/types": "^7.29.8",
|