Repository: isomorphic-git/isomorphic-git
Pull request #1030 (2020-02-07 21:42:31)

chore: make 'http' param required
- [x] Make `http` an external required dependency just like `fs` [#938](https://github.com/isomorphic-git/isomorphic-git/issues/938)

This brings us another step closer to a purely isomorphic solution. Ultimately, I want `dist/index.js` to work in node if node runs with module support, and `dist/index.cjs` to work in the browser if Webpack is told to import that one. Module format !== Runtime Environment. (CJS !== Node and ESM !== Browser). I want to lead the way in helping correct that long-standing assumption.

isomorphic-git-bot[bot]: Thank you wmhilton! I auto-formatted the code using [prettier-standard](https://github.com/sheerun/prettier-standard). :robot:
karma-pr-reporter: ## Test Results for 1339b5615ecab1f96b6f478d6addd676adbe1ae6:
| Browser                                 | Pass | Skip | Fail | Time   | Disconnect? |
| --------------------------------------- | ---- | ---- | ---- | ------ | ----------- |
| Chrome 79.0.3945 (Windows 10 0.0.0)     | 360  | 1    | 0    | 2m:25s | false       |
| Chrome Mobile 78.0.3904 (Android 0.0.0) | 360  | 1    | 0    | 1m:53s | false       |
| Firefox 72.0.0 (Ubuntu 0.0.0)           | 360  | 1    | 0    | 1m:31s | false       |
| HeadlessChrome 0.0.0 (Linux 0.0.0)      | 360  | 1    | 0    | 0m:53s | false       |
| Mobile Safari 13.0.0 (iOS 13.0.0)       | 360  | 1    | 0    | 2m:49s | false       |
| Safari 13.0.3 (Mac OS X 10.15.1)        | 360  | 1    | 0    | 3m:14s | false       |

### Longest running tests
- 12.22 secs - fetch shallow fetch relative (from Github) - _Firefox_
- 11.422 secs - fetch shallow fetch (from Github) - _Firefox_
- 9.835 secs - GitPackIndex from .pack - _Firefox_
- 9.389 secs - fetch fetch (from Github) - _Firefox_
- 9.069 secs - GitPackIndex to .idx file from .pack - _Firefox_
- 8.459 secs - fetch fetch --prune-tags from git-http-mock-server - _Safari_
- 7.437 secs - fetch fetch (from Github) - _Mobile Safari_
- 7.228 secs - fetch shallow fetch (from Github) - _HeadlessChrome_
- 7.154 secs - fetch shallow fetch (from Github) - _Chrome_
- 6.726 secs - fetch fetch (from Github) - _Chrome Mobile_
- 6.694 secs - fetch fetch (from Github) - _HeadlessChrome_

karma-pr-reporter: ## Test Results for ed742f686cc8d5348807f62ab9e48e5590f8e52c:
| Browser                                 | Pass | Skip | Fail | Time   | Disconnect? |
| --------------------------------------- | ---- | ---- | ---- | ------ | ----------- |
| Chrome 79.0.3945 (Windows 10 0.0.0)     | 360  | 1    | 0    | 2m:27s | false       |
| Chrome Mobile 78.0.3904 (Android 0.0.0) | 360  | 1    | 0    | 1m:50s | false       |
| Firefox 72.0.0 (Ubuntu 0.0.0)           | 360  | 1    | 0    | 1m:24s | false       |
| HeadlessChrome 0.0.0 (Linux 0.0.0)      | 360  | 1    | 0    | 0m:49s | false       |
| Mobile Safari 13.0.0 (iOS 13.0.0)       | 360  | 1    | 0    | 2m:36s | false       |
| Safari 13.0.3 (Mac OS X 10.15.1)        | 360  | 1    | 0    | 3m:15s | false       |

### Longest running tests
- 11.849 secs - fetch shallow fetch (from Github) - _Firefox_
- 10.154 secs - fetch fetch (from Github) - _Firefox_
- 9.397 secs - fetch shallow fetch relative (from Github) - _Firefox_
- 9.126 secs - GitPackIndex from .pack - _Firefox_
- 8.668 secs - GitPackIndex to .idx file from .pack - _Firefox_
- 8.346 secs - fetch fetch (from Github) - _Chrome Mobile_
- 7.664 secs - fetch fetch (from Github) - _HeadlessChrome_
- 7.48 secs - walk can populate type, mode, oid, and content - _Safari_
- 7.244 secs - fetch fetch --prune from git-http-mock-server - _Safari_
- 7.235 secs - fetch shallow fetch (from Github) - _HeadlessChrome_
- 7.183 secs - fetch shallow fetch (from Github) - _Chrome_

karma-pr-reporter: ## Test Results for 43b5bc6eb65b0b15ed13354a0402f985839b611e:
| Browser                                 | Pass | Skip | Fail | Time   | Disconnect? |
| --------------------------------------- | ---- | ---- | ---- | ------ | ----------- |
| Chrome 79.0.3945 (Windows 10 0.0.0)     | 360  | 1    | 0    | 3m:18s | false       |
| Chrome Mobile 78.0.3904 (Android 0.0.0) | 360  | 1    | 0    | 1m:49s | false       |
| Firefox 72.0.0 (Ubuntu 0.0.0)           | 360  | 1    | 0    | 1m:23s | false       |
| HeadlessChrome 0.0.0 (Linux 0.0.0)      | 360  | 1    | 0    | 0m:50s | false       |
| Mobile Safari 13.0.0 (iOS 13.0.0)       | 360  | 1    | 0    | 2m:39s | false       |
| Safari 13.0.3 (Mac OS X 10.15.1)        | 360  | 1    | 0    | 3m:22s | false       |

### Longest running tests
- 14.251 secs - fetch shallow fetch (from Github) - _Firefox_
- 10.735 secs - fetch fetch (from Github) - _Firefox_
- 10.183 secs - fetch shallow fetch relative (from Github) - _Firefox_
- 8.793 secs - fetch fetch --prune-tags from git-http-mock-server - _Safari_
- 8.544 secs - fetch fetch --prune-tags from git-http-mock-server - _Chrome_
- 7.692 secs - fetch shallow fetch relative (from Github) - _Chrome_
- 7.621 secs - fetch shallow fetch since (from Github) - _Firefox_
- 7.49 secs - fetch shallow fetch relative (from Github) - _HeadlessChrome_
- 7.312 secs - walk can populate type, mode, oid, and content - _Chrome_
- 6.858 secs - fetch shallow fetch (from Github) - _Chrome_
- 6.582 secs - fetch shallow fetch exclude (from Github) - _Firefox_


Patch:
diff --git a/README.md b/README.md
index c920621d..b0b4e2d0 100644
--- a/README.md
+++ b/README.md
@@ -64,7 +64,7 @@ At the time of writing, the following breaking changes are planned:
 - [ ] To go along with that, I'm experimenting with a way to make the API more aesthetic, eliminating the `emitter` plugin/argument and letting you chain event listeners onto running commands directly. NOTE: need to make sure there's no race condition between adding the event listeners and starting running the command.
   - [ ] This also provides an aesthetic way to cancel / stop running commands.
 - [x] break `config` into `getConfig` and `setConfig` or something.
-- [ ] Make `http` an external required dependency just like `fs` [#938](https://github.com/isomorphic-git/isomorphic-git/issues/938)
+- [x] Make `http` an external required dependency just like `fs` [#938](https://github.com/isomorphic-git/isomorphic-git/issues/938)
 - [ ] I should probably normalize on timestamps and get rid of the `date` options.
 - [x] Remove the `noOverwrite` option from `init` and make that the new behavior.
 - [ ] Oh, and I should move all the error strings into a separate JSON file that can be fetched lazily in production.
diff --git a/docs/http.md b/docs/http.md
index 36575fba..4337bf17 100644
--- a/docs/http.md
+++ b/docs/http.md
@@ -3,27 +3,38 @@ title: http
 sidebar_label: http
 ---
 
-You need to pass an HTTP client into `isomorphic-git` for functions that make HTTP requests.
-The `isomorphic-git` package already includes both a node client and a browser client, but you have to tell it which one to use.
+You need to pass an HTTP client into `isomorphic-git` functions that make HTTP requests.
+Both a node client (`.cjs`) and a browser client (`.js`) are included in the npm package, but you have to pick which one to use.
 Or you can provide your own!
 
-Node usage:
+(In the past, we tried to be clever and automatically select the client for you. But that can be really hard to determine in edge cases like Electron.)
+
+## Node Client
+
+The Node client uses the [`simple-get`](https://npm.im/simple-get) package under the hood.
 
 ```js
 const git = require("isomorphic-git");
-const http = require("isomorphic-git/node/http");
-git.clone({ ..., http })
+const { http } = require("isomorphic-git/dist/http.cjs");
+git.getRemoteInfo({ http, url: 'https://github.com/isomorphic-git/isomorphic-git' })
+  .then(console.log)
 ```
 
-Browser usage:
+If you need features that aren't supported currently, like detecting and handling `HTTP_PROXY` environment variables, you can
+wrap your own HTTP client. (See section below.)
+
+## Browser Client:
+
+The Browser client uses the [`Fetch API`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) under the hood.
 
 ```js
-const git = require("isomorphic-git");
-const http = require("isomorphic-git/browser/http");
-git.clone({ ..., http })
+import { getRemoteInfo } from "isomorphic-git";
+import { http } from "isomorphic-git/dist/http.js";
+getRemoteInfo({ http, url: 'https://github.com/isomorphic-git/isomorphic-git' })
+  .then(console.log)
 ```
 
-### Implementing your own `http` plugin
+### Implementing your own `http` client
 
 An `http` client is just one function that implements the following API:
 
@@ -77,3 +88,6 @@ Both requests and responses are "streaming" in the sense that they are async ite
 You don't _have_ to support streaming (and in some cases, like uploads in the browser, it may not be possible yet) but it is nice to have.
 If you are not streaming responses, you can simply fake it by returning an array with a single `Uint8Array` inside it.
 This works because the async iteration protocol (`for await ... of`) will fallback to the sync iteration protocol, which is supported by plain Arrays.
+
+To get started, you might want to look at [`src/builtin-node/http.js`](https://github.com/isomorphic-git/isomorphic-git/blob/master/src/builtin-node/http.js)
+and [`src/builtin-browser/http.js`](https://github.com/isomorphic-git/isomorphic-git/blob/master/src/builtin-browser/http.js).
diff --git a/jest.config.js b/jest.config.js
index 95decc75..0551bd18 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -2,6 +2,7 @@ module.exports = {
   testRegex: '/__tests__/(server-only\\.)?test-[^\\/]+\\.js',
   moduleNameMapper: {
     '^isomorphic-git$': '<rootDir>/src',
+    '^isomorphic-git/http$': '<rootDir>/src/builtin-node/http.js',
     '^isomorphic-git/(.+)$': '<rootDir>/src/$1'
   },
   collectCoverageFrom: ['src/*.js', 'src/**/*.js'],
diff --git a/karma.conf.js b/karma.conf.js
index ac9ffcef..d66cc403 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -157,6 +157,7 @@ module.exports = function (config) {
             'dist/internal.umd.min.js'
             // 'src/internal-apis.js'
           ),
+          'isomorphic-git/http': path.resolve(__dirname, 'dist/http.js'),
           'isomorphic-git': path.resolve(
             __dirname,
             'dist/bundle.umd.min.js'
diff --git a/package.json b/package.json
index 15b9309c..83492aca 100644
--- a/package.json
+++ b/package.json
@@ -6,8 +6,7 @@
   "main": "dist/index.cjs",
   "browser": {
     "isomorphic-git": "./dist/bundle.umd.min.js",
-    "isomorphic-git/internal-apis": "./dist/internal.umd.min.js",
-    "./src/utils/http.js": "./src/utils/http-browser.js"
+    "isomorphic-git/internal-apis": "./dist/internal.umd.min.js"
   },
   "module": "dist/index.js",
   "unpkg": "dist/bundle.umd.min.js",
@@ -43,14 +42,16 @@
   },
   "homepage": "https://isomorphic-git.org/",
   "files": [
-    "dist/index.js",
-    "dist/index.cjs",
-    "dist/index.d.ts",
+    "cli.js",
     "dist/browser-tests.json",
     "dist/bundle.umd.min.js",
     "dist/bundle.umd.min.js.map",
-    "dist/size_report.html",
-    "cli.js"
+    "dist/http.cjs",
+    "dist/http.js",
+    "dist/index.cjs",
+    "dist/index.d.ts",
+    "dist/index.js",
+    "dist/size_report.html"
   ],
   "dependencies": {
     "async-lock": "^1.1.0",
diff --git a/rollup.config.js b/rollup.config.js
index efff0f9f..208caadc 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -21,7 +21,7 @@ const moduleConfig = input => ({
     {
       format: 'es',
       name: 'git',
-      file: `dist/${input}`
+      file: `dist/${path.basename(input)}`
     }
   ],
   plugins: [resolve({ browser: true })]
@@ -42,4 +42,9 @@ const nodeConfig = input => ({
 
 const inputs = ['index.js', 'internal-apis.js']
 
-export default [...inputs.map(nodeConfig), ...inputs.map(moduleConfig)]
+export default [
+  ...inputs.map(nodeConfig),
+  ...inputs.map(moduleConfig),
+  nodeConfig('builtin-node/http.js'),
+  moduleConfig('builtin-browser/http.js')
+]
diff --git a/src/api/clone.js b/src/api/clone.js
index 2bf603f8..6c1b357b 100644
--- a/src/api/clone.js
+++ b/src/api/clone.js
@@ -13,7 +13,7 @@ import { join } from '../utils/join.js'
  *
  * @param {object} args
  * @param {FsClient} args.fs - a file system implementation
- * @param {HttpClient} [args.http] - an HTTP client
+ * @param {HttpClient} args.http - an HTTP client
  * @param {ProgressCallback} [args.onProgress] - optional progress event callback
  * @param {MessageCallback} [args.onMessage] - optional message event callback
  * @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
diff --git a/src/api/fetch.js b/src/api/fetch.js
index 44bf24b5..c06c7205 100644
--- a/src/api/fetch.js
+++ b/src/api/fetch.js
@@ -27,7 +27,7 @@ import { join } from '../utils/join.js'
  *
  * @param {object} args
  * @param {FsClient} args.fs - a file system client
- * @param {HttpClient} [args.http] - an HTTP client
+ * @param {HttpClient} args.http - an HTTP client
  * @param {ProgressCallback} [args.onProgress] - optional progress event callback
  * @param {MessageCallback} [args.onMessage] - optional message event callback
  * @param {AuthCallback} [args.onAuth] - optional auth fill callback
diff --git a/src/api/getRemoteInfo.js b/src/api/getRemoteInfo.js
index e4976ac3..5e02d4c7 100644
--- a/src/api/getRemoteInfo.js
+++ b/src/api/getRemoteInfo.js
@@ -22,7 +22,7 @@ import { assertParameter } from '../utils/assertParameter.js'
  * It just communicates to a remote git server, using the first step of the `git-upload-pack` handshake, but stopping short of fetching the packfile.
  *
  * @param {object} args
- * @param {HttpClient} [args.http] - an HTTP client
+ * @param {HttpClient} args.http - an HTTP client
  * @param {string} args.url - The URL of the remote repository. Will be gotten from gitconfig if absent.
  * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
  * @param {boolean} [args.forPush = false] - By default, the command queries the 'fetch' capabilities. If true, it will ask for the 'push' capabilities.
diff --git a/src/api/pull.js b/src/api/pull.js
index 3a3b9dc9..b7500ca3 100644
--- a/src/api/pull.js
+++ b/src/api/pull.js
@@ -16,7 +16,7 @@ import { normalizeCommitterObject } from '../utils/normalizeCommitterObject.js'
  *
  * @param {object} args
  * @param {FsClient} args.fs - a file system client
- * @param {HttpClient} [args.http] - an HTTP client
+ * @param {HttpClient} args.http - an HTTP client
  * @param {ProgressCallback} [args.onProgress] - optional progress event callback
  * @param {MessageCallback} [args.onMessage] - optional message event callback
  * @param {AuthCallback} [args.onAuth] - optional auth fill callback
diff --git a/src/api/push.js b/src/api/push.js
index badd7459..04bf49ac 100644
--- a/src/api/push.js
+++ b/src/api/push.js
@@ -32,7 +32,7 @@ import { join } from '../utils/join.js'
  *
  * @param {object} args
  * @param {FsClient} args.fs - a file system client
- * @param {HttpClient} [args.http] - an HTTP client
+ * @param {HttpClient} args.http - an HTTP client
  * @param {ProgressCallback} [args.onProgress] - optional progress event callback
  * @param {MessageCallback} [args.onMessage] - optional message event callback
  * @param {AuthCallback} [args.onAuth] - optional auth fill callback
diff --git a/src/utils/http-browser.js b/src/builtin-browser/http.js
similarity index 87%
rename from src/utils/http-browser.js
rename to src/builtin-browser/http.js
index f736d219..392387aa 100644
--- a/src/utils/http-browser.js
+++ b/src/builtin-browser/http.js
@@ -1,5 +1,5 @@
-import { fromStream } from './AsyncIterator.js'
-import { collect } from './collect.js'
+import { fromStream } from '../utils/AsyncIterator.js'
+import { collect } from '../utils/collect.js'
 
 export async function http ({
   onProgress,
diff --git a/src/utils/http.js b/src/builtin-node/http.js
similarity index 82%
rename from src/utils/http.js
rename to src/builtin-node/http.js
index bd03a751..7a3a5875 100644
--- a/src/utils/http.js
+++ b/src/builtin-node/http.js
@@ -1,6 +1,6 @@
-import { fromNodeStream } from './AsyncIterator.js'
-import { asyncIteratorToStream } from './asyncIteratorToStream.js'
-import { collect } from './collect.js'
+import { fromNodeStream } from '../utils/AsyncIterator.js'
+import { asyncIteratorToStream } from '../utils/asyncIteratorToStream.js'
+import { collect } from '../utils/collect.js'
 
 export async function http ({
   onProgress,
diff --git a/src/commands/fetch.js b/src/commands/fetch.js
index a7f78793..7ccb7a75 100644
--- a/src/commands/fetch.js
+++ b/src/commands/fetch.js
@@ -33,7 +33,7 @@ import { writeUploadPackRequest } from '../wire/writeUploadPackRequest.js'
 /**
  * @param {object} args
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
- * @param {HttpClient} [args.http]
+ * @param {HttpClient} args.http
  * @param {ProgressCallback} [args.onProgress]
  * @param {MessageCallback} [args.onMessage]
  * @param {AuthCallback} [args.onAuth]
diff --git a/src/commands/pull.js b/src/commands/pull.js
index 940e33e6..d7c788bc 100644
--- a/src/commands/pull.js
+++ b/src/commands/pull.js
@@ -10,7 +10,7 @@ import { E, GitError } from '../models/GitError.js'
 /**
  * @param {object} args
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
- * @param {HttpClient} [args.http] - an HTTP client
+ * @param {HttpClient} args.http - an HTTP client
  * @param {ProgressCallback} [args.onProgress] - optional progress event callback
  * @param {MessageCallback} [args.onMessage] - optional message event callback
  * @param {AuthCallback} [args.onAuth] - optional auth fill callback
diff --git a/src/commands/push.js b/src/commands/push.js
index 3c5754af..9dceb7be 100644
--- a/src/commands/push.js
+++ b/src/commands/push.js
@@ -30,7 +30,7 @@ import { writeReceivePackRequest } from '../wire/writeReceivePackRequest.js'
 /**
  * @param {object} args
  * @param {import('../models/FileSystem.js').FileSystem} args.fs
- * @param {HttpClient} [args.http]
+ * @param {HttpClient} args.http
  * @param {ProgressCallback} [args.onProgress]
  * @param {MessageCallback} [args.onMessage]
  * @param {AuthCallback} [args.onAuth]
diff --git a/src/http.d.ts b/src/http.d.ts
new file mode 100644
index 00000000..99485382
--- /dev/null
+++ b/src/http.d.ts
@@ -0,0 +1,1 @@
+declare module "isomorphic-git/http";
diff --git a/src/internal-apis.js b/src/internal-apis.js
index 66e49bbc..e9bb6e80 100644
--- a/src/internal-apis.js
+++ b/src/internal-apis.js
@@ -32,7 +32,6 @@ export * from './utils/calculateBasicAuthHeader'
 export * from './utils/calculateBasicAuthUsernamePasswordPair'
 export * from './utils/collect'
 export * from './utils/comparePath'
-export * from './utils/http'
 export * from './utils/flatFileListToDirectoryStructure'
 export * from './utils/isBinary'
 export * from './utils/join'
diff --git a/src/managers/GitRemoteHTTP.js b/src/managers/GitRemoteHTTP.js
index 6565c63d..425e0b71 100644
--- a/src/managers/GitRemoteHTTP.js
+++ b/src/managers/GitRemoteHTTP.js
@@ -5,7 +5,6 @@ import { calculateBasicAuthHeader } from '../utils/calculateBasicAuthHeader.js'
 import { calculateBasicAuthUsernamePasswordPair } from '../utils/calculateBasicAuthUsernamePasswordPair.js'
 import { collect } from '../utils/collect.js'
 import { extractAuthFromUrl } from '../utils/extractAuthFromUrl.js'
-import { http as builtinHttp } from '../utils/http.js'
 import { pkg } from '../utils/pkg.js'
 import { parseRefsAdResponse } from '../wire/parseRefsAdResponse.js'
 
@@ -24,7 +23,7 @@ export class GitRemoteHTTP {
 
   /**
    * @param {Object} args
-   * @param {HttpClient} [args.http]
+   * @param {HttpClient} args.http
    * @param {ProgressCallback} [args.onProgress]
    * @param {AuthCallback} [args.onAuth]
    * @param {AuthSuccessCallback} [args.onAuthSuccess]
@@ -37,7 +36,7 @@ export class GitRemoteHTTP {
    * @param {Object<string, string>} [args.headers]
    */
   static async discover ({
-    http = builtinHttp,
+    http,
     onProgress,
     onAuth,
     onAuthSuccess,
@@ -150,7 +149,7 @@ export class GitRemoteHTTP {
   }
 
   static async connect ({
-    http = builtinHttp,
+    http,
     onProgress,
     corsProxy,
     service,
diff --git a/tsconfig.json b/tsconfig.json
index d9269ffc..14161596 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -18,7 +18,8 @@
     "baseUrl": ".",
     "paths": {
       "isomorphic-git": ["./dist/index.d.ts"],
-      "isomorphic-git/internal-apis": ["./src/internal-apis.d.ts"]
+      "isomorphic-git/internal-apis": ["./src/internal-apis.d.ts"],
+      "isomorphic-git/http": ["./src/http.d.ts"]
     }
   }
 }
\ No newline at end of file
diff --git a/website/i18n/en.json b/website/i18n/en.json
index a53dcae2..f35c4824 100644
--- a/website/i18n/en.json
+++ b/website/i18n/en.json
@@ -212,26 +212,6 @@
         "title": "packObjects",
         "sidebar_label": "packObjects"
       },
-      "plugin_credentialManager": {
-        "title": "credentialManager",
-        "sidebar_label": "credentialManager"
-      },
-      "plugin_emitter": {
-        "title": "emitter",
-        "sidebar_label": "emitter"
-      },
-      "plugin_fs": {
-        "title": "fs",
-        "sidebar_label": "fs"
-      },
-      "plugin_http": {
-        "title": "http",
-        "sidebar_label": "http"
-      },
-      "plugin_pgp": {
-        "title": "pgp",
-        "sidebar_label": "pgp"
-      },
       "pull": {
         "title": "pull",
         "sidebar_label": "pull"


Test patch:
diff --git a/__tests__/__helpers__/generate-docs.js b/__tests__/__helpers__/generate-docs.js
index b9992e47..a309dbd1 100644
--- a/__tests__/__helpers__/generate-docs.js
+++ b/__tests__/__helpers__/generate-docs.js
@@ -148,9 +148,10 @@ async function gendoc (file, filepath) {
           if (param.name === '_' || param.name === 'args') continue
 
           let name = param.name.replace('_.', '').replace('args.', '')
-          const shouldLink = name.startsWith('on')
+          const actualName = name
+          const shouldLink =
+            actualName.startsWith('on') || name === 'http' || name === 'fs'
           if (!param.optional) name = `**${name}**`
-          if (shouldLink) name = `[${name}](./${name})`
 
           let type = param.type.names.map(escapeType).join(' | ')
           if (param.type.names[0] === 'function') {
@@ -180,6 +181,7 @@ async function gendoc (file, filepath) {
               name = `**${name}**`
             }
           }
+          if (shouldLink) name = `[${name}](./${actualName})`
           rows.push([name, escapeType(type), escapeType(description)])
         }
       }
diff --git a/__tests__/test-clone.js b/__tests__/test-clone.js
index b07a6039..eb425fec 100644
--- a/__tests__/test-clone.js
+++ b/__tests__/test-clone.js
@@ -2,6 +2,7 @@
 const { makeFixture } = require('./__helpers__/FixtureFS.js')
 
 const { clone } = require('isomorphic-git')
+const { http } = require('isomorphic-git/http')
 
 // this is so it works with either Node local tests or Browser WAN tests
 const localhost =
@@ -16,6 +17,7 @@ describe('clone', () => {
     const { fs, dir, gitdir } = await makeFixture('isomorphic-git')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       depth: 1,
@@ -37,6 +39,7 @@ describe('clone', () => {
     const { fs, dir, gitdir } = await makeFixture('isomorphic-git')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       depth: 1,
@@ -58,6 +61,7 @@ describe('clone', () => {
     const { fs, dir, gitdir } = await makeFixture('isomorphic-git')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       depth: 1,
@@ -82,6 +86,7 @@ describe('clone', () => {
     try {
       await clone({
         fs,
+        http,
         dir,
         gitdir,
         depth: 1,
@@ -101,6 +106,7 @@ describe('clone', () => {
     const { fs, dir, gitdir } = await makeFixture('test-clone-karma')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       depth: 1,
@@ -123,6 +129,7 @@ describe('clone', () => {
     const { fs, dir, gitdir } = await makeFixture('test-clone-empty')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       depth: 1,
diff --git a/__tests__/test-fetch.js b/__tests__/test-fetch.js
index 78bca43d..a08c4e89 100644
--- a/__tests__/test-fetch.js
+++ b/__tests__/test-fetch.js
@@ -2,6 +2,7 @@
 const { makeFixture } = require('./__helpers__/FixtureFS.js')
 
 const { sleep } = require('isomorphic-git/internal-apis')
+const { http } = require('isomorphic-git/http')
 const { E, setConfig, fetch } = require('isomorphic-git')
 
 // this is so it works with either Node local tests or Browser WAN tests
@@ -20,6 +21,7 @@ describe('fetch', () => {
     // Smoke Test
     await fetch({
       fs,
+      http,
       gitdir,
       singleBranch: true,
       remote: 'origin',
@@ -44,6 +46,7 @@ describe('fetch', () => {
     // Test
     await fetch({
       fs,
+      http,
       gitdir,
       onMessage: async x => {
         output.push(x)
@@ -65,6 +68,7 @@ describe('fetch', () => {
     // Now test deepen
     await fetch({
       fs,
+      http,
       gitdir,
       depth: 2,
       singleBranch: true,
@@ -89,6 +93,7 @@ describe('fetch', () => {
     try {
       await fetch({
         fs,
+        http,
         gitdir,
         depth: 1,
         singleBranch: true,
@@ -115,6 +120,7 @@ describe('fetch', () => {
     try {
       await fetch({
         fs,
+        http,
         gitdir,
         depth: 1,
         singleBranch: true,
@@ -142,6 +148,7 @@ describe('fetch', () => {
     // Test
     await fetch({
       fs,
+      http,
       gitdir,
       since: new Date(1506571200000),
       singleBranch: true,
@@ -164,6 +171,7 @@ describe('fetch', () => {
     // Test
     await fetch({
       fs,
+      http,
       gitdir,
       exclude: ['v0.0.5'],
       singleBranch: true,
@@ -186,6 +194,7 @@ describe('fetch', () => {
     // Test
     await fetch({
       fs,
+      http,
       gitdir,
       depth: 1,
       singleBranch: true,
@@ -198,6 +207,7 @@ describe('fetch', () => {
     // Now test deepen
     await fetch({
       fs,
+      http,
       gitdir,
       relative: true,
       depth: 1,
@@ -223,6 +233,7 @@ describe('fetch', () => {
     try {
       await fetch({
         fs,
+        http,
         gitdir,
         since: new Date(1506571200000),
         singleBranch: true,
@@ -239,8 +250,9 @@ describe('fetch', () => {
   it('fetch empty repository from git-http-mock-server', async () => {
     const { fs, dir, gitdir } = await makeFixture('test-empty')
     await fetch({
-      dir,
       fs,
+      http,
+      dir,
       gitdir,
       depth: 1,
       url: `http://${localhost}:8888/test-empty.git`
@@ -265,8 +277,9 @@ describe('fetch', () => {
       true
     )
     const { pruned } = await fetch({
-      dir,
       fs,
+      http,
+      dir,
       gitdir,
       depth: 1,
       prune: true
@@ -289,8 +302,9 @@ describe('fetch', () => {
     const oldValue = await fs.read(`${gitdir}/refs/tags/v1.0.0`, 'utf8')
     try {
       await fetch({
-        dir,
         fs,
+        http,
+        dir,
         gitdir,
         depth: 1,
         tags: true,
diff --git a/__tests__/test-getRemoteInfo.js b/__tests__/test-getRemoteInfo.js
index ea4e1896..348fdc91 100644
--- a/__tests__/test-getRemoteInfo.js
+++ b/__tests__/test-getRemoteInfo.js
@@ -3,6 +3,7 @@
 const snapshots = require('./__snapshots__/test-getRemoteInfo.js.snap')
 const registerSnapshots = require('./__helpers__/jasmine-snapshots')
 const { E, getRemoteInfo } = require('isomorphic-git')
+const { http } = require('isomorphic-git/http')
 
 // this is so it works with either Node local tests or Browser WAN tests
 const localhost =
@@ -14,6 +15,7 @@ describe('getRemoteInfo', () => {
   })
   it('getRemoteInfo', async () => {
     const info = await getRemoteInfo({
+      http,
       url: `http://${localhost}:8888/test-dumb-http-server.git`
     })
     expect(info).not.toBeNull()
@@ -27,6 +29,7 @@ describe('getRemoteInfo', () => {
       let error = null
       try {
         await getRemoteInfo({
+          http,
           url: `http://${localhost}:9876/base/__tests__/__fixtures__/test-dumb-http-server.git`
         })
       } catch (err) {
diff --git a/__tests__/test-hosting-providers.js b/__tests__/test-hosting-providers.js
index 7c052b87..ae72bb10 100644
--- a/__tests__/test-hosting-providers.js
+++ b/__tests__/test-hosting-providers.js
@@ -2,6 +2,7 @@
 const { makeFixture } = require('./__helpers__/FixtureFS.js')
 
 const { fetch, push } = require('isomorphic-git')
+const { http } = require('isomorphic-git/http')
 
 // this is so it works with either Node local tests or Browser WAN tests
 const localhost =
@@ -23,6 +24,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await fetch({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         username: 'tester-at-260687965765',
@@ -48,6 +50,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await push({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         username: 'tester-at-260687965765',
@@ -75,6 +78,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await fetch({
         fs,
+        http,
         noGitSuffix: true,
         gitdir,
         // corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
@@ -99,6 +103,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await push({
         fs,
+        http,
         noGitSuffix: true,
         gitdir,
         // corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
@@ -129,6 +134,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await push({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         username: 'isomorphic-git',
@@ -156,6 +162,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await fetch({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         username: 'isomorphic-git',
@@ -183,6 +190,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await fetch({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         token: token,
@@ -207,6 +215,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await push({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         token: token,
@@ -235,6 +244,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await fetch({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         username: 'isomorphic-git-test-push',
@@ -260,6 +270,7 @@ describe('Hosting Providers', () => {
       // Test
       const res = await push({
         fs,
+        http,
         gitdir,
         corsProxy: process.browser ? `http://${localhost}:9999` : undefined,
         username: 'isomorphic-git-test-push',
diff --git a/__tests__/test-plugin-http.js b/__tests__/test-plugin-http.js
index 0c61dfe6..9d437126 100644
--- a/__tests__/test-plugin-http.js
+++ b/__tests__/test-plugin-http.js
@@ -2,7 +2,7 @@
 const { makeFixture } = require('./__helpers__/FixtureFS.js')
 
 const { clone } = require('isomorphic-git')
-const { http } = require('isomorphic-git/internal-apis')
+const { http } = require('isomorphic-git/http')
 
 // this is so it works with either Node local tests or Browser WAN tests
 const localhost =
diff --git a/__tests__/test-plugin_credentialManager.js b/__tests__/test-plugin_credentialManager.js
index 3cd3e9b0..e06f5193 100644
--- a/__tests__/test-plugin_credentialManager.js
+++ b/__tests__/test-plugin_credentialManager.js
@@ -2,6 +2,7 @@
 const { makeFixture } = require('./__helpers__/FixtureFS.js')
 
 const { setConfig, push, E } = require('isomorphic-git')
+const { http } = require('isomorphic-git/http')
 
 // this is so it works with either Node local tests or Browser WAN tests
 const localhost =
@@ -23,6 +24,7 @@ describe('credentialManager', () => {
     let rejectedCalled = false
     await push({
       fs,
+      http,
       gitdir,
       remote: 'auth',
       ref: 'master',
@@ -61,6 +63,7 @@ describe('credentialManager', () => {
     try {
       await push({
         fs,
+        http,
         gitdir,
         remote: 'auth',
         ref: 'master',
diff --git a/__tests__/test-push.js b/__tests__/test-push.js
index 5d81ee2e..088a1f3f 100644
--- a/__tests__/test-push.js
+++ b/__tests__/test-push.js
@@ -5,6 +5,7 @@ const snapshots = require('./__snapshots__/test-push.js.snap')
 const registerSnapshots = require('./__helpers__/jasmine-snapshots')
 
 const { setConfig, push, listBranches } = require('isomorphic-git')
+const { http } = require('isomorphic-git/http')
 
 // this is so it works with either Node local tests or Browser WAN tests
 const localhost =
@@ -27,6 +28,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       onMessage: async m => {
         output.push(m)
@@ -52,6 +54,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       remote: 'karma'
     })
@@ -72,6 +75,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       remote: 'karma',
       ref: 'master',
@@ -97,6 +101,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       remote: 'karma',
       ref: 'lightweight-tag'
@@ -118,6 +123,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       remote: 'karma',
       ref: 'annotated-tag'
@@ -138,6 +144,7 @@ describe('push', () => {
     })
     await push({
       fs,
+      http,
       gitdir,
       remote: 'karma',
       ref: 'master',
@@ -149,6 +156,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       remote: 'karma',
       remoteRef: 'foobar',
@@ -175,6 +183,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       username: 'testuser',
       password: 'testpassword',
@@ -198,6 +207,7 @@ describe('push', () => {
     // Test
     const res = await push({
       fs,
+      http,
       gitdir,
       remote: 'url',
       ref: 'master'
@@ -221,6 +231,7 @@ describe('push', () => {
     try {
       await push({
         fs,
+        http,
         gitdir,
         remote: 'auth',
         ref: 'master'
@@ -244,6 +255,7 @@ describe('push', () => {
     try {
       await push({
         fs,
+        http,
         gitdir,
         username: 'test',
         password: 'test',
diff --git a/__tests__/test-submodules.js b/__tests__/test-submodules.js
index 52e6e0ce..561c0aa6 100644
--- a/__tests__/test-submodules.js
+++ b/__tests__/test-submodules.js
@@ -2,6 +2,7 @@
 const { makeFixture } = require('./__helpers__/FixtureFS.js')
 
 const { clone, checkout, listFiles, commit } = require('isomorphic-git')
+const { http } = require('isomorphic-git/http')
 
 // this is so it works with either Node local tests or Browser WAN tests
 const localhost =
@@ -12,6 +13,7 @@ describe('submodule "support"', () => {
     const { fs, dir, gitdir } = await makeFixture('test-clone-submodules')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       url: `http://${localhost}:8888/test-submodules.git`,
@@ -26,6 +28,7 @@ describe('submodule "support"', () => {
     const { fs, dir, gitdir } = await makeFixture('test-clone-submodules')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       url: `http://${localhost}:8888/test-submodules.git`,
@@ -51,6 +54,7 @@ describe('submodule "support"', () => {
     const { fs, dir, gitdir } = await makeFixture('test-clone-submodules')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       ref: 'no-modules',
@@ -74,6 +78,7 @@ describe('submodule "support"', () => {
     const { fs, dir, gitdir } = await makeFixture('test-clone-submodules')
     await clone({
       fs,
+      http,
       dir,
       gitdir,
       url: `http://${localhost}:8888/test-submodules.git`,