Comparing version 2.7.10 to 2.7.11
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.7.11"></a> | ||
## [2.7.11](https://github.com/zkat/pacote/compare/v2.7.10...v2.7.11) (2017-05-12) | ||
### Bug Fixes | ||
* **fetch:** make it play nicer with bundlers ([67cd713](https://github.com/zkat/pacote/commit/67cd713)) | ||
<a name="2.7.10"></a> | ||
@@ -7,0 +17,0 @@ ## [2.7.10](https://github.com/zkat/pacote/compare/v2.7.9...v2.7.10) (2017-05-12) |
@@ -29,13 +29,2 @@ 'use strict' | ||
const TYPES = new Set([ | ||
'directory', | ||
'file', | ||
'git', | ||
'hosted', | ||
'range', | ||
'remote', | ||
'tag', | ||
'version' | ||
]) | ||
const fetchers = {} | ||
@@ -51,15 +40,35 @@ | ||
function getFetcher (type) { | ||
if (!TYPES.has(type)) { | ||
throw new Error(`Invalid dependency type requested: ${type}`) | ||
} else if (fetchers[type]) { | ||
return fetchers[type] | ||
} else { | ||
const fetcher = ( | ||
fetchers[type] || | ||
( | ||
fetchers[type] = require(`./fetchers/${type}`) | ||
) | ||
) | ||
return fetcher | ||
if (!fetchers[type]) { | ||
// This is spelled out both to prevent sketchy stuff and to make life | ||
// easier for bundlers/preprocessors. | ||
switch (type) { | ||
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] | ||
} |
{ | ||
"name": "pacote", | ||
"version": "2.7.10", | ||
"version": "2.7.11", | ||
"description": "JavaScript package downloader", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
75271
1519
9