Skip to content

Commit 40865a0

Browse files
committed
Bundle typescript type in VLS
1 parent cdd6b2b commit 40865a0

9 files changed

+24
-7
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ test/**/data-dir/User/**
1111

1212
dist
1313
server/dist
14+
server/typings
1415
docs/.vuepress/dist
1516
dist-test/
1617
server/dist-test/

.vscodeignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ docs/
66
client/
77
**/test/
88
server/src/
9-
server/dist/types/
9+
server/typings
1010
vti
1111
dist-test/
1212
server/dist-test/

build/rollup-plugins.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function generateTypingsVls() {
3232
return new Promise((resolve, reject) => {
3333
const tsc = spawn(
3434
getServerPath('node_modules/.bin/tsc'),
35-
['--declaration', '--declarationDir', './dist/types', '--emitDeclarationOnly', '--pretty'],
35+
['--declaration', '--declarationDir', './typings', '--emitDeclarationOnly', '--pretty'],
3636
{ cwd: getServerPath('./'), shell: true }
3737
);
3838
tsc.stdout.on('data', data => {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@
555555
"prettier": "^2.1.2",
556556
"rollup": "^2.26.11",
557557
"rollup-plugin-delete": "^2.0.0",
558+
"rollup-plugin-dts": "^1.4.13",
558559
"rollup-plugin-terser": "^7.0.2",
559560
"rollup-plugin-typescript2": "^0.29.0",
560561
"shelljs": "^0.8.4",

server/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
dist
3+
typings

server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "Pine Wu <[email protected]>",
66
"license": "MIT",
77
"main": "dist/vls.js",
8-
"typings": "dist/types/main.d.ts",
8+
"typings": "dist/vls.d.ts",
99
"bin": {
1010
"vls": "./bin/vls"
1111
},

server/rollup.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const {
99
generateTypingsVls
1010
} = require('../build/rollup-plugins.js');
1111
const vlsPkg = require('./package.json');
12+
const dts = require('rollup-plugin-dts').default;
1213

1314
const getVLSPath = getRootPath('server');
1415

@@ -59,5 +60,15 @@ module.exports = [
5960
linkVlsInCLI(),
6061
...createPlugins(getVLSPath('tsconfig.json'))
6162
]
63+
},
64+
// bundle typings
65+
{
66+
input: getVLSPath('typings/main.d.ts'),
67+
output: {
68+
file: getVLSPath('dist/vls.d.ts'),
69+
format: 'es'
70+
},
71+
onwarn,
72+
plugins: [dts()]
6273
}
6374
];

vti/src/typing.d.ts

-4
This file was deleted.

yarn.lock

+7
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,13 @@ rollup-plugin-delete@^2.0.0:
16561656
dependencies:
16571657
del "^5.1.0"
16581658

1659+
rollup-plugin-dts@^1.4.13:
1660+
version "1.4.13"
1661+
resolved "https://registry.yarnpkg.com/rollup-plugin-dts/-/rollup-plugin-dts-1.4.13.tgz#4f086e84f4fdcc1f49160799ebc66f6b09db292b"
1662+
integrity sha512-7mxoQ6PcmCkBE5ZhrjGDL4k42XLy8BkSqpiRi1MipwiGs+7lwi4mQkp2afX+OzzLjJp/TGM8llfe8uayIUhPEw==
1663+
optionalDependencies:
1664+
"@babel/code-frame" "^7.10.4"
1665+
16591666
rollup-plugin-terser@^7.0.2:
16601667
version "7.0.2"
16611668
resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d"

0 commit comments

Comments
 (0)