mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action! (#1)
This commit is contained in:
parent
8deacc95b1
commit
ace1e6a69a
3750 changed files with 1155519 additions and 0 deletions
82
node_modules/pacote/lib/fetch.js
generated
vendored
Normal file
82
node_modules/pacote/lib/fetch.js
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
'use strict'
|
||||
|
||||
const duck = require('protoduck')
|
||||
|
||||
const Fetcher = duck.define(['spec', 'opts', 'manifest'], {
|
||||
packument: ['spec', 'opts'],
|
||||
manifest: ['spec', 'opts'],
|
||||
tarball: ['spec', 'opts'],
|
||||
fromManifest: ['manifest', 'spec', 'opts'],
|
||||
clearMemoized () {}
|
||||
}, { name: 'Fetcher' })
|
||||
module.exports = Fetcher
|
||||
|
||||
module.exports.packument = packument
|
||||
function packument (spec, opts) {
|
||||
const fetcher = getFetcher(spec.type)
|
||||
return fetcher.packument(spec, opts)
|
||||
}
|
||||
|
||||
module.exports.manifest = manifest
|
||||
function manifest (spec, opts) {
|
||||
const fetcher = getFetcher(spec.type)
|
||||
return fetcher.manifest(spec, opts)
|
||||
}
|
||||
|
||||
module.exports.tarball = tarball
|
||||
function tarball (spec, opts) {
|
||||
return getFetcher(spec.type).tarball(spec, opts)
|
||||
}
|
||||
|
||||
module.exports.fromManifest = fromManifest
|
||||
function fromManifest (manifest, spec, opts) {
|
||||
return getFetcher(spec.type).fromManifest(manifest, spec, opts)
|
||||
}
|
||||
|
||||
const fetchers = {}
|
||||
|
||||
module.exports.clearMemoized = clearMemoized
|
||||
function clearMemoized () {
|
||||
Object.keys(fetchers).forEach(k => {
|
||||
fetchers[k].clearMemoized()
|
||||
})
|
||||
}
|
||||
|
||||
function getFetcher (type) {
|
||||
if (!fetchers[type]) {
|
||||
// This is spelled out both to prevent sketchy stuff and to make life
|
||||
// easier for bundlers/preprocessors.
|
||||
switch (type) {
|
||||
case 'alias':
|
||||
fetchers[type] = require('./fetchers/alias')
|
||||
break
|
||||
case 'directory':
|
||||
fetchers[type] = require('./fetchers/directory')
|
||||
break
|
||||
case 'file':
|
||||
fetchers[type] = require('./fetchers/file')
|
||||
break
|
||||
case 'git':
|
||||
fetchers[type] = require('./fetchers/git')
|
||||
break
|
||||
case 'hosted':
|
||||
fetchers[type] = require('./fetchers/hosted')
|
||||
break
|
||||
case 'range':
|
||||
fetchers[type] = require('./fetchers/range')
|
||||
break
|
||||
case 'remote':
|
||||
fetchers[type] = require('./fetchers/remote')
|
||||
break
|
||||
case 'tag':
|
||||
fetchers[type] = require('./fetchers/tag')
|
||||
break
|
||||
case 'version':
|
||||
fetchers[type] = require('./fetchers/version')
|
||||
break
|
||||
default:
|
||||
throw new Error(`Invalid dependency type requested: ${type}`)
|
||||
}
|
||||
}
|
||||
return fetchers[type]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue