From 53e200253b1b412557ce627e7d6046077e8a7e09 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 6 Feb 2022 23:57:30 -0500 Subject: [PATCH] Re-enables github split chunk --- src/container.ts | 8 ++++---- src/env/browser/providers.ts | 6 ++---- src/env/node/providers.ts | 7 +++++-- src/extension.ts | 4 ++-- src/git/remotes/github.ts | 3 ++- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/container.ts b/src/container.ts index bd6e02c..cafd53c 100644 --- a/src/container.ts +++ b/src/container.ts @@ -192,17 +192,17 @@ export class Container { private _ready: boolean = false; - ready() { + async ready() { if (this._ready) throw new Error('Container is already ready'); this._ready = true; - this.registerGitProviders(); + await this.registerGitProviders(); queueMicrotask(() => this._onReady.fire()); } @log() - private registerGitProviders() { - const providers = getSupportedGitProviders(this); + private async registerGitProviders() { + const providers = await getSupportedGitProviders(this); for (const provider of providers) { this._context.subscriptions.push(this._git.register(provider.descriptor.id, provider)); } diff --git a/src/env/browser/providers.ts b/src/env/browser/providers.ts index c1760e5..8e0ae36 100644 --- a/src/env/browser/providers.ts +++ b/src/env/browser/providers.ts @@ -1,15 +1,13 @@ import { Container } from '../../container'; import { GitCommandOptions } from '../../git/commandOptions'; +// Force import of GitHub since dynamic imports are not supported in the WebWorker ExtensionHost import { GitHubGitProvider } from '../../premium/github/githubGitProvider'; import { GitProvider } from '../../git/gitProvider'; -// Force import of GitHub since dynamic imports are not supported in the WebWorker ExtensionHost -import * as GitHub from '../../premium/github/github'; export function git(_options: GitCommandOptions, ..._args: any[]): Promise { return Promise.resolve(''); } -export function getSupportedGitProviders(container: Container): GitProvider[] { - GitHub.GitHubApi; +export async function getSupportedGitProviders(container: Container): Promise { return [new GitHubGitProvider(container)]; } diff --git a/src/env/node/providers.ts b/src/env/node/providers.ts index 2f0fd5f..ad70ae2 100644 --- a/src/env/node/providers.ts +++ b/src/env/node/providers.ts @@ -1,7 +1,7 @@ import { Container } from '../../container'; import { GitCommandOptions } from '../../git/commandOptions'; import { GitProvider } from '../../git/gitProvider'; -import { GitHubGitProvider } from '../../premium/github/githubGitProvider'; +// import { GitHubGitProvider } from '../../premium/github/githubGitProvider'; import { Git } from './git/git'; import { LocalGitProvider } from './git/localGitProvider'; import { VslsGit, VslsGitProvider } from './git/vslsGitProvider'; @@ -18,7 +18,7 @@ export function git(_options: GitCommandOptions, ..._args: any[]): Promise { const git = ensureGit(); const providers: GitProvider[] = [ @@ -27,6 +27,9 @@ export function getSupportedGitProviders(container: Container): GitProvider[] { ]; if (container.config.experimental.virtualRepositories.enabled) { + const GitHubGitProvider = ( + await import(/* webpackChunkName: "github" */ '../../premium/github/githubGitProvider') + ).GitHubGitProvider; providers.push(new GitHubGitProvider(container)); } diff --git a/src/extension.ts b/src/extension.ts index ea100de..85aec6b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,7 +19,7 @@ import { Stopwatch } from './system/stopwatch'; import { compare } from './system/version'; import { ViewNode } from './views/nodes'; -export function activate(context: ExtensionContext): Promise | undefined { +export async function activate(context: ExtensionContext): Promise { const insiders = context.extension.id === 'eamodio.gitlens-insiders'; const gitlensVersion = context.extension.packageJSON.version; @@ -130,7 +130,7 @@ export function activate(context: ExtensionContext): Promise GitHubPullRequest.toState(s)),