Skip to content

Commit 7b5032f

Browse files
chore: use tsgo in development (#5860)
1 parent 784dd56 commit 7b5032f

24 files changed

+2157
-1983
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules
33
*.tsbuildinfo
44
*.vsix
55

6+
extensions/vscode/out
67
packages/*/*.d.ts
78
packages/*/*.js
89
packages/*/*.map

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
33
"dprint.dprint",
4-
"johnsoncodehk.vscode-tsslint"
4+
"johnsoncodehk.vscode-tsslint",
5+
"typescriptteam.native-preview"
56
]
67
}

.vscode/launch.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
"outFiles": [
1616
"${workspaceRoot}/**/*.js"
1717
],
18-
"preLaunchTask": {
19-
"type": "npm",
20-
"script": "watch"
21-
}
18+
"preLaunchTask": "watch"
2219
},
2320
{
2421
"name": "Launch Web Client",
@@ -33,10 +30,7 @@
3330
"outFiles": [
3431
"${workspaceRoot}/**/*.js"
3532
],
36-
"preLaunchTask": {
37-
"type": "npm",
38-
"script": "watch"
39-
}
33+
"preLaunchTask": "watch"
4034
},
4135
{
4236
"name": "Attach to Language Server",

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
2-
"vue.server.path": "packages/language-server",
3-
"typescript.tsdk": "node_modules/typescript/lib",
2+
"typescript.experimental.useTsgo": true,
43
"dprint.path": "node_modules/dprint/dprint",
54
"[javascript]": {
65
"editor.defaultFormatter": "dprint.dprint"

.vscode/tasks.json

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,33 @@
22
"version": "2.0.0",
33
"tasks": [
44
{
5-
"type": "npm",
6-
"script": "compile",
7-
"group": "build",
8-
"presentation": {
9-
"panel": "dedicated",
10-
"reveal": "never"
5+
"label": "build",
6+
"type": "shell",
7+
"command": "npm run build",
8+
"group": {
9+
"kind": "build",
10+
"isDefault": true
1111
},
1212
"problemMatcher": [
1313
"$tsc"
14-
]
14+
],
15+
"presentation": {
16+
"reveal": "always",
17+
"panel": "shared"
18+
}
1519
},
1620
{
17-
"type": "npm",
18-
"script": "watch",
21+
"label": "watch",
22+
"type": "shell",
23+
"command": "npm run watch",
1924
"isBackground": true,
20-
"group": {
21-
"kind": "build",
22-
"isDefault": true
23-
},
25+
"group": "build",
26+
"problemMatcher": [
27+
"$tsc-watch"
28+
],
2429
"presentation": {
25-
"panel": "dedicated",
26-
"reveal": "never"
27-
},
28-
"problemMatcher": {
29-
"pattern": {
30-
"regexp": "__________"
31-
},
32-
"background": {
33-
"activeOnStart": true,
34-
"beginsPattern": "> rolldown",
35-
"endsPattern": "Waiting for changes..."
36-
}
30+
"reveal": "always",
31+
"panel": "shared"
3732
}
3833
}
3934
]

extensions/vscode/.vscodeignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
**/*.ts
1+
node_modules
2+
src
3+
out
24
tests
35
tsconfig.json
6+
tsconfig.tsbuildinfo
7+
rolldown.config.ts

extensions/vscode/main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
try {
2+
module.exports = require('./out/extension.js');
3+
}
4+
catch {
5+
module.exports = require('./dist/extension.js');
6+
}

extensions/vscode/package.json

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"activationEvents": [
2525
"onLanguage"
2626
],
27-
"main": "./dist/extension.js",
27+
"main": "./main.js",
2828
"browser": "./web.js",
2929
"capabilities": {
3030
"virtualWorkspaces": {
@@ -472,29 +472,24 @@
472472
}
473473
},
474474
"scripts": {
475-
"build:dev": "rolldown --config",
476-
"build:prod": "rolldown --minify --config",
477-
"watch": "rolldown --watch --config",
478-
"pack": "pnpm run build:prod && vsce package",
479-
"release": "pnpm run build:prod && vsce publish",
475+
"build": "rolldown --config",
476+
"pack": "pnpm run build && vsce package",
477+
"release": "pnpm run build && vsce publish",
480478
"gen-ext-meta": "vscode-ext-gen --scope vue --output lib/generated-meta.ts && cd ../.. && pnpm run format"
481479
},
482480
"devDependencies": {
483481
"@types/node": "^22.10.4",
484-
"@types/semver": "^7.5.3",
485482
"@types/vscode": "1.88.0",
486483
"@volar/typescript": "2.4.27",
487484
"@volar/vscode": "2.4.27",
488-
"@vscode/vsce": "^3.2.1",
489-
"@vue/compiler-sfc": "^3.5.0",
485+
"@vscode/vsce": "latest",
490486
"@vue/language-core": "3.1.8",
491487
"@vue/language-server": "3.1.8",
492488
"@vue/typescript-plugin": "3.1.8",
493-
"laplacenoma": "^0.0.3",
494-
"reactive-vscode": "^0.2.9",
495-
"rolldown": "1.0.0-beta.8",
496-
"semver": "^7.5.4",
497-
"vscode-ext-gen": "^1.0.2",
498-
"vscode-tmlanguage-snapshot": "^1.0.1"
489+
"laplacenoma": "latest",
490+
"reactive-vscode": "latest",
491+
"rolldown": "latest",
492+
"vscode-ext-gen": "latest",
493+
"vscode-tmlanguage-snapshot": "latest"
499494
}
500495
}
Lines changed: 16 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,32 @@
11
import * as fs from 'node:fs';
22
import * as path from 'node:path';
3-
import { defineConfig, type RolldownOptions } from 'rolldown';
3+
import { defineConfig } from 'rolldown';
44

5-
const isDev = !process.argv.includes('--minify');
6-
const resolve = (...paths: string[]) => path.resolve(__dirname, ...paths);
7-
8-
const config: RolldownOptions = {
5+
export default defineConfig({
96
input: {
10-
'extension': './index.ts',
11-
'reactivity-analysis-plugin': './lib/reactivityAnalysisPlugin.ts',
7+
'extension': './src/extension.ts',
8+
'reactivity-analysis-plugin': './src/reactivityAnalysisPlugin.ts',
9+
'language-server': './node_modules/@vue/language-server/index.ts',
10+
'typescript-plugin': './node_modules/@vue/typescript-plugin/index.ts',
1211
},
1312
output: {
1413
format: 'cjs',
15-
sourcemap: isDev,
14+
minify: true,
15+
},
16+
transform: {
17+
define: {
18+
'process.env.NODE_ENV': '"production"',
19+
},
1620
},
17-
define: {
18-
'process.env.NODE_ENV': '"production"',
21+
checks: {
22+
eval: false,
1923
},
2024
external: ['vscode'],
2125
plugins: [
2226
{
2327
name: 'clean',
2428
buildStart() {
25-
fs.rmSync(resolve('./dist'), { recursive: true, force: true });
26-
},
27-
},
28-
{
29-
name: 'redirect',
30-
buildEnd() {
31-
fs.mkdirSync(resolve('./node_modules/vue-typescript-plugin-pack'), { recursive: true });
32-
fs.writeFileSync(
33-
resolve('./node_modules/vue-typescript-plugin-pack/index.js'),
34-
`module.exports = require('../../dist/typescript-plugin.js');`,
35-
);
36-
37-
fs.mkdirSync(resolve('./node_modules/vue-reactivity-analysis-plugin-pack'), { recursive: true });
38-
fs.writeFileSync(
39-
resolve('./node_modules/vue-reactivity-analysis-plugin-pack/index.js'),
40-
`module.exports = require('../../dist/reactivity-analysis-plugin.js');`,
41-
);
42-
43-
if (isDev) {
44-
fs.mkdirSync(resolve('./dist'), { recursive: true });
45-
fs.writeFileSync(
46-
resolve('./dist/language-server.js'),
47-
`module.exports = require('../node_modules/@vue/language-server/index.js');`,
48-
);
49-
fs.writeFileSync(
50-
resolve('./dist/typescript-plugin.js'),
51-
`module.exports = require('../node_modules/@vue/typescript-plugin/index.js');`,
52-
);
53-
}
29+
fs.rmSync(path.resolve(__dirname, './dist'), { recursive: true, force: true });
5430
},
5531
},
5632
{
@@ -79,14 +55,4 @@ const config: RolldownOptions = {
7955
},
8056
},
8157
],
82-
};
83-
84-
if (!isDev) {
85-
config.input = {
86-
...config.input as Record<string, string>,
87-
'language-server': './node_modules/@vue/language-server/index.js',
88-
'typescript-plugin': './node_modules/@vue/typescript-plugin/index.js',
89-
};
90-
}
91-
92-
export default defineConfig(config);
58+
});

0 commit comments

Comments
 (0)