Browse Source

Re-enables github split chunk

main
Eric Amodio 2 years ago
parent
commit
53e200253b
5 changed files with 15 additions and 13 deletions
  1. +4
    -4
      src/container.ts
  2. +2
    -4
      src/env/browser/providers.ts
  3. +5
    -2
      src/env/node/providers.ts
  4. +2
    -2
      src/extension.ts
  5. +2
    -1
      src/git/remotes/github.ts

+ 4
- 4
src/container.ts View File

@ -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));
}

+ 2
- 4
src/env/browser/providers.ts View File

@ -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<string | Buffer> {
return Promise.resolve('');
}
export function getSupportedGitProviders(container: Container): GitProvider[] {
GitHub.GitHubApi;
export async function getSupportedGitProviders(container: Container): Promise<GitProvider[]> {
return [new GitHubGitProvider(container)];
}

+ 5
- 2
src/env/node/providers.ts View File

@ -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
return ensureGit().git(_options, ..._args);
}
export function getSupportedGitProviders(container: Container): GitProvider[] {
export async function getSupportedGitProviders(container: Container): Promise<GitProvider[]> {
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));
}

+ 2
- 2
src/extension.ts View File

@ -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<GitLensApi | undefined> | undefined {
export async function activate(context: ExtensionContext): Promise<GitLensApi | undefined> {
const insiders = context.extension.id === 'eamodio.gitlens-insiders';
const gitlensVersion = context.extension.packageJSON.version;
@ -130,7 +130,7 @@ export function activate(context: ExtensionContext): Promise
});
// Signal that the container is now ready
container.ready();
await container.ready();
sw.stop({
message: ` activated${exitMessage != null ? `, ${exitMessage}` : ''}${

+ 2
- 1
src/git/remotes/github.ts View File

@ -238,7 +238,8 @@ export class GitHubRemote extends RichRemoteProvider {
const [owner, repo] = this.splitPath();
const { include, ...opts } = options ?? {};
const GitHubPullRequest = (await import('../../premium/github/github')).GitHubPullRequest;
const GitHubPullRequest = (await import(/* webpackChunkName: "github" */ '../../premium/github/github'))
.GitHubPullRequest;
return (await Container.instance.github)?.getPullRequestForBranch(this, accessToken, owner, repo, branch, {
...opts,
include: include?.map(s => GitHubPullRequest.toState(s)),

Loading…
Cancel
Save