News for hackers. Stuff that matters.
Re:Micropackages and Open Source Trust Scaling by orf on Thursday March 24, 2016 @04:32PM (#11356175)
Holy crap, I had a look through https://www.npmjs.com/~sindresorhus

There are so many one line packages:

https://github.com/sindresorhus/is-finite/blob/master/index....

https://github.com/sindresorhus/is-fn/blob/master/index.js

https://github.com/sindresorhus/is-gif/blob/master/index.js

https://github.com/sindresorhus/is-github-down/blob/master/c...

https://github.com/sindresorhus/is-ip/blob/master/index.js

https://github.com/sindresorhus/is-npm/blob/master/index.js

https://github.com/sindresorhus/is-obj/blob/master/index.js

https://github.com/imagemin/advpng-bin/blob/master/lib/index...

https://github.com/chalk/ansi-regex/blob/master/index.js (my favourite)

https://github.com/sindresorhus/array-move/blob/master/index...

https://github.com/sindresorhus/compare-urls/blob/master/ind...

https://github.com/sindresorhus/debug-log/blob/master/index....

https://github.com/sindresorhus/file-url/blob/master/index.j...

https://github.com/sindresorhus/fix-path/blob/master/index.j...

https://github.com/sindresorhus/fn-args/blob/master/index.js

https://github.com/sindresorhus/fn-name/blob/master/index.js

https://github.com/sindresorhus/globals/blob/master/index.js

https://github.com/sindresorhus/imul/blob/master/index.js

https://github.com/sindresorhus/is-text-path/blob/master/ind...

https://github.com/sindresorhus/is-up/blob/master/index.js

https://github.com/sindresorhus/is-travis/blob/master/index....

https://github.com/sindresorhus/is-video/blob/master/index.j...

https://github.com/sindresorhus/is-webp/blob/master/index.js

https://github.com/sindresorhus/is-archive/blob/master/index...

https://github.com/sindresorhus/is-admin/blob/master/index.j...

https://github.com/sindresorhus/is-absolute-url/blob/master/...

https://github.com/sindresorhus/ipify/blob/master/index.js

https://github.com/sindresorhus/is-url-superb/blob/master/in...

https://github.com/sindresorhus/is-tif/blob/master/index.js

https://github.com/datetime/leap-year/blob/master/index.js

https://github.com/sindresorhus/lpad/blob/master/index.js

https://github.com/sindresorhus/md5-hex/blob/master/index.js

And I ran out of willpower, at only L. Seems to me the complete lack of any decent standard library has caused this Cambrian explosion of packages, and the overhead is astounding. Sure it's appealing to google "nodejs validate ip", then run "npm install is-ip" and use it with "require('is-ip')", but fuck me how wasteful do you want to be. My frontend ember app ends up installing over 500mb of dependencies (most of which is useless test files and other redundant fluff files). How has this happened?

What's to stop one of those one line packages adding a malicious one liner that concatenates and uploads your super-secret private source code to somebodies server? You're really trusting the complete integrity of your codebase because you depend on "is-array", because you can't be bothered to write "x.toString() === '[object Array]'", and JS introspection (which seems so (ab)used) is so broken that this is needed? Woah.

Re:Micropackages and Open Source Trust Scaling by bentlegen on Thursday March 24, 2016 @04:50PM (#11356316)
> because you can't be bothered to write "x.toString() === '[object Array]'"

([1,2,3]).toString() => "1,2,3"

Re:Micropackages and Open Source Trust Scaling by orf on Thursday March 24, 2016 @05:20PM (#11356544)
My bad, '({}).toString.call([1,2,3])'.

Because type introspection is so ugly in JS, but so needed, that it's hidden behind 'require('is-array')' to make it palatable. Ridiculous.