Skip to content

Port git extension to use esbuild#298108

Open
mjbvz wants to merge 1 commit intomainfrom
dev/mjbvz/other-meadowlark
Open

Port git extension to use esbuild#298108
mjbvz wants to merge 1 commit intomainfrom
dev/mjbvz/other-meadowlark

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Feb 26, 2026

Fixes #296355

Required more changes as esbuild won't inline const enums from d.ts files

Copilot AI review requested due to automatic review settings February 26, 2026 22:11
@mjbvz mjbvz added this to the March 2026 milestone Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the git extension from webpack to esbuild. The main challenge was handling const enums defined in the git.d.ts API file, which esbuild cannot inline from declaration files. The solution creates a runtime constants file that provides Object.freeze equivalents of the const enums while maintaining type safety through TypeScript's satisfies operator.

Changes:

  • Created git.constants.ts to provide runtime equivalents of const enums (RefType, Status, ForcePushMode, GitErrorCodes) from git.d.ts
  • Updated all imports throughout the extension to use import type for types and import runtime values from git.constants
  • Replaced webpack configuration with esbuild configuration
  • Added ESLint rule to enforce the import pattern and prevent future violations

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
extensions/git/src/api/git.constants.ts New file providing runtime const enum equivalents using Object.freeze with satisfies for type safety
extensions/git/src/uri.ts Updated imports: type-only import for Change, runtime import for Status
extensions/git/src/timelineProvider.ts Updated to use type-only imports for AvatarQuery and AvatarQueryCommit
extensions/git/src/test/smoke.test.ts Updated imports to separate types from runtime values
extensions/git/src/statusbar.ts Updated imports: type-only for Branch and RemoteSourcePublisher, runtime for RefType
extensions/git/src/repositoryCache.ts Updated to use type-only imports
extensions/git/src/repository.ts Updated imports to separate types from runtime const enum values
extensions/git/src/remotePublisher.ts Updated to use type-only import
extensions/git/src/quickDiffProvider.ts Updated to import Status from git.constants for runtime usage
extensions/git/src/pushError.ts Updated to use type-only import
extensions/git/src/postCommitCommands.ts Updated to use type-only import
extensions/git/src/model.ts Updated to use type-only imports
extensions/git/src/main.ts Updated to use type-only import for GitExtension
extensions/git/src/historyProvider.ts Updated imports to separate types from runtime RefType
extensions/git/src/historyItemDetailsProvider.ts Updated to use type-only imports
extensions/git/src/git.ts Updated imports and added explicit type annotations for status variables to work with runtime const enums
extensions/git/src/editSessionIdentityProvider.ts Updated to import RefType from git.constants
extensions/git/src/decorationProvider.ts Updated imports: type-only for Change, runtime for GitErrorCodes and Status
extensions/git/src/commands.ts Updated imports, added default case to refId switch statement throwing error for unknown ref types
extensions/git/src/branchProtection.ts Updated to use type-only imports
extensions/git/src/blame.ts Updated to use type-only imports
extensions/git/src/autofetch.ts Updated to import GitErrorCodes from git.constants
extensions/git/src/askpass.ts Updated to use type-only imports
extensions/git/src/artifactProvider.ts Updated imports: type-only for Ref and Worktree, runtime for RefType
extensions/git/src/api/extension.ts Updated to use type-only imports
extensions/git/src/api/api1.ts Updated imports to separate types from runtime const enum values
extensions/git/src/actionButton.ts Updated imports: type-only for Branch, runtime for RefType and Status
extensions/git/extension.webpack.config.js Removed webpack configuration file
extensions/git/esbuild.mts New esbuild configuration with three entry points (main, askpass-main, git-editor-main)
extensions/git/.vscodeignore Updated to ignore esbuild config instead of webpack config
eslint.config.js Added rule to enforce import type pattern for git.d.ts and prevent non-type imports

@mjbvz mjbvz requested a review from lszomoru February 27, 2026 07:32
@mjbvz mjbvz marked this pull request as ready for review February 27, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update the git extension to support esbuild

2 participants