diff --git a/.gitignore b/.gitignore index 151dc55..6f63646 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,31 @@ -.DS_Store +# Logs +logs *.log -node_modules -build -*.node -components + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript + +# Garbage files +.DS_Store diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 151dc55..0000000 --- a/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -*.log -node_modules -build -*.node -components -coverage diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 9bf67df..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,163 +0,0 @@ -## Change Log - -### v1.1.1 (2016/01/18 23:23 +00:00) -- [3990e00](https://github.com/gulpjs/vinyl/commit/3990e007b004c809a53670c00566afb157fa56b6) 1.1.1 -- [2d3e984](https://github.com/gulpjs/vinyl/commit/2d3e98447a42285b593e1b261984b87b171e7313) chore: add NPM script for changelog (@T1st3) -- [f70c395](https://github.com/gulpjs/vinyl/commit/f70c395085fc3952cf72c061c851f5b0d4676030) docs: add CHANGELOG.md (@T1st3) -- [#74](https://github.com/gulpjs/vinyl/pull/74) Fix isVinyl for falsy values (@erikkemperman) -- [3e8b132](https://github.com/gulpjs/vinyl/commit/3e8b132cd87bf5ab536ff7a4c6d660e33f5990b4) Fix isVinyl for falsy values (@erikkemperman) -- [#73](https://github.com/gulpjs/vinyl/pull/73) Readme: use SVG images. (@d10) -- [193e3d2](https://github.com/gulpjs/vinyl/commit/193e3d25f68c97593e011981e49db2c3e7a47d91) Readme: use SVG images. (@d10) -- [#67](https://github.com/gulpjs/vinyl/pull/67) Set Travis to sudo:false and add node 0.12/4.x (@pdehaan) -- [c33d85a](https://github.com/gulpjs/vinyl/commit/c33d85ab1d63fbcd272f7fb91d666006dab76d99) Set Travis to sudo:false and add node 0.12/4.x (@pdehaan) - -### v1.1.0 (2015/10/23 06:33 +00:00) -- [51052ad](https://github.com/gulpjs/vinyl/commit/51052add24bb1c771bf5912809b47d4d53288c48) 1.1.0 -- [#64](https://github.com/gulpjs/vinyl/pull/64) File.stem for basename without suffix (@soslan) -- [e505375](https://github.com/gulpjs/vinyl/commit/e5053756a49ea8800cd5da12fc0eefce859ccf61) Following JSCS rules in File.stem (@soslan) -- [d45f478](https://github.com/gulpjs/vinyl/commit/d45f478c7af3f2e956e57ce6d7550d64e3b7dbfb) Following JSCS rules (@soslan) -- [#66](https://github.com/gulpjs/vinyl/pull/66) Replace JSHint with ESLint (@pdehaan) -- [c5549f7](https://github.com/gulpjs/vinyl/commit/c5549f7002ae580fa9a7f7df490d6e3911af2285) Bump to eslint-config-gulp@2 (@pdehaan) -- [f6a5512](https://github.com/gulpjs/vinyl/commit/f6a55125e7230621ecae1f395da202140baaee1d) Replace JSHint with ESLint (@pdehaan) -- [#65](https://github.com/gulpjs/vinyl/pull/65) Add JSCS to repo (@pdehaan) -- [f9a0101](https://github.com/gulpjs/vinyl/commit/f9a0101d013356056293d21356d4cb443613b0be) Comments should start with uppercase letters (per JSCS) (@pdehaan) -- [6506478](https://github.com/gulpjs/vinyl/commit/650647833e3cea8d005a3ab1810ecd285418fa1e) Add JSCS to repo (@pdehaan) -- [ae3778c](https://github.com/gulpjs/vinyl/commit/ae3778c536a898fe47bbb37e5932b300123b28b8) Documentation for File.stem (@soslan) -- [e2246af](https://github.com/gulpjs/vinyl/commit/e2246af8aad6df348557f9d1df5001c30ff83774) add stem property to File (@soslan) -- [#63](https://github.com/gulpjs/vinyl/pull/63) Fix broken badge URLs in README.md (@tatsuyafw) -- [032ae7c](https://github.com/gulpjs/vinyl/commit/032ae7c5c59b72dc58041a14449d8d66af053023) Use reference links (@tatsuyafw) -- [652bc3b](https://github.com/gulpjs/vinyl/commit/652bc3bd3cc7a6af5d21d8d759a01cee3ce46acf) Fix some broken links in README.md (@tatsuyafw) - -### v1.0.0 (2015/09/25 22:40 +00:00) -- [dbe943d](https://github.com/gulpjs/vinyl/commit/dbe943dad575b04995f38a35bd27962f54dc8217) 1.0.0 (@contra) -- [0b64336](https://github.com/gulpjs/vinyl/commit/0b643367289db0cfefc6c628eff2be4ee019405c) correct url (@contra) -- [#60](https://github.com/gulpjs/vinyl/pull/60) remove
from README.md (@bobintornado) -- [d9ae5ea](https://github.com/gulpjs/vinyl/commit/d9ae5eab010fd15094c8a0260a25d1244f17df79) remove
from README.md (@bobintornado) - -### v0.5.3 (2015/09/03 00:20 +00:00) -- [6f19648](https://github.com/gulpjs/vinyl/commit/6f19648bd67040bfd0dc755ad031e1e5e0b58429) 0.5.3 (@contra) -- [0fe8da7](https://github.com/gulpjs/vinyl/commit/0fe8da757a862bb956d88dec03ab6f99ca895f7f) add isVinyl function (@contra) - -### v0.5.1 (2015/08/04 21:26 +00:00) -- [81692ec](https://github.com/gulpjs/vinyl/commit/81692ece22eb3b927dba74fedb54a2acb65a36eb) 0.5.1 (@contra) -- [#58](https://github.com/gulpjs/vinyl/pull/58) use Buffer.isBuffer instead of instanceof (@whyrusleeping) -- [7293a71](https://github.com/gulpjs/vinyl/commit/7293a71b9daf177d9b9f600f3acf00a73b95107c) condense isBuffer module to a one liner (@whyrusleeping) -- [e7208e2](https://github.com/gulpjs/vinyl/commit/e7208e2c27029405c7c9cf9c9a3263cdf1e0dfb8) also remove old comment (@whyrusleeping) -- [b4ac64b](https://github.com/gulpjs/vinyl/commit/b4ac64b85ce28093f576db4f006264438f546cb8) use Buffer.isBuffer instead of instanceof (@whyrusleeping) -- [#54](https://github.com/gulpjs/vinyl/pull/54) Fix file clone options (@danielhusar) -- [4b42095](https://github.com/gulpjs/vinyl/commit/4b42095d8e0cb4351a503da67752da15e6b59570) Fix file clone options (@danielhusar) -- [04f681e](https://github.com/gulpjs/vinyl/commit/04f681e4af8ffb99ea3a0a3eab1cc79793887560) closes #50 and #51 (@contra) - -### v0.5.0 (2015/06/03 23:44 +00:00) -- [8fea984](https://github.com/gulpjs/vinyl/commit/8fea9843e6b2aca820ccfee394927ca073f88a05) 0.5.0 (@contra) -- [#52](https://github.com/gulpjs/vinyl/pull/52) Add explicit newlines to readme (@jeremyruppel) -- [027142c](https://github.com/gulpjs/vinyl/commit/027142cf62a3f0a68f4659a612ee782b24c00198) Add explicit newlines to readme (@jeremyruppel) -- [#46](https://github.com/gulpjs/vinyl/pull/46) Add dirname, basename and extname getters (@jeremyruppel) -- [e09817f](https://github.com/gulpjs/vinyl/commit/e09817f15e4ddfc28e1b3452bbca5e2ba1fc2f19) Add dirname, basename and extname accessors (@jeremyruppel) -- [#49](https://github.com/gulpjs/vinyl/pull/49) update license attribute (@pgilad) -- [e5b2670](https://github.com/gulpjs/vinyl/commit/e5b2670af205ca0fb6f589a396b89ab2845a91ac) update license attribut (@pgilad) -- [55f90e3](https://github.com/gulpjs/vinyl/commit/55f90e3763af84c7eb599bd6403dbe14f63d5513) dep updates (@contra) -- [#48](https://github.com/gulpjs/vinyl/pull/48) Update docs for `path` and `history` (@jmm) -- [231f32a](https://github.com/gulpjs/vinyl/commit/231f32a375aa9147d0a41ffd1ace773c45e66ee5) Document `path`. (@jmm) -- [93df183](https://github.com/gulpjs/vinyl/commit/93df18374b62de32c76862baf73e92f33b04882a) Document `options.history`. (@jmm) -- [2ed6a01](https://github.com/gulpjs/vinyl/commit/2ed6a012c03a78b46f9d41034969898a15fdfe15) Correct `options.path` default value docs. (@jmm) -- [edf1ecb](https://github.com/gulpjs/vinyl/commit/edf1ecb0698f355e137f9361a9a9a2581ca485e5) Document `history`. (@jmm) -- [#45](https://github.com/gulpjs/vinyl/pull/45) Update dependencies and devDependencies (@shinnn) -- [f1f9dfb](https://github.com/gulpjs/vinyl/commit/f1f9dfbb1346b608226e5847161bf48e0caa2c1e) update test script (@shinnn) -- [0737ef4](https://github.com/gulpjs/vinyl/commit/0737ef489f9cfffa2494b06edaab9a032f00eb7e) update dependencies and devDependencies (@shinnn) -- [#43](https://github.com/gulpjs/vinyl/pull/43) Document `file.clone()` arguments (@pascalduez) -- [3c5e95d](https://github.com/gulpjs/vinyl/commit/3c5e95d5f482ea9f28dd2d78b83166723cd121bb) Document `file.clone()` arguments (@pascalduez) - -### v0.4.6 (2014/12/03 06:15 +00:00) -- [8255a5f](https://github.com/gulpjs/vinyl/commit/8255a5f1de7fecb1cd5e7ba7ac1ec997395f6be1) 0.4.6 (@contra) -- [37dafeb](https://github.com/gulpjs/vinyl/commit/37dafeb8cb0b33424e77fe67a094517925be2bef) dep update (@contra) - -### v0.4.5 (2014/11/13 23:23 +00:00) -- [a7a8c68](https://github.com/gulpjs/vinyl/commit/a7a8c68a1df914b1f486a54a97b68e9186699d33) 0.4.5 (@contra) -- [ec094b4](https://github.com/gulpjs/vinyl/commit/ec094b43e36512894142baacef26dfffc5827114) reduce size by switching off lodash (@contra) - -### v0.4.4 (2014/11/13 22:59 +00:00) -- [61834c9](https://github.com/gulpjs/vinyl/commit/61834c9429f2e6883a18f377bc5893031ea1c94f) 0.4.4 (@contra) -- [fd887b3](https://github.com/gulpjs/vinyl/commit/fd887b3d21ed47c2b4cf40b0c0ed7b2df9048b09) ignore some files for size reasons (@contra) -- [#37](https://github.com/gulpjs/vinyl/pull/37) Don't package coverage into NPM (@Dapperbot) -- [9b811b8](https://github.com/gulpjs/vinyl/commit/9b811b86529e2b4b0cc20936a6697b3d9df503a2) Don't package coverage into NPM (@lotyrin) - -### v0.4.3 (2014/09/01 18:17 +00:00) -- [6eae432](https://github.com/gulpjs/vinyl/commit/6eae432519b007c313a8df83b093adfb97a2944c) 0.4.3 (@contra) -- [d220c85](https://github.com/gulpjs/vinyl/commit/d220c857259f0070ab38c7b50d90f184a919e472) fix funky history passing, closes #35 (@contra) - -### v0.4.2 (2014/08/29 15:58 +00:00) -- [f33d6d5](https://github.com/gulpjs/vinyl/commit/f33d6d5c1b9d1f83e238521651114beb90a01019) 0.4.2 (@contra) -- [cd0d042](https://github.com/gulpjs/vinyl/commit/cd0d04272297363f27f8456818dbf675618939c3) remove native clone (@contra) -- [e4d8b99](https://github.com/gulpjs/vinyl/commit/e4d8b99c21a50700afd17173e1f3a2076e6fe860) minor speed enhancements (@contra) -- [2353e39](https://github.com/gulpjs/vinyl/commit/2353e3996ac67629da92c2af906bdfdbc6978065) minor speed ups (@contra) - -### v0.4.1 (2014/08/29 14:34 +00:00) -- [0014b9b](https://github.com/gulpjs/vinyl/commit/0014b9bf4166fb5cbe94c439201752cda7991a70) 0.4.1 (@contra) -- [0142513](https://github.com/gulpjs/vinyl/commit/0142513b0727ad6a018b0944fea2bb4966d8bbfa) fix history cloning bug (@contra) - -### v0.4.0 (2014/08/29 07:07 +00:00) -- [80d3f61](https://github.com/gulpjs/vinyl/commit/80d3f61445b347fc1c34f462f0ab800644e90e04) 0.4.0 (@contra) -- [#33](https://github.com/gulpjs/vinyl/pull/33) Clone stream (@popomore) -- [d37b57b](https://github.com/gulpjs/vinyl/commit/d37b57bba0aa1fba18d9fecec3513ac4e61b27cd) coverage 100% :sparkles: (@popomore) -- [b5a62f0](https://github.com/gulpjs/vinyl/commit/b5a62f0ede71bdeae957e8653e6ccbdca998879c) fix testcase and delete duplicate testcase (@popomore) -- [fb1b15d](https://github.com/gulpjs/vinyl/commit/fb1b15da472647743eb4e829b99f64d6d9f751fa) Adding more test (@nfroidure) -- [acea889](https://github.com/gulpjs/vinyl/commit/acea8894e9d983d8037641b4ff6f08b666056979) Fixing the clone method (@nfroidure) -- [#32](https://github.com/gulpjs/vinyl/pull/32) improve clone (@popomore) -- [037e830](https://github.com/gulpjs/vinyl/commit/037e8300b75fdddf9c3e003fd205da7ec13b9157) object should multiline (@popomore) -- [7724121](https://github.com/gulpjs/vinyl/commit/7724121194a4ac94fb23a0048ff926d00a784ecc) pass jshint (@popomore) -- [f76a921](https://github.com/gulpjs/vinyl/commit/f76a9211b8b495d81074884d8ea6454a20bba349) use node-v8-clone for performance, fallback to lodash #29 (@popomore) -- [7638f07](https://github.com/gulpjs/vinyl/commit/7638f072bf33a427ec8324a0fb463f73cb9fc8f2) option to not clone buffer #16 (@popomore) -- [6bfd73c](https://github.com/gulpjs/vinyl/commit/6bfd73cc459907a06ce9affc373599ffb8130c08) copy all attributes deeply #29 (@popomore) -- [b34f813](https://github.com/gulpjs/vinyl/commit/b34f8135d47e0a2ba3be6f769729ba66931b3234) add testcase for clone history (@popomore) -- [a913edf](https://github.com/gulpjs/vinyl/commit/a913edf1dd91c5bdcfc9ff3149a94eae131006aa) fix mixed quote and unused variable (@popomore) - -### v0.3.3 (2014/08/28 13:50 +00:00) -- [c801d3d](https://github.com/gulpjs/vinyl/commit/c801d3dc354383cf2656338d63908ec2983e3612) 0.3.3 (@contra) -- [f13970e](https://github.com/gulpjs/vinyl/commit/f13970e3cc5d1d730f94316daeee5b5c0e6c00f3) fix jshint on tests (@contra) -- [6186101](https://github.com/gulpjs/vinyl/commit/61861017bc22a786a026730cf5c55d23c657abea) closes #31 (@contra) -- [#24](https://github.com/gulpjs/vinyl/pull/24) path get/set for recording path change (@popomore) -- [6eab1c4](https://github.com/gulpjs/vinyl/commit/6eab1c4f1376aec901d8869d3d410953f1c93e9f) done (@contra) - -### v0.3.2 (2014/07/30 23:22 +00:00) -- [44ef836](https://github.com/gulpjs/vinyl/commit/44ef8369e1a0a7ba01da4608d01166c5a5d8cbe1) 0.3.2 (@contra) -- [ae28ff2](https://github.com/gulpjs/vinyl/commit/ae28ff200c034e9a40babb38886cdc7ef97a0f25) oops, thats what i get for coding from a car (@contra) - -### v0.3.1 (2014/07/30 22:35 +00:00) -- [03b7578](https://github.com/gulpjs/vinyl/commit/03b75789e58b43bdaef9ca166e4062b8ccfdefb9) 0.3.1 (@contra) -- [64850ff](https://github.com/gulpjs/vinyl/commit/64850ffdf4d31b35ac1160d0d495644cadd52914) fix deep deps, closes #28 (@contra) - -### v0.3.0 (2014/07/19 04:57 +00:00) -- [dcb77f3](https://github.com/gulpjs/vinyl/commit/dcb77f3246d1011a430c20f883eb89c520206ca6) 0.3.0 (@contra) -- [#27](https://github.com/gulpjs/vinyl/pull/27) Clone custom properties (@vweevers) -- [95710de](https://github.com/gulpjs/vinyl/commit/95710de62f4c1234a244a6818b5e39d92ea7b9a8) fix relative path test for windows (@vweevers) -- [e493187](https://github.com/gulpjs/vinyl/commit/e493187b3f2fd1485077f09e73e669407ac077d3) clone custom properties (@laurelnaiad) -- [e50ceac](https://github.com/gulpjs/vinyl/commit/e50ceacfc3daa825e111976ba4192cb93c80bfe2) throw when set path is null (@popomore) -- [7c71bf3](https://github.com/gulpjs/vinyl/commit/7c71bf3d806a98730a0ce5edd56c0b8f1f42e8f0) remove initialize of this.path (@popomore) -- [d95023f](https://github.com/gulpjs/vinyl/commit/d95023f6604a990d38e4f5b332c7916ceb012366) delete this._path :tongue: (@popomore) -- [f3f9be0](https://github.com/gulpjs/vinyl/commit/f3f9be0f3d76b4125353cd936731f70015d44284) path get/set for recording path change #19 (@popomore) -- [#21](https://github.com/gulpjs/vinyl/pull/21) LICENSE: Remove executable mode (@felixrabe) -- [#22](https://github.com/gulpjs/vinyl/pull/22) Travis: Dump node 0.9 - travis-ci/travis-ci#2251 (@felixrabe) -- [70a2193](https://github.com/gulpjs/vinyl/commit/70a219346c00e0db6be1a0aa55c183e7d5b80ad1) Travis: Dump node 0.9 - travis-ci/travis-ci#2251 (@felixrabe) -- [460eed5](https://github.com/gulpjs/vinyl/commit/460eed58de9cb04d44e35b6bebbfbaea9146015f) LICENSE: Remove executable mode (@felixrabe) -- [#18](https://github.com/gulpjs/vinyl/pull/18) fix typo (@vvakame) -- [1783e7f](https://github.com/gulpjs/vinyl/commit/1783e7f031ecfb118ee9b43971a72be264caa144) fix typo (@vvakame) -- [#11](https://github.com/gulpjs/vinyl/pull/11) Correct README about pipe's end option. (@shuhei) -- [1824ec9](https://github.com/gulpjs/vinyl/commit/1824ec9cefd276557b7338dfdbd54922599f020a) Correct README about pipe's end option. (@shuhei) -- [f49b9c3](https://github.com/gulpjs/vinyl/commit/f49b9c325229754229726ed530c579e4ac23252b) remove dead line (@contra) -- [1ca8e46](https://github.com/gulpjs/vinyl/commit/1ca8e463259c2a395d5d41b528b04a89a953f6b7) dep update, new coveralls stuff (@contra) -- [f00767b](https://github.com/gulpjs/vinyl/commit/f00767bf8b61ca8a7b25f3ebd3dde297fa2dafd7) bump (@contra) -- [#8](https://github.com/gulpjs/vinyl/pull/8) Correct File.clone() treatment of File.stats (@hughsk) -- [bc3acf7](https://github.com/gulpjs/vinyl/commit/bc3acf7b1ed712d70e7d8cb4f6e5248124743ec7) Add test for new File.clone() functionality (@hughsk) -- [dd668fb](https://github.com/gulpjs/vinyl/commit/dd668fb5aaed02cfb0f63a58f027c937dd7e0467) Use clone-stats module to clone fs.Stats instances. (@hughsk) -- [b6244c5](https://github.com/gulpjs/vinyl/commit/b6244c52d3bf9bd87bd6b926f0486f407627f7e0) Correct File.clone() treatment of File.stats (@hughsk) -- [796ba8b](https://github.com/gulpjs/vinyl/commit/796ba8b5ddd658fed3393c7d0a0d7bea7befa1b1) 0.2.1 - fixes #2 (@contra) -- [bffa6a4](https://github.com/gulpjs/vinyl/commit/bffa6a4e323e18e084b5b1444b4537aa3fb3e109) vinyl-fs movement? (@contra) -- [cfaa0a0](https://github.com/gulpjs/vinyl/commit/cfaa0a02b7794e493f600d1d36b288294a278e6c) fix isDirectory tests (@contra) -- [05d1f1b](https://github.com/gulpjs/vinyl/commit/05d1f1b741960cce8e8d2702d326ebb0187935ad) add isDirectory (@contra) -- [76580e5](https://github.com/gulpjs/vinyl/commit/76580e573870885580ac00dd9175e562d008cb81) bump to 0.1.0 (@contra) -- [f7a15c4](https://github.com/gulpjs/vinyl/commit/f7a15c41ac5e82de930e161f6b109ae3336d337b) readme 0.9+ (@contra) -- [fc7f192](https://github.com/gulpjs/vinyl/commit/fc7f1925b2a18466f19db062ad28df02f1db823b) drop 0.8 support (@contra) -- [c004b6c](https://github.com/gulpjs/vinyl/commit/c004b6c857d03a292e8ecd5020ad0420d82dbf1e) target 0.8+ (@contra) -- [edf20bd](https://github.com/gulpjs/vinyl/commit/edf20bd8563fca6e8a568b9d08fb728f6705573c) add small example (@contra) -- [d8c63fe](https://github.com/gulpjs/vinyl/commit/d8c63fe0fd16cf13db2d9a6452c979ec12779428) 0.0.1 (@contra) \ No newline at end of file diff --git a/LICENSE b/LICENSE index 4f482f9..84b3420 100644 --- a/LICENSE +++ b/LICENSE @@ -1,20 +1,21 @@ -Copyright (c) 2013 Fractal +The MIT License (MIT) -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Copyright (c) 2013 Blaine Bublitz , Eric Schoffstall and other contributors -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ef3592d..a36777f 100644 --- a/README.md +++ b/README.md @@ -1,186 +1,241 @@ -# vinyl [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url] +

+ + + +

-## Information -
Packagevinyl
DescriptionA virtual file format
Node Version>= 0.9
+# vinyl -## What is this? -Read this for more info about how this plays into the grand scheme of things [https://medium.com/@eschoff/3828e8126466](https://medium.com/@eschoff/3828e8126466) +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] -## File +Virtual file format. -```javascript -var File = require('vinyl'); +## What is Vinyl? -var coffeeFile = new File({ - cwd: "/", - base: "/test/", - path: "/test/file.coffee", - contents: new Buffer("test = 123") +Vinyl is a very simple metadata object that describes a file. When you think of a file, two attributes come to mind: `path` and `contents`. These are the main attributes on a Vinyl object. A file does not necessarily represent something on your computer’s file system. You have files on S3, FTP, Dropbox, Box, CloudThingly.io and other services. Vinyl can be used to describe files from all of these sources. + +## What is a Vinyl Adapter? + +While Vinyl provides a clean way to describe a file, we also need a way to access these files. Each file source needs what I call a "Vinyl adapter". A Vinyl adapter simply exposes a `src(globs)` and a `dest(folder)` method. Each return a stream. The `src` stream produces Vinyl objects, and the `dest` stream consumes Vinyl objects. Vinyl adapters can expose extra methods that might be specific to their input/output medium, such as the `symlink` method [`vinyl-fs`][vinyl-fs] provides. + +## Usage + +```js +var Vinyl = require('vinyl'); + +var jsFile = new Vinyl({ + cwd: '/', + base: '/test/', + path: '/test/file.js', + contents: new Buffer('var x = 123') }); ``` -### isVinyl -When checking if an object is a vinyl file, you should not use instanceof. Use the isVinyl function instead. +## API -```js -var File = require('vinyl'); +### `new Vinyl([options])` -var dummy = new File({stuff}); -var notAFile = {}; +The constructor is used to create a new instance of `Vinyl`. Each instance represents a separate file, directory or symlink. -File.isVinyl(dummy); // true -File.isVinyl(notAFile); // false -``` +All internally managed paths (`cwd`, `base`, `path`, `history`) are normalized and have trailing separators removed. See [Normalization and concatenation][normalization] for more information. -### isCustomProp -Vinyl checks if a property is not managed internally, such as `sourceMap`. This is than used in `constructor(options)` when setting, and `clone()` when copying properties. +Options may be passed upon instantiation to create a file with specific properties. -```js -var File = require('vinyl'); +#### `options` -File.isCustomProp('sourceMap'); // true -File.isCustomProp('path'); // false -> internal getter/setter -``` +Options are not mutated by the constructor. + +##### `options.cwd` + +The current working directory of the file. + +Type: `String` -Read more in [Extending Vinyl](#extending-vinyl). +Default: `process.cwd()` -### constructor(options) -All internally managed paths (`cwd`, `base`, `path`, `[history]`) are normalized and remove a trailing separator. +##### `options.base` -#### options.cwd -Type: `String`

Default: `process.cwd()` +Used for calculating the `relative` property. This is typically where a glob starts. -#### options.base -Used for relative pathing. Typically where a glob starts. +Type: `String` -Type: `String`

Default: `options.cwd` +Default: `options.cwd` -#### options.path -Full path to the file. +##### `options.path` -Type: `String`

Default: `undefined` +The full path to the file. -#### options.history -Path history. Has no effect if `options.path` is passed. +Type: `String` -Type: `Array`

Default: `options.path ? [options.path] : []` +Default: `undefined` -#### options.stat -The result of an fs.stat call. This is how you mark the file as a directory. See [isDirectory()](#isDirectory) and [fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information. +##### `options.history` -Type: `fs.Stats`

Default: `null` +Stores the path history. If `options.path` and `options.history` are both passed, `options.path` is appended to `options.history`. All `options.history` paths are normalized by the `file.path` setter. -#### options.contents -File contents. +Type: `Array` -Type: `Buffer, Stream, or null`

Default: `null` +Default: `[]` (or `[options.path]` if `options.path` is passed) -#### options.{custom} -Any other option properties will just be assigned to the new File object. +##### `options.stat` + +The result of an `fs.stat` call. This is how you mark the file as a directory or symbolic link. See [isDirectory()][is-directory], [isSymbolic()][is-symbolic] and [fs.Stats][fs-stats] for more information. + +Type: [`fs.Stats`][fs-stats] + +Default: `undefined` + +##### `options.contents` + +The contents of the file. If `options.contents` is a [`Stream`][stream], it is wrapped in a [`cloneable-readable`][cloneable-readable] stream. + +Type: [`Stream`][stream], [`Buffer`][buffer], or `null` + +Default: `null` + +##### `options.{custom}` + +Any other option properties will be directly assigned to the new Vinyl object. ```js -var File = require('vinyl'); +var Vinyl = require('vinyl'); -var file = new File({foo: 'bar'}); +var file = new Vinyl({ foo: 'bar' }); file.foo === 'bar'; // true ``` -### isBuffer() -Returns true if file.contents is a Buffer. +### Instance methods + +Each Vinyl object will have instance methods. Every method will be available but may return differently based on what properties were set upon instantiation or modified since. + +#### `file.isBuffer()` + +Returns `true` if the file contents are a [`Buffer`][buffer], otherwise `false`. + +#### `file.isStream()` -### isStream() -Returns true if file.contents is a Stream. +Returns `true` if the file contents are a [`Stream`][stream], otherwise `false`. -### isNull() -Returns true if file.contents is null. +#### `file.isNull()` -### isDirectory() -Returns true if file is a directory. File is considered a directory when: +Returns `true` if the file contents are `null`, otherwise `false`. + +#### `file.isDirectory()` + +Returns `true` if the file represents a directory, otherwise `false`. + +A file is considered a directory when: - `file.isNull()` is `true` - `file.stat` is an object - `file.stat.isDirectory()` returns `true` -When constructing a Vinyl object, pass in a valid `fs.Stats` object via `options.stat`. If you are mocking the `fs.Stats` object, you may need to stub the `isDirectory()` method. +When constructing a Vinyl object, pass in a valid [`fs.Stats`][fs-stats] object via `options.stat`. If you are mocking the [`fs.Stats`][fs-stats] object, you may need to stub the `isDirectory()` method. + +#### `file.isSymbolic()` -### isSymbolic() -Returns true if file is a symbolic link. File is considered symbolic when: +Returns `true` if the file represents a symbolic link, otherwise `false`. + +A file is considered symbolic when: - `file.isNull()` is `true` - `file.stat` is an object - `file.stat.isSymbolicLink()` returns `true` -When constructing a Vinyl object, pass in a valid `fs.Stats` object via `options.stat`. If you are mocking the `fs.Stats` object, you may need to stub the `isSymbolicLink()` method. +When constructing a Vinyl object, pass in a valid [`fs.Stats`][fs-stats] object via `options.stat`. If you are mocking the [`fs.Stats`][fs-stats] object, you may need to stub the `isSymbolicLink()` method. -### clone([opt]) -Returns a new File object with all attributes cloned.
By default custom attributes are deep-cloned. +#### `file.clone([options])` -If opt or opt.deep is false, custom attributes will not be deep-cloned. +Returns a new Vinyl object with all attributes cloned. -If opt.contents is false, it will copy file.contents Buffer's reference. +__By default custom attributes are cloned deeply.__ -### pipe(stream[, opt]) -If file.contents is a Buffer, it will write it to the stream. +If `options` or `options.deep` is `false`, custom attributes will not be cloned deeply. -If file.contents is a Stream, it will pipe it to the stream. +If `file.contents` is a [`Buffer`][buffer] and `options.contents` is `false`, the [`Buffer`][buffer] reference will be reused instead of copied. -If file.contents is null, it will do nothing. +#### `file.inspect()` -If opt.end is false, the destination stream will not be ended (same as node core). +Returns a formatted-string interpretation of the Vinyl object. Automatically called by node's `console.log`. -Returns the stream. +### Instance properties -### inspect() -Returns a pretty String interpretation of the File. Useful for console.log. +Each Vinyl object will have instance properties. Some may be unavailable based on what properties were set upon instantiation or modified since. -### contents -The [Stream](https://nodejs.org/api/stream.html#stream_stream) or [Buffer](https://nodejs.org/api/buffer.html#buffer_class_buffer) of the file as it was passed in via options, or as the result of modification. +#### `file.contents` -For example: +Gets and sets the contents of the file. If set to a [`Stream`][stream], it is wrapped in a [`cloneable-readable`][cloneable-readable] stream. -```js -if (file.isBuffer()) { - console.log(file.contents.toString()); // logs out the string of contents -} -``` +Throws when set to any value other than a [`Stream`][stream], a [`Buffer`][buffer] or `null`. + +Type: [`Stream`][stream], [`Buffer`][buffer] or `null` + +#### `file.cwd` + +Gets and sets current working directory. Will always be normalized and have trailing separators removed. + +Throws when set to any value other than non-empty strings. + +Type: `String` + +#### `file.base` -### cwd -Gets and sets current working directory. Defaults to `process.cwd`. Will always be normalized and remove a trailing separator. +Gets and sets base directory. Used for relative pathing (typically where a glob starts). +When `null` or `undefined`, it simply proxies the `file.cwd` property. Will always be normalized and have trailing separators removed. -### base -Gets and sets base directory. Used for relative pathing (typically where a glob starts). When `null` or `undefined`, it simply proxies the `file.cwd` property. Will always be normalized and remove a trailing separator. +Throws when set to any value other than non-empty strings or `null`/`undefined`. -### path -Absolute pathname string or `undefined`. Setting to a different value pushes the old value to `history`. All new values are normalized and remove a trailing separator. +Type: `String` -### history -Array of `path` values the file object has had, from `history[0]` (original) through `history[history.length - 1]` (current). `history` and its elements should normally be treated as read-only and only altered indirectly by setting `path`. +#### `file.path` -### relative -Returns path.relative for the file base and file path. +Gets and sets the absolute pathname string or `undefined`. Setting to a different value appends the new path to `file.history`. If set to the same value as the current path, it is ignored. All new values are normalized and have trailing separators removed. + +Throws when set to any value other than a string. + +Type: `String` + +#### `file.history` + +Array of `file.path` values the Vinyl object has had, from `file.history[0]` (original) through `file.history[file.history.length - 1]` (current). `file.history` and its elements should normally be treated as read-only and only altered indirectly by setting `file.path`. + +Type: `Array` + +#### `file.relative` + +Gets the result of `path.relative(file.base, file.path)`. + +Throws when set or when `file.path` is not set. + +Type: `String` Example: -```javascript +```js var file = new File({ - cwd: "/", - base: "/test/", - path: "/test/file.coffee" + cwd: '/', + base: '/test/', + path: '/test/file.js' }); -console.log(file.relative); // file.coffee +console.log(file.relative); // file.js ``` -### dirname -Gets and sets path.dirname for the file path. Will always be normalized and remove a trailing separator. +#### `file.dirname` + +Gets and sets the dirname of `file.path`. Will always be normalized and have trailing separators removed. + +Throws when `file.path` is not set. + +Type: `String` Example: -```javascript +```js var file = new File({ - cwd: "/", - base: "/test/", - path: "/test/file.coffee" + cwd: '/', + base: '/test/', + path: '/test/file.js' }); console.log(file.dirname); // /test @@ -188,39 +243,49 @@ console.log(file.dirname); // /test file.dirname = '/specs'; console.log(file.dirname); // /specs -console.log(file.path); // /specs/file.coffee +console.log(file.path); // /specs/file.js ``` -### basename -Gets and sets path.basename for the file path. +#### `file.basename` + +Gets and sets the basename of `file.path`. + +Throws when `file.path` is not set. + +Type: `String` Example: -```javascript +```js var file = new File({ - cwd: "/", - base: "/test/", - path: "/test/file.coffee" + cwd: '/', + base: '/test/', + path: '/test/file.js' }); -console.log(file.basename); // file.coffee +console.log(file.basename); // file.js -file.basename = 'file.js'; +file.basename = 'file.txt'; -console.log(file.basename); // file.js -console.log(file.path); // /test/file.js +console.log(file.basename); // file.txt +console.log(file.path); // /test/file.txt ``` -### stem -Gets and sets stem (filename without suffix) for the file path. +#### `file.stem` + +Gets and sets stem (filename without suffix) of `file.path`. + +Throws when `file.path` is not set. + +Type: `String` Example: -```javascript +```js var file = new File({ - cwd: "/", - base: "/test/", - path: "/test/file.coffee" + cwd: '/', + base: '/test/', + path: '/test/file.js' }); console.log(file.stem); // file @@ -228,40 +293,89 @@ console.log(file.stem); // file file.stem = 'foo'; console.log(file.stem); // foo -console.log(file.path); // /test/foo.coffee +console.log(file.path); // /test/foo.js ``` -### extname -Gets and sets path.extname for the file path. +#### `file.extname` + +Gets and sets extname of `file.path`. + +Throws when `file.path` is not set. + +Type: `String` Example: -```javascript +```js var file = new File({ - cwd: "/", - base: "/test/", - path: "/test/file.coffee" + cwd: '/', + base: '/test/', + path: '/test/file.js' }); -console.log(file.extname); // .coffee +console.log(file.extname); // .js -file.extname = '.js'; +file.extname = '.txt'; -console.log(file.extname); // .js -console.log(file.path); // /test/file.js +console.log(file.extname); // .txt +console.log(file.path); // /test/file.txt ``` -### symlink -Path where the file points to in case it's a symbolic link. Will always be normalized and remove a trailing separator. +#### `file.symlink` + +Gets and sets the path where the file points to if it's a symbolic link. Will always be normalized and have trailing separators removed. + +Throws when set to any value other than a string. + +Type: `String` + +### `Vinyl.isVinyl(file)` + +Static method used for checking if an object is a Vinyl file. Use this method instead of `instanceof`. + +Takes an object and returns `true` if it is a Vinyl file, otherwise returns `false`. + +__Note: This method uses an internal flag that some older versions of Vinyl didn't expose.__ + +Example: + +```js +var Vinyl = require('vinyl'); + +var file = new Vinyl(); +var notAFile = {}; + +Vinyl.isVinyl(file); // true +Vinyl.isVinyl(notAFile); // false +``` + +### `Vinyl.isCustomProp(property)` + +Static method used by Vinyl when setting values inside the constructor or when copying properties in `file.clone()`. + +Takes a string `property` and returns `true` if the property is not used internally, otherwise returns `false`. + +This method is usefuly for inheritting from the Vinyl constructor. Read more in [Extending Vinyl][extending-vinyl]. + +Example: + +```js +var Vinyl = require('vinyl'); + +Vinyl.isCustomProp('sourceMap'); // true +Vinyl.isCustomProp('path'); // false -> internal getter/setter +``` ## Normalization and concatenation + Since all properties are normalized in their setters, you can just concatenate with `/`, and normalization takes care of it properly on all platforms. Example: -```javascript +```js var file = new File(); file.path = '/' + 'test' + '/' + 'foo.bar'; + console.log(file.path); // posix => /test/foo.bar // win32 => \\test\\foo.bar @@ -270,16 +384,17 @@ console.log(file.path); But never concatenate with `\`, since that is a valid filename character on posix system. ## Extending Vinyl + When extending Vinyl into your own class with extra features, you need to think about a few things. When you have your own properties that are managed internally, you need to extend the static `isCustomProp` method to return `false` when one of these properties is queried. ```js -const File = require('vinyl'); +var Vinyl = require('vinyl'); -const builtInProps = ['foo', '_foo']; +var builtInProps = ['foo', '_foo']; -class SuperFile extends File { +class SuperFile extends Vinyl { constructor(options) { super(options); this._foo = 'example internal read-only value'; @@ -299,11 +414,32 @@ This makes properties `foo` and `_foo` ignored when cloning, and when passed in Same goes for `clone()`. If you have your own internal stuff that needs special handling during cloning, you should extend it to do so. -[npm-url]: https://npmjs.org/package/vinyl -[npm-image]: https://badge.fury.io/js/vinyl.svg +## License + +MIT + +[is-symbolic]: #issymbolic +[is-directory]: #isdirectory +[normalization]: #normalization-and-concatenation +[extending-vinyl]: #extending-vinyl +[stream]: https://nodejs.org/api/stream.html#stream_stream +[buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer +[fs-stats]: http://nodejs.org/api/fs.html#fs_class_fs_stats +[vinyl-fs]: https://github.com/gulpjs/vinyl-fs +[cloneable-readable]: https://github.com/mcollina/cloneable-readable + +[downloads-image]: http://img.shields.io/npm/dm/vinyl.svg +[npm-url]: https://www.npmjs.com/package/vinyl +[npm-image]: http://img.shields.io/npm/v/vinyl.svg + [travis-url]: https://travis-ci.org/gulpjs/vinyl -[travis-image]: https://travis-ci.org/gulpjs/vinyl.svg?branch=master -[coveralls-url]: https://coveralls.io/github/gulpjs/vinyl -[coveralls-image]: https://coveralls.io/repos/github/gulpjs/vinyl/badge.svg -[depstat-url]: https://david-dm.org/gulpjs/vinyl -[depstat-image]: https://david-dm.org/gulpjs/vinyl.svg +[travis-image]: http://img.shields.io/travis/gulpjs/vinyl.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/vinyl +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/vinyl.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/vinyl +[coveralls-image]: http://img.shields.io/coveralls/gulpjs/vinyl/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/index.js b/index.js index fe04694..af91a12 100644 --- a/index.js +++ b/index.js @@ -1,14 +1,18 @@ +'use strict'; + var path = require('path'); +var isBuffer = require('buffer').Buffer.isBuffer; + var clone = require('clone'); +var isStream = require('is-stream'); +var cloneable = require('cloneable-readable'); +var replaceExt = require('replace-ext'); var cloneStats = require('clone-stats'); var cloneBuffer = require('clone-buffer'); var removeTrailingSep = require('remove-trailing-separator'); -var isBuffer = require('buffer').Buffer.isBuffer; -var isStream = require('is-stream'); -var inspectStream = require('./lib/inspectStream'); + var normalize = require('./lib/normalize'); -var replaceExt = require('replace-ext'); -var cloneable = require('cloneable-readable'); +var inspectStream = require('./lib/inspect-stream'); var builtInFields = [ '_contents', '_symlink', 'contents', 'stat', 'history', 'path', diff --git a/lib/inspectStream.js b/lib/inspect-stream.js similarity index 74% rename from lib/inspectStream.js rename to lib/inspect-stream.js index b9affed..314009d 100644 --- a/lib/inspectStream.js +++ b/lib/inspect-stream.js @@ -1,6 +1,8 @@ +'use strict'; + var isStream = require('is-stream'); -module.exports = function(stream) { +function inspectStream(stream) { if (!isStream(stream)) { return; } @@ -12,4 +14,6 @@ module.exports = function(stream) { } return '<' + streamType + 'Stream>'; -}; +} + +module.exports = inspectStream; diff --git a/lib/normalize.js b/lib/normalize.js index 5bb5537..f90dcb2 100644 --- a/lib/normalize.js +++ b/lib/normalize.js @@ -1,5 +1,9 @@ -var normalize = require('path').normalize; +'use strict'; -module.exports = function(str) { - return str === '' ? str : normalize(str); -}; +var path = require('path'); + +function normalize(str) { + return str === '' ? str : path.normalize(str); +} + +module.exports = normalize; diff --git a/package.json b/package.json index 09a8865..42a27c5 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,30 @@ { "name": "vinyl", - "description": "A virtual file format", "version": "1.2.0", - "homepage": "http://github.com/gulpjs/vinyl", - "repository": "git://github.com/gulpjs/vinyl.git", - "author": "Fractal (http://wearefractal.com/)", - "main": "./index.js", + "description": "Virtual file format.", + "author": "Gulp Team (http://gulpjs.com/)", + "contributors": [ + "Eric Schoffstall ", + "Blaine Bublitz " + ], + "repository": "gulpjs/vinyl", + "license": "MIT", + "engines": { + "node": ">= 0.10" + }, + "main": "index.js", "files": [ + "LICENSE", "index.js", "lib" ], + "scripts": { + "lint": "eslint . && jscs index.js lib/ test/", + "pretest": "npm run lint", + "test": "mocha --async-only", + "cover": "istanbul cover _mocha --report lcovonly", + "coveralls": "npm run cover && istanbul-coveralls" + }, "dependencies": { "clone": "^1.0.0", "clone-buffer": "^1.0.0", @@ -23,25 +38,19 @@ "eslint": "^1.7.3", "eslint-config-gulp": "^2.0.0", "expect": "^1.20.2", - "github-changes": "^1.0.1", "istanbul": "^0.4.3", "istanbul-coveralls": "^1.0.3", "jscs": "^2.3.5", "jscs-preset-gulp": "^1.0.0", "mississippi": "^1.2.0", - "mocha": "^2.4.5", - "readable-stream": "^2.1.0" - }, - "scripts": { - "lint": "eslint . && jscs index.js lib/ test/", - "pretest": "npm run lint", - "test": "mocha --async-only", - "cover": "istanbul cover _mocha --report lcovonly", - "coveralls": "npm run cover && istanbul-coveralls", - "changelog": "github-changes -o gulpjs -r vinyl -b master -f ./CHANGELOG.md --order-semver --use-commit-body" - }, - "engines": { - "node": ">= 0.9" + "mocha": "^2.4.5" }, - "license": "MIT" + "keywords": [ + "virtual", + "filesystem", + "file", + "directory", + "stat", + "path" + ] } diff --git a/test/inspect-stream.js b/test/inspect-stream.js index 921e401..2289af5 100644 --- a/test/inspect-stream.js +++ b/test/inspect-stream.js @@ -1,15 +1,15 @@ 'use strict'; +var Stream = require('stream'); var expect = require('expect'); -var Stream = require('readable-stream'); var Cloneable = require('cloneable-readable'); -var inspectStream = require('../lib/inspectStream'); +var inspectStream = require('../lib/inspect-stream'); describe('inspectStream()', function() { it('works on a Stream', function(done) { - var testStream = new Stream.Stream(); + var testStream = new Stream(); var result = inspectStream(testStream); expect(result).toEqual(''); done();