@vue-macros/volar
Advanced tools
Comparing version 0.23.0 to 0.23.1
@@ -227,2 +227,19 @@ // src/common.ts | ||
} | ||
function transformVSlots(nodes, ctxMap, options) { | ||
const { codes, source } = options; | ||
for (const { | ||
node, | ||
attribute: { initializer } | ||
} of nodes) { | ||
if (initializer && isJsxExpression(initializer) && initializer.expression) { | ||
(0, import_muggle_string3.replaceSourceRange)( | ||
codes, | ||
source, | ||
initializer.expression.end, | ||
initializer.expression.end, | ||
` satisfies typeof ${ctxMap.get(node)}.slots` | ||
); | ||
} | ||
} | ||
} | ||
@@ -545,2 +562,3 @@ // src/jsx-directive/v-if.ts | ||
const refNodes = []; | ||
const vSlots = []; | ||
const ctxNodeSet = /* @__PURE__ */ new Set(); | ||
@@ -578,4 +596,21 @@ function walkJsxDirective(node, parent) { | ||
refNodes.push({ node, attribute }); | ||
} else if (attributeName === "v-slots") { | ||
ctxNodeSet.add(node); | ||
vSlots.push({ node, attribute }); | ||
} | ||
} | ||
if (isJsxExpression(node) && node.expression && ts.isObjectLiteralExpression(node.expression) && parent && ts.isJsxElement(parent) && parent.children.filter( | ||
(child) => ts.isJsxText(child) ? getText(child, options).trim() : true | ||
).length === 1) { | ||
ctxNodeSet.add(parent); | ||
vSlots.push({ | ||
node: parent, | ||
attribute: { | ||
initializer: { | ||
kind: ts.SyntaxKind.JsxExpression, | ||
expression: node.expression | ||
} | ||
} | ||
}); | ||
} | ||
if (!(vSlotAttribute && tagName === "template")) { | ||
@@ -648,2 +683,3 @@ if (vIfAttribute) { | ||
transformRef(refNodes, ctxMap, options); | ||
transformVSlots(vSlots, ctxMap, options); | ||
} | ||
@@ -650,0 +686,0 @@ function getOpeningElement(node, options) { |
{ | ||
"name": "@vue-macros/volar", | ||
"version": "0.23.0", | ||
"version": "0.23.1", | ||
"description": "Volar plugin for Vue Macros.", | ||
@@ -48,8 +48,8 @@ "keywords": [ | ||
"@rollup/pluginutils": "^5.1.0", | ||
"@vue/language-core": "2.0.22", | ||
"@vue/shared": "^3.4.30", | ||
"@vue/language-core": "2.0.24", | ||
"@vue/shared": "^3.4.31", | ||
"muggle-string": "^0.4.1", | ||
"@vue-macros/boolean-prop": "0.4.0", | ||
"@vue-macros/common": "1.10.4", | ||
"@vue-macros/define-props": "2.0.6", | ||
"@vue-macros/boolean-prop": "0.4.0", | ||
"@vue-macros/short-bind": "0.2.5", | ||
@@ -59,5 +59,5 @@ "@vue-macros/short-vmodel": "1.4.5" | ||
"devDependencies": { | ||
"@vue/compiler-dom": "^3.4.30", | ||
"@vue/compiler-dom": "^3.4.31", | ||
"typescript": "~5.5.2", | ||
"vue-tsc": "2.0.22" | ||
"vue-tsc": "2.0.24" | ||
}, | ||
@@ -64,0 +64,0 @@ "engines": { |
60247
1669
+ Added@vue/language-core@2.0.24(transitive)
- Removed@volar/language-core@2.3.4(transitive)
- Removed@volar/source-map@2.3.4(transitive)
- Removed@vue/language-core@2.0.22(transitive)
Updated@vue/language-core@2.0.24
Updated@vue/shared@^3.4.31