Esbuild a few more built-in extensions

Switches from webpack to esbuild for `merge-conflict`, `references-view`,  `search-result`, and `simple-browser`
This commit is contained in:
Matt Bierner
2026-02-13 15:00:06 -08:00
parent 552db6b5ba
commit 75a0ad4f75
26 changed files with 183 additions and 127 deletions

View File

@@ -1,7 +1,6 @@
src/**
out/**
tsconfig.json
extension.webpack.config.js
extension-browser.webpack.config.js
tsconfig*.json
esbuild*.mts
package-lock.json
syntaxes/generateTMLanguage.js

View File

@@ -0,0 +1,21 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as path from 'node:path';
import { run } from '../esbuild-extension-common.mts';
const srcDir = path.join(import.meta.dirname, 'src');
const outDir = path.join(import.meta.dirname, 'dist', 'browser');
run({
platform: 'browser',
entryPoints: {
'extension': path.join(srcDir, 'extension.ts'),
},
srcDir,
outdir: outDir,
additionalOptions: {
tsconfig: path.join(import.meta.dirname, 'tsconfig.browser.json'),
},
}, process.argv);

View File

@@ -2,17 +2,17 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs';
import path from 'path';
import * as path from 'node:path';
import { run } from '../esbuild-extension-common.mts';
export default withBrowserDefaults({
context: import.meta.dirname,
entry: {
extension: './src/extension.ts'
const srcDir = path.join(import.meta.dirname, 'src');
const outDir = path.join(import.meta.dirname, 'dist');
run({
platform: 'node',
entryPoints: {
'extension': path.join(srcDir, 'extension.ts'),
},
output: {
filename: 'extension.js',
path: path.join(import.meta.dirname, 'dist')
}
});
srcDir,
outdir: outDir,
}, process.argv);

View File

@@ -1,16 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// @ts-check
import withDefaults from '../shared.webpack.config.mjs';
export default withDefaults({
context: import.meta.dirname,
resolve: {
mainFields: ['module', 'main']
},
entry: {
extension: './src/extension.ts',
}
});

View File

@@ -10,13 +10,19 @@
"vscode": "^1.39.0"
},
"main": "./out/extension.js",
"browser": "./dist/extension.js",
"browser": "./dist/browser/extension",
"activationEvents": [
"onLanguage:search-result"
],
"scripts": {
"generate-grammar": "node ./syntaxes/generateTMLanguage.js",
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.mjs compile-extension:search-result ./tsconfig.json"
"vscode:prepublish": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.mjs compile-extension:search-result ./tsconfig.json",
"compile-web": "npm-run-all2 -lp bundle-web typecheck-web",
"bundle-web": "node ./esbuild.browser.mts",
"typecheck-web": "tsgo --project ./tsconfig.json --noEmit",
"watch-web": "npm-run-all2 -lp watch-bundle-web watch-typecheck-web",
"watch-bundle-web": "node ./esbuild.browser.mts --watch",
"watch-typecheck-web": "tsgo --project ./tsconfig.json --noEmit --watch"
},
"capabilities": {
"virtualWorkspaces": true,

View File

@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}