@vue/compiler-sfc 3.6.0-beta.13 → 3.6.0-beta.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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-beta.14
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -15044,7 +15044,6 @@ function compileScript(sfc, options) {
|
|
|
15044
15044
|
const local = specifier.local.name;
|
|
15045
15045
|
const imported = getImportedName(specifier);
|
|
15046
15046
|
const source = node.source.value;
|
|
15047
|
-
if (vapor && ssr && specifier.type === "ImportSpecifier" && source === "vue" && imported === "defineVaporAsyncComponent") ctx.s.overwrite(specifier.start + startOffset, specifier.end + startOffset, `defineAsyncComponent as ${local}`);
|
|
15048
15047
|
const existing = ctx.userImports[local];
|
|
15049
15048
|
if (source === "vue" && MACROS.includes(imported)) {
|
|
15050
15049
|
if (local === imported) warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
|
|
@@ -15443,7 +15442,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
15443
15442
|
}
|
|
15444
15443
|
//#endregion
|
|
15445
15444
|
//#region packages/compiler-sfc/src/index.ts
|
|
15446
|
-
const version = "3.6.0-beta.
|
|
15445
|
+
const version = "3.6.0-beta.14";
|
|
15447
15446
|
const parseCache = parseCache$1;
|
|
15448
15447
|
const errorMessages = {
|
|
15449
15448
|
..._vue_compiler_dom.errorMessages,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-sfc v3.6.0-beta.
|
|
2
|
+
* @vue/compiler-sfc v3.6.0-beta.14
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -25813,7 +25813,7 @@ function isConstantBinding(value, context) {
|
|
|
25813
25813
|
//#region packages/compiler-vapor/src/generators/for.ts
|
|
25814
25814
|
function genFor(oper, context) {
|
|
25815
25815
|
const { helper } = context;
|
|
25816
|
-
const { source, value, key, index, render, keyProp, once, id, component, onlyChild } = oper;
|
|
25816
|
+
const { source, value, key, index, render, keyProp, once, id, component, onlyChild, slotRoot } = oper;
|
|
25817
25817
|
const rawValue = value && value.content;
|
|
25818
25818
|
const rawKey = key && key.content;
|
|
25819
25819
|
const rawIndex = index && index.content;
|
|
@@ -25872,6 +25872,7 @@ function genFor(oper, context) {
|
|
|
25872
25872
|
if (isFragmentBlock(render)) flags |= 16;
|
|
25873
25873
|
if (!component && isSingleNodeBlock(render)) flags |= 8;
|
|
25874
25874
|
if (once) flags |= 4;
|
|
25875
|
+
if (slotRoot) flags |= 32;
|
|
25875
25876
|
const onResetCalls = [];
|
|
25876
25877
|
for (let i = 0; i < selectorPatterns.length; i++) onResetCalls.push(NEWLINE, `n${id}.onReset(${selectorName(i)}.reset)`);
|
|
25877
25878
|
return [
|
|
@@ -25953,7 +25954,7 @@ function parseValueDestructure(value, context) {
|
|
|
25953
25954
|
if (child.type === "AssignmentPattern" && (parent.type === "ObjectProperty" || parent.type === "ArrayPattern")) {
|
|
25954
25955
|
isDynamic = true;
|
|
25955
25956
|
helper = context.helper("getDefaultValue");
|
|
25956
|
-
helperArgs = rawValue.slice(child.right.start - 1, child.right.end - 1)
|
|
25957
|
+
helperArgs = `() => (${rawValue.slice(child.right.start - 1, child.right.end - 1)})`;
|
|
25957
25958
|
}
|
|
25958
25959
|
}
|
|
25959
25960
|
map.set(id.name, {
|
|
@@ -26101,9 +26102,9 @@ function genSetHtml(oper, context) {
|
|
|
26101
26102
|
//#region packages/compiler-vapor/src/generators/if.ts
|
|
26102
26103
|
function genIf(oper, context, isNested = false) {
|
|
26103
26104
|
const { helper } = context;
|
|
26104
|
-
const { condition, positive, negative, once, index, blockShape } = oper;
|
|
26105
|
+
const { condition, positive, negative, once, slotRoot, index, blockShape } = oper;
|
|
26105
26106
|
const [frag, push] = buildCodeFragment();
|
|
26106
|
-
const flags = genIfFlags(blockShape, once, negative ? index : void 0);
|
|
26107
|
+
const flags = genIfFlags(blockShape, once, slotRoot, negative ? index : void 0);
|
|
26107
26108
|
const conditionExpr = [
|
|
26108
26109
|
"() => (",
|
|
26109
26110
|
...genExpression(condition, context),
|
|
@@ -26117,19 +26118,21 @@ function genIf(oper, context, isNested = false) {
|
|
|
26117
26118
|
push(...genCall(helper("createIf"), conditionExpr, positiveArg, negativeArg, flags));
|
|
26118
26119
|
return frag;
|
|
26119
26120
|
}
|
|
26120
|
-
function genIfFlags(blockShape, once, index) {
|
|
26121
|
+
function genIfFlags(blockShape, once, slotRoot, index) {
|
|
26121
26122
|
let flags = blockShape;
|
|
26123
|
+
if (slotRoot) flags |= 128;
|
|
26122
26124
|
if (once) flags |= 16;
|
|
26123
|
-
else if (index !== void 0) flags |= index + 1 <<
|
|
26125
|
+
else if (index !== void 0) flags |= index + 1 << 8;
|
|
26124
26126
|
if (flags === 1) return false;
|
|
26125
|
-
return `${flags} /* ${genIfFlagNames(once, index, blockShape)} */`;
|
|
26127
|
+
return `${flags} /* ${genIfFlagNames(once, slotRoot, index, blockShape)} */`;
|
|
26126
26128
|
}
|
|
26127
|
-
function genIfFlagNames(once, index, blockShape) {
|
|
26129
|
+
function genIfFlagNames(once, slotRoot, index, blockShape) {
|
|
26128
26130
|
const names = ["BLOCK_SHAPE"];
|
|
26129
26131
|
if (blockShape & 32) names.push("TRUE_NO_SCOPE");
|
|
26130
26132
|
if (blockShape & 64) names.push("FALSE_NO_SCOPE");
|
|
26131
26133
|
if (once) names.push("ONCE");
|
|
26132
|
-
|
|
26134
|
+
if (slotRoot) names.push("SLOT_ROOT");
|
|
26135
|
+
if (!once && index !== void 0) names.push("INDEX_SHIFT");
|
|
26133
26136
|
return names.join(", ");
|
|
26134
26137
|
}
|
|
26135
26138
|
//#endregion
|
|
@@ -26475,7 +26478,9 @@ function genCreateComponent(operation, context) {
|
|
|
26475
26478
|
const useAssetComponentHelper = operation.asset && !operation.dynamic && context.block === context.ir.block && !!singleUseAssetComponentNames && singleUseAssetComponentNames.has(operation.tag);
|
|
26476
26479
|
const maybeSelfReference = useAssetComponentHelper && operation.tag.endsWith("__self");
|
|
26477
26480
|
const tag = genTag();
|
|
26478
|
-
const { root, props, slots, once } = operation;
|
|
26481
|
+
const { root, props, slots, once, slotRoot } = operation;
|
|
26482
|
+
const isRuntimeDynamicComponent = !!(operation.dynamic && !operation.dynamic.isStatic);
|
|
26483
|
+
const dynamicComponentFlags = isRuntimeDynamicComponent ? (root ? 1 : 0) | (once ? 2 : 0) | (slotRoot ? 4 : 0) : 0;
|
|
26479
26484
|
const rawSlots = genRawSlots(slots, context);
|
|
26480
26485
|
const [ids, handlers] = processInlineHandlers(props, context);
|
|
26481
26486
|
const rawProps = context.withId(() => genRawProps(props, context, true), ids);
|
|
@@ -26491,7 +26496,7 @@ function genCreateComponent(operation, context) {
|
|
|
26491
26496
|
];
|
|
26492
26497
|
}, []),
|
|
26493
26498
|
`const n${operation.id} = `,
|
|
26494
|
-
...genCall(
|
|
26499
|
+
...genCall(isRuntimeDynamicComponent ? helper("createDynamicComponent") : operation.useCreateElement ? helper("createPlainElement") : useAssetComponentHelper ? helper("createAssetComponent") : operation.asset ? helper("createComponentWithFallback") : helper("createComponent"), tag, rawProps, rawSlots, isRuntimeDynamicComponent ? dynamicComponentFlags ? String(dynamicComponentFlags) : false : root ? "true" : false, isRuntimeDynamicComponent ? false : once && "true", isRuntimeDynamicComponent ? false : maybeSelfReference && "true"),
|
|
26495
26500
|
...genDirectivesForElement(operation.id, context)
|
|
26496
26501
|
];
|
|
26497
26502
|
function genTag() {
|
|
@@ -26768,23 +26773,12 @@ function genDynamicSlot(slot, context, withFunction = false) {
|
|
|
26768
26773
|
break;
|
|
26769
26774
|
}
|
|
26770
26775
|
if (!withFunction) return frag;
|
|
26771
|
-
return
|
|
26772
|
-
`${context.helper("withVaporCtx")}(() => (`,
|
|
26773
|
-
...frag,
|
|
26774
|
-
"))"
|
|
26775
|
-
] : [
|
|
26776
|
+
return [
|
|
26776
26777
|
"() => (",
|
|
26777
26778
|
...frag,
|
|
26778
26779
|
")"
|
|
26779
26780
|
];
|
|
26780
26781
|
}
|
|
26781
|
-
function needsDynamicSlotSourceCtx(slot) {
|
|
26782
|
-
switch (slot.slotType) {
|
|
26783
|
-
case 1: return needsVaporCtx(slot.fn);
|
|
26784
|
-
case 2: return needsVaporCtx(slot.fn);
|
|
26785
|
-
case 3: return needsDynamicSlotSourceCtx(slot.positive) || (slot.negative ? needsDynamicSlotSourceCtx(slot.negative) : false);
|
|
26786
|
-
}
|
|
26787
|
-
}
|
|
26788
26782
|
function genBasicDynamicSlot(slot, context) {
|
|
26789
26783
|
const { name, fn } = slot;
|
|
26790
26784
|
return genMulti(DELIMITERS_OBJECT_NEWLINE, ["name: ", ...genExpression(name, context)], ["fn: ", ...genSlotBlockWithProps(fn, context)]);
|
|
@@ -26829,7 +26823,7 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
26829
26823
|
let propsName;
|
|
26830
26824
|
let exitScope;
|
|
26831
26825
|
let depth;
|
|
26832
|
-
const { props
|
|
26826
|
+
const { props } = oper;
|
|
26833
26827
|
const idToPathMap = props ? parseValueDestructure(props, context) : /* @__PURE__ */ new Map();
|
|
26834
26828
|
if (props) if (props.ast) {
|
|
26835
26829
|
[depth, exitScope] = context.enterScope();
|
|
@@ -26838,64 +26832,12 @@ function genSlotBlockWithProps(oper, context) {
|
|
|
26838
26832
|
const idMap = idToPathMap.size ? buildDestructureIdMap(idToPathMap, propsName || "", context.options.expressionPlugins) : {};
|
|
26839
26833
|
if (propsName) idMap[propsName] = null;
|
|
26840
26834
|
const exitSlotBlock = context.enterSlotBlock();
|
|
26835
|
+
markSlotRootOperations(oper);
|
|
26841
26836
|
let blockFn = context.withId(() => genBlock(oper, context, propsName ? [propsName] : []), idMap);
|
|
26842
26837
|
exitSlotBlock();
|
|
26843
26838
|
exitScope && exitScope();
|
|
26844
|
-
if (node.type === 1) {
|
|
26845
|
-
if (needsVaporCtx(oper)) blockFn = [
|
|
26846
|
-
`${context.helper("withVaporCtx")}(`,
|
|
26847
|
-
...blockFn,
|
|
26848
|
-
`)`
|
|
26849
|
-
];
|
|
26850
|
-
}
|
|
26851
26839
|
return blockFn;
|
|
26852
26840
|
}
|
|
26853
|
-
/**
|
|
26854
|
-
* Check if a slot block needs withVaporCtx wrapper.
|
|
26855
|
-
* Returns true if the block contains:
|
|
26856
|
-
* - Component creation (needs scopeId inheritance)
|
|
26857
|
-
* - Slot outlet (needs rawSlots from slot owner)
|
|
26858
|
-
*/
|
|
26859
|
-
function needsVaporCtx(block) {
|
|
26860
|
-
return hasComponentOrSlotInBlock(block);
|
|
26861
|
-
}
|
|
26862
|
-
function hasComponentOrSlotInBlock(block) {
|
|
26863
|
-
if (hasComponentOrSlotInOperations(block.operation)) return true;
|
|
26864
|
-
return hasComponentOrSlotInDynamic(block.dynamic);
|
|
26865
|
-
}
|
|
26866
|
-
function hasComponentOrSlotInDynamic(dynamic) {
|
|
26867
|
-
if (dynamic.operation) {
|
|
26868
|
-
const type = dynamic.operation.type;
|
|
26869
|
-
if (type === 12 || type === 13) return true;
|
|
26870
|
-
if (type === 15) {
|
|
26871
|
-
if (hasComponentOrSlotInIf(dynamic.operation)) return true;
|
|
26872
|
-
}
|
|
26873
|
-
if (type === 16) {
|
|
26874
|
-
if (hasComponentOrSlotInBlock(dynamic.operation.render)) return true;
|
|
26875
|
-
}
|
|
26876
|
-
}
|
|
26877
|
-
for (const child of dynamic.children) if (hasComponentOrSlotInDynamic(child)) return true;
|
|
26878
|
-
return false;
|
|
26879
|
-
}
|
|
26880
|
-
function hasComponentOrSlotInOperations(operations) {
|
|
26881
|
-
for (const op of operations) switch (op.type) {
|
|
26882
|
-
case 12:
|
|
26883
|
-
case 13: return true;
|
|
26884
|
-
case 15:
|
|
26885
|
-
if (hasComponentOrSlotInIf(op)) return true;
|
|
26886
|
-
break;
|
|
26887
|
-
case 16:
|
|
26888
|
-
if (hasComponentOrSlotInBlock(op.render)) return true;
|
|
26889
|
-
break;
|
|
26890
|
-
}
|
|
26891
|
-
return false;
|
|
26892
|
-
}
|
|
26893
|
-
function hasComponentOrSlotInIf(node) {
|
|
26894
|
-
if (hasComponentOrSlotInBlock(node.positive)) return true;
|
|
26895
|
-
if (node.negative) if ("positive" in node.negative) return hasComponentOrSlotInIf(node.negative);
|
|
26896
|
-
else return hasComponentOrSlotInBlock(node.negative);
|
|
26897
|
-
return false;
|
|
26898
|
-
}
|
|
26899
26841
|
//#endregion
|
|
26900
26842
|
//#region packages/compiler-vapor/src/generators/slotOutlet.ts
|
|
26901
26843
|
function genSlotOutlet(oper, context) {
|
|
@@ -26903,7 +26845,10 @@ function genSlotOutlet(oper, context) {
|
|
|
26903
26845
|
const { id, name, fallback, flags } = oper;
|
|
26904
26846
|
const [frag, push] = buildCodeFragment();
|
|
26905
26847
|
let fallbackArg;
|
|
26906
|
-
if (fallback)
|
|
26848
|
+
if (fallback) {
|
|
26849
|
+
markSlotRootOperations(fallback);
|
|
26850
|
+
fallbackArg = genBlock(fallback, context);
|
|
26851
|
+
}
|
|
26907
26852
|
const createSlot = helper("createSlot");
|
|
26908
26853
|
const rawPropsArg = genRawProps(oper.props, context, true);
|
|
26909
26854
|
const nameArg = name.isStatic && name.content === "default" && !rawPropsArg && !fallbackArg && !flags ? void 0 : name.isStatic ? genExpression(name, context) : [
|
|
@@ -27237,6 +27182,42 @@ function genBlockContent(block, context, root, genEffectsExtraFrag) {
|
|
|
27237
27182
|
for (const name of context.ir[kind]) push(NEWLINE, `const ${toValidAssetId(name, kind)} = `, ...genCall(context.helper(helper), JSON.stringify(name)));
|
|
27238
27183
|
}
|
|
27239
27184
|
}
|
|
27185
|
+
function markSlotRootOperations(block) {
|
|
27186
|
+
for (let i = 0; i < block.returns.length; i++) {
|
|
27187
|
+
const child = findReturnedDynamic$1(block, block.returns[i]);
|
|
27188
|
+
const operation = child && child.operation;
|
|
27189
|
+
if (!operation) continue;
|
|
27190
|
+
if (operation.type === 15) markSlotRootIf(operation);
|
|
27191
|
+
else if (operation.type === 16) markSlotRootFor(operation);
|
|
27192
|
+
else if (operation.type === 13) markSlotRootSlotOutlet(operation);
|
|
27193
|
+
else if (operation.type === 12) markSlotRootComponent(operation);
|
|
27194
|
+
}
|
|
27195
|
+
}
|
|
27196
|
+
function markSlotRootIf(operation) {
|
|
27197
|
+
if (!operation.once) operation.slotRoot = true;
|
|
27198
|
+
markSlotRootOperations(operation.positive);
|
|
27199
|
+
const negative = operation.negative;
|
|
27200
|
+
if (!negative) return;
|
|
27201
|
+
if (negative.type === 15) markSlotRootIf(negative);
|
|
27202
|
+
else markSlotRootOperations(negative);
|
|
27203
|
+
}
|
|
27204
|
+
function markSlotRootFor(operation) {
|
|
27205
|
+
if (!operation.once) operation.slotRoot = true;
|
|
27206
|
+
markSlotRootOperations(operation.render);
|
|
27207
|
+
}
|
|
27208
|
+
function markSlotRootSlotOutlet(operation) {
|
|
27209
|
+
operation.flags |= 4;
|
|
27210
|
+
if (operation.fallback) markSlotRootOperations(operation.fallback);
|
|
27211
|
+
}
|
|
27212
|
+
function markSlotRootComponent(operation) {
|
|
27213
|
+
if (!operation.once && operation.dynamic && !operation.dynamic.isStatic) operation.slotRoot = true;
|
|
27214
|
+
}
|
|
27215
|
+
function findReturnedDynamic$1(block, id) {
|
|
27216
|
+
for (let i = 0; i < block.dynamic.children.length; i++) {
|
|
27217
|
+
const child = block.dynamic.children[i];
|
|
27218
|
+
if (child.id === id) return child;
|
|
27219
|
+
}
|
|
27220
|
+
}
|
|
27240
27221
|
function collectSingleUseAssetComponents(block) {
|
|
27241
27222
|
const usageMap = /* @__PURE__ */ new Map();
|
|
27242
27223
|
const seenOperations = /* @__PURE__ */ new Set();
|
|
@@ -41782,7 +41763,6 @@ function compileScript(sfc, options) {
|
|
|
41782
41763
|
const local = specifier.local.name;
|
|
41783
41764
|
const imported = getImportedName(specifier);
|
|
41784
41765
|
const source = node.source.value;
|
|
41785
|
-
if (vapor && ssr && specifier.type === "ImportSpecifier" && source === "vue" && imported === "defineVaporAsyncComponent") ctx.s.overwrite(specifier.start + startOffset, specifier.end + startOffset, `defineAsyncComponent as ${local}`);
|
|
41786
41766
|
const existing = ctx.userImports[local];
|
|
41787
41767
|
if (source === "vue" && MACROS.includes(imported)) {
|
|
41788
41768
|
if (local === imported) warnOnce(`\`${imported}\` is a compiler macro and no longer needs to be imported.`);
|
|
@@ -42177,7 +42157,7 @@ function mergeSourceMaps(scriptMap, templateMap, templateLineOffset) {
|
|
|
42177
42157
|
//#endregion
|
|
42178
42158
|
//#region packages/compiler-sfc/src/index.ts
|
|
42179
42159
|
init_objectSpread2();
|
|
42180
|
-
const version = "3.6.0-beta.
|
|
42160
|
+
const version = "3.6.0-beta.14";
|
|
42181
42161
|
const parseCache = parseCache$1;
|
|
42182
42162
|
const errorMessages = _objectSpread2(_objectSpread2({}, errorMessages$1), DOMErrorMessages);
|
|
42183
42163
|
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-beta.
|
|
3
|
+
"version": "3.6.0-beta.14",
|
|
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.14",
|
|
49
49
|
"source-map-js": "^1.2.1",
|
|
50
|
-
"@vue/compiler-core": "3.6.0-beta.
|
|
51
|
-
"@vue/compiler-
|
|
52
|
-
"@vue/compiler-vapor": "3.6.0-beta.
|
|
53
|
-
"@vue/shared": "3.6.0-beta.
|
|
54
|
-
"@vue/compiler-
|
|
50
|
+
"@vue/compiler-core": "3.6.0-beta.14",
|
|
51
|
+
"@vue/compiler-dom": "3.6.0-beta.14",
|
|
52
|
+
"@vue/compiler-vapor": "3.6.0-beta.14",
|
|
53
|
+
"@vue/shared": "3.6.0-beta.14",
|
|
54
|
+
"@vue/compiler-ssr": "3.6.0-beta.14"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@babel/types": "^7.29.0",
|