Initial commit

This commit is contained in:
Patrick Marsceill
2017-03-09 13:16:08 -05:00
commit b7b0d0d7bf
4147 changed files with 401224 additions and 0 deletions

2
node_modules/hosted-git-info/.npmignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
test
.travis.yml

13
node_modules/hosted-git-info/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,13 @@
Copyright (c) 2015, Rebecca Turner
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

103
node_modules/hosted-git-info/README.md generated vendored Normal file
View File

@@ -0,0 +1,103 @@
# hosted-git-info
This will let you identify and transform various git hosts URLs between
protocols. It also can tell you what the URL is for the raw path for
particular file for direct access without git.
## Usage
```javascript
var hostedGitInfo = require("hosted-git-info")
var info = hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git")
/* info looks like:
{
type: "github",
domain: "github.com",
user: "npm",
project: "hosted-git-info"
}
*/
```
If the URL can't be matched with a git host, `null` will be returned. We
can match git, ssh and https urls. Additionally, we can match ssh connect
strings (`git@github.com:npm/hosted-git-info`) and shortcuts (eg,
`github:npm/hosted-git-info`). Github specifically, is detected in the case
of a third, unprefixed, form: `npm/hosted-git-info`.
If it does match, the returned object has properties of:
* info.type -- The short name of the service
* info.domain -- The domain for git protocol use
* info.user -- The name of the user/org on the git host
* info.project -- The name of the project on the git host
And methods of:
* info.file(path)
Given the path of a file relative to the repository, returns a URL for
directly fetching it from the githost. If no committish was set then
`master` will be used as the default.
For example `hostedGitInfo.fromUrl("git@github.com:npm/hosted-git-info.git#v1.0.0").file("package.json")`
would return `https://raw.githubusercontent.com/npm/hosted-git-info/v1.0.0/package.json`
* info.shortcut()
eg, `github:npm/hosted-git-info`
* info.browse()
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0`
* info.bugs()
eg, `https://github.com/npm/hosted-git-info/issues`
* info.docs()
eg, `https://github.com/npm/hosted-git-info/tree/v1.2.0#readme`
* info.https()
eg, `git+https://github.com/npm/hosted-git-info.git`
* info.sshurl()
eg, `git+ssh://git@github.com/npm/hosted-git-info.git`
* info.ssh()
eg, `git@github.com:npm/hosted-git-info.git`
* info.path()
eg, `npm/hosted-git-info`
* info.tarball()
eg, `https://github.com/npm/hosted-git-info/archive/v1.2.0.tar.gz`
* info.getDefaultRepresentation()
Returns the default output type. The default output type is based on the
string you passed in to be parsed
* info.toString()
Uses the getDefaultRepresentation to call one of the other methods to get a URL for
this resource. As such `hostedGitInfo.fromUrl(url).toString()` will give
you a normalized version of the URL that still uses the same protocol.
Shortcuts will still be returned as shortcuts, but the special case github
form of `org/project` will be normalized to `github:org/project`.
SSH connect strings will be normalized into `git+ssh` URLs.
## Supported hosts
Currently this supports Github, Bitbucket and Gitlab. Pull requests for
additional hosts welcome.

68
node_modules/hosted-git-info/git-host-info.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
'use strict'
var gitHosts = module.exports = {
github: {
// First two are insecure and generally shouldn't be used any more, but
// they are still supported.
'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ],
'domain': 'github.com',
'treepath': 'tree',
'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}',
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}',
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz'
},
bitbucket: {
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
'domain': 'bitbucket.org',
'treepath': 'src',
'tarballtemplate': 'https://{domain}/{user}/{project}/get/{committish}.tar.gz'
},
gitlab: {
'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
'domain': 'gitlab.com',
'treepath': 'tree',
'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#README',
'bugstemplate': 'https://{domain}/{user}/{project}/issues',
'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}'
},
gist: {
'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],
'domain': 'gist.github.com',
'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]+)(?:[.]git)?$/,
'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}',
'bugstemplate': 'https://{domain}/{project}',
'gittemplate': 'git://{domain}/{project}.git{#committish}',
'sshtemplate': 'git@{domain}:/{project}.git{#committish}',
'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}',
'browsetemplate': 'https://{domain}/{project}{/committish}',
'docstemplate': 'https://{domain}/{project}{/committish}',
'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
'shortcuttemplate': '{type}:{project}{#committish}',
'pathtemplate': '{project}{#committish}',
'tarballtemplate': 'https://{domain}/{user}/{project}/archive/{committish}.tar.gz'
}
}
var gitHostDefaults = {
'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}',
'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}',
'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}',
'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme',
'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}',
'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}',
'shortcuttemplate': '{type}:{user}/{project}{#committish}',
'pathtemplate': '{user}/{project}{#committish}',
'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git)?$/
}
Object.keys(gitHosts).forEach(function (name) {
Object.keys(gitHostDefaults).forEach(function (key) {
if (gitHosts[name][key]) return
gitHosts[name][key] = gitHostDefaults[key]
})
gitHosts[name].protocols_re = RegExp('^(' +
gitHosts[name].protocols.map(function (protocol) {
return protocol.replace(/([\\+*{}()\[\]$^|])/g, '\\$1')
}).join('|') + '):$')
})

100
node_modules/hosted-git-info/git-host.js generated vendored Normal file
View File

@@ -0,0 +1,100 @@
'use strict'
var gitHosts = require('./git-host-info.js')
var GitHost = module.exports = function (type, user, auth, project, committish, defaultRepresentation) {
var gitHostInfo = this
gitHostInfo.type = type
Object.keys(gitHosts[type]).forEach(function (key) {
gitHostInfo[key] = gitHosts[type][key]
})
gitHostInfo.user = user
gitHostInfo.auth = auth
gitHostInfo.project = project
gitHostInfo.committish = committish
gitHostInfo.default = defaultRepresentation
}
GitHost.prototype = {}
GitHost.prototype.hash = function () {
return this.committish ? '#' + this.committish : ''
}
GitHost.prototype._fill = function (template, vars) {
if (!template) return
if (!vars) vars = {}
var self = this
Object.keys(this).forEach(function (key) {
if (self[key] != null && vars[key] == null) vars[key] = self[key]
})
var rawAuth = vars.auth
var rawComittish = vars.committish
Object.keys(vars).forEach(function (key) {
vars[key] = encodeURIComponent(vars[key])
})
vars['auth@'] = rawAuth ? rawAuth + '@' : ''
vars['#committish'] = rawComittish ? '#' + rawComittish : ''
vars['/tree/committish'] = vars.committish
? '/' + vars.treepath + '/' + vars.committish
: ''
vars['/committish'] = vars.committish ? '/' + vars.committish : ''
vars.committish = vars.committish || 'master'
var res = template
Object.keys(vars).forEach(function (key) {
res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key])
})
return res
}
GitHost.prototype.ssh = function () {
return this._fill(this.sshtemplate)
}
GitHost.prototype.sshurl = function () {
return this._fill(this.sshurltemplate)
}
GitHost.prototype.browse = function () {
return this._fill(this.browsetemplate)
}
GitHost.prototype.docs = function () {
return this._fill(this.docstemplate)
}
GitHost.prototype.bugs = function () {
return this._fill(this.bugstemplate)
}
GitHost.prototype.https = function () {
return this._fill(this.httpstemplate)
}
GitHost.prototype.git = function () {
return this._fill(this.gittemplate)
}
GitHost.prototype.shortcut = function () {
return this._fill(this.shortcuttemplate)
}
GitHost.prototype.path = function () {
return this._fill(this.pathtemplate)
}
GitHost.prototype.tarball = function () {
return this._fill(this.tarballtemplate)
}
GitHost.prototype.file = function (P) {
return this._fill(this.filetemplate, {
path: P.replace(/^[/]+/g, '')
})
}
GitHost.prototype.getDefaultRepresentation = function () {
return this.default
}
GitHost.prototype.toString = function () {
return (this[this.default] || this.sshurl).call(this)
}

103
node_modules/hosted-git-info/index.js generated vendored Normal file
View File

@@ -0,0 +1,103 @@
'use strict'
var url = require('url')
var gitHosts = require('./git-host-info.js')
var GitHost = module.exports = require('./git-host.js')
var protocolToRepresentationMap = {
'git+ssh': 'sshurl',
'git+https': 'https',
'ssh': 'sshurl',
'git': 'git'
}
function protocolToRepresentation (protocol) {
if (protocol.substr(-1) === ':') protocol = protocol.slice(0, -1)
return protocolToRepresentationMap[protocol] || protocol
}
var authProtocols = {
'git:': true,
'https:': true,
'git+https:': true,
'http:': true,
'git+http:': true
}
module.exports.fromUrl = function (giturl) {
if (giturl == null || giturl === '') return
var url = fixupUnqualifiedGist(
isGitHubShorthand(giturl) ? 'github:' + giturl : giturl
)
var parsed = parseGitUrl(url)
var matches = Object.keys(gitHosts).map(function (gitHostName) {
var gitHostInfo = gitHosts[gitHostName]
var auth = null
if (parsed.auth && authProtocols[parsed.protocol]) {
auth = decodeURIComponent(parsed.auth)
}
var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null
var user = null
var project = null
var defaultRepresentation = null
if (parsed.protocol === gitHostName + ':') {
user = decodeURIComponent(parsed.host)
project = parsed.path && decodeURIComponent(parsed.path.replace(/^[/](.*?)(?:[.]git)?$/, '$1'))
defaultRepresentation = 'shortcut'
} else {
if (parsed.host !== gitHostInfo.domain) return
if (!gitHostInfo.protocols_re.test(parsed.protocol)) return
var pathmatch = gitHostInfo.pathmatch
var matched = parsed.path.match(pathmatch)
if (!matched) return
if (matched[1] != null) user = decodeURIComponent(matched[1])
if (matched[2] != null) project = decodeURIComponent(matched[2])
defaultRepresentation = protocolToRepresentation(parsed.protocol)
}
return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation)
}).filter(function (gitHostInfo) { return gitHostInfo })
if (matches.length !== 1) return
return matches[0]
}
function isGitHubShorthand (arg) {
// Note: This does not fully test the git ref format.
// See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
//
// The only way to do this properly would be to shell out to
// git-check-ref-format, and as this is a fast sync function,
// we don't want to do that. Just let git fail if it turns
// out that the commit-ish is invalid.
// GH usernames cannot start with . or -
return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg)
}
function fixupUnqualifiedGist (giturl) {
// necessary for round-tripping gists
var parsed = url.parse(giturl)
if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) {
return parsed.protocol + '/' + parsed.host
} else {
return giturl
}
}
function parseGitUrl (giturl) {
if (typeof giturl !== 'string') giturl = '' + giturl
var matched = giturl.match(/^([^@]+)@([^:]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/)
if (!matched) return url.parse(giturl)
return {
protocol: 'git+ssh:',
slashes: true,
auth: matched[1],
host: matched[2],
port: null,
hostname: matched[2],
hash: matched[4],
search: null,
query: null,
pathname: '/' + matched[3],
path: '/' + matched[3],
href: 'git+ssh://' + matched[1] + '@' + matched[2] +
'/' + matched[3] + (matched[4] || '')
}
}

94
node_modules/hosted-git-info/package.json generated vendored Normal file
View File

@@ -0,0 +1,94 @@
{
"_args": [
[
"hosted-git-info@^2.1.4",
"/Users/pmarsceill/_projects/just-the-docs/node_modules/normalize-package-data"
]
],
"_from": "hosted-git-info@>=2.1.4 <3.0.0",
"_id": "hosted-git-info@2.2.0",
"_inCache": true,
"_installable": true,
"_location": "/hosted-git-info",
"_nodeVersion": "7.4.0",
"_npmOperationalInternal": {
"host": "packages-18-east.internal.npmjs.com",
"tmp": "tmp/hosted-git-info-2.2.0.tgz_1486365886030_0.0815314722713083"
},
"_npmUser": {
"email": "kat@sykosomatic.org",
"name": "zkat"
},
"_npmVersion": "4.2.0",
"_phantomChildren": {},
"_requested": {
"name": "hosted-git-info",
"raw": "hosted-git-info@^2.1.4",
"rawSpec": "^2.1.4",
"scope": null,
"spec": ">=2.1.4 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/normalize-package-data"
],
"_resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.2.0.tgz",
"_shasum": "7a0d097863d886c0fabbdcd37bf1758d8becf8a5",
"_shrinkwrap": null,
"_spec": "hosted-git-info@^2.1.4",
"_where": "/Users/pmarsceill/_projects/just-the-docs/node_modules/normalize-package-data",
"author": {
"email": "me@re-becca.org",
"name": "Rebecca Turner",
"url": "http://re-becca.org"
},
"bugs": {
"url": "https://github.com/npm/hosted-git-info/issues"
},
"dependencies": {},
"description": "Provides metadata and conversions from repository urls for Github, Bitbucket and Gitlab",
"devDependencies": {
"standard": "^3.3.2",
"tap": "^10.0.2"
},
"directories": {},
"dist": {
"shasum": "7a0d097863d886c0fabbdcd37bf1758d8becf8a5",
"tarball": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.2.0.tgz"
},
"gitHead": "d5ea6d1de852b04589f100c671fa0d3311f3449f",
"homepage": "https://github.com/npm/hosted-git-info",
"keywords": [
"bitbucket",
"git",
"github",
"gitlab"
],
"license": "ISC",
"main": "index.js",
"maintainers": [
{
"name": "iarna",
"email": "me@re-becca.org"
},
{
"name": "othiym23",
"email": "ogd@aoaioxxysz.net"
},
{
"name": "zkat",
"email": "kat@sykosomatic.org"
}
],
"name": "hosted-git-info",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/hosted-git-info.git"
},
"scripts": {
"test": "standard && tap -j8 test/*.js"
},
"version": "2.2.0"
}