Skip to content

Commit

Permalink
chore: upgrade esbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Oct 30, 2023
1 parent 92cf193 commit 85a236c
Show file tree
Hide file tree
Showing 10 changed files with 945 additions and 731 deletions.
3 changes: 0 additions & 3 deletions .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion extensions/vscode-typescript-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"release:next": "vsce publish --pre-release"
},
"devDependencies": {
"esbuild": "0.15.18",
"esbuild": "latest",
"typescript-vue-plugin": "1.8.22",
"vsce": "latest"
}
Expand Down
17 changes: 14 additions & 3 deletions extensions/vscode-typescript-plugin/scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
require('esbuild').build({
// @ts-check

require('esbuild').context({
entryPoints: ['./node_modules/typescript-vue-plugin/out/index.js'],
bundle: true,
outfile: './node_modules/typescript-vue-plugin-bundle/index.js',
Expand All @@ -10,7 +12,6 @@ require('esbuild').build({
platform: 'node',
tsconfig: './tsconfig.json',
minify: process.argv.includes('--minify'),
watch: process.argv.includes('--watch'),
plugins: [{
name: 'umd2esm',
setup(build) {
Expand All @@ -21,4 +22,14 @@ require('esbuild').build({
})
},
}],
}).catch(() => process.exit(1))
}).then(async ctx => {
console.log('building...');
if (process.argv.includes('--watch')) {
await ctx.watch();
console.log('watching...');
} else {
await ctx.rebuild();
await ctx.dispose();
console.log('finished.');
}
})
2 changes: 1 addition & 1 deletion extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@
"@volar/vscode": "~1.10.5",
"@vue/language-core": "1.8.22",
"@vue/language-server": "1.8.22",
"esbuild": "0.15.18",
"esbuild": "latest",
"esbuild-plugin-copy": "latest",
"esbuild-visualizer": "latest",
"semver": "^7.5.4",
Expand Down
18 changes: 15 additions & 3 deletions extensions/vscode/scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// @ts-check

const path = require('path');
const fs = require('fs');

require('esbuild').build({
require('esbuild').context({
entryPoints: {
client: './out/nodeClientMain.js',
server: './node_modules/@vue/language-server/out/nodeServer.js',
Expand All @@ -18,7 +20,6 @@ require('esbuild').build({
tsconfig: './tsconfig.json',
define: { 'process.env.NODE_ENV': '"production"' },
minify: process.argv.includes('--minify'),
watch: process.argv.includes('--watch'),
plugins: [
{
name: 'umd2esm',
Expand All @@ -37,6 +38,7 @@ require('esbuild').build({
from: ['./node_modules/@vue/language-core/schemas/**/*'],
to: ['./dist/schemas'],
},
// @ts-expect-error
keepStructure: true,
}),
{
Expand All @@ -53,4 +55,14 @@ require('esbuild').build({
},
},
],
}).catch(() => process.exit(1))
}).then(async ctx => {
console.log('building...');
if (process.argv.includes('--watch')) {
await ctx.watch();
console.log('watching...');
} else {
await ctx.rebuild();
await ctx.dispose();
console.log('finished.');
}
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"devDependencies": {
"@types/node": "latest",
"@volar/language-service": "~1.10.5",
"typescript": "next",
"typescript": "latest",
"vite": "latest",
"vitest": "latest"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/component-meta/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export function baseCreate(
ts,
) : [];
const core = vue.createLanguageContext(host, vueLanguages);
const tsLsHost = createLanguageServiceHost(core, ts, ts.sys, undefined);
const tsLsHost = createLanguageServiceHost(core, ts, ts.sys);
const tsLs = ts.createLanguageService(tsLsHost);

decorateLanguageService(core.virtualFiles, tsLs, false);
Expand Down
2 changes: 1 addition & 1 deletion packages/tsc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export function createProgram(options: ts.CreateProgramOptions) {
ts,
),
);
const languageServiceHost = volarTs.createLanguageServiceHost(languageContext, ts, ts.sys, undefined);
const languageServiceHost = volarTs.createLanguageServiceHost(languageContext, ts, ts.sys);
const vueTsLs = ts.createLanguageService(languageServiceHost, volarTs.getDocumentRegistry(ts, ts.sys.useCaseSensitiveFileNames, languageHost.workspacePath));

volarTs.decorateLanguageService(languageContext.virtualFiles, vueTsLs, false);
Expand Down
1 change: 1 addition & 0 deletions packages/typescript-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const init: ts.server.PluginModuleFactory = (modules) => {
},
getExternalFiles(project, updateLevel = 0) {
if (
// @ts-expect-error wait for TS 5.3
updateLevel >= (1 satisfies ts.ProgramUpdateLevel.RootNamesAndUpdate)
|| !externalFiles.has(project)
) {
Expand Down
Loading

0 comments on commit 85a236c

Please sign in to comment.