Skip to content

Commit 734b31b

Browse files
committed
feat: upgrade to latest @vue/language-core
1 parent 6fed91f commit 734b31b

File tree

10 files changed

+2043
-1914
lines changed

10 files changed

+2043
-1914
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"version": "1.0.0-beta.5",
4-
"packageManager": "pnpm@10.14.0",
4+
"packageManager": "pnpm@10.20.0",
55
"type": "module",
66
"scripts": {
77
"build": "pnpm -r run build",
@@ -13,20 +13,20 @@
1313
"typecheck": "tsgo --noEmit"
1414
},
1515
"devDependencies": {
16-
"@antfu/ni": "^25.0.0",
17-
"@so1ve/eslint-config": "^3.8.0",
18-
"@so1ve/prettier-config": "^3.8.0",
19-
"@types/node": "^24.1.0",
16+
"@antfu/ni": "^27.0.1",
17+
"@so1ve/eslint-config": "^3.11.2",
18+
"@so1ve/prettier-config": "^3.11.2",
19+
"@types/node": "^24.9.2",
2020
"@typescript/native-preview": "7.0.0-dev.20250711.1",
21-
"@vue-macros/test-utils": "^2.0.0",
22-
"bumpp": "^10.2.2",
23-
"eslint": "^9.32.0",
21+
"@vue-macros/test-utils": "^3.1.1",
22+
"bumpp": "^10.3.1",
23+
"eslint": "^9.38.0",
2424
"prettier": "^3.6.2",
25-
"tsdown": "^0.13.2",
26-
"typescript": "^5.9.2",
27-
"vite": "^7.0.6",
25+
"tsdown": "^0.15.11",
26+
"typescript": "^5.9.3",
27+
"vite": "^7.1.12",
2828
"vite-tsconfig-paths": "^5.1.4",
29-
"vitest": "^3.2.4",
30-
"vue": "^3.5.18"
29+
"vitest": "^4.0.5",
30+
"vue": "^3.5.22"
3131
}
3232
}

packages/complex-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
},
7777
"devDependencies": {
7878
"@nuxt/schema": "catalog:",
79-
"@vue-macros/better-define": "^1.11.4",
79+
"@vue-macros/better-define": "^3.1.1",
8080
"rolldown": "catalog:",
8181
"rollup": "catalog:",
8282
"vite": "catalog:",

packages/complex-types/test/__snapshots__/fixtures-compiled.test.ts.snap

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
690690
type: Function,
691691
required: false
692692
},
693+
onFormdata: {
694+
type: Function,
695+
required: false
696+
},
693697
onInput: {
694698
type: Function,
695699
required: false
@@ -706,35 +710,31 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
706710
type: Function,
707711
required: false
708712
},
709-
onLoad: {
710-
type: Function,
711-
required: false
712-
},
713-
onError: {
713+
onFullscreenchange: {
714714
type: Function,
715715
required: false
716716
},
717-
onKeydown: {
717+
onFullscreenerror: {
718718
type: Function,
719719
required: false
720720
},
721-
onKeypress: {
721+
onLoad: {
722722
type: Function,
723723
required: false
724724
},
725-
onKeyup: {
725+
onError: {
726726
type: Function,
727727
required: false
728728
},
729-
onAuxclick: {
729+
onKeydown: {
730730
type: Function,
731731
required: false
732732
},
733-
onClick: {
733+
onKeypress: {
734734
type: Function,
735735
required: false
736736
},
737-
onContextmenu: {
737+
onKeyup: {
738738
type: Function,
739739
required: false
740740
},
@@ -886,6 +886,26 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
886886
type: Function,
887887
required: false
888888
},
889+
onAuxclick: {
890+
type: Function,
891+
required: false
892+
},
893+
onClick: {
894+
type: Function,
895+
required: false
896+
},
897+
onContextmenu: {
898+
type: Function,
899+
required: false
900+
},
901+
onGotpointercapture: {
902+
type: Function,
903+
required: false
904+
},
905+
onLostpointercapture: {
906+
type: Function,
907+
required: false
908+
},
889909
onPointerdown: {
890910
type: Function,
891911
required: false
@@ -918,10 +938,22 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
918938
type: Function,
919939
required: false
920940
},
941+
onBeforetoggle: {
942+
type: Function,
943+
required: false
944+
},
945+
onToggle: {
946+
type: Function,
947+
required: false
948+
},
921949
onWheel: {
922950
type: Function,
923951
required: false
924952
},
953+
onAnimationcancel: {
954+
type: Function,
955+
required: false
956+
},
925957
onAnimationstart: {
926958
type: Function,
927959
required: false
@@ -934,10 +966,22 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
934966
type: Function,
935967
required: false
936968
},
969+
onSecuritypolicyviolation: {
970+
type: Function,
971+
required: false
972+
},
973+
onTransitioncancel: {
974+
type: Function,
975+
required: false
976+
},
937977
onTransitionend: {
938978
type: Function,
939979
required: false
940980
},
981+
onTransitionrun: {
982+
type: Function,
983+
required: false
984+
},
941985
onTransitionstart: {
942986
type: Function,
943987
required: false

packages/complex-types/test/__snapshots__/fixtures.test.ts.snap

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,18 @@ defineProps<{
207207
"onBlur"?: Function,
208208
"onChange"?: Function,
209209
"onBeforeinput"?: Function,
210+
"onFormdata"?: Function,
210211
"onInput"?: Function,
211212
"onReset"?: Function,
212213
"onSubmit"?: Function,
213214
"onInvalid"?: Function,
215+
"onFullscreenchange"?: Function,
216+
"onFullscreenerror"?: Function,
214217
"onLoad"?: Function,
215218
"onError"?: Function,
216219
"onKeydown"?: Function,
217220
"onKeypress"?: Function,
218221
"onKeyup"?: Function,
219-
"onAuxclick"?: Function,
220-
"onClick"?: Function,
221-
"onContextmenu"?: Function,
222222
"onDblclick"?: Function,
223223
"onMousedown"?: Function,
224224
"onMouseenter"?: Function,
@@ -256,6 +256,11 @@ defineProps<{
256256
"onTouchend"?: Function,
257257
"onTouchmove"?: Function,
258258
"onTouchstart"?: Function,
259+
"onAuxclick"?: Function,
260+
"onClick"?: Function,
261+
"onContextmenu"?: Function,
262+
"onGotpointercapture"?: Function,
263+
"onLostpointercapture"?: Function,
259264
"onPointerdown"?: Function,
260265
"onPointermove"?: Function,
261266
"onPointerup"?: Function,
@@ -264,11 +269,17 @@ defineProps<{
264269
"onPointerleave"?: Function,
265270
"onPointerover"?: Function,
266271
"onPointerout"?: Function,
272+
"onBeforetoggle"?: Function,
273+
"onToggle"?: Function,
267274
"onWheel"?: Function,
275+
"onAnimationcancel"?: Function,
268276
"onAnimationstart"?: Function,
269277
"onAnimationend"?: Function,
270278
"onAnimationiteration"?: Function,
279+
"onSecuritypolicyviolation"?: Function,
280+
"onTransitioncancel"?: Function,
271281
"onTransitionend"?: Function,
282+
"onTransitionrun"?: Function,
272283
"onTransitionstart"?: Function,
273284
}>();
274285
</script>

packages/complex-types/test/fixtures-compiled.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,14 @@ describe("fixtures compiled", async () => {
1919
["__fixtures__/**/*.vue", "!__fixtures__/**/*.exclude.vue"],
2020
(_args, id) =>
2121
rollupBuild(id, [
22-
// @ts-expect-error
2322
VueComplexTypes({
2423
tsconfigPath: join(__dirname, "__fixtures__", "tsconfig.json"),
2524
}),
26-
// @ts-expect-error
2725
VueBetterDefine({ isProduction: false }),
28-
// @ts-expect-error
2926
RollupVue(),
3027
RollupVueJsx(),
3128
RollupJson(),
3229
RollupNodeResolve(),
33-
// @ts-expect-error
3430
UnpluginOxc.rollup(),
3531
]),
3632
{

packages/language/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"watch": "tsdown --watch"
3939
},
4040
"dependencies": {
41-
"@volar/typescript": "~2.4.22",
41+
"@volar/typescript": "~2.4.23",
4242
"@vue.ts/shared": "workspace:*",
43-
"@vue/language-core": "3.0.1"
43+
"@vue/language-core": "^3.1.2"
4444
}
4545
}

packages/language/src/index.ts

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,63 @@ function createLanguage(
2121
const tsconfig = normalizePath(tsconfigPath);
2222

2323
return createLanguageWorker(
24-
() => vue.createParsedCommandLine(ts, ts.sys, tsconfigPath, true),
25-
path.dirname(tsconfig),
2624
ts,
25+
() => {
26+
const commandLine = vue.createParsedCommandLine(ts, ts.sys, tsconfig);
27+
const { fileNames } = ts.parseJsonSourceFileConfigFileContent(
28+
ts.readJsonConfigFile(tsconfig, ts.sys.readFile),
29+
ts.sys,
30+
path.dirname(tsconfig),
31+
{},
32+
tsconfig,
33+
undefined,
34+
vue.getAllExtensions(commandLine.vueOptions).map((extension) => ({
35+
extension: extension.slice(1),
36+
isMixedContent: true,
37+
scriptKind: ts.ScriptKind.Deferred,
38+
})),
39+
);
40+
41+
return [commandLine, fileNames];
42+
},
43+
path.dirname(tsconfig),
2744
);
2845
}
2946

3047
function createLanguageWorker(
31-
loadParsedCommandLine: () => vue.ParsedCommandLine,
32-
rootPath: string,
3348
ts: typeof import("typescript/lib/tsserverlibrary"),
49+
getConfigAndFiles: () => [
50+
commandLine: vue.ParsedCommandLine,
51+
fileNames: string[],
52+
],
53+
rootPath: string,
3454
) {
35-
let parsedCommandLine = loadParsedCommandLine();
36-
let fileNames = new Set(
37-
parsedCommandLine.fileNames.map((fileName) => normalizePath(fileName)),
55+
let [{ vueOptions, options, projectReferences }, fileNames] =
56+
getConfigAndFiles();
57+
let fileNamesSet = new Set(
58+
fileNames.map((fileName) => normalizePath(fileName)),
3859
);
3960
let projectVersion = 0;
4061

62+
vueOptions.globalTypesPath = vue.createGlobalTypesWriter(
63+
vueOptions,
64+
ts.sys.writeFile,
65+
);
66+
4167
const projectHost: TypeScriptProjectHost = {
4268
getCurrentDirectory: () => rootPath,
4369
getProjectVersion: () => projectVersion.toString(),
44-
getCompilationSettings: () => parsedCommandLine.options,
45-
getScriptFileNames: () => [...fileNames],
46-
getProjectReferences: () => parsedCommandLine.projectReferences,
70+
getCompilationSettings: () => options,
71+
getScriptFileNames: () => [...fileNamesSet],
72+
getProjectReferences: () => projectReferences,
4773
};
4874

4975
const scriptSnapshots = new Map<string, ts.IScriptSnapshot | undefined>();
5076

5177
const vueLanguagePlugin = vue.createVueLanguagePlugin<string>(
5278
ts,
5379
projectHost.getCompilationSettings(),
54-
parsedCommandLine.vueOptions,
80+
vueOptions,
5581
(id) => id,
5682
);
5783

@@ -112,31 +138,29 @@ function createLanguageWorker(
112138
const program = tsLs.getProgram()!;
113139
const typeChecker = program.getTypeChecker();
114140

115-
const helpers = createHelpers(
116-
language,
117-
program,
118-
parsedCommandLine.vueOptions,
119-
ts,
120-
);
141+
const helpers = createHelpers(language, program, vueOptions, ts);
121142

122143
return {
123144
...helpers,
124145
updateFile(fileName: string, text: string) {
125146
fileName = normalizePath(fileName);
126147
scriptSnapshots.set(fileName, ts.ScriptSnapshot.fromString(text));
127-
fileNames.add(fileName);
148+
fileNamesSet.add(fileName);
128149
projectVersion++;
129150
},
130151
deleteFile(fileName: string) {
131152
fileName = normalizePath(fileName);
132-
fileNames.delete(fileName);
153+
fileNamesSet.delete(fileName);
133154
projectVersion++;
134155
},
135156
reload() {
136-
parsedCommandLine = loadParsedCommandLine();
137-
fileNames = new Set(
138-
parsedCommandLine.fileNames.map((fileName) => normalizePath(fileName)),
157+
[{ vueOptions, options, projectReferences }, fileNames] =
158+
getConfigAndFiles();
159+
vueOptions.globalTypesPath = vue.createGlobalTypesWriter(
160+
vueOptions,
161+
ts.sys.writeFile,
139162
);
163+
fileNamesSet = new Set(fileNames.map(normalizePath));
140164
this.clearCache();
141165
},
142166
clearCache() {

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
"watch": "tsdown --watch"
3838
},
3939
"dependencies": {
40-
"@rollup/pluginutils": "^5.2.0"
40+
"@rollup/pluginutils": "^5.3.0"
4141
}
4242
}

0 commit comments

Comments
 (0)