0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-03-25 02:32:52 -05:00

Merge pull request #556 from verdaccio/es6-improve

Increase flow support and es6
This commit is contained in:
Juan Picado @jotadeveloper 2018-02-04 14:51:28 +01:00 committed by GitHub
commit ab4235c7f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 4944 additions and 425 deletions

2
.yarnrc Normal file
View file

@ -0,0 +1,2 @@
save-prefix ""
registry "http://registry.npmjs.org/"

199
flow-typed/npm/JSONStream_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,199 @@
// flow-typed signature: 12a8262920099086254f18882b49d862
// flow-typed version: <<STUB>>/JSONStream_v1.3.2/flow_v0.64.0
/**
* This is an autogenerated libdef stub for:
*
* 'JSONStream'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'JSONStream' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'JSONStream/bin' {
declare module.exports: any;
}
declare module 'JSONStream/examples/all_docs' {
declare module.exports: any;
}
declare module 'JSONStream/test/bool' {
declare module.exports: any;
}
declare module 'JSONStream/test/browser' {
declare module.exports: any;
}
declare module 'JSONStream/test/destroy_missing' {
declare module.exports: any;
}
declare module 'JSONStream/test/disabled/doubledot1' {
declare module.exports: any;
}
declare module 'JSONStream/test/disabled/doubledot2' {
declare module.exports: any;
}
declare module 'JSONStream/test/empty' {
declare module.exports: any;
}
declare module 'JSONStream/test/error_contents' {
declare module.exports: any;
}
declare module 'JSONStream/test/fn' {
declare module.exports: any;
}
declare module 'JSONStream/test/gen' {
declare module.exports: any;
}
declare module 'JSONStream/test/header_footer' {
declare module.exports: any;
}
declare module 'JSONStream/test/issues' {
declare module.exports: any;
}
declare module 'JSONStream/test/keys' {
declare module.exports: any;
}
declare module 'JSONStream/test/map' {
declare module.exports: any;
}
declare module 'JSONStream/test/multiple_objects_error' {
declare module.exports: any;
}
declare module 'JSONStream/test/multiple_objects' {
declare module.exports: any;
}
declare module 'JSONStream/test/null' {
declare module.exports: any;
}
declare module 'JSONStream/test/parsejson' {
declare module.exports: any;
}
declare module 'JSONStream/test/stringify_object' {
declare module.exports: any;
}
declare module 'JSONStream/test/stringify' {
declare module.exports: any;
}
declare module 'JSONStream/test/test' {
declare module.exports: any;
}
declare module 'JSONStream/test/test2' {
declare module.exports: any;
}
declare module 'JSONStream/test/two-ways' {
declare module.exports: any;
}
// Filename aliases
declare module 'JSONStream/bin.js' {
declare module.exports: $Exports<'JSONStream/bin'>;
}
declare module 'JSONStream/examples/all_docs.js' {
declare module.exports: $Exports<'JSONStream/examples/all_docs'>;
}
declare module 'JSONStream/index' {
declare module.exports: $Exports<'JSONStream'>;
}
declare module 'JSONStream/index.js' {
declare module.exports: $Exports<'JSONStream'>;
}
declare module 'JSONStream/test/bool.js' {
declare module.exports: $Exports<'JSONStream/test/bool'>;
}
declare module 'JSONStream/test/browser.js' {
declare module.exports: $Exports<'JSONStream/test/browser'>;
}
declare module 'JSONStream/test/destroy_missing.js' {
declare module.exports: $Exports<'JSONStream/test/destroy_missing'>;
}
declare module 'JSONStream/test/disabled/doubledot1.js' {
declare module.exports: $Exports<'JSONStream/test/disabled/doubledot1'>;
}
declare module 'JSONStream/test/disabled/doubledot2.js' {
declare module.exports: $Exports<'JSONStream/test/disabled/doubledot2'>;
}
declare module 'JSONStream/test/empty.js' {
declare module.exports: $Exports<'JSONStream/test/empty'>;
}
declare module 'JSONStream/test/error_contents.js' {
declare module.exports: $Exports<'JSONStream/test/error_contents'>;
}
declare module 'JSONStream/test/fn.js' {
declare module.exports: $Exports<'JSONStream/test/fn'>;
}
declare module 'JSONStream/test/gen.js' {
declare module.exports: $Exports<'JSONStream/test/gen'>;
}
declare module 'JSONStream/test/header_footer.js' {
declare module.exports: $Exports<'JSONStream/test/header_footer'>;
}
declare module 'JSONStream/test/issues.js' {
declare module.exports: $Exports<'JSONStream/test/issues'>;
}
declare module 'JSONStream/test/keys.js' {
declare module.exports: $Exports<'JSONStream/test/keys'>;
}
declare module 'JSONStream/test/map.js' {
declare module.exports: $Exports<'JSONStream/test/map'>;
}
declare module 'JSONStream/test/multiple_objects_error.js' {
declare module.exports: $Exports<'JSONStream/test/multiple_objects_error'>;
}
declare module 'JSONStream/test/multiple_objects.js' {
declare module.exports: $Exports<'JSONStream/test/multiple_objects'>;
}
declare module 'JSONStream/test/null.js' {
declare module.exports: $Exports<'JSONStream/test/null'>;
}
declare module 'JSONStream/test/parsejson.js' {
declare module.exports: $Exports<'JSONStream/test/parsejson'>;
}
declare module 'JSONStream/test/stringify_object.js' {
declare module.exports: $Exports<'JSONStream/test/stringify_object'>;
}
declare module 'JSONStream/test/stringify.js' {
declare module.exports: $Exports<'JSONStream/test/stringify'>;
}
declare module 'JSONStream/test/test.js' {
declare module.exports: $Exports<'JSONStream/test/test'>;
}
declare module 'JSONStream/test/test2.js' {
declare module.exports: $Exports<'JSONStream/test/test2'>;
}
declare module 'JSONStream/test/two-ways.js' {
declare module.exports: $Exports<'JSONStream/test/two-ways'>;
}

913
flow-typed/npm/async_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,913 @@
// flow-typed signature: 9f4aa70155d93ad082ea38137cded473
// flow-typed version: <<STUB>>/async_v2.6.0/flow_v0.64.0
/**
* This is an autogenerated libdef stub for:
*
* 'async'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'async' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'async/all' {
declare module.exports: any;
}
declare module 'async/allLimit' {
declare module.exports: any;
}
declare module 'async/allSeries' {
declare module.exports: any;
}
declare module 'async/any' {
declare module.exports: any;
}
declare module 'async/anyLimit' {
declare module.exports: any;
}
declare module 'async/anySeries' {
declare module.exports: any;
}
declare module 'async/apply' {
declare module.exports: any;
}
declare module 'async/applyEach' {
declare module.exports: any;
}
declare module 'async/applyEachSeries' {
declare module.exports: any;
}
declare module 'async/asyncify' {
declare module.exports: any;
}
declare module 'async/auto' {
declare module.exports: any;
}
declare module 'async/autoInject' {
declare module.exports: any;
}
declare module 'async/cargo' {
declare module.exports: any;
}
declare module 'async/compose' {
declare module.exports: any;
}
declare module 'async/concat' {
declare module.exports: any;
}
declare module 'async/concatLimit' {
declare module.exports: any;
}
declare module 'async/concatSeries' {
declare module.exports: any;
}
declare module 'async/constant' {
declare module.exports: any;
}
declare module 'async/detect' {
declare module.exports: any;
}
declare module 'async/detectLimit' {
declare module.exports: any;
}
declare module 'async/detectSeries' {
declare module.exports: any;
}
declare module 'async/dir' {
declare module.exports: any;
}
declare module 'async/dist/async' {
declare module.exports: any;
}
declare module 'async/dist/async.min' {
declare module.exports: any;
}
declare module 'async/doDuring' {
declare module.exports: any;
}
declare module 'async/doUntil' {
declare module.exports: any;
}
declare module 'async/doWhilst' {
declare module.exports: any;
}
declare module 'async/during' {
declare module.exports: any;
}
declare module 'async/each' {
declare module.exports: any;
}
declare module 'async/eachLimit' {
declare module.exports: any;
}
declare module 'async/eachOf' {
declare module.exports: any;
}
declare module 'async/eachOfLimit' {
declare module.exports: any;
}
declare module 'async/eachOfSeries' {
declare module.exports: any;
}
declare module 'async/eachSeries' {
declare module.exports: any;
}
declare module 'async/ensureAsync' {
declare module.exports: any;
}
declare module 'async/every' {
declare module.exports: any;
}
declare module 'async/everyLimit' {
declare module.exports: any;
}
declare module 'async/everySeries' {
declare module.exports: any;
}
declare module 'async/filter' {
declare module.exports: any;
}
declare module 'async/filterLimit' {
declare module.exports: any;
}
declare module 'async/filterSeries' {
declare module.exports: any;
}
declare module 'async/find' {
declare module.exports: any;
}
declare module 'async/findLimit' {
declare module.exports: any;
}
declare module 'async/findSeries' {
declare module.exports: any;
}
declare module 'async/foldl' {
declare module.exports: any;
}
declare module 'async/foldr' {
declare module.exports: any;
}
declare module 'async/forEach' {
declare module.exports: any;
}
declare module 'async/forEachLimit' {
declare module.exports: any;
}
declare module 'async/forEachOf' {
declare module.exports: any;
}
declare module 'async/forEachOfLimit' {
declare module.exports: any;
}
declare module 'async/forEachOfSeries' {
declare module.exports: any;
}
declare module 'async/forEachSeries' {
declare module.exports: any;
}
declare module 'async/forever' {
declare module.exports: any;
}
declare module 'async/groupBy' {
declare module.exports: any;
}
declare module 'async/groupByLimit' {
declare module.exports: any;
}
declare module 'async/groupBySeries' {
declare module.exports: any;
}
declare module 'async/inject' {
declare module.exports: any;
}
declare module 'async/internal/applyEach' {
declare module.exports: any;
}
declare module 'async/internal/breakLoop' {
declare module.exports: any;
}
declare module 'async/internal/consoleFunc' {
declare module.exports: any;
}
declare module 'async/internal/createTester' {
declare module.exports: any;
}
declare module 'async/internal/doLimit' {
declare module.exports: any;
}
declare module 'async/internal/doParallel' {
declare module.exports: any;
}
declare module 'async/internal/doParallelLimit' {
declare module.exports: any;
}
declare module 'async/internal/DoublyLinkedList' {
declare module.exports: any;
}
declare module 'async/internal/eachOfLimit' {
declare module.exports: any;
}
declare module 'async/internal/filter' {
declare module.exports: any;
}
declare module 'async/internal/findGetResult' {
declare module.exports: any;
}
declare module 'async/internal/getIterator' {
declare module.exports: any;
}
declare module 'async/internal/initialParams' {
declare module.exports: any;
}
declare module 'async/internal/iterator' {
declare module.exports: any;
}
declare module 'async/internal/map' {
declare module.exports: any;
}
declare module 'async/internal/notId' {
declare module.exports: any;
}
declare module 'async/internal/once' {
declare module.exports: any;
}
declare module 'async/internal/onlyOnce' {
declare module.exports: any;
}
declare module 'async/internal/parallel' {
declare module.exports: any;
}
declare module 'async/internal/queue' {
declare module.exports: any;
}
declare module 'async/internal/reject' {
declare module.exports: any;
}
declare module 'async/internal/setImmediate' {
declare module.exports: any;
}
declare module 'async/internal/slice' {
declare module.exports: any;
}
declare module 'async/internal/withoutIndex' {
declare module.exports: any;
}
declare module 'async/internal/wrapAsync' {
declare module.exports: any;
}
declare module 'async/log' {
declare module.exports: any;
}
declare module 'async/map' {
declare module.exports: any;
}
declare module 'async/mapLimit' {
declare module.exports: any;
}
declare module 'async/mapSeries' {
declare module.exports: any;
}
declare module 'async/mapValues' {
declare module.exports: any;
}
declare module 'async/mapValuesLimit' {
declare module.exports: any;
}
declare module 'async/mapValuesSeries' {
declare module.exports: any;
}
declare module 'async/memoize' {
declare module.exports: any;
}
declare module 'async/nextTick' {
declare module.exports: any;
}
declare module 'async/parallel' {
declare module.exports: any;
}
declare module 'async/parallelLimit' {
declare module.exports: any;
}
declare module 'async/priorityQueue' {
declare module.exports: any;
}
declare module 'async/queue' {
declare module.exports: any;
}
declare module 'async/race' {
declare module.exports: any;
}
declare module 'async/reduce' {
declare module.exports: any;
}
declare module 'async/reduceRight' {
declare module.exports: any;
}
declare module 'async/reflect' {
declare module.exports: any;
}
declare module 'async/reflectAll' {
declare module.exports: any;
}
declare module 'async/reject' {
declare module.exports: any;
}
declare module 'async/rejectLimit' {
declare module.exports: any;
}
declare module 'async/rejectSeries' {
declare module.exports: any;
}
declare module 'async/retry' {
declare module.exports: any;
}
declare module 'async/retryable' {
declare module.exports: any;
}
declare module 'async/select' {
declare module.exports: any;
}
declare module 'async/selectLimit' {
declare module.exports: any;
}
declare module 'async/selectSeries' {
declare module.exports: any;
}
declare module 'async/seq' {
declare module.exports: any;
}
declare module 'async/series' {
declare module.exports: any;
}
declare module 'async/setImmediate' {
declare module.exports: any;
}
declare module 'async/some' {
declare module.exports: any;
}
declare module 'async/someLimit' {
declare module.exports: any;
}
declare module 'async/someSeries' {
declare module.exports: any;
}
declare module 'async/sortBy' {
declare module.exports: any;
}
declare module 'async/timeout' {
declare module.exports: any;
}
declare module 'async/times' {
declare module.exports: any;
}
declare module 'async/timesLimit' {
declare module.exports: any;
}
declare module 'async/timesSeries' {
declare module.exports: any;
}
declare module 'async/transform' {
declare module.exports: any;
}
declare module 'async/tryEach' {
declare module.exports: any;
}
declare module 'async/unmemoize' {
declare module.exports: any;
}
declare module 'async/until' {
declare module.exports: any;
}
declare module 'async/waterfall' {
declare module.exports: any;
}
declare module 'async/whilst' {
declare module.exports: any;
}
declare module 'async/wrapSync' {
declare module.exports: any;
}
// Filename aliases
declare module 'async/all.js' {
declare module.exports: $Exports<'async/all'>;
}
declare module 'async/allLimit.js' {
declare module.exports: $Exports<'async/allLimit'>;
}
declare module 'async/allSeries.js' {
declare module.exports: $Exports<'async/allSeries'>;
}
declare module 'async/any.js' {
declare module.exports: $Exports<'async/any'>;
}
declare module 'async/anyLimit.js' {
declare module.exports: $Exports<'async/anyLimit'>;
}
declare module 'async/anySeries.js' {
declare module.exports: $Exports<'async/anySeries'>;
}
declare module 'async/apply.js' {
declare module.exports: $Exports<'async/apply'>;
}
declare module 'async/applyEach.js' {
declare module.exports: $Exports<'async/applyEach'>;
}
declare module 'async/applyEachSeries.js' {
declare module.exports: $Exports<'async/applyEachSeries'>;
}
declare module 'async/asyncify.js' {
declare module.exports: $Exports<'async/asyncify'>;
}
declare module 'async/auto.js' {
declare module.exports: $Exports<'async/auto'>;
}
declare module 'async/autoInject.js' {
declare module.exports: $Exports<'async/autoInject'>;
}
declare module 'async/cargo.js' {
declare module.exports: $Exports<'async/cargo'>;
}
declare module 'async/compose.js' {
declare module.exports: $Exports<'async/compose'>;
}
declare module 'async/concat.js' {
declare module.exports: $Exports<'async/concat'>;
}
declare module 'async/concatLimit.js' {
declare module.exports: $Exports<'async/concatLimit'>;
}
declare module 'async/concatSeries.js' {
declare module.exports: $Exports<'async/concatSeries'>;
}
declare module 'async/constant.js' {
declare module.exports: $Exports<'async/constant'>;
}
declare module 'async/detect.js' {
declare module.exports: $Exports<'async/detect'>;
}
declare module 'async/detectLimit.js' {
declare module.exports: $Exports<'async/detectLimit'>;
}
declare module 'async/detectSeries.js' {
declare module.exports: $Exports<'async/detectSeries'>;
}
declare module 'async/dir.js' {
declare module.exports: $Exports<'async/dir'>;
}
declare module 'async/dist/async.js' {
declare module.exports: $Exports<'async/dist/async'>;
}
declare module 'async/dist/async.min.js' {
declare module.exports: $Exports<'async/dist/async.min'>;
}
declare module 'async/doDuring.js' {
declare module.exports: $Exports<'async/doDuring'>;
}
declare module 'async/doUntil.js' {
declare module.exports: $Exports<'async/doUntil'>;
}
declare module 'async/doWhilst.js' {
declare module.exports: $Exports<'async/doWhilst'>;
}
declare module 'async/during.js' {
declare module.exports: $Exports<'async/during'>;
}
declare module 'async/each.js' {
declare module.exports: $Exports<'async/each'>;
}
declare module 'async/eachLimit.js' {
declare module.exports: $Exports<'async/eachLimit'>;
}
declare module 'async/eachOf.js' {
declare module.exports: $Exports<'async/eachOf'>;
}
declare module 'async/eachOfLimit.js' {
declare module.exports: $Exports<'async/eachOfLimit'>;
}
declare module 'async/eachOfSeries.js' {
declare module.exports: $Exports<'async/eachOfSeries'>;
}
declare module 'async/eachSeries.js' {
declare module.exports: $Exports<'async/eachSeries'>;
}
declare module 'async/ensureAsync.js' {
declare module.exports: $Exports<'async/ensureAsync'>;
}
declare module 'async/every.js' {
declare module.exports: $Exports<'async/every'>;
}
declare module 'async/everyLimit.js' {
declare module.exports: $Exports<'async/everyLimit'>;
}
declare module 'async/everySeries.js' {
declare module.exports: $Exports<'async/everySeries'>;
}
declare module 'async/filter.js' {
declare module.exports: $Exports<'async/filter'>;
}
declare module 'async/filterLimit.js' {
declare module.exports: $Exports<'async/filterLimit'>;
}
declare module 'async/filterSeries.js' {
declare module.exports: $Exports<'async/filterSeries'>;
}
declare module 'async/find.js' {
declare module.exports: $Exports<'async/find'>;
}
declare module 'async/findLimit.js' {
declare module.exports: $Exports<'async/findLimit'>;
}
declare module 'async/findSeries.js' {
declare module.exports: $Exports<'async/findSeries'>;
}
declare module 'async/foldl.js' {
declare module.exports: $Exports<'async/foldl'>;
}
declare module 'async/foldr.js' {
declare module.exports: $Exports<'async/foldr'>;
}
declare module 'async/forEach.js' {
declare module.exports: $Exports<'async/forEach'>;
}
declare module 'async/forEachLimit.js' {
declare module.exports: $Exports<'async/forEachLimit'>;
}
declare module 'async/forEachOf.js' {
declare module.exports: $Exports<'async/forEachOf'>;
}
declare module 'async/forEachOfLimit.js' {
declare module.exports: $Exports<'async/forEachOfLimit'>;
}
declare module 'async/forEachOfSeries.js' {
declare module.exports: $Exports<'async/forEachOfSeries'>;
}
declare module 'async/forEachSeries.js' {
declare module.exports: $Exports<'async/forEachSeries'>;
}
declare module 'async/forever.js' {
declare module.exports: $Exports<'async/forever'>;
}
declare module 'async/groupBy.js' {
declare module.exports: $Exports<'async/groupBy'>;
}
declare module 'async/groupByLimit.js' {
declare module.exports: $Exports<'async/groupByLimit'>;
}
declare module 'async/groupBySeries.js' {
declare module.exports: $Exports<'async/groupBySeries'>;
}
declare module 'async/index' {
declare module.exports: $Exports<'async'>;
}
declare module 'async/index.js' {
declare module.exports: $Exports<'async'>;
}
declare module 'async/inject.js' {
declare module.exports: $Exports<'async/inject'>;
}
declare module 'async/internal/applyEach.js' {
declare module.exports: $Exports<'async/internal/applyEach'>;
}
declare module 'async/internal/breakLoop.js' {
declare module.exports: $Exports<'async/internal/breakLoop'>;
}
declare module 'async/internal/consoleFunc.js' {
declare module.exports: $Exports<'async/internal/consoleFunc'>;
}
declare module 'async/internal/createTester.js' {
declare module.exports: $Exports<'async/internal/createTester'>;
}
declare module 'async/internal/doLimit.js' {
declare module.exports: $Exports<'async/internal/doLimit'>;
}
declare module 'async/internal/doParallel.js' {
declare module.exports: $Exports<'async/internal/doParallel'>;
}
declare module 'async/internal/doParallelLimit.js' {
declare module.exports: $Exports<'async/internal/doParallelLimit'>;
}
declare module 'async/internal/DoublyLinkedList.js' {
declare module.exports: $Exports<'async/internal/DoublyLinkedList'>;
}
declare module 'async/internal/eachOfLimit.js' {
declare module.exports: $Exports<'async/internal/eachOfLimit'>;
}
declare module 'async/internal/filter.js' {
declare module.exports: $Exports<'async/internal/filter'>;
}
declare module 'async/internal/findGetResult.js' {
declare module.exports: $Exports<'async/internal/findGetResult'>;
}
declare module 'async/internal/getIterator.js' {
declare module.exports: $Exports<'async/internal/getIterator'>;
}
declare module 'async/internal/initialParams.js' {
declare module.exports: $Exports<'async/internal/initialParams'>;
}
declare module 'async/internal/iterator.js' {
declare module.exports: $Exports<'async/internal/iterator'>;
}
declare module 'async/internal/map.js' {
declare module.exports: $Exports<'async/internal/map'>;
}
declare module 'async/internal/notId.js' {
declare module.exports: $Exports<'async/internal/notId'>;
}
declare module 'async/internal/once.js' {
declare module.exports: $Exports<'async/internal/once'>;
}
declare module 'async/internal/onlyOnce.js' {
declare module.exports: $Exports<'async/internal/onlyOnce'>;
}
declare module 'async/internal/parallel.js' {
declare module.exports: $Exports<'async/internal/parallel'>;
}
declare module 'async/internal/queue.js' {
declare module.exports: $Exports<'async/internal/queue'>;
}
declare module 'async/internal/reject.js' {
declare module.exports: $Exports<'async/internal/reject'>;
}
declare module 'async/internal/setImmediate.js' {
declare module.exports: $Exports<'async/internal/setImmediate'>;
}
declare module 'async/internal/slice.js' {
declare module.exports: $Exports<'async/internal/slice'>;
}
declare module 'async/internal/withoutIndex.js' {
declare module.exports: $Exports<'async/internal/withoutIndex'>;
}
declare module 'async/internal/wrapAsync.js' {
declare module.exports: $Exports<'async/internal/wrapAsync'>;
}
declare module 'async/log.js' {
declare module.exports: $Exports<'async/log'>;
}
declare module 'async/map.js' {
declare module.exports: $Exports<'async/map'>;
}
declare module 'async/mapLimit.js' {
declare module.exports: $Exports<'async/mapLimit'>;
}
declare module 'async/mapSeries.js' {
declare module.exports: $Exports<'async/mapSeries'>;
}
declare module 'async/mapValues.js' {
declare module.exports: $Exports<'async/mapValues'>;
}
declare module 'async/mapValuesLimit.js' {
declare module.exports: $Exports<'async/mapValuesLimit'>;
}
declare module 'async/mapValuesSeries.js' {
declare module.exports: $Exports<'async/mapValuesSeries'>;
}
declare module 'async/memoize.js' {
declare module.exports: $Exports<'async/memoize'>;
}
declare module 'async/nextTick.js' {
declare module.exports: $Exports<'async/nextTick'>;
}
declare module 'async/parallel.js' {
declare module.exports: $Exports<'async/parallel'>;
}
declare module 'async/parallelLimit.js' {
declare module.exports: $Exports<'async/parallelLimit'>;
}
declare module 'async/priorityQueue.js' {
declare module.exports: $Exports<'async/priorityQueue'>;
}
declare module 'async/queue.js' {
declare module.exports: $Exports<'async/queue'>;
}
declare module 'async/race.js' {
declare module.exports: $Exports<'async/race'>;
}
declare module 'async/reduce.js' {
declare module.exports: $Exports<'async/reduce'>;
}
declare module 'async/reduceRight.js' {
declare module.exports: $Exports<'async/reduceRight'>;
}
declare module 'async/reflect.js' {
declare module.exports: $Exports<'async/reflect'>;
}
declare module 'async/reflectAll.js' {
declare module.exports: $Exports<'async/reflectAll'>;
}
declare module 'async/reject.js' {
declare module.exports: $Exports<'async/reject'>;
}
declare module 'async/rejectLimit.js' {
declare module.exports: $Exports<'async/rejectLimit'>;
}
declare module 'async/rejectSeries.js' {
declare module.exports: $Exports<'async/rejectSeries'>;
}
declare module 'async/retry.js' {
declare module.exports: $Exports<'async/retry'>;
}
declare module 'async/retryable.js' {
declare module.exports: $Exports<'async/retryable'>;
}
declare module 'async/select.js' {
declare module.exports: $Exports<'async/select'>;
}
declare module 'async/selectLimit.js' {
declare module.exports: $Exports<'async/selectLimit'>;
}
declare module 'async/selectSeries.js' {
declare module.exports: $Exports<'async/selectSeries'>;
}
declare module 'async/seq.js' {
declare module.exports: $Exports<'async/seq'>;
}
declare module 'async/series.js' {
declare module.exports: $Exports<'async/series'>;
}
declare module 'async/setImmediate.js' {
declare module.exports: $Exports<'async/setImmediate'>;
}
declare module 'async/some.js' {
declare module.exports: $Exports<'async/some'>;
}
declare module 'async/someLimit.js' {
declare module.exports: $Exports<'async/someLimit'>;
}
declare module 'async/someSeries.js' {
declare module.exports: $Exports<'async/someSeries'>;
}
declare module 'async/sortBy.js' {
declare module.exports: $Exports<'async/sortBy'>;
}
declare module 'async/timeout.js' {
declare module.exports: $Exports<'async/timeout'>;
}
declare module 'async/times.js' {
declare module.exports: $Exports<'async/times'>;
}
declare module 'async/timesLimit.js' {
declare module.exports: $Exports<'async/timesLimit'>;
}
declare module 'async/timesSeries.js' {
declare module.exports: $Exports<'async/timesSeries'>;
}
declare module 'async/transform.js' {
declare module.exports: $Exports<'async/transform'>;
}
declare module 'async/tryEach.js' {
declare module.exports: $Exports<'async/tryEach'>;
}
declare module 'async/unmemoize.js' {
declare module.exports: $Exports<'async/unmemoize'>;
}
declare module 'async/until.js' {
declare module.exports: $Exports<'async/until'>;
}
declare module 'async/waterfall.js' {
declare module.exports: $Exports<'async/waterfall'>;
}
declare module 'async/whilst.js' {
declare module.exports: $Exports<'async/whilst'>;
}
declare module 'async/wrapSync.js' {
declare module.exports: $Exports<'async/wrapSync'>;
}

143
flow-typed/npm/axios_v0.17.x.js vendored Normal file
View file

@ -0,0 +1,143 @@
// flow-typed signature: 9fd7b9287df55ee8cfa980889d107499
// flow-typed version: a8b5058d19/axios_v0.17.x/flow_>=v0.25.x
declare module "axios" {
declare interface ProxyConfig {
host: string;
port: number;
}
declare interface Cancel {
constructor(message?: string): Cancel;
message: string;
}
declare interface Canceler {
(message?: string): void;
}
declare interface CancelTokenSource {
token: CancelToken;
cancel: Canceler;
}
declare class CancelToken {
constructor(executor: (cancel: Canceler) => void): CancelToken;
static source(): CancelTokenSource;
promise: Promise<Cancel>;
reason?: Cancel;
throwIfRequested(): void;
}
declare interface AxiosXHRConfigBase<T> {
adapter?: <T>(config: AxiosXHRConfig<T>) => Promise<AxiosXHR<T>>;
auth?: {
username: string,
password: string
};
baseURL?: string;
cancelToken?: CancelToken;
headers?: Object;
httpAgent?: mixed; // Missing the type in the core flow node libdef
httpsAgent?: mixed; // Missing the type in the core flow node libdef
maxContentLength?: number;
maxRedirects?: 5;
params?: Object;
paramsSerializer?: (params: Object) => string;
progress?: (progressEvent: Event) => void | mixed;
proxy?: ProxyConfig | false;
responseType?:
| "arraybuffer"
| "blob"
| "document"
| "json"
| "text"
| "stream";
timeout?: number;
transformRequest?: Array<<U>(data: T) => U | Array<<U>(data: T) => U>>;
transformResponse?: Array<<U>(data: T) => U>;
validateStatus?: (status: number) => boolean;
withCredentials?: boolean;
xsrfCookieName?: string;
xsrfHeaderName?: string;
}
declare type $AxiosXHRConfigBase<T> = AxiosXHRConfigBase<T>;
declare interface AxiosXHRConfig<T> extends AxiosXHRConfigBase<T> {
data?: T;
method?: string;
url: string;
}
declare type $AxiosXHRConfig<T> = AxiosXHRConfig<T>;
declare class AxiosXHR<T> {
config: AxiosXHRConfig<T>;
data: T;
headers?: Object;
status: number;
statusText: string;
request: http$ClientRequest | XMLHttpRequest;
}
declare type $AxiosXHR<T> = AxiosXHR<T>;
declare class AxiosInterceptorIdent extends String {}
declare class AxiosRequestInterceptor<T> {
use(
successHandler: ?(
response: AxiosXHRConfig<T>
) => Promise<AxiosXHRConfig<*>> | AxiosXHRConfig<*>,
errorHandler: ?(error: mixed) => mixed
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare class AxiosResponseInterceptor<T> {
use(
successHandler: ?(response: AxiosXHR<T>) => mixed,
errorHandler: ?(error: $AxiosError<any>) => mixed
): AxiosInterceptorIdent;
eject(ident: AxiosInterceptorIdent): void;
}
declare type AxiosPromise<T> = Promise<AxiosXHR<T>>;
declare class Axios {
constructor<T>(config?: AxiosXHRConfigBase<T>): void;
$call: <T>(
config: AxiosXHRConfig<T> | string,
config?: AxiosXHRConfig<T>
) => AxiosPromise<T>;
request<T>(config: AxiosXHRConfig<T>): AxiosPromise<T>;
delete<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
get<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
head<T>(url: string, config?: AxiosXHRConfigBase<T>): AxiosPromise<T>;
post<T>(
url: string,
data?: mixed,
config?: AxiosXHRConfigBase<T>
): AxiosPromise<T>;
put<T>(
url: string,
data?: mixed,
config?: AxiosXHRConfigBase<T>
): AxiosPromise<T>;
patch<T>(
url: string,
data?: mixed,
config?: AxiosXHRConfigBase<T>
): AxiosPromise<T>;
interceptors: {
request: AxiosRequestInterceptor<mixed>,
response: AxiosResponseInterceptor<mixed>
};
defaults: { headers: Object } & AxiosXHRConfig<*>;
}
declare class AxiosError<T> extends Error {
config: AxiosXHRConfig<T>;
response: AxiosXHR<T>;
code?: string;
}
declare type $AxiosError<T> = AxiosError<T>;
declare interface AxiosExport extends Axios {
Axios: typeof Axios;
Cancel: Class<Cancel>;
CancelToken: Class<CancelToken>;
isCancel(value: any): boolean;
create(config?: AxiosXHRConfigBase<any>): Axios;
all: typeof Promise.all;
spread(callback: Function): (arr: Array<any>) => Function;
}
declare module.exports: AxiosExport;
}

View file

@ -1,43 +1,46 @@
// flow-typed signature: 18dadbe162b608c79b9b31c3d2f1c822
// flow-typed version: b43dff3e0e/body-parser_v1.x.x/flow_>=v0.17.x
// flow-typed signature: bac0ee66e0653772d037dc47b51a5e1f
// flow-typed version: da30fe6876/body-parser_v1.x.x/flow_>=v0.25.x
import type { Middleware, $Request, $Response } from 'express';
import type { Middleware, $Request, $Response } from "express";
declare type bodyParser$Options = {
inflate?: boolean;
limit?: number | string;
type?: string | string[] | ((req: $Request) => any);
verify?: (req: $Request, res: $Response, buf: Buffer, encoding: string) => void;
inflate?: boolean,
limit?: number | string,
type?: string | string[] | ((req: $Request) => any),
verify?: (
req: $Request,
res: $Response,
buf: Buffer,
encoding: string
) => void
};
declare type bodyParser$OptionsText = bodyParser$Options & {
reviver?: (key: string, value: any) => any;
strict?: boolean;
reviver?: (key: string, value: any) => any,
strict?: boolean
};
declare type bodyParser$OptionsJson = bodyParser$Options & {
reviver?: (key: string, value: any) => any;
strict?: boolean;
reviver?: (key: string, value: any) => any,
strict?: boolean
};
declare type bodyParser$OptionsUrlencoded = bodyParser$Options & {
extended?: boolean;
parameterLimit?: number;
extended?: boolean,
parameterLimit?: number
};
declare module "body-parser" {
declare type Options = bodyParser$Options;
declare type OptionsText = bodyParser$OptionsText;
declare type OptionsJson = bodyParser$OptionsJson;
declare type OptionsUrlencoded = bodyParser$OptionsUrlencoded;
declare type Options = bodyParser$Options;
declare type OptionsText = bodyParser$OptionsText;
declare type OptionsJson = bodyParser$OptionsJson;
declare type OptionsUrlencoded = bodyParser$OptionsUrlencoded;
declare function json(options?: OptionsJson): Middleware;
declare function json(options?: OptionsJson): Middleware;
declare function raw(options?: Options): Middleware;
declare function raw(options?: Options): Middleware;
declare function text(options?: OptionsText): Middleware;
declare function urlencoded(options?: OptionsUrlencoded): Middleware;
declare function text(options?: OptionsText): Middleware;
declare function urlencoded(options?: OptionsUrlencoded): Middleware;
}

156
flow-typed/npm/bunyan_v1.x.x.js vendored Normal file
View file

@ -0,0 +1,156 @@
// flow-typed signature: b3827b7e37fa457f58d7a6656d830369
// flow-typed version: da30fe6876/bunyan_v1.x.x/flow_>=v0.25.x
declare module "bunyan" {
declare var TRACE: 10;
declare var DEBUG: 20;
declare var INFO: 30;
declare var WARN: 40;
declare var ERROR: 50;
declare var FATAL: 60;
declare type BunyanLogLevels =
| 60 // fatal
| 50 // error
| 40 // warn
| 30 // info
| 20 // debug
| 10; // info
declare type BunyanRecord = {
v: number,
level: BunyanLogLevels,
name: string,
hostname: string,
pid: string,
time: Date,
msg: string,
src: string,
err?: {
message: string,
name: string,
code: any,
signal: any,
stack: string
},
[key: string]: any
};
declare type Writable = {
write(rec: BunyanRecord): void
};
declare class Logger extends events$EventEmitter {
constructor(options: LoggerOptions): any;
addStream(stream: Stream): void;
addSerializers(serializers: Serializers): void;
child(opts?: LoggerOptions, simple?: boolean): Logger;
reopenFileStreams(): void;
level(): string | number;
level(value: number | string): void;
levels(name: number | string, value: number | string): void;
trace(...params: Array<void>): boolean;
trace(error: Error, format?: any, ...params: Array<any>): void;
trace(buffer: Buffer, format?: any, ...params: Array<any>): void;
trace(obj: Object, format?: any, ...params: Array<any>): void;
trace(format: string, ...params: Array<any>): void;
debug(...params: Array<void>): boolean;
debug(error: Error, format?: any, ...params: Array<any>): void;
debug(buffer: Buffer, format?: any, ...params: Array<any>): void;
debug(obj: Object, format?: any, ...params: Array<any>): void;
debug(format: string, ...params: Array<any>): void;
info(...params: Array<void>): boolean;
info(error: Error, format?: any, ...params: Array<any>): void;
info(buffer: Buffer, format?: any, ...params: Array<any>): void;
info(obj: Object, format?: any, ...params: Array<any>): void;
info(format: string, ...params: Array<any>): void;
warn(...params: Array<void>): boolean;
warn(error: Error, format?: any, ...params: Array<any>): void;
warn(buffer: Buffer, format?: any, ...params: Array<any>): void;
warn(obj: Object, format?: any, ...params: Array<any>): void;
warn(format: string, ...params: Array<any>): void;
error(...params: Array<void>): boolean;
error(error: Error, format?: any, ...params: Array<any>): void;
error(buffer: Buffer, format?: any, ...params: Array<any>): void;
error(obj: Object, format?: any, ...params: Array<any>): void;
error(format: string, ...params: Array<any>): void;
fatal(...params: Array<void>): boolean;
fatal(error: Error, format?: any, ...params: Array<any>): void;
fatal(buffer: Buffer, format?: any, ...params: Array<any>): void;
fatal(obj: Object, format?: any, ...params: Array<any>): void;
fatal(format: string, ...params: Array<any>): void;
static stdSerializers: {
req: (
req: http$ClientRequest
) => {
method: string,
url: string,
headers: mixed,
remoteAddress: string,
remotePort: number
},
res: (
res: http$IncomingMessage
) => { statusCode: number, header: string },
err: (
err: Error
) => {
message: string,
name: string,
stack: string,
code: string,
signal: string
}
};
}
declare interface LoggerOptions {
streams?: Array<Stream>;
level?: BunyanLogLevels | string;
stream?: stream$Writable;
serializers?: Serializers;
src?: boolean;
}
declare type Serializers = {
[key: string]: (input: any) => mixed
};
declare type Stream = {
type?: string,
level?: number | string,
path?: string,
stream?: stream$Writable | tty$WriteStream | Stream | Writable,
closeOnExit?: boolean,
period?: string,
count?: number
};
declare var stdSerializers: Serializers;
declare function resolveLevel(value: number | string): number;
declare function createLogger(
options: LoggerOptions & { name: string }
): Logger;
declare class RingBuffer extends events$EventEmitter {
constructor(options: RingBufferOptions): any;
writable: boolean;
records: Array<any>;
write(record: BunyanRecord): void;
end(record?: any): void;
destroy(): void;
destroySoon(): void;
}
declare interface RingBufferOptions {
limit: number;
}
declare function safeCycles(): (key: string, value: any) => any;
declare class ConsoleRawStream {
write(rec: BunyanRecord): void;
}
declare var levelFromName: {
trace: typeof TRACE,
debug: typeof DEBUG,
info: typeof INFO,
warn: typeof WARN,
error: typeof ERROR,
fatal: typeof FATAL
};
declare var nameFromLevel: {
[key: BunyanLogLevels]: string
};
declare var VERSION: string;
declare var LOG_VERSION: string;
}

108
flow-typed/npm/chalk_v2.x.x.js vendored Normal file
View file

@ -0,0 +1,108 @@
// flow-typed signature: fa51178772ad1f35158cb4238bc3f1eb
// flow-typed version: da30fe6876/chalk_v2.x.x/flow_>=v0.25.x
type $npm$chalk$StyleElement = {
open: string,
close: string
};
type $npm$chalk$Chain = $npm$chalk$Style & ((...text: any[]) => string);
type $npm$chalk$Style = {
// General
reset: $npm$chalk$Chain,
bold: $npm$chalk$Chain,
dim: $npm$chalk$Chain,
italic: $npm$chalk$Chain,
underline: $npm$chalk$Chain,
inverse: $npm$chalk$Chain,
strikethrough: $npm$chalk$Chain,
// Text colors
black: $npm$chalk$Chain,
red: $npm$chalk$Chain,
redBright: $npm$chalk$Chain,
green: $npm$chalk$Chain,
greenBright: $npm$chalk$Chain,
yellow: $npm$chalk$Chain,
yellowBright: $npm$chalk$Chain,
blue: $npm$chalk$Chain,
blueBright: $npm$chalk$Chain,
magenta: $npm$chalk$Chain,
magentaBright: $npm$chalk$Chain,
cyan: $npm$chalk$Chain,
cyanBright: $npm$chalk$Chain,
white: $npm$chalk$Chain,
whiteBright: $npm$chalk$Chain,
gray: $npm$chalk$Chain,
grey: $npm$chalk$Chain,
// Background colors
bgBlack: $npm$chalk$Chain,
bgBlackBright: $npm$chalk$Chain,
bgRed: $npm$chalk$Chain,
bgRedBright: $npm$chalk$Chain,
bgGreen: $npm$chalk$Chain,
bgGreenBright: $npm$chalk$Chain,
bgYellow: $npm$chalk$Chain,
bgYellowBright: $npm$chalk$Chain,
bgBlue: $npm$chalk$Chain,
bgBlueBright: $npm$chalk$Chain,
bgMagenta: $npm$chalk$Chain,
bgMagentaBright: $npm$chalk$Chain,
bgCyan: $npm$chalk$Chain,
bgCyanBright: $npm$chalk$Chain,
bgWhite: $npm$chalk$Chain,
bgWhiteBright: $npm$chalk$Chain
};
declare module "chalk" {
declare var enabled: boolean;
declare var supportsColor: boolean;
// General
declare var reset: $npm$chalk$Chain;
declare var bold: $npm$chalk$Chain;
declare var dim: $npm$chalk$Chain;
declare var italic: $npm$chalk$Chain;
declare var underline: $npm$chalk$Chain;
declare var inverse: $npm$chalk$Chain;
declare var strikethrough: $npm$chalk$Chain;
// Text colors
declare var black: $npm$chalk$Chain;
declare var red: $npm$chalk$Chain;
declare var redBright: $npm$chalk$Chain;
declare var green: $npm$chalk$Chain;
declare var greenBright: $npm$chalk$Chain;
declare var yellow: $npm$chalk$Chain;
declare var yellowBright: $npm$chalk$Chain;
declare var blue: $npm$chalk$Chain;
declare var blueBright: $npm$chalk$Chain;
declare var magenta: $npm$chalk$Chain;
declare var magentaBright: $npm$chalk$Chain;
declare var cyan: $npm$chalk$Chain;
declare var cyanBright: $npm$chalk$Chain;
declare var white: $npm$chalk$Chain;
declare var whiteBright: $npm$chalk$Chain;
declare var gray: $npm$chalk$Chain;
declare var grey: $npm$chalk$Chain;
// Background colors
declare var bgBlack: $npm$chalk$Chain;
declare var bgBlackBright: $npm$chalk$Chain;
declare var bgRed: $npm$chalk$Chain;
declare var bgRedBright: $npm$chalk$Chain;
declare var bgGreen: $npm$chalk$Chain;
declare var bgGreenBright: $npm$chalk$Chain;
declare var bgYellow: $npm$chalk$Chain;
declare var bgYellowBright: $npm$chalk$Chain;
declare var bgBlue: $npm$chalk$Chain;
declare var bgBlueBright: $npm$chalk$Chain;
declare var bgMagenta: $npm$chalk$Chain;
declare var bgMagentaBright: $npm$chalk$Chain;
declare var bgCyan: $npm$chalk$Chain;
declare var bgCyanBright: $npm$chalk$Chain;
declare var bgWhite: $npm$chalk$Chain;
declare var bgWhiteBright: $npm$chalk$Chain;
}

281
flow-typed/npm/commander_v2.x.x.js vendored Normal file
View file

@ -0,0 +1,281 @@
// flow-typed signature: 9a1fb3feac221b50aab621209bf8ca9c
// flow-typed version: 94e9f7e0a4/commander_v2.x.x/flow_>=v0.28.x
declare module "commander" {
declare class Command extends events$EventEmitter {
/**
* Initialize a new `Command`.
*
* @param {String} name
* @api public
*/
constructor(name?: string): Command;
/**
* Add command `name`.
*
* The `.action()` callback is invoked when the
* command `name` is specified via __ARGV__,
* and the remaining arguments are applied to the
* function for access.
*
* When the `name` is "*" an un-matched command
* will be passed as the first arg, followed by
* the rest of __ARGV__ remaining.
*
* Examples:
*
* program
* .version('0.0.1')
* .option('-C, --chdir <path>', 'change the working directory')
* .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
* .option('-T, --no-tests', 'ignore test hook')
*
* program
* .command('setup')
* .description('run remote setup commands')
* .action(function(){
* console.log('setup');
* });
*
* program
* .command('exec <cmd>')
* .description('run the given remote command')
* .action(function(cmd){
* console.log('exec "%s"', cmd);
* });
*
* program
* .command('*')
* .description('deploy the given env')
* .action(function(env){
* console.log('deploying "%s"', env);
* });
*
* program.parse(process.argv);
*
* @param {String} name
* @param {String} [desc]
* @param {Mixed} [opts]
* @return {Command} the new command
* @api public
*/
command(
name: string,
desc?: string,
opts?: { isDefault: boolean, noHelp: boolean }
): Command;
/**
* Parse expected `args`.
*
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
*
* @param {Array} args
* @return {Command} for chaining
* @api public
*/
parseExpectedArgs(args: Array<string>): this;
/**
* Register callback `fn` for the command.
*
* Examples:
*
* program
* .command('help')
* .description('display verbose help')
* .action(function(){
* // output help here
* });
*
* @param {Function} fn
* @return {Command} for chaining
* @api public
*/
action(fn: (...args: Array<any>) => mixed): this;
/**
* Define option with `flags`, `description` and optional
* coercion `fn`.
*
* The `flags` string should contain both the short and long flags,
* separated by comma, a pipe or space. The following are all valid
* all will output this way when `--help` is used.
*
* "-p, --pepper"
* "-p|--pepper"
* "-p --pepper"
*
* Examples:
*
* // simple boolean defaulting to false
* program.option('-p, --pepper', 'add pepper');
*
* --pepper
* program.pepper
* // => Boolean
*
* // simple boolean defaulting to true
* program.option('-C, --no-cheese', 'remove cheese');
*
* program.cheese
* // => true
*
* --no-cheese
* program.cheese
* // => false
*
* // required argument
* program.option('-C, --chdir <path>', 'change the working directory');
*
* --chdir /tmp
* program.chdir
* // => "/tmp"
*
* // optional argument
* program.option('-c, --cheese [type]', 'add cheese [marble]');
*
* @param {String} flags
* @param {String} description
* @param {Function|Mixed} fn or default
* @param {Mixed} defaultValue
* @return {Command} for chaining
* @api public
*/
option(flags: string, description?: string, fn?: ((val: any, memo: any) => mixed) | RegExp, defaultValue?: mixed): this;
option(flags: string, description?: string, defaultValue?: mixed): this;
/**
* Allow unknown options on the command line.
*
* @param {Boolean} arg if `true` or omitted, no error will be thrown
* for unknown options.
* @api public
*/
allowUnknownOption(arg?: boolean): this;
/**
* Parse `argv`, settings options and invoking commands when defined.
*
* @param {Array} argv
* @return {Command} for chaining
* @api public
*/
parse(argv: Array<string>): this;
/**
* Parse options from `argv` returning `argv`
* void of these options.
*
* @param {Array} argv
* @return {Array}
* @api public
*/
parseOptions(argv: Array<string>): { args: Array<string>, unknown: Array<string> };
/**
* Define argument syntax for the top-level command.
*
* @api public
*/
arguments(desc: string): this;
/**
* Return an object containing options as key-value pairs
*
* @return {Object}
* @api public
*/
opts(): { [key: string]: any };
/**
* Set the program version to `str`.
*
* This method auto-registers the "-V, --version" flag
* which will print the version number when passed.
*
* @param {String} str
* @param {String} flags
* @return {Command} for chaining
* @api public
*/
version(str: string, flags?: string): this;
/**
* Set the description to `str`.
*
* @param {String} str
* @return {String|Command}
* @api public
*/
description(str: string): this;
description(): string;
/**
* Set an alias for the command
*
* @param {String} alias
* @return {String|Command}
* @api public
*/
alias(alias: string): this;
alias(): string;
/**
* Set / get the command usage `str`.
*
* @param {String} str
* @return {String|Command}
* @api public
*/
usage(str: string): this;
usage(): string;
/**
* Get the name of the command
*
* @param {String} name
* @return {String|Command}
* @api public
*/
name(): string;
/**
* Output help information for this command
*
* @api public
*/
outputHelp(): void;
/**
* Output help information and exit.
*
* @api public
*/
help(): void;
}
declare class Option {
/**
* Initialize a new `Option` with the given `flags` and `description`.
*
* @param {String} flags
* @param {String} description
* @api public
*/
constructor(flags: string, description?: string): Option;
flags: string;
required: boolean;
optional: boolean;
bool: boolean;
short?: string;
long: string;
description: string;
}
declare module.exports: Command & {
Command: Command,
Option: Option
};
}

127
flow-typed/npm/enzyme_v3.x.x.js vendored Normal file
View file

@ -0,0 +1,127 @@
// flow-typed signature: 02db3523747059d89e87d4dec6873edf
// flow-typed version: 62a0c60689/enzyme_v3.x.x/flow_>=v0.53.x
import * as React from "react";
declare module "enzyme" {
declare type PredicateFunction<T: Wrapper> = (
wrapper: T,
index: number
) => boolean;
declare type NodeOrNodes = React.Node | Array<React.Node>;
declare type EnzymeSelector = string | Class<React.Component<*, *>> | Object;
// CheerioWrapper is a type alias for an actual cheerio instance
// TODO: Reference correct type from cheerio's type declarations
declare type CheerioWrapper = any;
declare class Wrapper {
find(selector: EnzymeSelector): this,
findWhere(predicate: PredicateFunction<this>): this,
filter(selector: EnzymeSelector): this,
filterWhere(predicate: PredicateFunction<this>): this,
hostNodes(): this,
contains(nodeOrNodes: NodeOrNodes): boolean,
containsMatchingElement(node: React.Node): boolean,
containsAllMatchingElements(nodes: NodeOrNodes): boolean,
containsAnyMatchingElements(nodes: NodeOrNodes): boolean,
dive(option?: { context?: Object }): this,
exists(): boolean,
isEmptyRender(): boolean,
matchesElement(node: React.Node): boolean,
hasClass(className: string): boolean,
is(selector: EnzymeSelector): boolean,
isEmpty(): boolean,
not(selector: EnzymeSelector): this,
children(selector?: EnzymeSelector): this,
childAt(index: number): this,
parents(selector?: EnzymeSelector): this,
parent(): this,
closest(selector: EnzymeSelector): this,
render(): CheerioWrapper,
unmount(): this,
text(): string,
html(): string,
get(index: number): React.Node,
getNodes(): Array<React.Node>,
getDOMNode(): HTMLElement | HTMLInputElement,
at(index: number): this,
first(): this,
last(): this,
state(key?: string): any,
context(key?: string): any,
props(): Object,
prop(key: string): any,
key(): string,
simulate(event: string, ...args: Array<any>): this,
setState(state: {}, callback?: Function): this,
setProps(props: {}): this,
setContext(context: Object): this,
instance(): React.Component<*, *>,
update(): this,
debug(): string,
type(): string | Function | null,
name(): string,
forEach(fn: (node: this, index: number) => mixed): this,
map<T>(fn: (node: this, index: number) => T): Array<T>,
reduce<T>(
fn: (value: T, node: this, index: number) => T,
initialValue?: T
): Array<T>,
reduceRight<T>(
fn: (value: T, node: this, index: number) => T,
initialValue?: T
): Array<T>,
some(selector: EnzymeSelector): boolean,
someWhere(predicate: PredicateFunction<this>): boolean,
every(selector: EnzymeSelector): boolean,
everyWhere(predicate: PredicateFunction<this>): boolean,
length: number
}
declare class ReactWrapper extends Wrapper {
constructor(nodes: NodeOrNodes, root: any, options?: ?Object): ReactWrapper,
mount(): this,
ref(refName: string): this,
detach(): void
}
declare class ShallowWrapper extends Wrapper {
constructor(
nodes: NodeOrNodes,
root: any,
options?: ?Object
): ShallowWrapper,
equals(node: React.Node): boolean,
shallow(options?: { context?: Object }): ShallowWrapper
}
declare function shallow(
node: React.Node,
options?: { context?: Object, disableLifecycleMethods?: boolean }
): ShallowWrapper;
declare function mount(
node: React.Node,
options?: {
context?: Object,
attachTo?: HTMLElement,
childContextTypes?: Object
}
): ReactWrapper;
declare function render(
node: React.Node,
options?: { context?: Object }
): CheerioWrapper;
declare module.exports: {
configure(options: {
Adapter?: any,
disableLifecycleMethods?: boolean
}): void,
render: typeof render,
mount: typeof mount,
shallow: typeof shallow,
ShallowWrapper: typeof ShallowWrapper,
ReactWrapper: typeof ReactWrapper
};
}

View file

@ -1,8 +1,8 @@
// flow-typed signature: f0e399a136d6e8dc8b1fbdc078e2850c
// flow-typed version: ed397013d1/express_v4.x.x/flow_>=v0.32.x
// flow-typed signature: 41a220e96fcef89a09244ac3797039e8
// flow-typed version: 9f7cf2ab0c/express_v4.16.x/flow_>=v0.32.x
import type { Server } from 'http';
import type { Socket } from 'net';
import type { Server } from "http";
import type { Socket } from "net";
declare type express$RouterOptions = {
caseSensitive?: boolean,
@ -17,12 +17,12 @@ declare class express$RequestResponseBase {
declare type express$RequestParams = {
[param: string]: string
}
};
declare class express$Request extends http$IncomingMessage mixins express$RequestResponseBase {
baseUrl: string;
body: any;
cookies: {[cookie: string]: string};
body: mixed;
cookies: { [cookie: string]: string };
connection: Socket;
fresh: boolean;
hostname: string;
@ -32,11 +32,11 @@ declare class express$Request extends http$IncomingMessage mixins express$Reques
originalUrl: string;
params: express$RequestParams;
path: string;
protocol: 'https' | 'http';
query: {[name: string]: string | Array<string>};
protocol: "https" | "http";
query: { [name: string]: string | Array<string> };
route: string;
secure: boolean;
signedCookies: {[signedCookie: string]: string};
signedCookies: { [signedCookie: string]: string };
stale: boolean;
subdomains: Array<string>;
xhr: boolean;
@ -63,53 +63,80 @@ declare type express$CookieOptions = {
declare type express$Path = string | RegExp;
declare type express$RenderCallback = (err: Error | null, html?: string) => mixed;
declare type express$RenderCallback = (
err: Error | null,
html?: string
) => mixed;
declare type express$SendFileOptions = {
maxAge?: number,
root?: string,
lastModified?: boolean,
headers?: {[name: string]: string},
dotfiles?: 'allow' | 'deny' | 'ignore'
headers?: { [name: string]: string },
dotfiles?: "allow" | "deny" | "ignore"
};
declare class express$Response extends http$ServerResponse mixins express$RequestResponseBase {
headersSent: boolean;
locals: {[name: string]: mixed};
locals: { [name: string]: mixed };
append(field: string, value?: string): this;
attachment(filename?: string): this;
cookie(name: string, value: string, options?: express$CookieOptions): this;
clearCookie(name: string, options?: express$CookieOptions): this;
download(path: string, filename?: string, callback?: (err?: ?Error) => void): this;
format(typesObject: {[type: string]: Function}): this;
download(
path: string,
filename?: string,
callback?: (err?: ?Error) => void
): this;
format(typesObject: { [type: string]: Function }): this;
json(body?: mixed): this;
jsonp(body?: mixed): this;
links(links: {[name: string]: string}): this;
links(links: { [name: string]: string }): this;
location(path: string): this;
redirect(url: string, ...args: Array<void>): this;
redirect(status: number, url: string, ...args: Array<void>): this;
render(view: string, locals?: {[name: string]: mixed}, callback?: express$RenderCallback): this;
render(
view: string,
locals?: { [name: string]: mixed },
callback?: express$RenderCallback
): this;
send(body?: mixed): this;
sendFile(path: string, options?: express$SendFileOptions, callback?: (err?: ?Error) => mixed): this;
sendFile(
path: string,
options?: express$SendFileOptions,
callback?: (err?: ?Error) => mixed
): this;
sendStatus(statusCode: number): this;
header(field: string, value?: string): this;
header(headers: {[name: string]: string}): this;
set(field: string, value?: string|string[]): this;
set(headers: {[name: string]: string}): this;
header(headers: { [name: string]: string }): this;
set(field: string, value?: string | string[]): this;
set(headers: { [name: string]: string }): this;
status(statusCode: number): this;
type(type: string): this;
vary(field: string): this;
req: express$Request;
}
declare type express$NextFunction = (err?: ?Error | 'route') => mixed;
declare type express$NextFunction = (err?: ?Error | "route") => mixed;
declare type express$Middleware =
((req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed) |
((error: Error, req: $Subtype<express$Request>, res: express$Response, next: express$NextFunction) => mixed);
| ((
req: $Subtype<express$Request>,
res: express$Response,
next: express$NextFunction
) => mixed)
| ((
error: Error,
req: $Subtype<express$Request>,
res: express$Response,
next: express$NextFunction
) => mixed);
declare interface express$RouteMethodType<T> {
(middleware: express$Middleware): T;
(...middleware: Array<express$Middleware>): T;
(path: express$Path|express$Path[], ...middleware: Array<express$Middleware>): T;
(
path: express$Path | express$Path[],
...middleware: Array<express$Middleware>
): T;
}
declare class express$Route {
all: express$RouteMethodType<this>;
@ -149,9 +176,16 @@ declare class express$Router extends express$Route {
static (options?: express$RouterOptions): express$Router;
use(middleware: express$Middleware): this;
use(...middleware: Array<express$Middleware>): this;
use(path: express$Path|express$Path[], ...middleware: Array<express$Middleware>): this;
use(
path: express$Path | express$Path[],
...middleware: Array<express$Middleware>
): this;
use(path: string, router: express$Router): this;
handle(req: http$IncomingMessage, res: http$ServerResponse, next: express$NextFunction): void;
handle(
req: http$IncomingMessage,
res: http$ServerResponse,
next: express$NextFunction
): void;
param(
param: string,
callback: (
@ -163,18 +197,39 @@ declare class express$Router extends express$Route {
): void;
// Can't use regular callable signature syntax due to https://github.com/facebook/flow/issues/3084
$call: (req: http$IncomingMessage, res: http$ServerResponse, next?: ?express$NextFunction) => void;
$call: (
req: http$IncomingMessage,
res: http$ServerResponse,
next?: ?express$NextFunction
) => void;
}
/*
With flow-bin ^0.59, express app.listen() is deemed to return any and fails flow type coverage.
Which is ironic because https://github.com/facebook/flow/blob/master/Changelog.md#misc-2 (release notes for 0.59)
says "Improves typings for Node.js HTTP server listen() function." See that? IMPROVES!
To work around this issue, we changed Server to ?Server here, so that our invocations of express.listen() will
not be deemed to lack type coverage.
*/
declare class express$Application extends express$Router mixins events$EventEmitter {
constructor(): void;
locals: {[name: string]: mixed};
locals: { [name: string]: mixed };
mountpath: string;
listen(port: number, hostname?: string, backlog?: number, callback?: (err?: ?Error) => mixed): Server;
listen(port: number, hostname?: string, callback?: (err?: ?Error) => mixed): Server;
listen(port: number, callback?: (err?: ?Error) => mixed): Server;
listen(path: string, callback?: (err?: ?Error) => mixed): Server;
listen(handle: Object, callback?: (err?: ?Error) => mixed): Server;
listen(
port: number,
hostname?: string,
backlog?: number,
callback?: (err?: ?Error) => mixed
): ?Server;
listen(
port: number,
hostname?: string,
callback?: (err?: ?Error) => mixed
): ?Server;
listen(port: number, callback?: (err?: ?Error) => mixed): ?Server;
listen(path: string, callback?: (err?: ?Error) => mixed): ?Server;
listen(handle: Object, callback?: (err?: ?Error) => mixed): ?Server;
disable(name: string): void;
disabled(name: string): boolean;
enable(name: string): express$Application;
@ -185,11 +240,33 @@ declare class express$Application extends express$Router mixins events$EventEmit
*/
// get(name: string): mixed;
set(name: string, value: mixed): mixed;
render(name: string, optionsOrFunction: {[name: string]: mixed}, callback: express$RenderCallback): void;
handle(req: http$IncomingMessage, res: http$ServerResponse, next?: ?express$NextFunction): void;
render(
name: string,
optionsOrFunction: { [name: string]: mixed },
callback: express$RenderCallback
): void;
handle(
req: http$IncomingMessage,
res: http$ServerResponse,
next?: ?express$NextFunction
): void;
}
declare module 'express' {
declare type JsonOptions = {
inflate?: boolean,
limit?: string | number,
reviver?: (key: string, value: mixed) => mixed,
strict?: boolean,
type?: string | Array<string> | ((req: express$Request) => boolean),
verify?: (
req: express$Request,
res: express$Response,
buf: Buffer,
encoding: string
) => mixed
};
declare module "express" {
declare export type RouterOptions = express$RouterOptions;
declare export type CookieOptions = express$CookieOptions;
declare export type Middleware = express$Middleware;
@ -201,7 +278,8 @@ declare module 'express' {
declare module.exports: {
(): express$Application, // If you try to call like a function, it will use this signature
json: (opts: ?JsonOptions) => express$Middleware,
static: (root: string, options?: Object) => express$Middleware, // `static` property on the function
Router: typeof express$Router, // `Router` property on the function
Router: typeof express$Router // `Router` property on the function
};
}

6
flow-typed/npm/flow-bin_v0.x.x.js vendored Normal file
View file

@ -0,0 +1,6 @@
// flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583
// flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x
declare module "flow-bin" {
declare module.exports: string;
}

59
flow-typed/npm/http-errors_v1.x.x.js vendored Normal file
View file

@ -0,0 +1,59 @@
// flow-typed signature: 573c576fe34eb3c3c65dd7a9c90a46d2
// flow-typed version: b43dff3e0e/http-errors_v1.x.x/flow_>=v0.25.x
declare module 'http-errors' {
declare class SpecialHttpError extends HttpError {
constructor(): SpecialHttpError;
}
declare class HttpError extends Error {
expose: bool;
message: string;
status: number;
statusCode: number;
}
declare module.exports: {
(status?: number, message?: string, props?: Object): HttpError;
HttpError: typeof HttpError;
BadRequest: typeof SpecialHttpError;
Unauthorized: typeof SpecialHttpError;
PaymentRequired: typeof SpecialHttpError;
Forbidden: typeof SpecialHttpError;
NotFound: typeof SpecialHttpError;
MethodNotAllowed: typeof SpecialHttpError;
NotAcceptable: typeof SpecialHttpError;
ProxyAuthenticationRequired: typeof SpecialHttpError;
RequestTimeout: typeof SpecialHttpError;
Conflict: typeof SpecialHttpError;
Gone: typeof SpecialHttpError;
LengthRequired: typeof SpecialHttpError;
PreconditionFailed: typeof SpecialHttpError;
PayloadTooLarge: typeof SpecialHttpError;
URITooLong: typeof SpecialHttpError;
UnsupportedMediaType: typeof SpecialHttpError;
RangeNotStatisfiable: typeof SpecialHttpError;
ExpectationFailed: typeof SpecialHttpError;
ImATeapot: typeof SpecialHttpError;
MisdirectedRequest: typeof SpecialHttpError;
UnprocessableEntity: typeof SpecialHttpError;
Locked: typeof SpecialHttpError;
FailedDependency: typeof SpecialHttpError;
UnorderedCollection: typeof SpecialHttpError;
UpgradeRequired: typeof SpecialHttpError;
PreconditionRequired: typeof SpecialHttpError;
TooManyRequests: typeof SpecialHttpError;
RequestHeaderFieldsTooLarge: typeof SpecialHttpError;
UnavailableForLegalReasons: typeof SpecialHttpError;
InternalServerError: typeof SpecialHttpError;
NotImplemented: typeof SpecialHttpError;
BadGateway: typeof SpecialHttpError;
ServiceUnavailable: typeof SpecialHttpError;
GatewayTimeout: typeof SpecialHttpError;
HTTPVersionNotSupported: typeof SpecialHttpError;
VariantAlsoNegotiates: typeof SpecialHttpError;
InsufficientStorage: typeof SpecialHttpError;
LoopDetected: typeof SpecialHttpError;
BandwidthLimitExceeded: typeof SpecialHttpError;
NotExtended: typeof SpecialHttpError;
NetworkAuthenticationRequired: typeof SpecialHttpError;
}
}

18
flow-typed/npm/lockfile_v1.x.x.js vendored Normal file
View file

@ -0,0 +1,18 @@
// flow-typed signature: 20e87b8d51bb8f98aaf129f4b0bdaf81
// flow-typed version: c5395b57b9/lockfile_v1.x.x/flow_>=v0.47.x
declare module "lockfile" {
declare type Callback = (err: ?Error) => void | mixed;
declare type LockOptions = {
wait?: number,
pollPeriod?: number,
stale?: number,
retries?: number,
retryWait?: number
};
declare interface LockFileExport {
lock(fileName: string, opts: LockOptions, cb: Callback): void,
unlock(fileName: string, cb: Callback): void
}
declare module.exports: LockFileExport;
}

File diff suppressed because it is too large Load diff

163
flow-typed/npm/marked_v0.3.x.js vendored Normal file
View file

@ -0,0 +1,163 @@
// flow-typed signature: 85ea5a515c42c00188d893614f410655
// flow-typed version: 72fe9c1b53/marked_v0.3.x/flow_>=v0.28.x
type marked$AlignFlag = 'left' | 'right' | 'center'
type marked$NodeCallback<T> = (e: ?Error, d: ?T) => void
class marked$Renderer {
options: marked$MarkedOptions;
code: (c: string, l: string) => string;
blockquote: (q: string) => string;
html: (h: string) => string;
heading: (t: string, l: number) => string;
hr: () => string;
list: (b: string, o: boolean) => string;
listitem: (t: string) => string;
paragraph: (t: string) => string;
table: (h: string, b: string) => string;
tablerow: (c: string) => string;
tablecell: (c: string, f: ?marked$AlignFlag) => string;
heading: (t: string, l: number) => string;
strong: (t: string) => string;
em: (t: string) => string;
codespan: (c: string) => string;
br: () => string;
del: (t: string) => string;
link: (h: string, ti: string, te: string) => string;
image: (h: string, ti: string, te: string) => string;
text: (t: string) => string;
constructor(o?: marked$MarkedOptions): marked$Renderer {
return this;
}
}
type marked$HighlightFunction =
((c: string, l: string, cb: marked$NodeCallback<string>) => void)
| ((c: string, cb: marked$NodeCallback<string>) => void)
| ((c: string, l?: string) => string)
type marked$MarkedOptions = {
highlight?: marked$HighlightFunction;
renderer?: marked$Renderer;
gfm?: boolean;
tables?: boolean;
breaks?: boolean;
pedantic?: boolean;
sanitize?: boolean;
smartLists?: boolean;
smartypants?: boolean;
}
/*
* marked$Tokens
*/
type marked$Space = { type: 'space'; }
type marked$Code = { type: 'code'; text: string; lang?: string; }
type marked$Heading = { type: 'heading'; depth: number; text: string; }
type marked$Table = { type: 'table'; header: string; align: Array<marked$AlignFlag> ; cells: Array<Array<string>> }
type marked$Hr = { type: 'hr'; }
type marked$BlockquoteStart = { type: 'blockquote_start' }
type marked$BlockquoteEnd = { type: 'blockquote_end' }
type marked$ListStart = { type: 'list_start' }
type marked$ListEnd = { type: 'list_end' }
type marked$Paragraph = { type: 'paragraph'; pre: boolean; text: string; }
type marked$Html = { type: 'paragraph'; pre: boolean; text: string; }
type marked$Text = { type: 'text'; text: string; }
type marked$Token =
marked$Space
| marked$Code
| marked$Heading
| marked$Table
| marked$Hr
| marked$BlockquoteStart
| marked$BlockquoteEnd
| marked$ListStart
| marked$ListEnd
| marked$Paragraph
| marked$Html
| marked$Text
type marked$Link = {
title: ?string;
href: string;
}
type marked$Tokens = { links: Array<marked$Link> } & Array<marked$Token>;
type marked$NoopRule = {
(i: mixed): void;
exec: (i: mixed) => void;
}
type marked$Rule = RegExp | marked$NoopRule
type marked$lex = (t: string) => marked$Tokens;
class marked$Lexer {
static lexer: (t: string, o?: marked$MarkedOptions) => marked$Tokens;
static rules: { [key: string]: marked$Rule };
rules: { [key: string]: marked$Rule };
lex: marked$lex;
tokens: marked$Tokens;
options: marked$MarkedOptions;
constructor(o?: marked$MarkedOptions): marked$Lexer {
return this;
}
}
class marked$Parser {
static parse: (t: marked$Tokens, o?: marked$MarkedOptions) => string;
parse: (t: marked$Tokens) => string;
next: () => marked$Token;
peek: () => marked$Token;
parsemarked$Text: () => string;
tok: () => string;
tokens: marked$Tokens;
token: ?marked$Token;
options: marked$MarkedOptions;
renderer: marked$Renderer;
constructor(o?: marked$MarkedOptions): marked$Parser {
return this;
}
}
class marked$InlineLexer {
static rules: Array<marked$Rule>;
static output: (s: string, l: Array<marked$Link>, o?: marked$MarkedOptions) => string;
output: (s: string) => string;
outputmarked$Link: (c: Array<string>, l: marked$Link) => string;
smartypants: (t: string) => string;
mangle: (t: string) => string;
options: marked$MarkedOptions;
links: Array<marked$Link>;
rules: Array<marked$Rule>;
renderer: marked$Renderer;
constructor(l: Array<marked$Link>, o?: marked$MarkedOptions): marked$InlineLexer {
return this;
}
}
type marked$Marked = {
(md: string, o: marked$MarkedOptions, cb: marked$NodeCallback<string>): void;
(md: string, cb: marked$NodeCallback<string>): void;
(md: string, o?: marked$MarkedOptions): string;
setOptions: (o: marked$MarkedOptions) => void;
defaults: marked$MarkedOptions;
Parser: typeof marked$Parser;
parser: typeof marked$Parser.parse;
Lexer: typeof marked$Lexer;
lexer: typeof marked$Lexer.lexer;
InlineLexer: typeof marked$InlineLexer;
inlinelexer: marked$InlineLexer.output;
Renderer: typeof marked$Renderer;
parse: marked$Marked;
}
declare module marked {
declare export default marked$Marked;
}

53
flow-typed/npm/minimatch_v3.x.x.js vendored Normal file
View file

@ -0,0 +1,53 @@
// flow-typed signature: bc0af4a44bb8631039f713b1afba6988
// flow-typed version: d42cbef63c/minimatch_v3.x.x/flow_>=v0.25.x
type $npm$minimatch$Options = {
debug?: boolean,
nobrace?: boolean,
noglobstar?: boolean,
dot?: boolean,
noext?: boolean,
nocase?: boolean,
nonull?: boolean,
matchBase?: boolean,
nocomment?: boolean,
nonegate?: boolean,
flipNegate?: boolean
};
declare module "minimatch" {
declare class Minimatch {
constructor(pattern: string, options?: $npm$minimatch$Options): Minimatch,
set: Array<Array<string | RegExp>>,
regexp: null | RegExp, // null until .makeRe() is called
negate: boolean,
comment: boolean,
empty: boolean,
makeRe(): RegExp | false,
match(name: string): boolean,
matchOne(
fileArray: Array<string>,
patternArray: Array<string>,
partial?: boolean
): boolean
}
declare class MinimatchModule {
Minimatch: Class<Minimatch>,
(name: string, pattern: string, options?: $npm$minimatch$Options): boolean,
filter(
pattern: string,
options?: $npm$minimatch$Options
): (value: string) => boolean,
match(
list: Array<string>,
pattern: string,
options?: $npm$minimatch$Options
): Array<string>
}
declare module.exports: MinimatchModule;
}

13
flow-typed/npm/mkdirp_v0.5.x.js vendored Normal file
View file

@ -0,0 +1,13 @@
// flow-typed signature: 82aa0feffc2bbd64dce3bec492f5d601
// flow-typed version: 3315d89a00/mkdirp_v0.5.x/flow_>=v0.25.0
declare module 'mkdirp' {
declare type Options = number | { mode?: number; fs?: mixed };
declare type Callback = (err: ?Error, path: ?string) => void;
declare module.exports: {
(path: string, options?: Options | Callback, callback?: Callback): void;
sync(path: string, options?: Options): void;
};
}

View file

@ -0,0 +1,9 @@
// flow-typed signature: b0a8c8851219a1c2a933509d842e0bc8
// flow-typed version: 4a2d036a51/normalize.css_v7.x.x/flow_>=v0.34.x
// normalize.css may be imported for side-effects,
// e.g. to force webpack to bundle it alongside CSS modules
declare module "normalize.css" {
declare export default empty
}

34
flow-typed/npm/prop-types_v15.x.x.js vendored Normal file
View file

@ -0,0 +1,34 @@
// flow-typed signature: 3eaa1f24c7397b78a7481992d2cddcb2
// flow-typed version: a1a20d4928/prop-types_v15.x.x/flow_>=v0.41.x
type $npm$propTypes$ReactPropsCheckType = (
props: any,
propName: string,
componentName: string,
href?: string) => ?Error;
declare module 'prop-types' {
declare var array: React$PropType$Primitive<Array<any>>;
declare var bool: React$PropType$Primitive<boolean>;
declare var func: React$PropType$Primitive<Function>;
declare var number: React$PropType$Primitive<number>;
declare var object: React$PropType$Primitive<Object>;
declare var string: React$PropType$Primitive<string>;
declare var any: React$PropType$Primitive<any>;
declare var arrayOf: React$PropType$ArrayOf;
declare var element: React$PropType$Primitive<any>; /* TODO */
declare var instanceOf: React$PropType$InstanceOf;
declare var node: React$PropType$Primitive<any>; /* TODO */
declare var objectOf: React$PropType$ObjectOf;
declare var oneOf: React$PropType$OneOf;
declare var oneOfType: React$PropType$OneOfType;
declare var shape: React$PropType$Shape;
declare function checkPropTypes<V>(
propTypes: $Subtype<{[_: $Keys<V>]: $npm$propTypes$ReactPropsCheckType}>,
values: V,
location: string,
componentName: string,
getStack: ?(() => ?string)
) : void;
}

View file

@ -0,0 +1,158 @@
// flow-typed signature: 7ef7e99bfa7953a438470755d51dc345
// flow-typed version: 107feb8c45/react-router-dom_v4.x.x/flow_>=v0.53.x
declare module "react-router-dom" {
declare export class BrowserRouter extends React$Component<{
basename?: string,
forceRefresh?: boolean,
getUserConfirmation?: GetUserConfirmation,
keyLength?: number,
children?: React$Node
}> {}
declare export class HashRouter extends React$Component<{
basename?: string,
getUserConfirmation?: GetUserConfirmation,
hashType?: "slash" | "noslash" | "hashbang",
children?: React$Node
}> {}
declare export class Link extends React$Component<{
to: string | LocationShape,
replace?: boolean,
children?: React$Node
}> {}
declare export class NavLink extends React$Component<{
to: string | LocationShape,
activeClassName?: string,
className?: string,
activeStyle?: Object,
style?: Object,
isActive?: (match: Match, location: Location) => boolean,
children?: React$Node,
exact?: boolean,
strict?: boolean
}> {}
// NOTE: Below are duplicated from react-router. If updating these, please
// update the react-router and react-router-native types as well.
declare export type Location = {
pathname: string,
search: string,
hash: string,
state?: any,
key?: string
};
declare export type LocationShape = {
pathname?: string,
search?: string,
hash?: string,
state?: any
};
declare export type HistoryAction = "PUSH" | "REPLACE" | "POP";
declare export type RouterHistory = {
length: number,
location: Location,
action: HistoryAction,
listen(
callback: (location: Location, action: HistoryAction) => void
): () => void,
push(path: string | LocationShape, state?: any): void,
replace(path: string | LocationShape, state?: any): void,
go(n: number): void,
goBack(): void,
goForward(): void,
canGo?: (n: number) => boolean,
block(
callback: (location: Location, action: HistoryAction) => boolean
): void,
// createMemoryHistory
index?: number,
entries?: Array<Location>
};
declare export type Match = {
params: { [key: string]: ?string },
isExact: boolean,
path: string,
url: string
};
declare export type ContextRouter = {|
history: RouterHistory,
location: Location,
match: Match
|};
declare export type GetUserConfirmation = (
message: string,
callback: (confirmed: boolean) => void
) => void;
declare type StaticRouterContext = {
url?: string
};
declare export class StaticRouter extends React$Component<{
basename?: string,
location?: string | Location,
context: StaticRouterContext,
children?: React$Node
}> {}
declare export class MemoryRouter extends React$Component<{
initialEntries?: Array<LocationShape | string>,
initialIndex?: number,
getUserConfirmation?: GetUserConfirmation,
keyLength?: number,
children?: React$Node
}> {}
declare export class Router extends React$Component<{
history: RouterHistory,
children?: React$Node
}> {}
declare export class Prompt extends React$Component<{
message: string | ((location: Location) => string | boolean),
when?: boolean
}> {}
declare export class Redirect extends React$Component<{
to: string | LocationShape,
push?: boolean
}> {}
declare export class Route extends React$Component<{
component?: React$ComponentType<*>,
render?: (router: ContextRouter) => React$Node,
children?: React$ComponentType<ContextRouter> | React$Node,
path?: string,
exact?: boolean,
strict?: boolean
}> {}
declare export class Switch extends React$Component<{
children?: React$Node
}> {}
declare export function withRouter<P>(
Component: React$ComponentType<{| ...ContextRouter, ...P |}>
): React$ComponentType<P>;
declare type MatchPathOptions = {
path?: string,
exact?: boolean,
sensitive?: boolean,
strict?: boolean
};
declare export function matchPath(
pathname: string,
options?: MatchPathOptions | string
): null | Match;
}

View file

@ -1,5 +0,0 @@
declare function request(options: any, callback: any): Promise<any>;
declare module 'request' {
declare module.exports: request
}

108
flow-typed/npm/request_vx.x.x.js vendored Normal file
View file

@ -0,0 +1,108 @@
// flow-typed signature: fce684fdcdf9c74363f2c0bf136dbf88
// flow-typed version: <<STUB>>/request_v2.83.0/flow_v0.64.0
/**
* This is an autogenerated libdef stub for:
*
* 'request'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/
declare module 'request' {
declare module.exports: any;
}
/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'request/lib/auth' {
declare module.exports: any;
}
declare module 'request/lib/cookies' {
declare module.exports: any;
}
declare module 'request/lib/getProxyFromURI' {
declare module.exports: any;
}
declare module 'request/lib/har' {
declare module.exports: any;
}
declare module 'request/lib/helpers' {
declare module.exports: any;
}
declare module 'request/lib/multipart' {
declare module.exports: any;
}
declare module 'request/lib/oauth' {
declare module.exports: any;
}
declare module 'request/lib/querystring' {
declare module.exports: any;
}
declare module 'request/lib/redirect' {
declare module.exports: any;
}
declare module 'request/lib/tunnel' {
declare module.exports: any;
}
declare module 'request/request' {
declare module.exports: any;
}
// Filename aliases
declare module 'request/index' {
declare module.exports: $Exports<'request'>;
}
declare module 'request/index.js' {
declare module.exports: $Exports<'request'>;
}
declare module 'request/lib/auth.js' {
declare module.exports: $Exports<'request/lib/auth'>;
}
declare module 'request/lib/cookies.js' {
declare module.exports: $Exports<'request/lib/cookies'>;
}
declare module 'request/lib/getProxyFromURI.js' {
declare module.exports: $Exports<'request/lib/getProxyFromURI'>;
}
declare module 'request/lib/har.js' {
declare module.exports: $Exports<'request/lib/har'>;
}
declare module 'request/lib/helpers.js' {
declare module.exports: $Exports<'request/lib/helpers'>;
}
declare module 'request/lib/multipart.js' {
declare module.exports: $Exports<'request/lib/multipart'>;
}
declare module 'request/lib/oauth.js' {
declare module.exports: $Exports<'request/lib/oauth'>;
}
declare module 'request/lib/querystring.js' {
declare module.exports: $Exports<'request/lib/querystring'>;
}
declare module 'request/lib/redirect.js' {
declare module.exports: $Exports<'request/lib/redirect'>;
}
declare module 'request/lib/tunnel.js' {
declare module.exports: $Exports<'request/lib/tunnel'>;
}
declare module 'request/request.js' {
declare module.exports: $Exports<'request/request'>;
}

198
flow-typed/npm/semver_v5.1.x.js vendored Normal file
View file

@ -0,0 +1,198 @@
// flow-typed signature: dc381ee55406f66b7272c6343db0834b
// flow-typed version: da30fe6876/semver_v5.1.x/flow_>=v0.25.x
declare module "semver" {
declare type Release =
| "major"
| "premajor"
| "minor"
| "preminor"
| "patch"
| "prepatch"
| "prerelease";
// The supported comparators are taken from the source here:
// https://github.com/npm/node-semver/blob/8bd070b550db2646362c9883c8d008d32f66a234/semver.js#L623
declare type Operator =
| "==="
| "!=="
| "=="
| "="
| "" // Not sure why you would want this, but whatever.
| "!="
| ">"
| ">="
| "<"
| "<=";
declare class SemVer {
build: Array<string>;
loose: ?boolean;
major: number;
minor: number;
patch: number;
prerelease: Array<string | number>;
raw: string;
version: string;
constructor(version: string | SemVer, loose?: boolean): SemVer;
compare(other: string | SemVer): -1 | 0 | 1;
compareMain(other: string | SemVer): -1 | 0 | 1;
comparePre(other: string | SemVer): -1 | 0 | 1;
format(): string;
inc(release: Release, identifier: string): this;
}
declare class Comparator {
loose?: boolean;
operator: Operator;
semver: SemVer;
value: string;
constructor(comp: string | Comparator, loose?: boolean): Comparator;
parse(comp: string): void;
test(version: string): boolean;
}
declare class Range {
loose: ?boolean;
raw: string;
set: Array<Array<Comparator>>;
constructor(range: string | Range, loose?: boolean): Range;
format(): string;
parseRange(range: string): Array<Comparator>;
test(version: string): boolean;
toString(): string;
}
declare var SEMVER_SPEC_VERSION: string;
declare var re: Array<RegExp>;
declare var src: Array<string>;
// Functions
declare function valid(v: string | SemVer, loose?: boolean): string | null;
declare function clean(v: string | SemVer, loose?: boolean): string | null;
declare function inc(
v: string | SemVer,
release: Release,
loose?: boolean,
identifier?: string
): string | null;
declare function inc(
v: string | SemVer,
release: Release,
identifier: string
): string | null;
declare function major(v: string | SemVer, loose?: boolean): number;
declare function minor(v: string | SemVer, loose?: boolean): number;
declare function patch(v: string | SemVer, loose?: boolean): number;
// Comparison
declare function gt(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): boolean;
declare function gte(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): boolean;
declare function lt(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): boolean;
declare function lte(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): boolean;
declare function eq(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): boolean;
declare function neq(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): boolean;
declare function cmp(
v1: string | SemVer,
comparator: Operator,
v2: string | SemVer,
loose?: boolean
): boolean;
declare function compare(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): -1 | 0 | 1;
declare function rcompare(
v1: string | SemVer,
v2: string | SemVer,
loose?: boolean
): -1 | 0 | 1;
declare function compareLoose(
v1: string | SemVer,
v2: string | SemVer
): -1 | 0 | 1;
declare function diff(v1: string | SemVer, v2: string | SemVer): ?Release;
declare function sort(
list: Array<string | SemVer>,
loose?: boolean
): Array<string | SemVer>;
declare function rsort(
list: Array<string | SemVer>,
loose?: boolean
): Array<string | SemVer>;
declare function compareIdentifiers(
v1: string | SemVer,
v2: string | SemVer
): -1 | 0 | 1;
declare function rcompareIdentifiers(
v1: string | SemVer,
v2: string | SemVer
): -1 | 0 | 1;
// Ranges
declare function validRange(
range: string | Range,
loose?: boolean
): string | null;
declare function satisfies(
version: string | SemVer,
range: string | Range,
loose?: boolean
): boolean;
declare function maxSatisfying(
versions: Array<string | SemVer>,
range: string | Range,
loose?: boolean
): string | SemVer | null;
declare function gtr(
version: string | SemVer,
range: string | Range,
loose?: boolean
): boolean;
declare function ltr(
version: string | SemVer,
range: string | Range,
loose?: boolean
): boolean;
declare function outside(
version: string | SemVer,
range: string | Range,
hilo: ">" | "<",
loose?: boolean
): boolean;
// Not explicitly documented, or deprecated
declare function parse(version: string, loose?: boolean): ?SemVer;
declare function toComparators(
range: string | Range,
loose?: boolean
): Array<Array<string>>;
}

View file

@ -51,7 +51,7 @@
"@commitlint/cli": "^6.1.0",
"@commitlint/config-conventional": "^6.1.0",
"@commitlint/travis-cli": "^6.1.0",
"@verdaccio/types": "0.2.0",
"@verdaccio/types": "0.3.1",
"axios": "0.17.1",
"babel-cli": "6.26.0",
"babel-core": "6.26.0",

View file

@ -15,7 +15,7 @@ module.exports = function(route, auth, storage) {
let tags = {};
tags[req.params.tag] = req.body;
storage.merge_tags(req.params.package, tags, function(err) {
storage.mergeTags(req.params.package, tags, function(err) {
if (err) {
return next(err);
}
@ -37,7 +37,7 @@ module.exports = function(route, auth, storage) {
route.delete('/-/package/:package/dist-tags/:tag', can('publish'), function(req, res, next) {
const tags = {};
tags[req.params.tag] = null;
storage.merge_tags(req.params.package, tags, function(err) {
storage.mergeTags(req.params.package, tags, function(err) {
if (err) {
return next(err);
}
@ -49,7 +49,7 @@ module.exports = function(route, auth, storage) {
});
route.get('/-/package/:package/dist-tags', can('access'), function(req, res, next) {
storage.get_package({
storage.getPackage({
name: req.params.package,
req,
callback: function(err, info) {
@ -63,7 +63,7 @@ module.exports = function(route, auth, storage) {
});
route.post('/-/package/:package/dist-tags', can('publish'), function(req, res, next) {
storage.merge_tags(req.params.package, req.body, function(err) {
storage.mergeTags(req.params.package, req.body, function(err) {
if (err) {
return next(err);
}

View file

@ -37,7 +37,7 @@ module.exports = function(route, auth, storage, config) {
return next( createError[404]('version not found: ' + req.params.version) );
};
storage.get_package({
storage.getPackage({
name: req.params.package,
req,
callback: getPackageMetaCallback,

View file

@ -35,11 +35,11 @@ module.exports = function(router, auth, storage, config) {
};
const create_version = function(version, data, cb) {
storage.add_version(name, version, data, null, cb);
storage.addVersion(name, version, data, null, cb);
};
const add_tags = function(tags, cb) {
storage.merge_tags(name, tags, cb);
storage.mergeTags(name, tags, cb);
};
const after_change = function(err, ok_message) {
@ -175,7 +175,7 @@ module.exports = function(router, auth, storage, config) {
let version = req.params.version;
let tag = req.params.tag;
storage.add_version(name, version, req.body, tag, function(err) {
storage.addVersion(name, version, req.body, tag, function(err) {
if (err) {
return next(err);
}

View file

@ -1,201 +1,35 @@
import {Router} from 'express';
import bodyParser from 'body-parser';
import addUserAuthApi from './endpoint/user';
import addPackageWebApi from './endpoint/package';
import addSearchWebApi from './endpoint/search';
import Search from '../../lib/search';
const bodyParser = require('body-parser');
const express = require('express');
const marked = require('marked');
const _ = require('lodash');
const Middleware = require('./middleware');
const match = Middleware.match;
const validateName = Middleware.validate_name;
const validatePkg = Middleware.validate_package;
const securityIframe = Middleware.securityIframe;
const route = express.Router(); // eslint-disable-line
const async = require('async');
const HTTPError = require('http-errors');
const Utils = require('../../lib/utils');
const {generateGravatarUrl} = require('../../utils/user');
import {match, validate_name, validate_package, securityIframe} from './middleware';
const route = Router(); /* eslint new-cap: 0 */
/*
This file include all verdaccio only API(Web UI), for npm API please see ../endpoint/
*/
module.exports = function(config, auth, storage) {
Search.configureStorage(storage);
const can = Middleware.allow(auth);
// validate all of these params as a package name
// this might be too harsh, so ask if it causes trouble
route.param('package', validatePkg);
route.param('filename', validateName);
route.param('version', validateName);
route.param('package', validate_package);
route.param('filename', validate_name);
route.param('version', validate_name);
route.param('anything', match(/.*/));
route.use(bodyParser.urlencoded({extended: false}));
route.use(auth.jwtMiddleware());
route.use(securityIframe);
// Get list of all visible package
route.get('/packages', function(req, res, next) {
storage.getLocalDatabase(function(err, packages) {
if (err) {
// that function shouldn't produce any
throw err;
}
async.filterSeries(
packages,
function(pkg, cb) {
auth.allow_access(pkg.name, req.remote_user, function(err, allowed) {
setImmediate(function() {
if (err) {
cb(null, false);
} else {
cb(err, allowed);
}
});
});
},
function(err, packages) {
if (err) throw err;
packages.sort(function(a, b) {
if (a.name < b.name) {
return -1;
} else {
return 1;
}
});
next(packages);
}
);
});
});
// Get package readme
route.get('/package/readme/(@:scope/)?:package/:version?', can('access'), function(req, res, next) {
let packageName = req.params.package;
if (req.params.scope) {
packageName = `@${req.params.scope}/${packageName}`;
}
storage.get_package({
name: packageName,
req,
callback: function(err, info) {
if (err) {
return next(err);
}
res.set('Content-Type', 'text/plain');
next(marked(info.readme || 'ERROR: No README data found!'));
},
});
});
// Search package
route.get('/search/:anything', function(req, res, next) {
const results = Search.query(req.params.anything);
const packages = [];
const getPackageInfo = function(i) {
storage.get_package({
name: results[i].ref,
callback: (err, entry) => {
if (!err && entry) {
auth.allow_access(entry.name, req.remote_user, function(err, allowed) {
if (err || !allowed) {
return;
}
packages.push(entry.versions[entry['dist-tags'].latest]);
});
}
if (i >= results.length - 1) {
next(packages);
} else {
getPackageInfo(i + 1);
}
},
});
};
if (results.length) {
getPackageInfo(0);
} else {
next([]);
}
});
route.post('/login', function(req, res, next) {
auth.authenticate(req.body.username, req.body.password, (err, user) => {
if (!err) {
req.remote_user = user;
next({
token: auth.issue_token(user, '24h'),
username: req.remote_user.name,
});
} else {
next(HTTPError[err.message ? 401 : 500](err.message));
}
});
});
route.post('/-/logout', function(req, res, next) {
let base = Utils.combineBaseUrl(Utils.getWebProtocol(req), req.get('host'), config.url_prefix);
res.cookies.set('token', '');
res.redirect(base);
});
route.get('/sidebar/(@:scope/)?:package', function(req, res, next) {
let packageName = req.params.package;
if (req.params.scope) {
packageName = `@${req.params.scope}/${packageName}`;
}
storage.get_package({
name: packageName,
keepUpLinkData: true,
req,
callback: function(err, info) {
res.set('Content-Type', 'application/json');
if (!err) {
info.latest = info.versions[info['dist-tags'].latest];
let propertyToDelete = ['readme', 'versions'];
_.forEach(propertyToDelete, ((property) => {
delete info[property];
}));
if (typeof _.get(info, 'latest.author.email') === 'string') {
info.latest.author.avatar = generateGravatarUrl(info.latest.author.email);
} else {
// _.get can't guarantee author property exist
_.set(info, 'latest.author.avatar', generateGravatarUrl());
}
if (_.get(info, 'latest.contributors.length', 0) > 0) {
info.latest.contributors = _.map(info.latest.contributors, (contributor) => {
if (typeof contributor.email === 'string') {
contributor.avatar = generateGravatarUrl(contributor.email);
} else {
contributor.avatar = generateGravatarUrl();
}
return contributor;
}
);
}
res.end(JSON.stringify(info));
} else {
res.status(404);
res.end();
}
},
});
});
addPackageWebApi(route, storage, auth);
addSearchWebApi(route, storage, auth);
addUserAuthApi(route, auth, config);
// What are you looking for? logout? client side will remove token when user click logout,
// or it will auto expire after 24 hours.

View file

@ -0,0 +1,82 @@
import _ from 'lodash';
import {addGravatarSupport, deleteProperties, sortByName} from '../../../lib/utils';
import {addScope, allow} from '../middleware';
import async from 'async';
import marked from 'marked';
function addPackageWebApi(route, storage, auth) {
const can = allow(auth);
// Get list of all visible package
route.get('/packages', function(req, res, next) {
storage.getLocalDatabase(function(err, packages) {
if (err) {
// that function shouldn't produce any
throw err;
}
async.filterSeries(
packages,
function(pkg, cb) {
auth.allow_access(pkg.name, req.remote_user, function(err, allowed) {
setImmediate(function() {
if (err) {
cb(null, false);
} else {
cb(err, allowed);
}
});
});
},
function(err, packages) {
if (err) {
throw err;
}
next(sortByName(packages));
}
);
});
});
// Get package readme
route.get('/package/readme/(@:scope/)?:package/:version?', can('access'), function(req, res, next) {
const packageName = req.params.scope ? addScope(req.params.scope, req.params.package) : req.params.package;
storage.getPackage({
name: packageName,
req,
callback: function(err, info) {
if (err) {
return next(err);
}
res.set('Content-Type', 'text/plain');
next(marked(info.readme || 'ERROR: No README data found!'));
},
});
});
route.get('/sidebar/(@:scope/)?:package', function(req, res, next) {
const packageName = req.params.scope ? addScope(req.params.scope, req.params.package) : req.params.package;
storage.getPackage({
name: packageName,
keepUpLinkData: true,
req,
callback: function(err, info) {
if (_.isNil(err)) {
info.latest = info.versions[info['dist-tags'].latest];
info = deleteProperties(['readme', 'versions'], info);
info = addGravatarSupport(info);
next(info);
} else {
res.status(404);
res.end();
}
},
});
});
}
export default addPackageWebApi;

View file

@ -0,0 +1,40 @@
import Search from '../../../lib/search';
function addSearchWebApi(route, storage, auth) {
// Search package
route.get('/search/:anything', function(req, res, next) {
const results = Search.query(req.params.anything);
const packages = [];
const getPackageInfo = function(i) {
storage.getPackage({
name: results[i].ref,
callback: (err, entry) => {
if (!err && entry) {
auth.allow_access(entry.name, req.remote_user, function(err, allowed) {
if (err || !allowed) {
return;
}
packages.push(entry.versions[entry['dist-tags'].latest]);
});
}
if (i >= results.length - 1) {
next(packages);
} else {
getPackageInfo(i + 1);
}
},
});
};
if (results.length) {
getPackageInfo(0);
} else {
next([]);
}
});
}
export default addSearchWebApi;

View file

@ -0,0 +1,28 @@
import HTTPError from 'http-errors';
import {combineBaseUrl, getWebProtocol} from '../../../lib/utils';
function addUserAuthApi(route, auth, config) {
route.post('/login', function(req, res, next) {
auth.authenticate(req.body.username, req.body.password, (err, user) => {
if (!err) {
req.remote_user = user;
next({
token: auth.issue_token(user, '24h'),
username: req.remote_user.name,
});
} else {
next(HTTPError[err.message ? 401 : 500](err.message));
}
});
});
route.post('/-/logout', function(req, res, next) {
const base = combineBaseUrl(getWebProtocol(req), req.get('host'), config.url_prefix);
res.cookies.set('token', '');
res.redirect(base);
});
}
export default addUserAuthApi;

View file

@ -500,7 +500,7 @@ class LocalStorage implements IStorage {
* @param {*} filename
* @return {ReadTarball}
*/
getTarball(name: string, filename: string) {
getTarball(name: string, filename: string): IReadTarball {
assert(Utils.validate_name(filename));
const storage: IPackageStorage = this._getLocalStorage(name);
@ -517,7 +517,7 @@ class LocalStorage implements IStorage {
* @private
* @return {ReadTarball}
*/
_createFailureStreamResponse() {
_createFailureStreamResponse(): IReadTarball {
const stream: IReadTarball = new ReadTarball();
process.nextTick(() => {

View file

@ -1,8 +1,9 @@
// @flow
import _ from 'lodash';
import assert from 'assert';
import async from 'async';
import Error from 'http-errors';
import createError from 'http-errors';
import semver from 'semver';
import Stream from 'stream';
@ -12,7 +13,23 @@ import {ReadTarball} from '@verdaccio/streams';
import ProxyStorage from './up-storage';
import * as Utils from './utils';
const Logger = require('../lib/logger');
import type {
IStorage,
IProxy,
IStorageHandler,
ProxyList,
Package,
Config,
MergeTags,
Version,
DistFile,
Callback,
Logger,
} from '@verdaccio/types';
import type {IReadTarball} from '@verdaccio/streams';
const LoggerApi = require('../lib/logger');
const WHITELIST = ['_rev', 'name', 'versions', 'dist-tags', 'readme', 'time'];
const getDefaultMetadata = (name) => {
return {
@ -27,16 +44,21 @@ const getDefaultMetadata = (name) => {
* Implements Storage interface
* (same for storage.js, local-storage.js, up-storage.js).
*/
class Storage {
class Storage implements IStorageHandler {
localStorage: IStorage;
config: Config;
logger: Logger;
uplinks: ProxyList;
/**
* @param {*} config
*/
constructor(config) {
constructor(config: Config) {
this.config = config;
this.uplinks = {};
this._setupUpLinks(this.config);
this.logger = Logger.logger.child();
this.localStorage = new LocalStorage(this.config, Logger.logger);
this.logger = LoggerApi.logger.child();
this.localStorage = new LocalStorage(this.config, LoggerApi.logger);
}
/**
@ -48,7 +70,7 @@ class Storage {
* @param {*} metadata
* @param {*} callback
*/
addPackage(name, metadata, callback) {
addPackage(name: string, metadata: any, callback: Function) {
const self = this;
/**
@ -62,7 +84,7 @@ class Storage {
return reject(err);
}
if (results) {
return reject(Error[409]('this package is already present'));
return reject(Utils.ErrorCode.get409('this package is already present'));
}
return resolve();
});
@ -82,7 +104,7 @@ class Storage {
}
// checking package
if (results) {
return reject(Error[409]('this package is already present'));
return reject(Utils.ErrorCode.get409('this package is already present'));
}
for (let i = 0; i < err_results.length; i++) {
// checking error
@ -94,7 +116,7 @@ class Storage {
this.config.publish.allow_offline) {
return resolve();
}
return reject(Error[503]('one of the uplinks is down, refuse to publish'));
return reject(createError(503, 'one of the uplinks is down, refuse to publish'));
}
}
}
@ -144,7 +166,7 @@ class Storage {
* @param {*} tag
* @param {*} callback
*/
add_version(name, version, metadata, tag, callback) {
addVersion(name: string, version: Version, metadata: Package, tag: string, callback: Callback) {
this.localStorage.addVersion(name, version, metadata, tag, callback);
}
@ -155,8 +177,8 @@ class Storage {
* @param {*} tag_hash
* @param {*} callback
*/
merge_tags(name, tag_hash, callback) {
this.localStorage.mergeTags(name, tag_hash, callback);
mergeTags(name: string, tagHash: MergeTags, callback: Callback) {
this.localStorage.mergeTags(name, tagHash, callback);
}
/**
@ -166,9 +188,9 @@ class Storage {
* @param {*} tag_hash
* @param {*} callback
*/
replace_tags(name, tag_hash, callback) {
replace_tags(name: string, tagHash: MergeTags, callback: Callback) {
this.logger.warn('method deprecated');
this.localStorage.mergeTags(name, tag_hash, callback);
this.localStorage.mergeTags(name, tagHash, callback);
}
/**
@ -180,7 +202,7 @@ class Storage {
* @param {*} revision
* @param {*} callback
*/
change_package(name, metadata, revision, callback) {
change_package(name: string, metadata: Package, revision: string, callback: Callback) {
this.localStorage.changePackage(name, metadata, revision, callback);
}
@ -191,7 +213,7 @@ class Storage {
* @param {*} name
* @param {*} callback
*/
remove_package(name, callback) {
remove_package(name: string, callback: Callback) {
this.localStorage.removePackage(name, callback);
// update the indexer
Search.remove(name);
@ -208,7 +230,7 @@ class Storage {
* @param {*} revision
* @param {*} callback
*/
remove_tarball(name, filename, revision, callback) {
remove_tarball(name: string, filename: string, revision: string, callback: Callback) {
this.localStorage.removeTarball(name, filename, revision, callback);
}
@ -220,7 +242,7 @@ class Storage {
* @param {*} filename
* @return {Stream}
*/
add_tarball(name, filename) {
add_tarball(name: string, filename: string) {
return this.localStorage.addTarball(name, filename);
}
@ -234,7 +256,7 @@ class Storage {
* @param {*} filename
* @return {Stream}
*/
get_tarball(name, filename) {
get_tarball(name: string, filename: string) {
let readStream = new ReadTarball();
readStream.abort = function() {};
@ -244,7 +266,7 @@ class Storage {
// information about it, so fetching package info is unnecessary
// trying local first
let localStream = self.localStorage.getTarball(name, filename);
let localStream: IReadTarball = self.localStorage.getTarball(name, filename);
let is_open = false;
localStream.on('error', (err) => {
if (is_open || err.status !== 404) {
@ -255,13 +277,13 @@ class Storage {
let err404 = err;
localStream.abort();
localStream = null; // gc
self.localStorage.getPackageMetadata(name, (err, info) => {
self.localStorage.getPackageMetadata(name, (err, info: Package) => {
if (_.isNil(err) && info._distfiles && _.isNil(info._distfiles[filename]) === false) {
// information about this file exists locally
serveFile(info._distfiles[filename]);
} else {
// we know nothing about this file, trying to get information elsewhere
self._syncUplinksMetadata(name, info, {}, (err, info) => {
self._syncUplinksMetadata(name, info, {}, (err, info: Package) => {
if (_.isNil(err) === false) {
return readStream.emit('error', err);
}
@ -286,13 +308,16 @@ class Storage {
* Fetch and cache local/remote packages.
* @param {Object} file define the package shape
*/
function serveFile(file) {
let uplink = null;
function serveFile(file: DistFile) {
let uplink: any = null;
for (let p in self.uplinks) {
// $FlowFixMe
if (self.uplinks[p].isUplinkValid(file.url)) {
uplink = self.uplinks[p];
}
}
if (uplink == null) {
uplink = new ProxyStorage({
url: file.url,
@ -300,10 +325,12 @@ class Storage {
_autogenerated: true,
}, self.config);
}
let savestream = null;
if (uplink.config.cache) {
savestream = self.localStorage.addTarball(name, filename);
}
let on_open = function() {
// prevent it from being called twice
on_open = function() {};
@ -366,35 +393,36 @@ class Storage {
* @property {boolean} options.keepUpLinkData keep up link info in package meta, last update, etc.
* @property {function} options.callback Callback for receive data
*/
get_package(options) {
getPackage(options: any) {
this.localStorage.getPackageMetadata(options.name, (err, data) => {
if (err && (!err.status || err.status >= 500)) {
// report internal errors right away
return options.callback(err);
}
this._syncUplinksMetadata(options.name, data, {req: options.req}, function(err, result, uplink_errors) {
if (err) {
return options.callback(err);
}
const propertyToKeep = [...WHITELIST];
if (options.keepUpLinkData === true) {
propertyToKeep.push('_uplinks');
}
for (let i in result) {
if (propertyToKeep.indexOf(i) === -1) { // Remove sections like '_uplinks' from response
delete result[i];
this._syncUplinksMetadata(options.name, data, {req: options.req},
function getPackageSynUpLinksCallback(err, result: Package, uplink_errors) {
if (err) {
return options.callback(err);
}
}
Utils.normalize_dist_tags(result);
const propertyToKeep = [...WHITELIST];
if (options.keepUpLinkData === true) {
propertyToKeep.push('_uplinks');
}
// npm can throw if this field doesn't exist
result._attachments = {};
for (let i in result) {
if (propertyToKeep.indexOf(i) === -1) { // Remove sections like '_uplinks' from response
delete result[i];
}
}
options.callback(null, result, uplink_errors);
Utils.normalize_dist_tags(result);
// npm can throw if this field doesn't exist
result._attachments = {};
options.callback(null, result, uplink_errors);
});
});
}
@ -411,10 +439,10 @@ class Storage {
* @param {*} options
* @return {Stream}
*/
search(startkey, options) {
search(startkey: string, options: any) {
let self = this;
// stream to write a tarball
let stream = new Stream.PassThrough({objectMode: true});
let stream: any = new Stream.PassThrough({objectMode: true});
async.eachSeries(Object.keys(this.uplinks), function(up_name, cb) {
// shortcut: if `local=1` is supplied, don't call uplinks
@ -422,7 +450,7 @@ class Storage {
return cb();
}
// search by keyword for each uplink
let lstream = self.uplinks[up_name].search(options);
let lstream: IUploadTarball = self.uplinks[up_name].search(options);
// join streams
lstream.pipe(stream, {end: false});
lstream.on('error', function(err) {
@ -443,7 +471,7 @@ class Storage {
// executed after all series
function() {
// attach a local search results
let lstream = self.localStorage.search(startkey, options);
let lstream: IReadTarball = self.localStorage.search(startkey, options);
stream.abort = function() {
lstream.abort();
};
@ -461,7 +489,7 @@ class Storage {
* Retrieve only private local packages
* @param {*} callback
*/
getLocalDatabase(callback) {
getLocalDatabase(callback: Callback) {
let self = this;
let locals = this.localStorage.localData.get();
let packages = [];
@ -502,7 +530,7 @@ class Storage {
* @param {*} options
* @param {*} callback
*/
_syncUplinksMetadata(name, packageInfo, options, callback) {
_syncUplinksMetadata(name: string, packageInfo: Package, options: any, callback: Callback) {
let exists = false;
const self = this;
const upLinks = [];
@ -542,7 +570,8 @@ class Storage {
}
if (err || !upLinkResponse) {
return cb(null, [err || Error('no data')]);
// $FlowFixMe
return cb(null, [err || createError(500, 'no data')]);
}
try {
@ -568,7 +597,8 @@ class Storage {
this._updateVersionsHiddenUpLink(upLinkResponse.versions, upLink);
try {
Storage._merge_versions(packageInfo, upLinkResponse, self.config);
Storage._mergeVersions(packageInfo, upLinkResponse, self.config);
} catch(err) {
self.logger.error({
sub: 'out',
@ -582,15 +612,15 @@ class Storage {
exists = true;
cb();
});
}, (err, upLinksErrors) => {
}, (err: Error, upLinksErrors: any) => {
assert(!err && Array.isArray(upLinksErrors));
if (!exists) {
return callback( Error[404]('no such package available')
return callback( Utils.ErrorCode.get404('no such package available')
, null
, upLinksErrors );
}
self.localStorage.updateVersions(name, packageInfo, function(err, packageJsonLocal) {
self.localStorage.updateVersions(name, packageInfo, function(err, packageJsonLocal: Package) {
if (err) {
return callback(err);
}
@ -605,12 +635,13 @@ class Storage {
* @param {String} upLink uplink name
* @private
*/
_updateVersionsHiddenUpLink(versions, upLink) {
_updateVersionsHiddenUpLink(versions: Versions, upLink: IProxy) {
for (let i in versions) {
if (Object.prototype.hasOwnProperty.call(versions, i)) {
const version = versions[i];
// holds a "hidden" value to be used by the package storage.
// $FlowFixMe
version[Symbol.for('__verdaccio_uplink')] = upLink.upname;
}
}
@ -621,15 +652,14 @@ class Storage {
* @param {Object} config
* @private
*/
_setupUpLinks(config) {
// we support a number of uplinks, but only one local storage
// Proxy and Local classes should have similar API interfaces
this.uplinks = {};
for (let p in config.uplinks) {
if (Object.prototype.hasOwnProperty.call(config.uplinks, p)) {
_setupUpLinks(config: Config) {
for (let uplinkName in config.uplinks) {
if (Object.prototype.hasOwnProperty.call(config.uplinks, uplinkName)) {
// instance for each up-link definition
this.uplinks[p] = new ProxyStorage(config.uplinks[p], config);
this.uplinks[p].upname = p;
const proxy: IProxy = new ProxyStorage(config.uplinks[uplinkName], config);
proxy.upname = uplinkName;
this.uplinks[uplinkName] = proxy;
}
}
}
@ -642,7 +672,7 @@ class Storage {
* @param {*} config
* @static
*/
static _merge_versions(local, up, config) {
static _mergeVersions(local: Package, up: Package, config: Config) {
// copy new versions to a cache
// NOTE: if a certain version was updated, we can't refresh it reliably
for (let i in up.versions) {

View file

@ -1,20 +1,29 @@
const JSONStream = require('JSONStream');
const createError = require('http-errors');
const _ = require('lodash');
const request = require('request');
const Stream = require('stream');
const URL = require('url');
const Logger = require('./logger');
const MyStreams = require('@verdaccio/streams');
const Utils = require('./utils');
const zlib = require('zlib');
// @flow
import zlib from 'zlib';
import JSONStream from 'JSONStream';
import createError from 'http-errors';
import _ from 'lodash';
import request from 'request';
import Stream from 'stream';
import URL from 'url';
import {parseInterval, is_object, ErrorCode} from './utils';
import {ReadTarball} from '@verdaccio/streams';
import type {
IProxy,
Config,
Callback,
Logger,
} from '@verdaccio/types';
import type {IUploadTarball} from '@verdaccio/streams';
const LoggerApi = require('./logger');
const encode = function(thing) {
return encodeURIComponent(thing).replace(/^%40/, '@');
};
const jsonContentType = 'application/json';
const contenTypeAccept = `${jsonContentType};`;
/**
@ -32,23 +41,37 @@ const setConfig = (config, key, def) => {
* Implements Storage interface
* (same for storage.js, local-storage.js, up-storage.js)
*/
class ProxyStorage {
class ProxyStorage implements IProxy {
config: Config;
failed_requests: number;
userAgent: string;
ca: string | void;
logger: Logger;
server_id: string;
url: any;
maxage: string;
timeout: string;
max_fails: number;
fail_timeout: number;
upname: string;
proxy: string;
last_request_time: number;
/**
* Constructor
* @param {*} config
* @param {*} mainConfig
*/
constructor(config, mainConfig) {
constructor(config: UpLinkConf, mainConfig: Config) {
this.config = config;
this.failed_requests = 0;
this.userAgent = mainConfig.user_agent;
this.ca = config.ca;
this.logger = Logger.logger.child({sub: 'out'});
this.logger = LoggerApi.logger.child({sub: 'out'});
this.server_id = mainConfig.server_id;
this.url = URL.parse(this.config.url);
// $FlowFixMe
this._setupProxy(this.url.hostname, config, mainConfig, this.url.protocol === 'https:');
this.config.url = this.config.url.replace(/\/$/, '');
@ -61,10 +84,10 @@ class ProxyStorage {
}
// a bunch of different configurable timers
this.maxage = Utils.parseInterval(setConfig(this.config, 'maxage', '2m' ));
this.timeout = Utils.parseInterval(setConfig(this.config, 'timeout', '30s'));
this.maxage = parseInterval(setConfig(this.config, 'maxage', '2m' ));
this.timeout = parseInterval(setConfig(this.config, 'timeout', '30s'));
this.max_fails = Number(setConfig(this.config, 'max_fails', 2 ));
this.fail_timeout = Utils.parseInterval(setConfig(this.config, 'fail_timeout', '5m' ));
this.fail_timeout = parseInterval(setConfig(this.config, 'fail_timeout', '5m' ));
}
/**
@ -73,7 +96,7 @@ class ProxyStorage {
* @param {*} cb
* @return {Request}
*/
request(options, cb) {
request(options: any, cb: Callback) {
let json;
if (this._statusCheck() === false) {
@ -81,11 +104,12 @@ class ProxyStorage {
process.nextTick(function() {
if (_.isFunction(cb)) {
cb(createError('uplink is offline'));
cb(ErrorCode.get500('uplink is offline'));
}
// $FlowFixMe
streamRead.emit('error', createError('uplink is offline'));
});
// $FlowFixMe
streamRead._read = function() {};
// preventing 'Uncaught, unspecified "error" event'
streamRead.on('error', function() {});
@ -107,7 +131,7 @@ class ProxyStorage {
uri: uri,
}, 'making request: \'@{method} @{uri}\'');
if (Utils.is_object(options.json)) {
if (is_object(options.json)) {
json = JSON.stringify(options.json);
headers['Content-Type'] = headers['Content-Type'] || 'application/json';
}
@ -115,7 +139,7 @@ class ProxyStorage {
let requestCallback = cb ? (function(err, res, body) {
let error;
const responseLength = err ? 0 : body.length;
// $FlowFixMe
processBody(err, body);
logActivity();
cb(err, res, body);
@ -131,6 +155,7 @@ class ProxyStorage {
if (options.json && res.statusCode < 300) {
try {
// $FlowFixMe
body = JSON.parse(body.toString('utf8'));
} catch(_err) {
body = {};
@ -139,7 +164,7 @@ class ProxyStorage {
}
}
if (!err && Utils.is_object(body)) {
if (!err && is_object(body)) {
if (_.isString(body.error)) {
error = body.error;
}
@ -181,7 +206,7 @@ class ProxyStorage {
let statusCalled = false;
req.on('response', function(res) {
if (!req._verdaccio_aborted && _.isNil(statusCalled) === false) {
if (!req._verdaccio_aborted && !statusCalled) {
statusCalled = true;
self._statusCheck(true);
}
@ -215,7 +240,7 @@ class ProxyStorage {
* @return {Object}
* @private
*/
_setHeaders(options) {
_setHeaders(options: any) {
const headers = options.headers || {};
const accept = 'Accept';
const acceptEncoding = 'Accept-Encoding';
@ -235,7 +260,7 @@ class ProxyStorage {
* @return {Object}
* @private
*/
_setAuth(headers) {
_setAuth(headers: any) {
if (_.isNil(this.config.auth) || headers['authorization']) {
return headers;
@ -247,7 +272,7 @@ class ProxyStorage {
// get NPM_TOKEN http://blog.npmjs.org/post/118393368555/deploying-with-npm-private-modules
// or get other variable export in env
let token = process.env.NPM_TOKEN;
let token: any = process.env.NPM_TOKEN;
if (this.config.auth.token) {
token = this.config.auth.token;
} else if (this.config.auth.token_env) {
@ -269,7 +294,7 @@ class ProxyStorage {
* @throws {Error}
* @private
*/
_throwErrorAuth(message) {
_throwErrorAuth(message: string) {
this.logger.error(message);
throw new Error(message);
}
@ -281,7 +306,7 @@ class ProxyStorage {
* @param {string} token
* @private
*/
_setHeaderAuthorization(headers, type, token) {
_setHeaderAuthorization(headers: any, type: string, token: string) {
if (type !== 'bearer' && type !== 'basic') {
this._throwErrorAuth(`Auth type '${type}' not allowed`);
}
@ -309,7 +334,7 @@ class ProxyStorage {
* @param {Object} headers
* @private
*/
_overrideWithUplinkConfigHeaders(headers) {
_overrideWithUplinkConfigHeaders(headers: any) {
// add/override headers specified in the config
for (let key in this.config.headers) {
if (Object.prototype.hasOwnProperty.call(this.config.headers, key)) {
@ -319,13 +344,15 @@ class ProxyStorage {
}
/**
* Determine whether can fetch from the provided URL.
* Determine whether can fetch from the provided URL
* @param {*} url
* @return {Boolean}
*/
isUplinkValid(url) {
url = URL.parse(url);
return url.protocol === this.url.protocol && url.host === this.url.host && url.path.indexOf(this.url.path) === 0;
isUplinkValid(url: string) {
// $FlowFixMe
url = URL.parse(url);
// $FlowFixMe
return url.protocol === this.url.protocol && url.host === this.url.host && url.path.indexOf(this.url.path) === 0;
}
/**
@ -334,7 +361,7 @@ class ProxyStorage {
* @param {*} options request options, eg: eTag.
* @param {*} callback
*/
getRemoteMetadata(name, options, callback) {
getRemoteMetadata(name: string, options: any, callback: Callback) {
const headers = {};
if (_.isNil(options.etag) === false) {
headers['If-None-Match'] = options.etag;
@ -351,10 +378,11 @@ class ProxyStorage {
return callback(err);
}
if (res.statusCode === 404) {
return callback( createError[404]('package doesn\'t exist on uplink') );
return callback( ErrorCode.get404('package doesn\'t exist on uplink'));
}
if (!(res.statusCode >= 200 && res.statusCode < 300)) {
const error = createError(`bad status code: ${res.statusCode}`);
const error = createError(500, `bad status code: ${res.statusCode}`);
// $FlowFixMe
error.remoteStatus = res.statusCode;
return callback(error);
}
@ -367,8 +395,8 @@ class ProxyStorage {
* @param {String} url
* @return {Stream}
*/
fetchTarball(url) {
const stream = new MyStreams.ReadTarball({});
fetchTarball(url: string) {
const stream = new ReadTarball({});
let current_length = 0;
let expected_length;
@ -381,12 +409,12 @@ class ProxyStorage {
},
});
readStream.on('response', function(res) {
readStream.on('response', function(res: any) {
if (res.statusCode === 404) {
return stream.emit('error', createError[404]('file doesn\'t exist on uplink'));
return stream.emit('error', ErrorCode.get404('file doesn\'t exist on uplink'));
}
if (!(res.statusCode >= 200 && res.statusCode < 300)) {
return stream.emit('error', createError('bad uplink status code: ' + res.statusCode));
return stream.emit('error', createError(500, 'bad uplink status code: ' + res.statusCode));
}
if (res.headers['content-length']) {
expected_length = res.headers['content-length'];
@ -407,7 +435,7 @@ class ProxyStorage {
current_length += data.length;
}
if (expected_length && current_length != expected_length) {
stream.emit('error', createError('content length mismatch'));
stream.emit('error', createError(500, 'content length mismatch'));
}
});
return stream;
@ -418,9 +446,9 @@ class ProxyStorage {
* @param {*} options request options
* @return {Stream}
*/
search(options) {
const transformStream = new Stream.PassThrough({objectMode: true});
const requestStream = this.request({
search(options: any) {
const transformStream: IUploadTarball = new Stream.PassThrough({objectMode: true});
const requestStream: IUploadTarball = this.request({
uri: options.req.url,
req: options.req,
headers: {
@ -429,14 +457,14 @@ class ProxyStorage {
});
let parsePackage = (pkg) => {
if (Utils.is_object(pkg)) {
if (is_object(pkg)) {
transformStream.emit('data', pkg);
}
};
requestStream.on('response', (res) => {
if (!String(res.statusCode).match(/^2\d\d$/)) {
return transformStream.emit('error', createError(`bad status code ${res.statusCode} from uplink`));
return transformStream.emit('error', createError(500, `bad status code ${res.statusCode} from uplink`));
}
// See https://github.com/request/request#requestoptions-callback
@ -470,7 +498,7 @@ class ProxyStorage {
* @param {*} req the http request
* @param {*} headers the request headers
*/
_addProxyHeaders(req, headers) {
_addProxyHeaders(req: any, headers: any) {
if (req) {
// Only submit X-Forwarded-For field if we don't have a proxy selected
// in the config file.
@ -501,7 +529,7 @@ class ProxyStorage {
* @param {*} alive
* @return {Boolean}
*/
_statusCheck(alive) {
_statusCheck(alive?: boolean) {
if (arguments.length === 0) {
return this._ifRequestFailure() === false;
} else {
@ -540,9 +568,9 @@ class ProxyStorage {
* @param {*} mainconfig
* @param {*} isHTTPS
*/
_setupProxy(hostname, config, mainconfig, isHTTPS) {
_setupProxy(hostname: string, config: UpLinkConf, mainconfig: Config, isHTTPS: boolean) {
let noProxyList;
let proxy_key = isHTTPS ? 'https_proxy' : 'http_proxy';
let proxy_key: string = isHTTPS ? 'https_proxy' : 'http_proxy';
// get http_proxy and no_proxy configs
if (proxy_key in config) {
@ -551,6 +579,7 @@ class ProxyStorage {
this.proxy = mainconfig[proxy_key];
}
if ('no_proxy' in config) {
// $FlowFixMe
noProxyList = config.no_proxy;
} else if ('no_proxy' in mainconfig) {
noProxyList = mainconfig.no_proxy;
@ -560,17 +589,22 @@ class ProxyStorage {
if (hostname[0] !== '.') {
hostname = '.' + hostname;
}
// $FlowFixMe
if (_.isString(noProxyList) && noProxyList.length) {
// $FlowFixMe
noProxyList = noProxyList.split(',');
}
if (_.isArray(noProxyList)) {
// $FlowFixMe
for (let i = 0; i < noProxyList.length; i++) {
// $FlowFixMe
let noProxyItem = noProxyList[i];
if (noProxyItem[0] !== '.') noProxyItem = '.' + noProxyItem;
if (hostname.lastIndexOf(noProxyItem) === hostname.length - noProxyItem.length) {
if (this.proxy) {
this.logger.debug({url: this.url.href, rule: noProxyItem},
'not using proxy for @{url}, excluded by @{rule} rule');
// $FlowFixMe
this.proxy = false;
}
break;

View file

@ -1,13 +1,13 @@
'use strict';
import {generateGravatarUrl} from '../utils/user';
import assert from 'assert';
import semver from 'semver';
import YAML from 'js-yaml';
import URL from 'url';
import fs from 'fs';
import _ from 'lodash';
import createError from 'http-errors';
const assert = require('assert');
const semver = require('semver');
const YAML = require('js-yaml');
const URL = require('url');
const fs = require('fs');
const _ = require('lodash');
const Logger = require('./logger');
const createError = require('http-errors');
/**
* Validate a package.
@ -336,8 +336,8 @@ const ErrorCode = {
get400: (customMessage) => {
return createError(400, customMessage);
},
get500: () => {
return createError(500);
get500: (customMessage) => {
return customMessage ? createError(500, customMessage) : createError(500);
},
get403: () => {
return createError(403, 'can\'t use this filename');
@ -380,6 +380,56 @@ function fileExists(path) {
}
}
function sortByName(packages) {
return packages.sort(function(a, b) {
if (a.name < b.name) {
return -1;
} else {
return 1;
}
});
}
function addScope(scope, packageName) {
return `@${scope}/${packageName}`;
}
function deleteProperties(propertiesToDelete, packageInfo) {
_.forEach(propertiesToDelete, (property) => {
delete packageInfo[property];
});
return packageInfo;
}
function addGravatarSupport(info) {
if (_.isString(_.get(info, 'latest.author.email'))) {
info.latest.author.avatar = generateGravatarUrl(info.latest.author.email);
} else {
// _.get can't guarantee author property exist
_.set(info, 'latest.author.avatar', generateGravatarUrl());
}
if (_.get(info, 'latest.contributors.length', 0) > 0) {
info.latest.contributors = _.map(info.latest.contributors, (contributor) => {
if (_.isString(contributor.email)) {
contributor.avatar = generateGravatarUrl(contributor.email);
} else {
contributor.avatar = generateGravatarUrl();
}
return contributor;
}
);
}
return info;
}
module.exports.addGravatarSupport = addGravatarSupport;
module.exports.deleteProperties = deleteProperties;
module.exports.addScope = addScope;
module.exports.sortByName = sortByName;
module.exports.folder_exists = folder_exists;
module.exports.file_exists = fileExists;
module.exports.parseInterval = parseInterval;

View file

@ -7,7 +7,8 @@ import {stringToMD5} from './string';
export function generateGravatarUrl(email?: string): string {
if (typeof email === 'string') {
email = email.trim().toLocaleLowerCase();
let emailMD5 = stringToMD5(email);
const emailMD5 = stringToMD5(email);
return `https://www.gravatar.com/avatar/${emailMD5}`;
} else {
return 'https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm';

View file

@ -2,12 +2,12 @@
.pkgDetail {
.title {
font-size: 38px;
font-size: 26px;
color: $primary-color;
border-bottom: 1px solid $border-color;
text-transform: capitalize;
font-weight: 600;
margin: 0 0 10px;
margin: 0 0 40px;
padding-bottom: 5px;
}

View file

@ -4,7 +4,7 @@
.moduleTitle {
display: flex;
align-items: flex-end;
font-size: 24px;
font-size: 21px;
color: $primary-color;
margin: 0 0 10px;
padding: 5px 0;

View file

@ -7,6 +7,7 @@
&:not(:last-child) {
margin-bottom: 10px;
}
img {
width: $mine-height;
height: $mine-height;
@ -14,6 +15,7 @@
border-radius: 100%;
flex-shrink: 0;
}
span {
font-size: 14px;
flex-shrink: 1;

View file

@ -1,9 +1,7 @@
import assert from 'assert';
export default function(server, express) {
describe('test for unexpected client hangs', () => {
let on_tarball;
let handleResponseTarball;
beforeAll(function() {
express.get('/testexp-racycrash', function(request, response) {
@ -23,16 +21,17 @@ export default function(server, express) {
});
express.get('/testexp-racycrash/-/test.tar.gz', function(request, response) {
on_tarball(response);
handleResponseTarball(response);
});
});
test('should not crash on error if client disconnects', callback => {
on_tarball = function(res) {
handleResponseTarball = function(res) {
res.header('content-length', 1e6);
res.write('test test test\n');
res.write('test test test');
setTimeout(function() {
res.write('test test test\n');
res.write('-');
// destroy the connection
res.socket.destroy();
cb();
}, 200);
@ -40,7 +39,7 @@ export default function(server, express) {
server.request({uri: '/testexp-racycrash/-/test.tar.gz'})
.then(function(body) {
assert.equal(body, 'test test test\n');
expect(body).toEqual('test test test');
});
function cb() {
@ -54,7 +53,7 @@ export default function(server, express) {
});
test('should not store tarball', () => {
on_tarball = function(res) {
handleResponseTarball = function(res) {
res.socket.destroy();
};

View file

@ -14,7 +14,7 @@ describe('Storage._merge_versions versions', () => {
'dist-tags': {},
};
Storage._merge_versions(pkg, {versions: {a: 2, q: 2}});
Storage._mergeVersions(pkg, {versions: {a: 2, q: 2}});
assert.deepEqual(pkg, {
'versions': {a: 1, b: 1, c: 1, q: 2},
@ -28,7 +28,7 @@ describe('Storage._merge_versions versions', () => {
'dist-tags': {q: '1.1.1', w: '2.2.2'},
};
Storage._merge_versions(pkg, {'dist-tags': {q: '2.2.2', w: '3.3.3', t: '4.4.4'}});
Storage._mergeVersions(pkg, {'dist-tags': {q: '2.2.2', w: '3.3.3', t: '4.4.4'}});
assert.deepEqual(pkg, {
'versions': {},
@ -48,7 +48,7 @@ describe('Storage._merge_versions versions', () => {
// against our local 1.1.10, which may end up published as 1.1.3 in the
// future
Storage._merge_versions(pkg, {'dist-tags':{q:'1.1.2',w:'3.3.3',t:'4.4.4'}})
Storage._mergeVersions(pkg, {'dist-tags':{q:'1.1.2',w:'3.3.3',t:'4.4.4'}})
assert.deepEqual(pkg, {
versions: {},

View file

@ -13,21 +13,22 @@ describe('UpStorge', () => {
const uplinkDefault = {
url: 'https://registry.npmjs.org/'
};
let generateProxy = (config = uplinkDefault) => {
let generateProxy = (config: UpLinkConf = uplinkDefault) => {
const appConfig: Config = new AppConfig(configExample);
// config.self_path = path.join('../partials/store');
return new ProxyStorage(config, appConfig);
}
test('should be defined', () => {
const proxy = generateProxy();
expect(proxy).toBeDefined();
});
describe('UpStorge::getRemoteMetadata', () => {
test('should be get remote metadata', (done) => {
const proxy = generateProxy();
proxy.getRemoteMetadata('jquery', {}, (err, data, etag) => {
expect(err).toBeNull();
expect(_.isString(etag)).toBeTruthy();
@ -38,6 +39,7 @@ describe('UpStorge', () => {
test('should be get remote metadata with etag', (done) => {
const proxy = generateProxy();
proxy.getRemoteMetadata('jquery', {etag: '123456'}, (err, data, etag) => {
expect(err).toBeNull();
expect(_.isString(etag)).toBeTruthy();
@ -48,7 +50,8 @@ describe('UpStorge', () => {
test('should be get remote metadata package does not exist', (done) => {
const proxy = generateProxy();
proxy.getRemoteMetadata('@verdaccio/fake-package', {etag: '123456'}, (err, data, etag) => {
proxy.getRemoteMetadata('@verdaccio/fake-package', {etag: '123456'}, (err) => {
expect(err).not.toBeNull();
expect(err.statusCode).toBe(404);
expect(err.message).toMatch(/package doesn't exist on uplink/);
@ -75,6 +78,62 @@ describe('UpStorge', () => {
});
});
test('should throw a 404 on fetch a tarball from uplink', (done) => {
const proxy = generateProxy();
const tarball:string = 'https://google.es/aaa/-/aaa-0.0.1.tgz';
const stream = proxy.fetchTarball(tarball);
stream.on('error', function(err) {
expect(err).not.toBeNull();
expect(err.statusCode).toBe(404);
expect(err.message).toMatch(/file doesn't exist on uplink/);
done();
});
stream.on('content-length', function(contentLength) {
expect(contentLength).toBeDefined();
done();
});
});
test('should be offline uplink', (done) => {
const proxy = generateProxy();
const tarball:string = 'http://404.verdaccioo.com';
const stream = proxy.fetchTarball(tarball);
expect(proxy.failed_requests).toBe(0);
//to test a uplink is offline we have to be try 3 times
//the default failed request are set to 2
process.nextTick(function() {
stream.on('error', function(err) {
expect(err).not.toBeNull();
// expect(err.statusCode).toBe(404);
expect(proxy.failed_requests).toBe(1);
const streamSecondTry = proxy.fetchTarball(tarball);
streamSecondTry.on('error', function(err) {
expect(err).not.toBeNull();
/*
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
*/
// expect(err.statusCode).toBe(404);
expect(proxy.failed_requests).toBe(2);
const streamThirdTry = proxy.fetchTarball(tarball);
streamThirdTry.on('error', function(err) {
expect(err).not.toBeNull();
expect(err.statusCode).toBe(500);
expect(proxy.failed_requests).toBe(2);
expect(err.message).toMatch(/uplink is offline/);
done();
});
});
});
});
});
});
});

View file

@ -208,9 +208,9 @@
version "1.0.0"
resolved "https://registry.npmjs.org/@verdaccio/streams/-/streams-1.0.0.tgz#d5d24c6747208728b9fd16b908e3932c3fb1f864"
"@verdaccio/types@0.2.0":
version "0.2.0"
resolved "https://registry.npmjs.org/@verdaccio/types/-/types-0.2.0.tgz#bd12a9d0df832b123585741c0de43f361f742a99"
"@verdaccio/types@0.3.1":
version "0.3.1"
resolved "https://registry.npmjs.org/@verdaccio/types/-/types-0.3.1.tgz#df7ed39dcdb09a7c032bb37478d2c90e33881b8e"
JSONStream@^1.0.4, JSONStream@^1.1.1:
version "1.3.2"
@ -628,8 +628,8 @@ babel-eslint@8.2.1:
eslint-visitor-keys "^1.0.0"
babel-generator@^6.18.0, babel-generator@^6.21.0, babel-generator@^6.26.0:
version "6.26.0"
resolved "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz#ac1ae20070b79f6e3ca1d3269613053774f20dc5"
version "6.26.1"
resolved "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz#1844408d3b8f0d35a404ea7ac180f087a601bd90"
dependencies:
babel-messages "^6.23.0"
babel-runtime "^6.26.0"
@ -637,7 +637,7 @@ babel-generator@^6.18.0, babel-generator@^6.21.0, babel-generator@^6.26.0:
detect-indent "^4.0.0"
jsesc "^1.3.0"
lodash "^4.17.4"
source-map "^0.5.6"
source-map "^0.5.7"
trim-right "^1.0.1"
babel-helper-bindify-decorators@^6.24.1:
@ -4125,8 +4125,8 @@ http-errors@1.6.2, http-errors@^1.4.0, http-errors@~1.6.2:
statuses ">= 1.3.1 < 2"
http-parser-js@>=0.4.0:
version "0.4.9"
resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.9.tgz#ea1a04fb64adff0242e9974f297dd4c3cad271e1"
version "0.4.10"
resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz#92c9c1374c35085f75db359ec56cc257cbb93fa4"
http-proxy-middleware@~0.17.4:
version "0.17.4"
@ -7016,8 +7016,8 @@ react-router@^4.2.0:
warning "^3.0.0"
react-stand-in@^4.0.0-beta.17:
version "4.0.0-beta.18"
resolved "https://registry.npmjs.org/react-stand-in/-/react-stand-in-4.0.0-beta.18.tgz#67d83309ae5d95526a2d1124beaa7ab093085cb2"
version "4.0.0-beta.19"
resolved "https://registry.npmjs.org/react-stand-in/-/react-stand-in-4.0.0-beta.19.tgz#ef808b1476fc9abb6dc61c424d640f4cae90b841"
dependencies:
shallowequal "^1.0.2"
@ -7828,7 +7828,7 @@ source-map-url@^0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, source-map@~0.5.6:
source-map@0.5.x, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1, source-map@~0.5.6:
version "0.5.7"
resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"