Browse Source

Changes to const enums for better tree shaking

main
Eric Amodio 3 years ago
parent
commit
fc99c2754c
16 changed files with 47 additions and 47 deletions
  1. +1
    -1
      src/annotations/annotationProvider.ts
  2. +1
    -1
      src/annotations/fileAnnotationController.ts
  3. +2
    -2
      src/commands/common.ts
  4. +21
    -21
      src/config.ts
  5. +9
    -9
      src/constants.ts
  6. +1
    -1
      src/git/git.ts
  7. +1
    -1
      src/git/gitProvider.ts
  8. +1
    -1
      src/git/models/branch.ts
  9. +1
    -1
      src/git/models/commit.ts
  10. +3
    -3
      src/git/models/file.ts
  11. +1
    -1
      src/git/models/pullRequest.ts
  12. +1
    -1
      src/git/models/remote.ts
  13. +1
    -1
      src/git/remotes/provider.ts
  14. +1
    -1
      src/messages.ts
  15. +1
    -1
      src/quickpicks/referencePicker.ts
  16. +1
    -1
      src/views/nodes/viewNode.ts

+ 1
- 1
src/annotations/annotationProvider.ts View File

@ -15,7 +15,7 @@ import { ContextKeys, setContext } from '../constants';
import { Logger } from '../logger'; import { Logger } from '../logger';
import { GitDocumentState, TrackedDocument } from '../trackers/gitDocumentTracker'; import { GitDocumentState, TrackedDocument } from '../trackers/gitDocumentTracker';
export enum AnnotationStatus {
export const enum AnnotationStatus {
Computing = 'computing', Computing = 'computing',
Computed = 'computed', Computed = 'computed',
} }

+ 1
- 1
src/annotations/fileAnnotationController.ts View File

@ -45,7 +45,7 @@ import { GutterBlameAnnotationProvider } from './gutterBlameAnnotationProvider';
import { ChangesAnnotationContext, GutterChangesAnnotationProvider } from './gutterChangesAnnotationProvider'; import { ChangesAnnotationContext, GutterChangesAnnotationProvider } from './gutterChangesAnnotationProvider';
import { GutterHeatmapBlameAnnotationProvider } from './gutterHeatmapBlameAnnotationProvider'; import { GutterHeatmapBlameAnnotationProvider } from './gutterHeatmapBlameAnnotationProvider';
export enum AnnotationClearReason {
export const enum AnnotationClearReason {
User = 'User', User = 'User',
BlameabilityChanged = 'BlameabilityChanged', BlameabilityChanged = 'BlameabilityChanged',
ColumnChanged = 'ColumnChanged', ColumnChanged = 'ColumnChanged',

+ 2
- 2
src/commands/common.ts View File

@ -25,7 +25,7 @@ import { Logger } from '../logger';
import { CommandQuickPickItem, RepositoryPicker } from '../quickpicks'; import { CommandQuickPickItem, RepositoryPicker } from '../quickpicks';
import { ViewNode, ViewRefNode } from '../views/nodes'; import { ViewNode, ViewRefNode } from '../views/nodes';
export enum Commands {
export const enum Commands {
ActionPrefix = 'gitlens.action.', ActionPrefix = 'gitlens.action.',
AddAuthors = 'gitlens.addAuthors', AddAuthors = 'gitlens.addAuthors',
BrowseRepoAtRevision = 'gitlens.browseRepoAtRevision', BrowseRepoAtRevision = 'gitlens.browseRepoAtRevision',
@ -732,7 +732,7 @@ export async function openEditor(
} }
} }
export enum OpenWorkspaceLocation {
export const enum OpenWorkspaceLocation {
CurrentWindow = 'currentWindow', CurrentWindow = 'currentWindow',
NewWindow = 'newWindow', NewWindow = 'newWindow',
AddToWorkspace = 'addToWorkspace', AddToWorkspace = 'addToWorkspace',

+ 21
- 21
src/config.ts View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
export enum TraceLevel {
export const enum TraceLevel {
Silent = 'silent', Silent = 'silent',
Errors = 'errors', Errors = 'errors',
Verbose = 'verbose', Verbose = 'verbose',
@ -152,7 +152,7 @@ export interface Config {
advanced: AdvancedConfig; advanced: AdvancedConfig;
} }
export enum AnnotationsToggleMode {
export const enum AnnotationsToggleMode {
File = 'file', File = 'file',
Window = 'window', Window = 'window',
} }
@ -165,25 +165,25 @@ export interface AutolinkReference {
ignoreCase?: boolean; ignoreCase?: boolean;
} }
export enum BlameHighlightLocations {
export const enum BlameHighlightLocations {
Gutter = 'gutter', Gutter = 'gutter',
Line = 'line', Line = 'line',
Overview = 'overview', Overview = 'overview',
} }
export enum BranchSorting {
export const enum BranchSorting {
DateDesc = 'date:desc', DateDesc = 'date:desc',
DateAsc = 'date:asc', DateAsc = 'date:asc',
NameAsc = 'name:asc', NameAsc = 'name:asc',
NameDesc = 'name:desc', NameDesc = 'name:desc',
} }
export enum ChangesLocations {
export const enum ChangesLocations {
Gutter = 'gutter', Gutter = 'gutter',
Overview = 'overview', Overview = 'overview',
} }
export enum CodeLensCommand {
export const enum CodeLensCommand {
CopyRemoteCommitUrl = 'gitlens.copyRemoteCommitUrl', CopyRemoteCommitUrl = 'gitlens.copyRemoteCommitUrl',
CopyRemoteFileUrl = 'gitlens.copyRemoteFileUrl', CopyRemoteFileUrl = 'gitlens.copyRemoteFileUrl',
DiffWithPrevious = 'gitlens.diffWithPrevious', DiffWithPrevious = 'gitlens.diffWithPrevious',
@ -201,13 +201,13 @@ export enum CodeLensCommand {
ToggleFileHeatmap = 'gitlens.toggleFileHeatmap', ToggleFileHeatmap = 'gitlens.toggleFileHeatmap',
} }
export enum CodeLensScopes {
export const enum CodeLensScopes {
Document = 'document', Document = 'document',
Containers = 'containers', Containers = 'containers',
Blocks = 'blocks', Blocks = 'blocks',
} }
export enum ContributorSorting {
export const enum ContributorSorting {
CountDesc = 'count:desc', CountDesc = 'count:desc',
CountAsc = 'count:asc', CountAsc = 'count:asc',
DateDesc = 'date:desc', DateDesc = 'date:desc',
@ -216,7 +216,7 @@ export enum ContributorSorting {
NameDesc = 'name:desc', NameDesc = 'name:desc',
} }
export enum CustomRemoteType {
export const enum CustomRemoteType {
AzureDevOps = 'AzureDevOps', AzureDevOps = 'AzureDevOps',
Bitbucket = 'Bitbucket', Bitbucket = 'Bitbucket',
BitbucketServer = 'BitbucketServer', BitbucketServer = 'BitbucketServer',
@ -227,28 +227,28 @@ export enum CustomRemoteType {
GitLab = 'GitLab', GitLab = 'GitLab',
} }
export enum DateSource {
export const enum DateSource {
Authored = 'authored', Authored = 'authored',
Committed = 'committed', Committed = 'committed',
} }
export enum DateStyle {
export const enum DateStyle {
Absolute = 'absolute', Absolute = 'absolute',
Relative = 'relative', Relative = 'relative',
} }
export enum FileAnnotationType {
export const enum FileAnnotationType {
Blame = 'blame', Blame = 'blame',
Changes = 'changes', Changes = 'changes',
Heatmap = 'heatmap', Heatmap = 'heatmap',
} }
export enum GitCommandSorting {
export const enum GitCommandSorting {
Name = 'name', Name = 'name',
Usage = 'usage', Usage = 'usage',
} }
export enum GravatarDefaultStyle {
export const enum GravatarDefaultStyle {
Faces = 'wavatar', Faces = 'wavatar',
Geometric = 'identicon', Geometric = 'identicon',
Monster = 'monsterid', Monster = 'monsterid',
@ -257,18 +257,18 @@ export enum GravatarDefaultStyle {
Robot = 'robohash', Robot = 'robohash',
} }
export enum HeatmapLocations {
export const enum HeatmapLocations {
Gutter = 'gutter', Gutter = 'gutter',
Overview = 'overview', Overview = 'overview',
} }
export enum KeyMap {
export const enum KeyMap {
Alternate = 'alternate', Alternate = 'alternate',
Chorded = 'chorded', Chorded = 'chorded',
None = 'none', None = 'none',
} }
export enum StatusBarCommand {
export const enum StatusBarCommand {
CopyRemoteCommitUrl = 'gitlens.copyRemoteCommitUrl', CopyRemoteCommitUrl = 'gitlens.copyRemoteCommitUrl',
CopyRemoteFileUrl = 'gitlens.copyRemoteFileUrl', CopyRemoteFileUrl = 'gitlens.copyRemoteFileUrl',
DiffWithPrevious = 'gitlens.diffWithPrevious', DiffWithPrevious = 'gitlens.diffWithPrevious',
@ -288,25 +288,25 @@ export enum StatusBarCommand {
ToggleFileHeatmap = 'gitlens.toggleFileHeatmap', ToggleFileHeatmap = 'gitlens.toggleFileHeatmap',
} }
export enum TagSorting {
export const enum TagSorting {
DateDesc = 'date:desc', DateDesc = 'date:desc',
DateAsc = 'date:asc', DateAsc = 'date:asc',
NameAsc = 'name:asc', NameAsc = 'name:asc',
NameDesc = 'name:desc', NameDesc = 'name:desc',
} }
export enum ViewBranchesLayout {
export const enum ViewBranchesLayout {
List = 'list', List = 'list',
Tree = 'tree', Tree = 'tree',
} }
export enum ViewFilesLayout {
export const enum ViewFilesLayout {
Auto = 'auto', Auto = 'auto',
List = 'list', List = 'list',
Tree = 'tree', Tree = 'tree',
} }
export enum ViewShowBranchComparison {
export const enum ViewShowBranchComparison {
Branch = 'branch', Branch = 'branch',
Working = 'working', Working = 'working',
} }

+ 9
- 9
src/constants.ts View File

@ -5,7 +5,7 @@ import { SearchPattern } from './git/git';
export const quickPickTitleMaxChars = 80; export const quickPickTitleMaxChars = 80;
export enum BuiltInCommands {
export const enum BuiltInCommands {
CloseActiveEditor = 'workbench.action.closeActiveEditor', CloseActiveEditor = 'workbench.action.closeActiveEditor',
CloseAllEditors = 'workbench.action.closeAllEditors', CloseAllEditors = 'workbench.action.closeAllEditors',
CursorMove = 'cursorMove', CursorMove = 'cursorMove',
@ -27,7 +27,7 @@ export enum BuiltInCommands {
ShowReferences = 'editor.action.showReferences', ShowReferences = 'editor.action.showReferences',
} }
export enum BuiltInGitCommands {
export const enum BuiltInGitCommands {
Publish = 'git.publish', Publish = 'git.publish',
Pull = 'git.pull', Pull = 'git.pull',
PullRebase = 'git.pullRebase', PullRebase = 'git.pullRebase',
@ -36,13 +36,13 @@ export enum BuiltInGitCommands {
UndoCommit = 'git.undoCommit', UndoCommit = 'git.undoCommit',
} }
export enum BuiltInGitConfiguration {
export const enum BuiltInGitConfiguration {
AutoRepositoryDetection = 'git.autoRepositoryDetection', AutoRepositoryDetection = 'git.autoRepositoryDetection',
FetchOnPull = 'git.fetchOnPull', FetchOnPull = 'git.fetchOnPull',
UseForcePushWithLease = 'git.useForcePushWithLease', UseForcePushWithLease = 'git.useForcePushWithLease',
} }
export enum ContextKeys {
export const enum ContextKeys {
ActionPrefix = 'gitlens:action:', ActionPrefix = 'gitlens:action:',
ActiveFileStatus = 'gitlens:activeFileStatus', ActiveFileStatus = 'gitlens:activeFileStatus',
AnnotationStatus = 'gitlens:annotationStatus', AnnotationStatus = 'gitlens:annotationStatus',
@ -71,7 +71,7 @@ export function setContext(key: ContextKeys | string, value: any) {
return commands.executeCommand(BuiltInCommands.SetContext, key, value); return commands.executeCommand(BuiltInCommands.SetContext, key, value);
} }
export enum Colors {
export const enum Colors {
GutterBackgroundColor = 'gitlens.gutterBackgroundColor', GutterBackgroundColor = 'gitlens.gutterBackgroundColor',
GutterForegroundColor = 'gitlens.gutterForegroundColor', GutterForegroundColor = 'gitlens.gutterForegroundColor',
GutterUncommittedForegroundColor = 'gitlens.gutterUncommittedForegroundColor', GutterUncommittedForegroundColor = 'gitlens.gutterUncommittedForegroundColor',
@ -87,7 +87,7 @@ export enum Colors {
UnpulledChangesIconColor = 'gitlens.unpulledChangesIconColor', UnpulledChangesIconColor = 'gitlens.unpulledChangesIconColor',
} }
export enum DocumentSchemes {
export const enum DocumentSchemes {
DebugConsole = 'debug', DebugConsole = 'debug',
File = 'file', File = 'file',
Git = 'git', Git = 'git',
@ -172,14 +172,14 @@ export const enum GlyphChars {
ZeroWidthSpace = '\u200b', ZeroWidthSpace = '\u200b',
} }
export enum SyncedState {
export const enum SyncedState {
Version = 'gitlens:synced:version', Version = 'gitlens:synced:version',
WelcomeViewVisible = 'gitlens:views:welcome:visible', WelcomeViewVisible = 'gitlens:views:welcome:visible',
Deprecated_DisallowConnectionPrefix = 'gitlens:disallow:connection:', Deprecated_DisallowConnectionPrefix = 'gitlens:disallow:connection:',
} }
export enum GlobalState {
export const enum GlobalState {
Avatars = 'gitlens:avatars', Avatars = 'gitlens:avatars',
PendingWelcomeOnFocus = 'gitlens:pendingWelcomeOnFocus', PendingWelcomeOnFocus = 'gitlens:pendingWelcomeOnFocus',
PendingWhatsNewOnFocus = 'gitlens:pendingWhatsNewOnFocus', PendingWhatsNewOnFocus = 'gitlens:pendingWhatsNewOnFocus',
@ -254,7 +254,7 @@ export interface Usage {
[id: string]: number; [id: string]: number;
} }
export enum WorkspaceState {
export const enum WorkspaceState {
AssumeRepositoriesOnStartup = 'gitlens:assumeRepositoriesOnStartup', AssumeRepositoriesOnStartup = 'gitlens:assumeRepositoriesOnStartup',
BranchComparisons = 'gitlens:branch:comparisons', BranchComparisons = 'gitlens:branch:comparisons',

+ 1
- 1
src/git/git.ts View File

@ -56,7 +56,7 @@ const GitWarnings = {
notAGitCommand: /'.+' is not a git command/i, notAGitCommand: /'.+' is not a git command/i,
}; };
export enum GitErrorHandling {
export const enum GitErrorHandling {
Ignore = 'ignore', Ignore = 'ignore',
Throw = 'throw', Throw = 'throw',
} }

+ 1
- 1
src/git/gitProvider.ts View File

@ -35,7 +35,7 @@ import { GitUri } from './gitUri';
import { RemoteProviders } from './remotes/factory'; import { RemoteProviders } from './remotes/factory';
import { SearchPattern } from './search'; import { SearchPattern } from './search';
export enum GitProviderId {
export const enum GitProviderId {
Git = 'git', Git = 'git',
GitHub = 'github', GitHub = 'github',
} }

+ 1
- 1
src/git/models/branch.ts View File

@ -25,7 +25,7 @@ export interface GitTrackingState {
behind: number; behind: number;
} }
export enum GitBranchStatus {
export const enum GitBranchStatus {
Ahead = 'ahead', Ahead = 'ahead',
Behind = 'behind', Behind = 'behind',
Diverged = 'diverged', Diverged = 'diverged',

+ 1
- 1
src/git/models/commit.ts View File

@ -21,7 +21,7 @@ export interface GitCommitLine {
code?: string; code?: string;
} }
export enum GitCommitType {
export const enum GitCommitType {
Blame = 'blame', Blame = 'blame',
Log = 'log', Log = 'log',
LogFile = 'logFile', LogFile = 'logFile',

+ 3
- 3
src/git/models/file.ts View File

@ -6,7 +6,7 @@ import { GitLogCommit } from './logCommit';
export declare type GitFileStatus = GitFileConflictStatus | GitFileIndexStatus | GitFileWorkingTreeStatus; export declare type GitFileStatus = GitFileConflictStatus | GitFileIndexStatus | GitFileWorkingTreeStatus;
export enum GitFileConflictStatus {
export const enum GitFileConflictStatus {
AddedByBoth = 'AA', AddedByBoth = 'AA',
AddedByUs = 'AU', AddedByUs = 'AU',
AddedByThem = 'UA', AddedByThem = 'UA',
@ -16,7 +16,7 @@ export enum GitFileConflictStatus {
ModifiedByBoth = 'UU', ModifiedByBoth = 'UU',
} }
export enum GitFileIndexStatus {
export const enum GitFileIndexStatus {
Added = 'A', Added = 'A',
Deleted = 'D', Deleted = 'D',
Modified = 'M', Modified = 'M',
@ -24,7 +24,7 @@ export enum GitFileIndexStatus {
Copied = 'C', Copied = 'C',
} }
export enum GitFileWorkingTreeStatus {
export const enum GitFileWorkingTreeStatus {
Added = 'A', Added = 'A',
Deleted = 'D', Deleted = 'D',
Modified = 'M', Modified = 'M',

+ 1
- 1
src/git/models/pullRequest.ts View File

@ -13,7 +13,7 @@ export const PullRequestDateFormatting = {
}, },
}; };
export enum PullRequestState {
export const enum PullRequestState {
Open = 'Open', Open = 'Open',
Closed = 'Closed', Closed = 'Closed',
Merged = 'Merged', Merged = 'Merged',

+ 1
- 1
src/git/models/remote.ts View File

@ -3,7 +3,7 @@ import { WorkspaceState } from '../../constants';
import { Container } from '../../container'; import { Container } from '../../container';
import { RemoteProvider, RichRemoteProvider } from '../remotes/factory'; import { RemoteProvider, RichRemoteProvider } from '../remotes/factory';
export enum GitRemoteType {
export const enum GitRemoteType {
Fetch = 'fetch', Fetch = 'fetch',
Push = 'push', Push = 'push',
} }

+ 1
- 1
src/git/remotes/provider.ts View File

@ -26,7 +26,7 @@ import {
Repository, Repository,
} from '../models/models'; } from '../models/models';
export enum RemoteResourceType {
export const enum RemoteResourceType {
Branch = 'branch', Branch = 'branch',
Branches = 'branches', Branches = 'branches',
Commit = 'commit', Commit = 'commit',

+ 1
- 1
src/messages.ts View File

@ -4,7 +4,7 @@ import { configuration } from './configuration';
import { GitCommit } from './git/git'; import { GitCommit } from './git/git';
import { Logger } from './logger'; import { Logger } from './logger';
export enum SuppressedMessages {
export const enum SuppressedMessages {
CommitHasNoPreviousCommitWarning = 'suppressCommitHasNoPreviousCommitWarning', CommitHasNoPreviousCommitWarning = 'suppressCommitHasNoPreviousCommitWarning',
CommitNotFoundWarning = 'suppressCommitNotFoundWarning', CommitNotFoundWarning = 'suppressCommitNotFoundWarning',
CreatePullRequestPrompt = 'suppressCreatePullRequestPrompt', CreatePullRequestPrompt = 'suppressCreatePullRequestPrompt',

+ 1
- 1
src/quickpicks/referencePicker.ts View File

@ -10,7 +10,7 @@ import { BranchQuickPickItem, getQuickPickIgnoreFocusOut, RefQuickPickItem, TagQ
export type ReferencesQuickPickItem = BranchQuickPickItem | TagQuickPickItem | RefQuickPickItem; export type ReferencesQuickPickItem = BranchQuickPickItem | TagQuickPickItem | RefQuickPickItem;
export enum ReferencesQuickPickIncludes {
export const enum ReferencesQuickPickIncludes {
Branches = 1, Branches = 1,
Tags = 2, Tags = 2,
WorkingTree = 4, WorkingTree = 4,

+ 1
- 1
src/views/nodes/viewNode.ts View File

@ -25,7 +25,7 @@ import { Logger } from '../../logger';
import { debug, Functions, gate, log, logName, Strings } from '../../system'; import { debug, Functions, gate, log, logName, Strings } from '../../system';
import { TreeViewNodeCollapsibleStateChangeEvent, View } from '../viewBase'; import { TreeViewNodeCollapsibleStateChangeEvent, View } from '../viewBase';
export enum ContextValues {
export const enum ContextValues {
ActiveFileHistory = 'gitlens:history:active:file', ActiveFileHistory = 'gitlens:history:active:file',
ActiveLineHistory = 'gitlens:history:active:line', ActiveLineHistory = 'gitlens:history:active:line',
Branch = 'gitlens:branch', Branch = 'gitlens:branch',

Loading…
Cancel
Save