/** * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * @format */ /// /// import { VersionedReactFileRepository } from './FileRepository'; /** * Retrieves React Native files using the React Native Github repo. Switching * between getting file contents of different versions may be slow. */ export default class GitReactFileRepository implements VersionedReactFileRepository { private readonly fileRepo; private readonly gitClient; private checkedOutVersion?; private static githubToken?; private readonly batchingQueue; private constructor(); /** * Asynchronously initialize the scratch repository, creating a new Git repo is needed * @param gitDirectory optional repo directory */ static createAndInit(gitDirectory?: string): Promise; /** * Set a GitHub API token for all instances of GitReactFileRepository to use * when making requests. * @param token a GitHub PAT */ static setGithubToken(token: string): void; listFiles(globs: string[] | undefined, reactNativeVersion: string): Promise; readFile(filename: string, reactNativeVersion: string): Promise; stat(filename: string, reactNativeVersion: string): Promise<'file' | 'directory' | 'none'>; /** * Generate a Git-style patch to transform the given file into the given * content. */ generatePatch(filename: string, reactNativeVersion: string, newContent: Buffer): Promise; /** * Apply a patch to the given file, returning the merged result, which may * include conflict markers. The underlying file is not mutated. * * Git is unable to generate a representation with conflict markers in the * event of binary merge conflicts. In this case a null Buffer is returned. */ getPatchedFile(filename: string, reactNativeVersion: string, patchContent: string): Promise<{ patchedFile: Buffer | null; hasConflicts: boolean; }>; private usingVersion; private checkoutVersion; private tryCheckoutLocal; private fetchAndCheckout; private static defaultGitDirectory; private ensureFile; }