binwrap
binwrap copied to clipboard
Drop `request` and `request-promise` deps
See https://github.com/elm-lang/elm-platform/issues/231 for motivation! This would drop about 4MB off every installer that uses it, which in turn would make them install faster. π
This originally replaced request and request-promise with request-stream, which is more lightweight than either. It's a tiny wrapper around Node's built-in http and https modules which adds support for passing in URLs (Node's core lib requires separately specifying hostname, port, protocol, etc) and for following redirects, and that's about it.
Then I took it a step further and removed request-stream in favor of directly using the built-in http and https modules. This has the downside of not following redirects, but it's not much work (or much code) to re-add support for that if it seems important. (I defaulted to assuming it's not, based on how binwrap is used in practice.)
Here are the dependencies post-PR:
βββ [email protected]
βββ¬ [email protected]
β βββ¬ [email protected]
β β βββ [email protected] deduped
β βββ¬ [email protected]
β β βββ [email protected]
β β βββ [email protected] deduped
β β βββ [email protected] deduped
β β βββ¬ [email protected]
β β βββ¬ [email protected]
β β βββ [email protected]
β β βββ¬ [email protected]
β β β βββ [email protected] deduped
β β β βββ [email protected]
β β βββ [email protected] deduped
β β βββ¬ [email protected]
β β β βββ¬ [email protected]
β β β βββ [email protected]
β β β βββ [email protected]
β β βββ¬ [email protected]
β β β βββ [email protected] deduped
β β βββ [email protected]
β βββ [email protected]
βββ¬ [email protected]
βββ¬ [email protected]
β βββ [email protected]
β βββ¬ [email protected]
β βββ [email protected]
βββ¬ [email protected]
βββ [email protected]
I recommend viewing this PR with ?w=1.
@avh4 Added redirect logic (it will follow up to 10 redirects; easy to adjust if desired) and some tests!
I tried fixing the merge conflicts and got a failing test now:
1) binwrap
passes tests when specified URLs do exist:
ChildProcessError: Command failed: (cd test_app && npm test)
TypeError: Cannot read property 'on' of undefined
at /Users/avh4/workspace/binwrap/test.js:61:17
at new Promise (<anonymous>)
at /Users/avh4/workspace/binwrap/test.js:58:18
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:279:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:696:3)
npm ERR! Test failed. See above for more details.
`(cd test_app && npm test)` (exited with error code 1)
at callback (node_modules/child-process-promise/lib/index.js:33:27)
at ChildProcess.exithandler (child_process.js:296:5)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
Do we need to βhandle HTTPS_PROXY and NO_PROXY for people with corporate firewallsβ?
https://github.com/elm/compiler/commit/41ec49ed921a2409afda483eb9e29197e262fe27#diff-234dbb95568376fa69c8c8f02316f97a
EDIT: Interesting module: https://github.com/gajus/global-agent
EDIT2: That module is 1.12MBβ¦
EDIT3: What if we spawned curl instead? curl (and tar!) is available on Windows these days. We could fall back to wget on Linuxes without curl.