Skip to content

Commit

Permalink
chore: update vue core deps to 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Nov 28, 2023
1 parent a03aae4 commit 349264b
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 208 deletions.
4 changes: 2 additions & 2 deletions packages/language-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dependencies": {
"@volar/language-core": "~1.11.0",
"@volar/source-map": "~1.11.0",
"@vue/compiler-dom": "^3.3.0",
"@vue/compiler-dom": "^3.4.0-alpha.3",
"@vue/shared": "^3.3.0",
"computeds": "^0.0.1",
"minimatch": "^9.0.3",
Expand All @@ -27,7 +27,7 @@
"@types/minimatch": "^5.1.2",
"@types/node": "latest",
"@types/path-browserify": "^1.0.1",
"@vue/compiler-sfc": "^3.3.0"
"@vue/compiler-sfc": "^3.4.0-alpha.3"
},
"peerDependencies": {
"typescript": "*"
Expand Down
2 changes: 1 addition & 1 deletion packages/language-core/src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function getDefaultVueLanguagePlugins(
'@vue/compiler-dom': vueCompilerOptions.target < 3
? {
...CompilerDOM,
compile: CompilerVue2.compile,
compile: CompilerVue2.compile as typeof CompilerDOM.compile,
}
: CompilerDOM,
typescript: ts,
Expand Down
11 changes: 6 additions & 5 deletions packages/language-core/src/utils/parseSfc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ export function parse(source: string): SFCParseResult {

const errors: CompilerError[] = [];
const ast = compiler.parse(source, {
parseMode: 'sfc',
// there are no components at SFC parsing level
isNativeTag: () => true,
// preserve all whitespaces
isPreTag: () => true,
getTextMode: ({ tag, props }, parent) => {
// @ts-ignore this has been removed in 3.4
getTextMode: ({ tag, props }: ElementNode, parent) => {
if (
(!parent && tag !== 'template')
|| (
Expand All @@ -24,10 +26,10 @@ export function parse(source: string): SFCParseResult {
p.value.content !== 'html'
)
)) {
return compiler.TextModes.RAWTEXT;
return 2 /* TextModes.RAWTEXT */;
}
else {
return compiler.TextModes.DATA;
return 0 /* TextModes.DATA */;
}
},
onError: e => {
Expand All @@ -53,8 +55,7 @@ export function parse(source: string): SFCParseResult {
}
switch (node.tag) {
case 'template':
const templateBlock = (descriptor.template = createBlock(node, source) as SFCTemplateBlock);
templateBlock.ast = node;
descriptor.template = createBlock(node, source) as SFCTemplateBlock;
break;
case 'script':
const scriptBlock = createBlock(node, source) as SFCScriptBlock;
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@volar/language-core": "~1.11.0",
"@volar/language-service": "~1.11.0",
"@volar/typescript": "~1.11.0",
"@vue/compiler-dom": "^3.3.0",
"@vue/compiler-dom": "^3.4.0-alpha.3",
"@vue/language-core": "1.8.22",
"@vue/shared": "^3.3.0",
"computeds": "^0.0.1",
Expand Down
Loading

0 comments on commit 349264b

Please sign in to comment.