Comparing version 0.40.0 to 0.41.0
"use strict"; | ||
const path = require('path'); | ||
const constantDefaults_1 = require('./constantDefaults'); | ||
const env_1 = require('../env'); | ||
const defaults = () => ({ | ||
@@ -7,4 +10,4 @@ fetchRetries: 2, | ||
fetchRetryMaxtimeout: 6e4, | ||
storePath: 'node_modules/.store', | ||
globalPath: '~/.pnpm', | ||
storePath: getDefaultStorePath(), | ||
globalPath: constantDefaults_1.GlobalPath, | ||
logger: 'pretty', | ||
@@ -18,4 +21,11 @@ ignoreScripts: false, | ||
force: false, | ||
silent: true | ||
silent: true, | ||
depth: 0, | ||
cacheTTL: 60 * 60 * 24, | ||
}); | ||
function getDefaultStorePath() { | ||
if (env_1.preserveSymlinks) | ||
return path.join(constantDefaults_1.GlobalPath, '.store'); | ||
return 'node_modules/.store'; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -22,0 +32,0 @@ exports.default = (opts) => { |
@@ -6,2 +6,3 @@ import { StrictPnpmOptions } from '../types'; | ||
pkg?: Package; | ||
cache: string; | ||
store: string; | ||
@@ -8,0 +9,0 @@ root: string; |
@@ -20,2 +20,3 @@ "use strict"; | ||
const mkdirp_1 = require('../fs/mkdirp'); | ||
const cache_1 = require('./cache'); | ||
const normalizePath = require('normalize-path'); | ||
@@ -34,2 +35,3 @@ function default_1(opts) { | ||
root, | ||
cache: cache_1.getCachePath(opts.globalPath), | ||
store, | ||
@@ -40,2 +42,3 @@ storeJson | ||
logger_1.default(opts.logger); | ||
yield mkdirp_1.default(ctx.cache); | ||
yield mkdirp_1.default(ctx.store); | ||
@@ -42,0 +45,0 @@ return ctx; |
export * from './install'; | ||
export * from './link'; | ||
export * from './prune'; | ||
export * from './cache'; | ||
import uninstall from './uninstall'; | ||
export { uninstall }; |
@@ -8,4 +8,5 @@ "use strict"; | ||
__export(require('./prune')); | ||
__export(require('./cache')); | ||
const uninstall_1 = require('./uninstall'); | ||
exports.uninstall = uninstall_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -36,3 +36,3 @@ "use strict"; | ||
const ctx = yield getContext_1.default(opts); | ||
const installCtx = yield createInstallCmd(opts, ctx.storeJson); | ||
const installCtx = yield createInstallCmd(opts, ctx.storeJson, ctx.cache); | ||
if (!ctx.pkg) | ||
@@ -61,3 +61,3 @@ throw runtimeError_1.default('No package.json found'); | ||
const ctx = yield getContext_1.default(opts); | ||
const installCtx = yield createInstallCmd(opts, ctx.storeJson); | ||
const installCtx = yield createInstallCmd(opts, ctx.storeJson, ctx.cache); | ||
return lock_1.default(ctx.store, () => installInContext('named', packagesToInstall, ctx, installCtx, opts)); | ||
@@ -71,3 +71,3 @@ }); | ||
const oldStoreJson = cloneDeep(ctx.storeJson); | ||
const pkgs = yield installMultiple_1.default(installCtx, packagesToInstall, ctx.pkg && ctx.pkg && ctx.pkg.optionalDependencies || {}, path.join(ctx.root, 'node_modules'), { | ||
const pkgs = yield lock_1.default(ctx.cache, () => installMultiple_1.default(installCtx, packagesToInstall, ctx.pkg && ctx.pkg && ctx.pkg.optionalDependencies || {}, path.join(ctx.root, 'node_modules'), { | ||
linkLocal: opts.linkLocal, | ||
@@ -77,4 +77,6 @@ dependent: ctx.root, | ||
store: ctx.store, | ||
force: opts.force | ||
}); | ||
force: opts.force, | ||
depth: opts.depth, | ||
tag: opts.tag | ||
})); | ||
if (installType === 'named') { | ||
@@ -132,3 +134,3 @@ const saveType = getSaveType_1.default(opts); | ||
} | ||
function createInstallCmd(opts, storeJson) { | ||
function createInstallCmd(opts, storeJson, cache) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -140,3 +142,6 @@ const client = new RegClient(adaptConfig(opts)); | ||
installs: {}, | ||
got: got_1.default(client), | ||
got: got_1.default(client, { | ||
cachePath: cache, | ||
cacheTTL: opts.cacheTTL | ||
}), | ||
storeJson | ||
@@ -143,0 +148,0 @@ }; |
@@ -24,2 +24,3 @@ #!/usr/bin/env node | ||
const installTest_1 = require('../cmd/installTest'); | ||
const cache_1 = require('../cmd/cache'); | ||
const pnpmCmds = { | ||
@@ -31,3 +32,4 @@ install: install_1.default, | ||
prune: prune_1.default, | ||
'install-test': installTest_1.default | ||
'install-test': installTest_1.default, | ||
cache: cache_1.default, | ||
}; | ||
@@ -41,3 +43,4 @@ const supportedCmds = new Set([ | ||
'prune', | ||
'install-test' | ||
'install-test', | ||
'cache', | ||
]); | ||
@@ -44,0 +47,0 @@ function run(argv) { |
@@ -16,2 +16,4 @@ import { ResolveResult } from '../resolve'; | ||
store: string; | ||
depth: number; | ||
tag: string; | ||
}; | ||
@@ -42,2 +44,4 @@ export declare type PackageSpec = { | ||
force: boolean; | ||
depth: number; | ||
tag: string; | ||
}; | ||
@@ -44,0 +48,0 @@ export declare type InstallLog = (msg: string, data?: Object) => void; |
@@ -20,2 +20,3 @@ "use strict"; | ||
const relSymlink_1 = require('../fs/relSymlink'); | ||
const exists = require('exists-file'); | ||
const linkBundledDeps_1 = require('./linkBundledDeps'); | ||
@@ -69,3 +70,4 @@ const isAvailable_1 = require('./isAvailable'); | ||
root: options.parentRoot || options.root, | ||
linkLocal: options.linkLocal | ||
linkLocal: options.linkLocal, | ||
tag: options.tag | ||
}); | ||
@@ -119,3 +121,5 @@ const freshPkg = saveResolution(res); | ||
store: options.store, | ||
force: options.force | ||
force: options.force, | ||
depth: options.depth, | ||
tag: options.tag | ||
}; | ||
@@ -155,12 +159,21 @@ } | ||
function buildToStoreCached(ctx, target, buildInfo, log) { | ||
// If a package is requested for a second time (usually when many packages depend | ||
// on the same thing), only resolve until it's fetched (not built). | ||
if (ctx.fetches[buildInfo.id]) | ||
return ctx.fetches[buildInfo.id]; | ||
return make(target, () => memoize(ctx.builds, buildInfo.id, function () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield memoize(ctx.fetches, buildInfo.id, () => fetchToStore(ctx, target, buildInfo, log)); | ||
return buildInStore(ctx, target, buildInfo, log); | ||
}); | ||
}), buildInfo.force); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// If a package is requested for a second time (usually when many packages depend | ||
// on the same thing), only resolve until it's fetched (not built). | ||
if (ctx.fetches[buildInfo.id]) | ||
return ctx.fetches[buildInfo.id]; | ||
if (!(yield exists(target)) || buildInfo.force) { | ||
yield memoize(ctx.builds, buildInfo.id, function () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield memoize(ctx.fetches, buildInfo.id, () => fetchToStore(ctx, target, buildInfo, log)); | ||
return buildInStore(ctx, target, buildInfo, log); | ||
}); | ||
}); | ||
return; | ||
} | ||
if (buildInfo.keypath.length <= buildInfo.depth) { | ||
const pkg = requireJson_1.default(path.resolve(path.join(target, '_', 'package.json'))); | ||
yield installSubDeps(ctx, target, buildInfo, pkg, log); | ||
} | ||
}); | ||
} | ||
@@ -186,2 +199,15 @@ /** | ||
yield linkBundledDeps_1.default(path.join(target, '_')); | ||
yield installSubDeps(ctx, target, buildInfo, pkg, log); | ||
// symlink itself; . -> node_modules/lodash@4.0.0 | ||
// this way it can require itself | ||
yield symlinkSelf(target, pkg, buildInfo.keypath.length); | ||
ctx.piq = ctx.piq || []; | ||
ctx.piq.push({ | ||
path: target, | ||
pkgId: buildInfo.id | ||
}); | ||
}); | ||
} | ||
function installSubDeps(ctx, target, buildInfo, pkg, log) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// recurse down to dependencies | ||
@@ -197,12 +223,6 @@ log('dependencies'); | ||
store: buildInfo.store, | ||
force: buildInfo.force | ||
force: buildInfo.force, | ||
depth: buildInfo.depth, | ||
tag: buildInfo.tag | ||
}); | ||
// symlink itself; . -> node_modules/lodash@4.0.0 | ||
// this way it can require itself | ||
yield symlinkSelf(target, pkg, buildInfo.keypath.length); | ||
ctx.piq = ctx.piq || []; | ||
ctx.piq.push({ | ||
path: target, | ||
pkgId: buildInfo.id | ||
}); | ||
}); | ||
@@ -253,20 +273,2 @@ } | ||
/** | ||
* If `path` doesn't exist, run `fn()`. | ||
* If it exists (and installation is not forced), don't do anything. | ||
*/ | ||
function make(path, fn, force) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
try { | ||
yield fs.stat(path); | ||
if (force) | ||
return fn(); | ||
} | ||
catch (err) { | ||
if (err.code !== 'ENOENT') | ||
throw err; | ||
return fn(); | ||
} | ||
}); | ||
} | ||
/** | ||
* Save promises for later | ||
@@ -273,0 +275,0 @@ */ |
@@ -11,3 +11,2 @@ "use strict"; | ||
const path = require('path'); | ||
const semver = require('semver'); | ||
const normalizePath = require('normalize-path'); | ||
@@ -21,4 +20,3 @@ const common_tags_1 = require('common-tags'); | ||
const binify_1 = require('../binify'); | ||
const preserveSymlinks = semver.satisfies(process.version, '>=6.3.0'); | ||
const isWindows = process.platform === 'win32'; | ||
const env_1 = require('../env'); | ||
function linkAllBins(modules) { | ||
@@ -58,4 +56,4 @@ return __awaiter(this, void 0, void 0, function* () { | ||
const targetPath = normalizePath(path.join(pkg.name, actualBin)); | ||
if (isWindows) { | ||
if (!preserveSymlinks) { | ||
if (env_1.isWindows) { | ||
if (!env_1.preserveSymlinks) { | ||
return cmdShim(externalBinPath, '../' + targetPath); | ||
@@ -67,3 +65,3 @@ } | ||
} | ||
if (!preserveSymlinks) { | ||
if (!env_1.preserveSymlinks) { | ||
yield makeExecutable(path.join(target, actualBin)); | ||
@@ -90,3 +88,3 @@ return relSymlink_1.default(path.join(target, actualBin), externalBinPath); | ||
function cmdShim(proxyPath, targetPath) { | ||
const nodeOptions = preserveSymlinks ? '--preserve-symlinks' : ''; | ||
const nodeOptions = env_1.preserveSymlinks ? '--preserve-symlinks' : ''; | ||
const cmdContent = common_tags_1.stripIndent ` | ||
@@ -93,0 +91,0 @@ @IF EXIST "%~dp0\\node.exe" ( |
@@ -33,3 +33,4 @@ "use strict"; | ||
logger.on('progress', (pkg, level, pkgSpec, status, args) => { | ||
const pkgData = pkgDataMap[pkgSpec]; // package.json | ||
// the `|| {}` is a temporal fix. For some reason package.json is not logged when it is taken from cache | ||
const pkgData = pkgDataMap[pkgSpec] || {}; // package.json | ||
const res = resMap[pkgSpec]; // resolution | ||
@@ -36,0 +37,0 @@ // lazy get task |
import { IncomingMessage } from 'http'; | ||
export declare type RequestParams = { | ||
headers?: { | ||
auth: string; | ||
authorization: string; | ||
}; | ||
@@ -22,2 +22,5 @@ }; | ||
fetch: Function; | ||
}, opts: { | ||
cachePath: string; | ||
cacheTTL: number; | ||
}) => { | ||
@@ -24,0 +27,0 @@ get: (url: string) => Promise<{ |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments)).next()); | ||
}); | ||
}; | ||
const pauseStream = require('pause-stream'); | ||
const getAuthToken = require('registry-auth-token'); | ||
const createCache_1 = require('./createCache'); | ||
const memoize = require('lodash.memoize'); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = (client) => { | ||
const cache = {}; | ||
function get(url, options) { | ||
const key = JSON.stringify([url, options]); | ||
if (!cache[key]) { | ||
cache[key] = new Promise((resolve, reject) => { | ||
client.get(url, extend(url, options), (err, data, raw, res) => { | ||
exports.default = (client, opts) => { | ||
const cache = createCache_1.default({ | ||
ttl: opts.cacheTTL, | ||
path: opts.cachePath | ||
}); | ||
function get(url) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const cachedValue = yield cache.get(url); | ||
if (cachedValue) | ||
return cachedValue; | ||
const value = yield new Promise((resolve, reject) => { | ||
client.get(url, createOptions(url), (err, data, raw, res) => { | ||
if (err) | ||
@@ -17,10 +32,13 @@ return reject(err); | ||
}); | ||
} | ||
return cache[key]; | ||
cache.set(url, value); | ||
return value; | ||
}); | ||
} | ||
function getJSON(url, options) { | ||
const key = JSON.stringify([url, options]); | ||
if (!cache[key]) { | ||
cache[key] = new Promise((resolve, reject) => { | ||
client.get(url, extend(url, options), (err, data, raw, res) => { | ||
function getJSON(url) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const cachedValue = yield cache.get(url); | ||
if (cachedValue) | ||
return cachedValue; | ||
const value = yield new Promise((resolve, reject) => { | ||
client.get(url, createOptions(url), (err, data, raw, res) => { | ||
if (err) | ||
@@ -31,8 +49,9 @@ return reject(err); | ||
}); | ||
} | ||
return cache[key]; | ||
cache.set(url, value); | ||
return value; | ||
}); | ||
} | ||
const getStream = function (url, options) { | ||
const getStream = function (url) { | ||
return new Promise((resolve, reject) => { | ||
client.fetch(url, extend(url, options), (err, res) => { | ||
client.fetch(url, createOptions(url), (err, res) => { | ||
if (err) | ||
@@ -46,18 +65,15 @@ return reject(err); | ||
}; | ||
/** | ||
* Extends request options with authorization headers | ||
*/ | ||
function extend(url, options) { | ||
options = options || {}; | ||
function createOptions(url) { | ||
const authToken = getAuthToken(url, { recursive: true }); | ||
if (authToken) { | ||
options.headers = Object.assign({}, options.headers, { | ||
if (!authToken) | ||
return {}; | ||
return { | ||
headers: { | ||
authorization: `${authToken.type} ${authToken.token}` | ||
}); | ||
} | ||
return options; | ||
} | ||
}; | ||
} | ||
return { | ||
get: get, | ||
getJSON: getJSON, | ||
get: memoize(get), | ||
getJSON: memoize(getJSON), | ||
getStream: getStream | ||
@@ -64,0 +80,0 @@ }; |
@@ -5,23 +5,18 @@ { | ||
{ | ||
"raw": "any-promise@^1.0.0", | ||
"raw": "any-promise@~0.1.0", | ||
"scope": null, | ||
"escapedName": "any-promise", | ||
"name": "any-promise", | ||
"rawSpec": "^1.0.0", | ||
"spec": ">=1.0.0 <2.0.0", | ||
"rawSpec": "~0.1.0", | ||
"spec": ">=0.1.0 <0.2.0", | ||
"type": "range" | ||
}, | ||
"/home/zkochan/src/pnpm/node_modules/mz" | ||
"/home/zkochan/src/pnpm/node_modules/fs-promise" | ||
] | ||
], | ||
"_from": "any-promise@>=1.0.0 <2.0.0", | ||
"_id": "any-promise@1.3.0", | ||
"_from": "any-promise@>=0.1.0 <0.2.0", | ||
"_id": "any-promise@0.1.0", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/any-promise", | ||
"_nodeVersion": "6.0.0", | ||
"_npmOperationalInternal": { | ||
"host": "packages-16-east.internal.npmjs.com", | ||
"tmp": "tmp/any-promise-1.3.0.tgz_1462709704988_0.08345960266888142" | ||
}, | ||
"_npmUser": { | ||
@@ -31,28 +26,25 @@ "name": "kevinbeaty", | ||
}, | ||
"_npmVersion": "3.8.6", | ||
"_npmVersion": "1.3.25", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"raw": "any-promise@^1.0.0", | ||
"raw": "any-promise@~0.1.0", | ||
"scope": null, | ||
"escapedName": "any-promise", | ||
"name": "any-promise", | ||
"rawSpec": "^1.0.0", | ||
"spec": ">=1.0.0 <2.0.0", | ||
"rawSpec": "~0.1.0", | ||
"spec": ">=0.1.0 <0.2.0", | ||
"type": "range" | ||
}, | ||
"_requiredBy": [ | ||
"/mz", | ||
"/thenify" | ||
"/fs-promise" | ||
], | ||
"_resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", | ||
"_shasum": "abc6afeedcea52e809cdc0376aed3ce39635d17f", | ||
"_resolved": "https://registry.npmjs.org/any-promise/-/any-promise-0.1.0.tgz", | ||
"_shasum": "830b680aa7e56f33451d4b049f3bd8044498ee27", | ||
"_shrinkwrap": null, | ||
"_spec": "any-promise@^1.0.0", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/mz", | ||
"_spec": "any-promise@~0.1.0", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/fs-promise", | ||
"author": { | ||
"name": "Kevin Beaty" | ||
}, | ||
"browser": { | ||
"./register.js": "./register-shim.js" | ||
}, | ||
"browser": "any-promise-shim.js", | ||
"bugs": { | ||
@@ -64,24 +56,17 @@ "url": "https://github.com/kevinbeaty/any-promise/issues" | ||
"devDependencies": { | ||
"ava": "^0.14.0", | ||
"bluebird": "^3.0.0", | ||
"es6-promise": "^3.0.0", | ||
"is-promise": "^2.0.0", | ||
"lie": "^3.0.0", | ||
"mocha": "^2.0.0", | ||
"native-promise-only": "^0.8.0", | ||
"phantomjs-prebuilt": "^2.0.0", | ||
"pinkie": "^2.0.0", | ||
"promise": "^7.0.0", | ||
"q": "^1.0.0", | ||
"rsvp": "^3.0.0", | ||
"vow": "^0.4.0", | ||
"when": "^3.0.0", | ||
"zuul": "^3.0.0" | ||
"bluebird": "~2.5.3", | ||
"es6-promise": "~2.0.1", | ||
"mocha": "~2.1.0", | ||
"native-promise-only": "~0.7.6-a", | ||
"promise": "~6.0.1", | ||
"promises-aplus-tests": "~2.1.0", | ||
"q": "~1.1.2", | ||
"rsvp": "~3.0.16", | ||
"when": "~3.6.4" | ||
}, | ||
"directories": {}, | ||
"dist": { | ||
"shasum": "abc6afeedcea52e809cdc0376aed3ce39635d17f", | ||
"tarball": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz" | ||
"shasum": "830b680aa7e56f33451d4b049f3bd8044498ee27", | ||
"tarball": "https://registry.npmjs.org/any-promise/-/any-promise-0.1.0.tgz" | ||
}, | ||
"gitHead": "39a1034e7345ca5f0f0a2e6cc82f3bf8e308b2cc", | ||
"homepage": "http://github.com/kevinbeaty/any-promise", | ||
@@ -93,3 +78,3 @@ "keywords": [ | ||
"license": "MIT", | ||
"main": "index.js", | ||
"main": "any-promise.js", | ||
"maintainers": [ | ||
@@ -109,6 +94,5 @@ { | ||
"scripts": { | ||
"test": "ava" | ||
"test": "make test" | ||
}, | ||
"typings": "index.d.ts", | ||
"version": "1.3.0" | ||
"version": "0.1.0" | ||
} |
@@ -5,122 +5,19 @@ ## Any Promise | ||
Let your library support any ES 2015 (ES6) compatible `Promise` and leave the choice to application authors. The application can *optionally* register its preferred `Promise` implementation and it will be exported when requiring `any-promise` from library code. | ||
Let your library support any ES6 compatible Promise library or polyfill and leave the choice to the end user. The end user can install a polyfill or `npm install` their preference before using this library and the installed library will be automatically detected. | ||
If no preference is registered, defaults to the global `Promise` for newer Node.js versions. The browser version defaults to the window `Promise`, so polyfill or register as necessary. | ||
Attempts to load libraries in the following order. The first successful `require` will be exported. | ||
### Usage with global Promise: | ||
- [es6-promise](https://github.com/jakearchibald/es6-promise) | ||
- [promise](https://github.com/then/promise) | ||
- [native-promise-only](https://github.com/getify/native-promise-only) | ||
- [bluebird](https://github.com/petkaantonov/bluebird) | ||
- [rsvp](https://github.com/tildeio/rsvp.js) | ||
- [when](https://github.com/cujojs/when) | ||
- [q](https://github.com/kriskowal/q) | ||
Assuming the global `Promise` is the desired implementation: | ||
If no library is installed, attempts to export the global `Promise` (native or polyfill). The `browserify` version will always export the the global `Promise`, so polyfill as necessary. | ||
```bash | ||
# Install any libraries depending on any-promise | ||
$ npm install mz | ||
``` | ||
If you have multiple libraries installed (e.g. for testing), and would like to specify one you can use the `PROMISE_IMPL` env variable. | ||
The installed libraries will use global Promise by default. | ||
```js | ||
// in library | ||
var Promise = require('any-promise') // the global Promise | ||
function promiseReturningFunction(){ | ||
return new Promise(function(resolve, reject){...}) | ||
} | ||
``` | ||
### Usage with registration: | ||
Assuming `bluebird` is the desired Promise implementation: | ||
```bash | ||
# Install preferred promise library | ||
$ npm install bluebird | ||
# Install any-promise to allow registration | ||
$ npm install any-promise | ||
# Install any libraries you would like to use depending on any-promise | ||
$ npm install mz | ||
``` | ||
Register your preference in the application entry point before any other `require` of packages that load `any-promise`: | ||
```javascript | ||
// top of application index.js or other entry point | ||
require('any-promise/register/bluebird') | ||
// -or- Equivalent to above, but allows customization of Promise library | ||
require('any-promise/register')('bluebird', {Promise: require('bluebird')}) | ||
``` | ||
Now that the implementation is registered, you can use any package depending on `any-promise`: | ||
```javascript | ||
var fsp = require('mz/fs') // mz/fs will use registered bluebird promises | ||
var Promise = require('any-promise') // the registered bluebird promise | ||
``` | ||
It is safe to call `register` multiple times, but it must always be with the same implementation. | ||
Again, registration is *optional*. It should only be called by the application user if overriding the global `Promise` implementation is desired. | ||
### Optional Application Registration | ||
As an application author, you can *optionally* register a preferred `Promise` implementation on application startup (before any call to `require('any-promise')`: | ||
You must register your preference before any call to `require('any-promise')` (by you or required packages), and only one implementation can be registered. Typically, this registration would occur at the top of the application entry point. | ||
#### Registration shortcuts | ||
If you are using a known `Promise` implementation, you can register your preference with a shortcut: | ||
```js | ||
require('any-promise/register/bluebird') | ||
// -or- | ||
import 'any-promise/register/q'; | ||
``` | ||
Shortcut registration is the preferred registration method as it works in the browser and Node.js. It is also convenient for using with `import` and many test runners, that offer a `--require` flag: | ||
``` | ||
$ ava --require=any-promise/register/bluebird test.js | ||
``` | ||
Current known implementations include `bluebird`, `q`, `when`, `rsvp`, `es6-promise`, `promise`, `native-promise-only`, `pinkie`, `vow` and `lie`. If you are not using a known implementation, you can use another registration method described below. | ||
#### Basic Registration | ||
As an alternative to registration shortcuts, you can call the `register` function with the preferred `Promise` implementation. The benefit of this approach is that a `Promise` library can be required by name without being a known implementation. This approach does NOT work in the browser. To use `any-promise` in the browser use either registration shortcuts or specify the `Promise` constructor using advanced registration (see below). | ||
```javascript | ||
require('any-promise/register')('when') | ||
// -or- require('any-promise/register')('any other ES6 compatible library (known or otherwise)') | ||
``` | ||
This registration method will try to detect the `Promise` constructor from requiring the specified implementation. If you would like to specify your own constructor, see advanced registration. | ||
#### Advanced Registration | ||
To use the browser version, you should either install a polyfill or explicitly register the `Promise` constructor: | ||
```javascript | ||
require('any-promise/register')('bluebird', {Promise: require('bluebird')}) | ||
``` | ||
This could also be used for registering a custom `Promise` implementation or subclass. | ||
Your preference will be registered globally, allowing a single registration even if multiple versions of `any-promise` are installed in the NPM dependency tree or are using multiple bundled JavaScript files in the browser. You can bypass this global registration in options: | ||
```javascript | ||
require('../register')('es6-promise', {Promise: require('es6-promise').Promise, global: false}) | ||
``` | ||
### Library Usage | ||
To use any `Promise` constructor, simply require it: | ||
```javascript | ||
var Promise = require('any-promise'); | ||
@@ -142,22 +39,1 @@ | ||
``` | ||
Except noted below, libraries using `any-promise` should only use [documented](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) functions as there is no guarantee which implementation will be chosen by the application author. Libraries should never call `register`, only the application user should call if desired. | ||
#### Advanced Library Usage | ||
If your library needs to branch code based on the registered implementation, you can retrieve it using `var impl = require('any-promise/implementation')`, where `impl` will be the package name (`"bluebird"`, `"when"`, etc.) if registered, `"global.Promise"` if using the global version on Node.js, or `"window.Promise"` if using the browser version. You should always include a default case, as there is no guarantee what package may be registered. | ||
### Support for old Node.js versions | ||
Node.js versions prior to `v0.12` may have contained buggy versions of the global `Promise`. For this reason, the global `Promise` is not loaded automatically for these old versions. If using `any-promise` in Node.js versions versions `<= v0.12`, the user should register a desired implementation. | ||
If an implementation is not registered, `any-promise` will attempt to discover an installed `Promise` implementation. If no implementation can be found, an error will be thrown on `require('any-promise')`. While the auto-discovery usually avoids errors, it is non-deterministic. It is recommended that the user always register a preferred implementation for older Node.js versions. | ||
This auto-discovery is only available for Node.jS versions prior to `v0.12`. Any newer versions will always default to the global `Promise` implementation. | ||
### Related | ||
- [any-observable](https://github.com/sindresorhus/any-observable) - `any-promise` for Observables. | ||
@@ -55,2 +55,4 @@ var aws4 = exports, | ||
request.hostname = headers.Host || headers.host | ||
this.isCodeCommitGit = this.service === 'codecommit' && request.method === 'GIT' | ||
} | ||
@@ -113,3 +115,3 @@ | ||
if (!request.doNotModifyHeaders) { | ||
if (!request.doNotModifyHeaders && !this.isCodeCommitGit) { | ||
if (request.body && !headers['Content-Type'] && !headers['content-type']) | ||
@@ -158,2 +160,5 @@ headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8' | ||
this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, '') | ||
// Remove the trailing 'Z' on the timestamp string for CodeCommit git access | ||
if (this.isCodeCommitGit) this.datetime = this.datetime.slice(0, -1) | ||
} | ||
@@ -208,4 +213,4 @@ return this.datetime | ||
firstValOnly = this.service === 's3', | ||
bodyHash = this.service === 's3' && this.request.signQuery ? | ||
'UNSIGNED-PAYLOAD' : hash(this.request.body || '', 'hex') | ||
bodyHash = this.service === 's3' && this.request.signQuery ? 'UNSIGNED-PAYLOAD' : | ||
(this.isCodeCommitGit ? '' : hash(this.request.body || '', 'hex')) | ||
@@ -212,0 +217,0 @@ if (query) { |
@@ -17,10 +17,10 @@ { | ||
"_from": "aws4@>=1.2.1 <2.0.0", | ||
"_id": "aws4@1.4.1", | ||
"_id": "aws4@1.5.0", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/aws4", | ||
"_nodeVersion": "4.4.3", | ||
"_nodeVersion": "4.5.0", | ||
"_npmOperationalInternal": { | ||
"host": "packages-12-west.internal.npmjs.com", | ||
"tmp": "tmp/aws4-1.4.1.tgz_1462643218465_0.6527479749638587" | ||
"host": "packages-16-east.internal.npmjs.com", | ||
"tmp": "tmp/aws4-1.5.0.tgz_1476226259635_0.2796843808609992" | ||
}, | ||
@@ -31,3 +31,3 @@ "_npmUser": { | ||
}, | ||
"_npmVersion": "2.15.4", | ||
"_npmVersion": "2.15.11", | ||
"_phantomChildren": {}, | ||
@@ -46,4 +46,4 @@ "_requested": { | ||
], | ||
"_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.4.1.tgz", | ||
"_shasum": "fde7d5292466d230e5ee0f4e038d9dfaab08fc61", | ||
"_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz", | ||
"_shasum": "0a29ffb79c31c9e712eeb087e8e7a64b4a56d755", | ||
"_shrinkwrap": null, | ||
@@ -68,6 +68,6 @@ "_spec": "aws4@^1.2.1", | ||
"dist": { | ||
"shasum": "fde7d5292466d230e5ee0f4e038d9dfaab08fc61", | ||
"tarball": "https://registry.npmjs.org/aws4/-/aws4-1.4.1.tgz" | ||
"shasum": "0a29ffb79c31c9e712eeb087e8e7a64b4a56d755", | ||
"tarball": "https://registry.npmjs.org/aws4/-/aws4-1.5.0.tgz" | ||
}, | ||
"gitHead": "f126d3ff80be1ddde0fc6b50bb51a7f199547e81", | ||
"gitHead": "ba136334ee08884c6042c8578a22e376233eef34", | ||
"homepage": "https://github.com/mhart/aws4#readme", | ||
@@ -144,3 +144,3 @@ "keywords": [ | ||
}, | ||
"version": "1.4.1" | ||
"version": "1.5.0" | ||
} |
@@ -437,2 +437,11 @@ aws4 | ||
*/ | ||
// Generate CodeCommit Git access password | ||
var signer = new aws4.RequestSigner({ | ||
service: 'codecommit', | ||
host: 'git-codecommit.us-east-1.amazonaws.com', | ||
method: 'GIT', | ||
path: '/v1/repos/MyAwesomeRepo', | ||
}) | ||
var password = signer.getDateTime() + 'Z' + signer.signature() | ||
``` | ||
@@ -439,0 +448,0 @@ |
@@ -31,3 +31,6 @@ { | ||
"_npmVersion": "2.15.9", | ||
"_phantomChildren": {}, | ||
"_phantomChildren": { | ||
"pseudomap": "1.0.2", | ||
"yallist": "2.0.0" | ||
}, | ||
"_requested": { | ||
@@ -34,0 +37,0 @@ "raw": "cross-spawn@^4.0.2", |
@@ -5,14 +5,14 @@ { | ||
{ | ||
"raw": "extend@~3.0.0", | ||
"raw": "extend@^3.0.0", | ||
"scope": null, | ||
"escapedName": "extend", | ||
"name": "extend", | ||
"rawSpec": "~3.0.0", | ||
"spec": ">=3.0.0 <3.1.0", | ||
"rawSpec": "^3.0.0", | ||
"spec": ">=3.0.0 <4.0.0", | ||
"type": "range" | ||
}, | ||
"/home/zkochan/src/pnpm/node_modules/request" | ||
"/home/zkochan/src/pnpm/node_modules/cache-manager-fs" | ||
] | ||
], | ||
"_from": "extend@>=3.0.0 <3.1.0", | ||
"_from": "extend@>=3.0.0 <4.0.0", | ||
"_id": "extend@3.0.0", | ||
@@ -30,11 +30,12 @@ "_inCache": true, | ||
"_requested": { | ||
"raw": "extend@~3.0.0", | ||
"raw": "extend@^3.0.0", | ||
"scope": null, | ||
"escapedName": "extend", | ||
"name": "extend", | ||
"rawSpec": "~3.0.0", | ||
"spec": ">=3.0.0 <3.1.0", | ||
"rawSpec": "^3.0.0", | ||
"spec": ">=3.0.0 <4.0.0", | ||
"type": "range" | ||
}, | ||
"_requiredBy": [ | ||
"/cache-manager-fs", | ||
"/request" | ||
@@ -45,4 +46,4 @@ ], | ||
"_shrinkwrap": null, | ||
"_spec": "extend@~3.0.0", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/request", | ||
"_spec": "extend@^3.0.0", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/cache-manager-fs", | ||
"author": { | ||
@@ -49,0 +50,0 @@ "name": "Stefan Thomas", |
@@ -106,3 +106,7 @@ exports.alphasort = alphasort | ||
self.cwdAbs = makeAbs(self, self.cwd) | ||
// TODO: is an absolute `cwd` supposed to be resolved against `root`? | ||
// e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') | ||
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) | ||
if (process.platform === "win32") | ||
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") | ||
self.nomount = !!options.nomount | ||
@@ -109,0 +113,0 @@ |
@@ -468,3 +468,3 @@ // Approach: | ||
var abs = this._makeAbs(e) | ||
var abs = isAbsolute(e) ? e : this._makeAbs(e) | ||
@@ -512,6 +512,6 @@ if (this.mark) | ||
function lstatcb_ (er, lstat) { | ||
if (er) | ||
if (er && er.code === 'ENOENT') | ||
return cb() | ||
var isSym = lstat.isSymbolicLink() | ||
var isSym = lstat && lstat.isSymbolicLink() | ||
self.symlinks[abs] = isSym | ||
@@ -521,3 +521,3 @@ | ||
// don't bother doing a readdir in that case. | ||
if (!isSym && !lstat.isDirectory()) { | ||
if (!isSym && lstat && !lstat.isDirectory()) { | ||
self.cache[abs] = 'FILE' | ||
@@ -775,3 +775,3 @@ cb() | ||
Glob.prototype._stat2 = function (f, abs, er, stat, cb) { | ||
if (er) { | ||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { | ||
this.statCache[abs] = false | ||
@@ -784,9 +784,11 @@ return cb() | ||
if (abs.slice(-1) === '/' && !stat.isDirectory()) | ||
if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) | ||
return cb(null, false, stat) | ||
var c = stat.isDirectory() ? 'DIR' : 'FILE' | ||
var c = true | ||
if (stat) | ||
c = stat.isDirectory() ? 'DIR' : 'FILE' | ||
this.cache[abs] = this.cache[abs] || c | ||
if (needDir && c !== 'DIR') | ||
if (needDir && c === 'FILE') | ||
return cb() | ||
@@ -793,0 +795,0 @@ |
@@ -17,3 +17,3 @@ { | ||
"_from": "glob@>=7.0.3 <8.0.0", | ||
"_id": "glob@7.1.0", | ||
"_id": "glob@7.1.1", | ||
"_inCache": true, | ||
@@ -24,4 +24,4 @@ "_installable": true, | ||
"_npmOperationalInternal": { | ||
"host": "packages-12-west.internal.npmjs.com", | ||
"tmp": "tmp/glob-7.1.0.tgz_1474396131090_0.08145137410610914" | ||
"host": "packages-16-east.internal.npmjs.com", | ||
"tmp": "tmp/glob-7.1.1.tgz_1475876991562_0.924720095237717" | ||
}, | ||
@@ -47,4 +47,4 @@ "_npmUser": { | ||
], | ||
"_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.0.tgz", | ||
"_shasum": "36add856d746d0d99e4cc2797bba1ae2c67272fd", | ||
"_resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", | ||
"_shasum": "805211df04faaf1c63a3600306cdf5ade50b2ec8", | ||
"_shrinkwrap": null, | ||
@@ -78,4 +78,4 @@ "_spec": "glob@^7.0.3", | ||
"dist": { | ||
"shasum": "36add856d746d0d99e4cc2797bba1ae2c67272fd", | ||
"tarball": "https://registry.npmjs.org/glob/-/glob-7.1.0.tgz" | ||
"shasum": "805211df04faaf1c63a3600306cdf5ade50b2ec8", | ||
"tarball": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz" | ||
}, | ||
@@ -90,3 +90,3 @@ "engines": { | ||
], | ||
"gitHead": "f65f9eb7eda113528c5257b58fac4ca685ee6c4f", | ||
"gitHead": "bc8d43b736a98a9e289fdfceee9266cff35e5742", | ||
"homepage": "https://github.com/isaacs/node-glob#readme", | ||
@@ -117,3 +117,3 @@ "license": "ISC", | ||
}, | ||
"version": "7.1.0" | ||
"version": "7.1.1" | ||
} |
@@ -253,7 +253,9 @@ module.exports = globSync | ||
} catch (er) { | ||
// lstat failed, doesn't exist | ||
return null | ||
if (er.code === 'ENOENT') { | ||
// lstat failed, doesn't exist | ||
return null | ||
} | ||
} | ||
var isSym = lstat.isSymbolicLink() | ||
var isSym = lstat && lstat.isSymbolicLink() | ||
this.symlinks[abs] = isSym | ||
@@ -263,3 +265,3 @@ | ||
// don't bother doing a readdir in that case. | ||
if (!isSym && !lstat.isDirectory()) | ||
if (!isSym && lstat && !lstat.isDirectory()) | ||
this.cache[abs] = 'FILE' | ||
@@ -449,6 +451,9 @@ else | ||
} catch (er) { | ||
return false | ||
if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { | ||
this.statCache[abs] = false | ||
return false | ||
} | ||
} | ||
if (lstat.isSymbolicLink()) { | ||
if (lstat && lstat.isSymbolicLink()) { | ||
try { | ||
@@ -466,6 +471,9 @@ stat = fs.statSync(abs) | ||
var c = stat.isDirectory() ? 'DIR' : 'FILE' | ||
var c = true | ||
if (stat) | ||
c = stat.isDirectory() ? 'DIR' : 'FILE' | ||
this.cache[abs] = this.cache[abs] || c | ||
if (needDir && c !== 'DIR') | ||
if (needDir && c === 'FILE') | ||
return false | ||
@@ -472,0 +480,0 @@ |
@@ -22,15 +22,25 @@ var wrappy = require('wrappy') | ||
var args = slice(arguments) | ||
for (var i = 0; i < len; i++) { | ||
cbs[i].apply(null, args) | ||
// XXX It's somewhat ambiguous whether a new callback added in this | ||
// pass should be queued for later execution if something in the | ||
// list of callbacks throws, or if it should just be discarded. | ||
// However, it's such an edge case that it hardly matters, and either | ||
// choice is likely as surprising as the other. | ||
// As it happens, we do go ahead and schedule it for later execution. | ||
try { | ||
for (var i = 0; i < len; i++) { | ||
cbs[i].apply(null, args) | ||
} | ||
} finally { | ||
if (cbs.length > len) { | ||
// added more in the interim. | ||
// de-zalgo, just in case, but don't call again. | ||
cbs.splice(0, len) | ||
process.nextTick(function () { | ||
RES.apply(null, args) | ||
}) | ||
} else { | ||
delete reqs[key] | ||
} | ||
} | ||
if (cbs.length > len) { | ||
// added more in the interim. | ||
// de-zalgo, just in case, but don't call again. | ||
cbs.splice(0, len) | ||
process.nextTick(function () { | ||
RES.apply(null, args) | ||
}) | ||
} else { | ||
delete reqs[key] | ||
} | ||
}) | ||
@@ -37,0 +47,0 @@ } |
@@ -17,16 +17,16 @@ { | ||
"_from": "inflight@>=1.0.4 <2.0.0", | ||
"_id": "inflight@1.0.5", | ||
"_id": "inflight@1.0.6", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/inflight", | ||
"_nodeVersion": "5.10.1", | ||
"_nodeVersion": "6.5.0", | ||
"_npmOperationalInternal": { | ||
"host": "packages-12-west.internal.npmjs.com", | ||
"tmp": "tmp/inflight-1.0.5.tgz_1463529611443_0.00041943578980863094" | ||
"host": "packages-16-east.internal.npmjs.com", | ||
"tmp": "tmp/inflight-1.0.6.tgz_1476330807696_0.10388551792129874" | ||
}, | ||
"_npmUser": { | ||
"name": "zkat", | ||
"email": "kat@sykosomatic.org" | ||
"name": "isaacs", | ||
"email": "i@izs.me" | ||
}, | ||
"_npmVersion": "3.9.1", | ||
"_npmVersion": "3.10.7", | ||
"_phantomChildren": {}, | ||
@@ -45,4 +45,4 @@ "_requested": { | ||
], | ||
"_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz", | ||
"_shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", | ||
"_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", | ||
"_shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9", | ||
"_shrinkwrap": null, | ||
@@ -65,8 +65,8 @@ "_spec": "inflight@^1.0.4", | ||
"devDependencies": { | ||
"tap": "^1.2.0" | ||
"tap": "^7.1.2" | ||
}, | ||
"directories": {}, | ||
"dist": { | ||
"shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", | ||
"tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz" | ||
"shasum": "49bd6331d7d02d0c09bc910a1075ba8165b56df9", | ||
"tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" | ||
}, | ||
@@ -76,3 +76,3 @@ "files": [ | ||
], | ||
"gitHead": "559e37b4f6327fca797fe8d7fe8ed6d9cae08821", | ||
"gitHead": "a547881738c8f57b27795e584071d67cf6ac1a57", | ||
"homepage": "https://github.com/isaacs/inflight", | ||
@@ -107,5 +107,5 @@ "license": "ISC", | ||
"scripts": { | ||
"test": "tap test.js" | ||
"test": "tap test.js --100" | ||
}, | ||
"version": "1.0.5" | ||
"version": "1.0.6" | ||
} |
@@ -15,3 +15,2 @@ module.exports = LRUCache | ||
var makeSymbol | ||
/* istanbul ignore if */ | ||
if (hasSymbol) { | ||
@@ -18,0 +17,0 @@ makeSymbol = function (key) { |
@@ -5,23 +5,19 @@ { | ||
{ | ||
"raw": "lru-cache@^4.0.1", | ||
"raw": "lru-cache@4.0.0", | ||
"scope": null, | ||
"escapedName": "lru-cache", | ||
"name": "lru-cache", | ||
"rawSpec": "^4.0.1", | ||
"spec": ">=4.0.1 <5.0.0", | ||
"type": "range" | ||
"rawSpec": "4.0.0", | ||
"spec": "4.0.0", | ||
"type": "version" | ||
}, | ||
"/home/zkochan/src/pnpm/node_modules/cross-spawn" | ||
"/home/zkochan/src/pnpm/node_modules/cache-manager" | ||
] | ||
], | ||
"_from": "lru-cache@>=4.0.1 <5.0.0", | ||
"_id": "lru-cache@4.0.1", | ||
"_from": "lru-cache@4.0.0", | ||
"_id": "lru-cache@4.0.0", | ||
"_inCache": true, | ||
"_installable": true, | ||
"_location": "/lru-cache", | ||
"_nodeVersion": "5.6.0", | ||
"_npmOperationalInternal": { | ||
"host": "packages-12-west.internal.npmjs.com", | ||
"tmp": "tmp/lru-cache-4.0.1.tgz_1458667372415_0.8005518841091543" | ||
}, | ||
"_nodeVersion": "4.0.0", | ||
"_npmUser": { | ||
@@ -31,21 +27,22 @@ "name": "isaacs", | ||
}, | ||
"_npmVersion": "3.7.3", | ||
"_npmVersion": "3.3.2", | ||
"_phantomChildren": {}, | ||
"_requested": { | ||
"raw": "lru-cache@^4.0.1", | ||
"raw": "lru-cache@4.0.0", | ||
"scope": null, | ||
"escapedName": "lru-cache", | ||
"name": "lru-cache", | ||
"rawSpec": "^4.0.1", | ||
"spec": ">=4.0.1 <5.0.0", | ||
"type": "range" | ||
"rawSpec": "4.0.0", | ||
"spec": "4.0.0", | ||
"type": "version" | ||
}, | ||
"_requiredBy": [ | ||
"/cross-spawn" | ||
"/cache-manager", | ||
"/cache-manager-fs/cache-manager" | ||
], | ||
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.1.tgz", | ||
"_shasum": "1343955edaf2e37d9b9e7ee7241e27c4b9fb72be", | ||
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.0.tgz", | ||
"_shasum": "b5cbf01556c16966febe54ceec0fb4dc90df6c28", | ||
"_shrinkwrap": null, | ||
"_spec": "lru-cache@^4.0.1", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/cross-spawn", | ||
"_spec": "lru-cache@4.0.0", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/cache-manager", | ||
"author": { | ||
@@ -65,13 +62,10 @@ "name": "Isaac Z. Schlueter", | ||
"standard": "^5.4.1", | ||
"tap": "^5.1.1" | ||
"tap": "^2.3.3" | ||
}, | ||
"directories": {}, | ||
"dist": { | ||
"shasum": "1343955edaf2e37d9b9e7ee7241e27c4b9fb72be", | ||
"tarball": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.1.tgz" | ||
"shasum": "b5cbf01556c16966febe54ceec0fb4dc90df6c28", | ||
"tarball": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.0.0.tgz" | ||
}, | ||
"files": [ | ||
"lib/lru-cache.js" | ||
], | ||
"gitHead": "6cd8c8a43cf56c585bdb696faae94f9836cb9e28", | ||
"gitHead": "da374d4776aaef443765b43cb3617e09c170a5d5", | ||
"homepage": "https://github.com/isaacs/node-lru-cache#readme", | ||
@@ -104,5 +98,5 @@ "keywords": [ | ||
"posttest": "standard test/*.js lib/*.js", | ||
"test": "tap test --branches=100 --functions=100 --lines=100 --statements=100" | ||
"test": "tap test --cov" | ||
}, | ||
"version": "4.0.1" | ||
"version": "4.0.0" | ||
} |
@@ -119,3 +119,3 @@ # lru cache | ||
* `length` | ||
* `length()` | ||
@@ -122,0 +122,0 @@ Return total length of objects in cache taking into account |
@@ -5,14 +5,14 @@ { | ||
{ | ||
"raw": "pinkie-promise@^2.0.0", | ||
"raw": "pinkie-promise@*", | ||
"scope": null, | ||
"escapedName": "pinkie-promise", | ||
"name": "pinkie-promise", | ||
"rawSpec": "^2.0.0", | ||
"spec": ">=2.0.0 <3.0.0", | ||
"rawSpec": "*", | ||
"spec": "*", | ||
"type": "range" | ||
}, | ||
"/home/zkochan/src/pnpm/node_modules/path-exists" | ||
"/home/zkochan/src/pnpm/node_modules/cb2promise" | ||
] | ||
], | ||
"_from": "pinkie-promise@>=2.0.0 <3.0.0", | ||
"_from": "pinkie-promise@*", | ||
"_id": "pinkie-promise@2.0.1", | ||
@@ -34,11 +34,12 @@ "_inCache": true, | ||
"_requested": { | ||
"raw": "pinkie-promise@^2.0.0", | ||
"raw": "pinkie-promise@*", | ||
"scope": null, | ||
"escapedName": "pinkie-promise", | ||
"name": "pinkie-promise", | ||
"rawSpec": "^2.0.0", | ||
"spec": ">=2.0.0 <3.0.0", | ||
"rawSpec": "*", | ||
"spec": "*", | ||
"type": "range" | ||
}, | ||
"_requiredBy": [ | ||
"/cb2promise", | ||
"/got", | ||
@@ -55,4 +56,4 @@ "/har-validator", | ||
"_shrinkwrap": null, | ||
"_spec": "pinkie-promise@^2.0.0", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/path-exists", | ||
"_spec": "pinkie-promise@*", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/cb2promise", | ||
"author": { | ||
@@ -59,0 +60,0 @@ "name": "Vsevolod Strukchinsky", |
@@ -38,2 +38,3 @@ { | ||
"_requiredBy": [ | ||
"/cross-spawn/lru-cache", | ||
"/lru-cache" | ||
@@ -40,0 +41,0 @@ ], |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"/home/zkochan/src/pnpm/node_modules/configstore" | ||
"/home/zkochan/src/pnpm/node_modules/cache-manager-fs" | ||
] | ||
@@ -43,2 +43,3 @@ ], | ||
"_requiredBy": [ | ||
"/cache-manager-fs", | ||
"/configstore" | ||
@@ -50,3 +51,3 @@ ], | ||
"_spec": "uuid@^2.0.1", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/configstore", | ||
"_where": "/home/zkochan/src/pnpm/node_modules/cache-manager-fs", | ||
"author": { | ||
@@ -53,0 +54,0 @@ "name": "Robert Kieffer", |
@@ -38,2 +38,3 @@ { | ||
"_requiredBy": [ | ||
"/cross-spawn/lru-cache", | ||
"/lru-cache" | ||
@@ -40,0 +41,0 @@ ], |
@@ -21,2 +21,3 @@ import { PackageSpec } from '../install'; | ||
linkLocal: boolean; | ||
tag: string; | ||
}; | ||
@@ -23,0 +24,0 @@ /** |
@@ -38,3 +38,3 @@ "use strict"; | ||
const parsedBody = (yield opts.got.getJSON(url)); | ||
const correctPkg = pickVersionFromRegistryDocument(parsedBody, spec); | ||
const correctPkg = pickVersionFromRegistryDocument(parsedBody, spec, opts.tag); | ||
return { | ||
@@ -58,3 +58,3 @@ id: createPkgId_1.default(correctPkg), | ||
exports.default = resolveNpm; | ||
function pickVersionFromRegistryDocument(pkg, dep) { | ||
function pickVersionFromRegistryDocument(pkg, dep, latestTag) { | ||
const versions = Object.keys(pkg.versions); | ||
@@ -68,2 +68,6 @@ if (dep.type === 'tag') { | ||
else { | ||
const latest = pkg['dist-tags'][latestTag]; | ||
if (semver.satisfies(latest, dep.spec, true)) { | ||
return pkg.versions[latest]; | ||
} | ||
const maxVersion = semver.maxSatisfying(versions, dep.spec, true); | ||
@@ -70,0 +74,0 @@ if (maxVersion) { |
@@ -17,2 +17,5 @@ "use strict"; | ||
} | ||
else { | ||
PATH = 'PATH'; | ||
} | ||
function runScript(command, args, opts) { | ||
@@ -19,0 +22,0 @@ opts = Object.assign({ log: (() => { }) }, opts); |
@@ -21,2 +21,3 @@ import { LoggerType } from './logger'; | ||
linkLocal?: boolean; | ||
depth?: number; | ||
proxy?: string; | ||
@@ -31,2 +32,3 @@ httpsProxy?: string; | ||
tag?: string; | ||
cacheTTL?: number; | ||
}; | ||
@@ -52,2 +54,3 @@ export declare type StrictPnpmOptions = { | ||
linkLocal: boolean; | ||
depth: number; | ||
proxy?: string; | ||
@@ -62,2 +65,3 @@ httpsProxy?: string; | ||
tag: string; | ||
cacheTTL: number; | ||
}; | ||
@@ -64,0 +68,0 @@ export declare type Dependencies = { |
{ | ||
"name": "pnpm", | ||
"description": "A fast implementation of npm install", | ||
"version": "0.40.0", | ||
"version": "0.41.0", | ||
"author": "Rico Sta. Cruz <rico@ricostacruz.com>", | ||
@@ -21,2 +21,4 @@ "bin": { | ||
"byline": "5.0.0", | ||
"cache-manager": "2.1.2", | ||
"cache-manager-fs": "1.0.5", | ||
"camelcase-keys": "4.0.0", | ||
@@ -29,2 +31,3 @@ "chalk": "1.1.3", | ||
"delocalize-dependencies": "0.1.0", | ||
"exists-file": "3.0.0", | ||
"find-up": "2.0.0", | ||
@@ -37,2 +40,3 @@ "gunzip-maybe": "1.3.1", | ||
"lodash.clonedeep": "4.5.0", | ||
"lodash.memoize": "4.1.2", | ||
"loud-rejection": "1.6.0", | ||
@@ -64,2 +68,4 @@ "meow": "3.7.0", | ||
"devDependencies": { | ||
"@zkochan/sinopia": "1.0.0", | ||
"anonymous-npm-registry-client": "0.1.2", | ||
"cash-rm": "0.2.0", | ||
@@ -69,3 +75,4 @@ "caw": "2.0.0", | ||
"cz-conventional-changelog": "^1.2.0", | ||
"docpress": "0.6.13", | ||
"docpress": "0.7.0", | ||
"exists-link": "1.0.0", | ||
"ghooks": "^1.3.2", | ||
@@ -78,8 +85,9 @@ "git-update-ghpages": "1.3.0", | ||
"nixt": "0.5.0", | ||
"npm-run-all": "3.1.0", | ||
"sepia": "2.0.1", | ||
"standard": "8.3.0", | ||
"tap-diff": "0.1.1", | ||
"tape": "4.6.1", | ||
"tape": "4.6.2", | ||
"tape-promise": "1.1.0", | ||
"ts-node": "1.3.0", | ||
"ts-node": "1.4.1", | ||
"tslint": "3.15.1", | ||
@@ -112,3 +120,5 @@ "typescript": "2.0.3", | ||
"lint": "standard && tslint -c tslint.json ./src/**/*.ts ./test/**/*.ts", | ||
"test": "npm run lint && ts-node test | tap-diff", | ||
"sinopia": "sinopia -c ./sinopia/config.yaml", | ||
"test:e2e": "ts-node test | tap-diff", | ||
"test": "node node_modules/npm-run-all/bin/npm-run-all lint -p -r sinopia test:e2e", | ||
"posttest": "rm -rf .tmp", | ||
@@ -115,0 +125,0 @@ "prerelease": "npm run tsc && npm test", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 2 instances 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
13462041
5375
214391
25
7
428
82