diff --git a/node_modules/.bin/browser-sync b/node_modules/.bin/browser-sync deleted file mode 120000 index ee4a7c3..0000000 --- a/node_modules/.bin/browser-sync +++ /dev/null @@ -1 +0,0 @@ -../browser-sync/bin/browser-sync \ No newline at end of file diff --git a/node_modules/.bin/gulp b/node_modules/.bin/gulp deleted file mode 120000 index 5de7332..0000000 --- a/node_modules/.bin/gulp +++ /dev/null @@ -1 +0,0 @@ -../gulp/bin/gulp.js \ No newline at end of file diff --git a/node_modules/browser-sync/LICENSE-GPL b/node_modules/browser-sync/LICENSE-GPL deleted file mode 100644 index 16d89e0..0000000 --- a/node_modules/browser-sync/LICENSE-GPL +++ /dev/null @@ -1,596 +0,0 @@ -GNU GENERAL PUBLIC LICENSE -========================== - -Version 3, 29 June 2007 - -Copyright © 2007 Free Software Foundation, Inc. <> - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and other -kinds of works. - -The licenses for most software and other practical works are designed to take away -your freedom to share and change the works. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change all versions of a -program--to make sure it remains free software for all its users. We, the Free -Software Foundation, use the GNU General Public License for most of our software; it -applies also to any other work released this way by its authors. You can apply it to -your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General -Public Licenses are designed to make sure that you have the freedom to distribute -copies of free software (and charge for them if you wish), that you receive source -code or can get it if you want it, that you can change the software or use pieces of -it in new free programs, and that you know you can do these things. - -To protect your rights, we need to prevent others from denying you these rights or -asking you to surrender the rights. Therefore, you have certain responsibilities if -you distribute copies of the software, or if you modify it: responsibilities to -respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for a fee, -you must pass on to the recipients the same freedoms that you received. You must make -sure that they, too, receive or can get the source code. And you must show them these -terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: (1) assert -copyright on the software, and (2) offer you this License giving you legal permission -to copy, distribute and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that there is -no warranty for this free software. For both users' and authors' sake, the GPL -requires that modified versions be marked as changed, so that their problems will not -be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified versions of -the software inside them, although the manufacturer can do so. This is fundamentally -incompatible with the aim of protecting users' freedom to change the software. The -systematic pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we have designed -this version of the GPL to prohibit the practice for those products. If such problems -arise substantially in other domains, we stand ready to extend this provision to -those domains in future versions of the GPL, as needed to protect the freedom of -users. - -Finally, every program is threatened constantly by software patents. States should -not allow patents to restrict development and use of software on general-purpose -computers, but in those that do, we wish to avoid the special danger that patents -applied to a free program could make it effectively proprietary. To prevent this, the -GPL assures that patents cannot be used to render the program non-free. - -The precise terms and conditions for copying, distribution and modification follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -“This License” refers to version 3 of the GNU General Public License. - -“Copyright” also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - -“The Program” refers to any copyrightable work licensed under this -License. Each licensee is addressed as “you”. “Licensees” and -“recipients” may be individuals or organizations. - -To “modify” a work means to copy from or adapt all or part of the work in -a fashion requiring copyright permission, other than the making of an exact copy. The -resulting work is called a “modified version” of the earlier work or a -work “based on” the earlier work. - -A “covered work” means either the unmodified Program or a work based on -the Program. - -To “propagate” a work means to do anything with it that, without -permission, would make you directly or secondarily liable for infringement under -applicable copyright law, except executing it on a computer or modifying a private -copy. Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To “convey” a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays “Appropriate Legal Notices” to the -extent that it includes a convenient and prominently visible feature that (1) -displays an appropriate copyright notice, and (2) tells the user that there is no -warranty for the work (except to the extent that warranties are provided), that -licensees may convey the work under this License, and how to view a copy of this -License. If the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - -### 1. Source Code. - -The “source code” for a work means the preferred form of the work for -making modifications to it. “Object code” means any non-source form of a -work. - -A “Standard Interface” means an interface that either is an official -standard defined by a recognized standards body, or, in the case of interfaces -specified for a particular programming language, one that is widely used among -developers working in that language. - -The “System Libraries” of an executable work include anything, other than -the work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only to -enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code form. -A “Major Component”, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on which -the executable work runs, or a compiler used to produce the work, or an object code -interpreter used to run it. - -The “Corresponding Source” for a work in object code form means all the -source code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. However, -it does not include the work's System Libraries, or general-purpose tools or -generally available free programs which are used unmodified in performing those -activities but which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for the work, and -the source code for shared libraries and dynamically linked subprograms that the work -is specifically designed to require, such as by intimate data communication or -control flow between those subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on the -Program, and are irrevocable provided the stated conditions are met. This License -explicitly affirms your unlimited permission to run the unmodified Program. The -output from running a covered work is covered by this License only if the output, -given its content, constitutes a covered work. This License acknowledges your rights -of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey covered -works to others for the sole purpose of having them make modifications exclusively -for you, or provide you with facilities for running those works, provided that you -comply with the terms of this License in conveying all material for which you do not -control copyright. Those thus making or running the covered works for you must do so -exclusively on your behalf, under your direction and control, on terms that prohibit -them from making any copies of your copyrighted material outside their relationship -with you. - -Conveying under any other circumstances is permitted solely under the conditions -stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure under any -applicable law fulfilling obligations under article 11 of the WIPO copyright treaty -adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention -of such measures. - -When you convey a covered work, you waive any legal power to forbid circumvention of -technological measures to the extent such circumvention is effected by exercising -rights under this License with respect to the covered work, and you disclaim any -intention to limit operation or modification of the work as a means of enforcing, -against the work's users, your or third parties' legal rights to forbid circumvention -of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, in any -medium, provided that you conspicuously and appropriately publish on each copy an -appropriate copyright notice; keep intact all notices stating that this License and -any non-permissive terms added in accord with section 7 apply to the code; keep -intact all notices of the absence of any warranty; and give all recipients a copy of -this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may offer -support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it from -the Program, in the form of source code under the terms of section 4, provided that -you also meet all of these conditions: - -* **a)** The work must carry prominent notices stating that you modified it, and giving a -relevant date. -* **b)** The work must carry prominent notices stating that it is released under this -License and any conditions added under section 7. This requirement modifies the -requirement in section 4 to “keep intact all notices”. -* **c)** You must license the entire work, as a whole, under this License to anyone who -comes into possession of a copy. This License will therefore apply, along with any -applicable section 7 additional terms, to the whole of the work, and all its parts, -regardless of how they are packaged. This License gives no permission to license the -work in any other way, but it does not invalidate such permission if you have -separately received it. -* **d)** If the work has interactive user interfaces, each must display Appropriate Legal -Notices; however, if the Program has interactive interfaces that do not display -Appropriate Legal Notices, your work need not make them do so. - -A compilation of a covered work with other separate and independent works, which are -not by their nature extensions of the covered work, and which are not combined with -it such as to form a larger program, in or on a volume of a storage or distribution -medium, is called an “aggregate” if the compilation and its resulting -copyright are not used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work in an aggregate -does not cause this License to apply to the other parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 and -5, provided that you also convey the machine-readable Corresponding Source under the -terms of this License, in one of these ways: - -* **a)** Convey the object code in, or embodied in, a physical product (including a -physical distribution medium), accompanied by the Corresponding Source fixed on a -durable physical medium customarily used for software interchange. -* **b)** Convey the object code in, or embodied in, a physical product (including a -physical distribution medium), accompanied by a written offer, valid for at least -three years and valid for as long as you offer spare parts or customer support for -that product model, to give anyone who possesses the object code either (1) a copy of -the Corresponding Source for all the software in the product that is covered by this -License, on a durable physical medium customarily used for software interchange, for -a price no more than your reasonable cost of physically performing this conveying of -source, or (2) access to copy the Corresponding Source from a network server at no -charge. -* **c)** Convey individual copies of the object code with a copy of the written offer to -provide the Corresponding Source. This alternative is allowed only occasionally and -noncommercially, and only if you received the object code with such an offer, in -accord with subsection 6b. -* **d)** Convey the object code by offering access from a designated place (gratis or for -a charge), and offer equivalent access to the Corresponding Source in the same way -through the same place at no further charge. You need not require recipients to copy -the Corresponding Source along with the object code. If the place to copy the object -code is a network server, the Corresponding Source may be on a different server -(operated by you or a third party) that supports equivalent copying facilities, -provided you maintain clear directions next to the object code saying where to find -the Corresponding Source. Regardless of what server hosts the Corresponding Source, -you remain obligated to ensure that it is available for as long as needed to satisfy -these requirements. -* **e)** Convey the object code using peer-to-peer transmission, provided you inform -other peers where the object code and Corresponding Source of the work are being -offered to the general public at no charge under subsection 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A “User Product” is either (1) a “consumer product”, which -means any tangible personal property which is normally used for personal, family, or -household purposes, or (2) anything designed or sold for incorporation into a -dwelling. In determining whether a product is a consumer product, doubtful cases -shall be resolved in favor of coverage. For a particular product received by a -particular user, “normally used” refers to a typical or common use of -that class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, the -product. A product is a consumer product regardless of whether the product has -substantial commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - -“Installation Information” for a User Product means any methods, -procedures, authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified version of -its Corresponding Source. The information must suffice to ensure that the continued -functioning of the modified object code is in no case prevented or interfered with -solely because modification has been made. - -If you convey an object code work under this section in, or with, or specifically for -use in, a User Product, and the conveying occurs as part of a transaction in which -the right of possession and use of the User Product is transferred to the recipient -in perpetuity or for a fixed term (regardless of how the transaction is -characterized), the Corresponding Source conveyed under this section must be -accompanied by the Installation Information. But this requirement does not apply if -neither you nor any third party retains the ability to install modified object code -on the User Product (for example, the work has been installed in ROM). - -The requirement to provide Installation Information does not include a requirement to -continue to provide support service, warranty, or updates for a work that has been -modified or installed by the recipient, or for the User Product in which it has been -modified or installed. Access to a network may be denied when the modification itself -materially and adversely affects the operation of the network or violates the rules -and protocols for communication across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord with -this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require no -special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -“Additional permissions” are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. Additional -permissions that are applicable to the entire Program shall be treated as though they -were included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may be -used separately under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when you -modify the work.) You may place additional permissions on material, added by you to a -covered work, for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -* **a)** Disclaiming warranty or limiting liability differently from the terms of -sections 15 and 16 of this License; or -* **b)** Requiring preservation of specified reasonable legal notices or author -attributions in that material or in the Appropriate Legal Notices displayed by works -containing it; or -* **c)** Prohibiting misrepresentation of the origin of that material, or requiring that -modified versions of such material be marked in reasonable ways as different from the -original version; or -* **d)** Limiting the use for publicity purposes of names of licensors or authors of the -material; or -* **e)** Declining to grant rights under trademark law for use of some trade names, -trademarks, or service marks; or -* **f)** Requiring indemnification of licensors and authors of that material by anyone -who conveys the material (or modified versions of it) with contractual assumptions of -liability to the recipient, for any liability that these contractual assumptions -directly impose on those licensors and authors. - -All other non-permissive additional terms are considered “further -restrictions” within the meaning of section 10. If the Program as you received -it, or any part of it, contains a notice stating that it is governed by this License -along with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or conveying -under this License, you may add to a covered work material governed by the terms of -that license document, provided that the further restriction does not survive such -relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, in -the relevant source files, a statement of the additional terms that apply to those -files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements apply -either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided under -this License. Any attempt otherwise to propagate or modify it is void, and will -automatically terminate your rights under this License (including any patent licenses -granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated (a) provisionally, unless and until the -copyright holder explicitly and finally terminates your license, and (b) permanently, -if the copyright holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated permanently -if the copyright holder notifies you of the violation by some reasonable means, this -is the first time you have received notice of violation of this License (for any -work) from that copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses of -parties who have received copies or rights from you under this License. If your -rights have been terminated and not permanently reinstated, you do not qualify to -receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy of the -Program. Ancillary propagation of a covered work occurring solely as a consequence of -using peer-to-peer transmission to receive a copy likewise does not require -acceptance. However, nothing other than this License grants you permission to -propagate or modify any covered work. These actions infringe copyright if you do not -accept this License. Therefore, by modifying or propagating a covered work, you -indicate your acceptance of this License to do so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a license -from the original licensors, to run, modify and propagate that work, subject to this -License. You are not responsible for enforcing compliance by third parties with this -License. - -An “entity transaction” is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an organization, or -merging organizations. If propagation of a covered work results from an entity -transaction, each party to that transaction who receives a copy of the work also -receives whatever licenses to the work the party's predecessor in interest had or -could give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if the predecessor -has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights granted or -affirmed under this License. For example, you may not impose a license fee, royalty, -or other charge for exercise of rights granted under this License, and you may not -initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging -that any patent claim is infringed by making, using, selling, offering for sale, or -importing the Program or any portion of it. - -### 11. Patents. - -A “contributor” is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The work thus -licensed is called the contributor's “contributor version”. - -A contributor's “essential patent claims” are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, that -would be infringed by some manner, permitted by this License, of making, using, or -selling its contributor version, but do not include claims that would be infringed -only as a consequence of further modification of the contributor version. For -purposes of this definition, “control” includes the right to grant patent -sublicenses in a manner consistent with the requirements of this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent license -under the contributor's essential patent claims, to make, use, sell, offer for sale, -import and otherwise run, modify and propagate the contents of its contributor -version. - -In the following three paragraphs, a “patent license” is any express -agreement or commitment, however denominated, not to enforce a patent (such as an -express permission to practice a patent or covenant not to sue for patent -infringement). To “grant” such a patent license to a party means to make -such an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of charge -and under the terms of this License, through a publicly available network server or -other readily accessible means, then you must either (1) cause the Corresponding -Source to be so available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner consistent with -the requirements of this License, to extend the patent license to downstream -recipients. “Knowingly relying” means you have actual knowledge that, but -for the patent license, your conveying the covered work in a country, or your -recipient's use of the covered work in a country, would infringe one or more -identifiable patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a patent -license to some of the parties receiving the covered work authorizing them to use, -propagate, modify or convey a specific copy of the covered work, then the patent -license you grant is automatically extended to all recipients of the covered work and -works based on it. - -A patent license is “discriminatory” if it does not include within the -scope of its coverage, prohibits the exercise of, or is conditioned on the -non-exercise of one or more of the rights that are specifically granted under this -License. You may not convey a covered work if you are a party to an arrangement with -a third party that is in the business of distributing software, under which you make -payment to the third party based on the extent of your activity of conveying the -work, and under which the third party grants, to any of the parties who would receive -the covered work from you, a discriminatory patent license (a) in connection with -copies of the covered work conveyed by you (or copies made from those copies), or (b) -primarily for and in connection with specific products or compilations that contain -the covered work, unless you entered into that arrangement, or that patent license -was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to you -under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or otherwise) -that contradict the conditions of this License, they do not excuse you from the -conditions of this License. If you cannot convey a covered work so as to satisfy -simultaneously your obligations under this License and any other pertinent -obligations, then as a consequence you may not convey it at all. For example, if you -agree to terms that obligate you to collect a royalty for further conveying from -those to whom you convey the Program, the only way you could satisfy both those terms -and this License would be to refrain entirely from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to link or -combine any covered work with a work licensed under version 3 of the GNU Affero -General Public License into a single combined work, and to convey the resulting work. -The terms of this License will continue to apply to the part which is the covered -work, but the special requirements of the GNU Affero General Public License, section -13, concerning interaction through a network will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in spirit -to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies that -a certain numbered version of the GNU General Public License “or any later -version” applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by the -Free Software Foundation. If the Program does not specify a version number of the GNU -General Public License, you may choose any version ever published by the Free -Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the GNU -General Public License can be used, that proxy's public statement of acceptance of a -version permanently authorizes you to choose that version for the Program. - -Later license versions may give you additional or different permissions. However, no -additional obligations are imposed on any author or copyright holder as a result of -your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE -OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE -WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot be -given local legal effect according to their terms, reviewing courts shall apply local -law that most closely approximates an absolute waiver of all civil liability in -connection with the Program, unless a warranty or assumption of liability accompanies -a copy of the Program in return for a fee. - -END OF TERMS AND CONDITIONS - -## How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible use to -the public, the best way to achieve this is to make it free software which everyone -can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach them -to the start of each source file to most effectively state the exclusion of warranty; -and each file should have at least the “copyright” line and a pointer to -where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like this -when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type 'show c' for details. - -The hypothetical commands 'show w' and 'show c' should show the appropriate parts of -the General Public License. Of course, your program's commands might be different; -for a GUI interface, you would use an “about box”. - -You should also get your employer (if you work as a programmer) or school, if any, to -sign a “copyright disclaimer” for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -<>. - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider it -more useful to permit linking proprietary applications with the library. If this is -what you want to do, use the GNU Lesser General Public License instead of this -License. But first, please read -<>. \ No newline at end of file diff --git a/node_modules/browser-sync/README.md b/node_modules/browser-sync/README.md deleted file mode 100644 index 8b8f281..0000000 --- a/node_modules/browser-sync/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# BrowserSync [![Build status] (https://ci.appveyor.com/api/projects/status/r5vung2ipn9uj4sy)](https://ci.appveyor.com/project/shakyShane/browser-sync) [![Build Status](http://img.shields.io/travis/shakyShane/browser-sync/master.svg?style=flat)] (https://travis-ci.org/shakyShane/browser-sync) [![Coverage Status](https://img.shields.io/coveralls/shakyShane/browser-sync.svg?style=flat)](https://coveralls.io/r/shakyShane/browser-sync?branch=master) [![NPM version](https://img.shields.io/npm/v/browser-sync.svg?style=flat)](http://npmjs.org/package/browser-sync) - -> Keep multiple browsers & devices in sync when building websites. - - - -BrowserSync is developed and maintained internally at JH, follow @BrowserSync on twitter for news & updates. - -##Features -1. **Scroll** - I can keep your pages in sync when scrolling. -2. **Forms** - You fill out a form in one browser, I'll copy the data to all the others. -3. **Links** - I'll watch your clicks and make all the other browsers follow you. -4. **CSS injecting** - I can even watch your CSS files & inject them when they change. -5. **Live Reload** - I can also watch files like HTML and PHP & when they change I can reload all browsers for you. -6. **Built-in Server** - Yep, I can serve static files too if you need me to (uses Connect). -7. **Use with any back-end setup** - I even have a proxy option so that I can be used with existing PHP, Rails, Python, Node or ASP.net setup. -8. **Public URL** - View your website via a URL that any internet connected device can access & maintain all BrowserSync features. -9. **Browser Stack support** - Use the all of my features when viewing your site through Browser Stack. - - -##When is it useful? -It's pretty useful when used with a single browser, watching a CSS file for changes & injecting it. But the real power comes when you're building responsive sites and using multiple devices/monitors because it can keep all browsers in sync & make your workflow much faster. - -##Requirements -BrowserSync works by injecting an asynchronous script tag (``) right after the `` tag -during initial request. In order for this to work properly the `` tag must be present. Alternatively you -can provide a custom rule for the snippet using [snippetOptions](http://www.browsersync.io/docs/options/#option-snippetOptions) - -##Install -``` -npm install -g browser-sync -``` -##How to use it - -1. [Command line](http://www.browsersync.io/docs/command-line/) -2. [API](http://www.browsersync.io/docs/api/) - -## Using Grunt? -There's a [separate plugin](https://github.com/shakyShane/grunt-browser-sync) for that - -## Using Gulp? -No problem, here's a [setup guide](http://www.browsersync.io/docs/gulp) - -## Using Brunch? -Enjoy the [browser-sync-brunch plugin](https://github.com/ocombe/browser-sync-brunch) - -## Screencasts -[Some listed here](https://github.com/shakyShane/browser-sync/wiki/Screencasts) -Want any more? Something specific? ask me nicely [@shaneOsbourne](http://www.twitter.com/shaneOsbourne) - -##Support -If you've found Browser-sync useful and would like to contribute to its continued development & support, please feel free to send a donation of any size - it would be greatly appreciated! - -[![Support via Gittip](https://rawgithub.com/chris---/Donation-Badges/master/gittip.jpeg)](https://www.gittip.com/shakyshane) -[![Support via PayPal](https://rawgithub.com/chris---/Donation-Badges/master/paypal.jpeg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=shakyshane%40gmail%2ecom&lc=US&item_name=browser%2dsync) - -## Contributors - -``` - 778 Shane Osbourne - 29 Shinnosuke Watanabe - 19 Shane Daniel - 13 Hugo Bessa - 11 Paul Kinlan - 8 shinnn - 3 Marek 'saji' Augustynowicz - 3 Werner van Deventer - 3 Adam Lynch - 2 Paul Robertson - 2 Dan Tello - 2 Hugo Dias - 2 Michael Branch - 2 Olivier Combe - 2 Piotr Kaleta - 2 brutaldev - 2 chase_chou - 1 Dave Hall - 1 mericson - 1 Robert Vock - 1 Craig Morris - 1 Cedric Kastner - 1 Carl Henderson - 1 Sylvain Emery - 1 Tony Holdstock-Brown - 1 Victor Fernandez de Alba - 1 Cameron Spear - 1 Yazhong Liu - 1 Jory Graham - 1 Benjamín Eidelman - 1 viktor hesselbom - 1 Guillaume Lambert - 1 Peter Blazejewicz -``` - -## License -Copyright (c) 2014 Shane Osbourne -Licensed under the GPL license. diff --git a/node_modules/browser-sync/bin/browser-sync b/node_modules/browser-sync/bin/browser-sync deleted file mode 100755 index 8db5485..0000000 --- a/node_modules/browser-sync/bin/browser-sync +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env node -"use strict"; - -var cli = require("../lib/cli/index"); -var pjson = require("../package.json"); -var utils = require("../lib/utils"); - -var init = cli.init; -var info = cli.info; - -var BrowserSync = require("../lib/browser-sync"); -var browserSync = new BrowserSync(); - -var argv = process.argv; -var args = require("minimist")(argv.slice(2)); - -init.parse(pjson.version, args, argv, function (err, data) { - - if (err) { - utils.fail(err, {}, true); - } - if (data.config) { - browserSync.init(data.files || [], data.config, pjson.version); - } - if (data.configFile) { - info.makeConfig(browserSync.cwd); - } -}); diff --git a/node_modules/browser-sync/index.js b/node_modules/browser-sync/index.js deleted file mode 100755 index a6aa5df..0000000 --- a/node_modules/browser-sync/index.js +++ /dev/null @@ -1,80 +0,0 @@ -#! /usr/bin/env node -"use strict"; - -/** - * @module BrowserSync - */ -var pjson = require("./package.json"); -var BrowserSync = require("./lib/browser-sync"); - -var browserSync = new BrowserSync(); - -/** - * @method browserSync - * @param {Object} [config] This is the main configuration for your BrowserSync instance and can contain any of the [available options]({{site.links.options}}) - * If you do not pass a config an argument for configuration, BrowserSync will still run; but it will be in the `snippet` mode - * @param {Function} [cb] If you pass a callback function, it will be called when BrowserSync has completed all setup tasks and is ready to use. This - * is useful when you need to wait for information (for example: urls, port etc) or perform other tasks synchronously. - * @returns {BrowserSync} - */ -var publicInit = require("./lib/public/init")(browserSync, pjson); - -module.exports = publicInit; -module.exports.init = publicInit; - -/** - * The `reload` method will inform all browsers about changed files and will either cause the browser to refresh, or inject the files where possible. - * - * @method reload - * @param {String|Array|Object} [arg] The file or files to be reloaded. For - * details and examples of Streams support, please see the [GulpJS]({{site.links.gulp}}) examples - * @returns {*} - */ -module.exports.reload = require("./lib/public/reload")(browserSync); - -/** - * Helper method for browser notifications - * - * @method notify - * @param {String|HTML} msg Can be a simple message such as 'Connected' or HTML - * @param {Number} [timeout] How long the message will remain in the browser. @since 1.3.0 - */ -module.exports.notify = require("./lib/public/notify")(browserSync); - -/** - * Register a plugin. Must implement at least a 'plugin' method that returns a - * callable function. - * - * @method use - * @param {String} name The name of the plugin - * @param {Object} module The object to be `required`. - * @param {Function} [cb] A callback function that will return any errors. - */ -module.exports.use = browserSync.registerPlugin.bind(browserSync); - -/** - * The internal Event Emitter used by the running BrowserSync instance (if there is one). - * You can use this to emit your own events, such as changed files, logging etc. - * - * @property emitter - * @type Events.EventEmitter - */ -module.exports.emitter = browserSync.events; - -/** - * This method will close any running server, stop file watching & exit the current process. - * - * @method exit - */ -module.exports.exit = require("./lib/public/exit")(browserSync); - -/** - * A simple true/false flag that you can use to determine if there's a currently-running BrowserSync instance. - * - * @property active - */ -Object.defineProperty(module.exports, "active", { - get: function () { - return browserSync.active; - } -}); diff --git a/node_modules/browser-sync/lib/args.js b/node_modules/browser-sync/lib/args.js deleted file mode 100644 index 35848cb..0000000 --- a/node_modules/browser-sync/lib/args.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict"; - -function isFilesArg (arg) { - return Array.isArray(arg) || typeof arg === "string"; -} - -/** - * Handle arguments for backwards compatibility - * @param {Object} args - * @returns {{config: {}, cb: *}} - */ -module.exports = function (args) { - - var config = {}; - var cb; - - switch (args.length) { - - case 1 : - - if (isFilesArg(args[0])) { - - config.files = args[0]; - - } else if (typeof args[0] === "function") { - - cb = args[0]; - - } else { - - config = args[0]; - - } - - break; - - case 2 : - - // if second is a function, first MUST be config - if (typeof args[1] === "function") { - - config = args[0] || {}; - cb = args[1]; - - } else { - - config = args[1] || {}; - - if (!config.files) { - config.files = args[0]; - } - } - - break; - - case 3 : - - config = args[1] || {}; - - if (!config.files) { - config.files = args[0]; - } - - cb = args[2]; - } - - return { - config: config, - cb: cb - }; -}; diff --git a/node_modules/browser-sync/lib/browser-sync.js b/node_modules/browser-sync/lib/browser-sync.js deleted file mode 100644 index 61fa1f5..0000000 --- a/node_modules/browser-sync/lib/browser-sync.js +++ /dev/null @@ -1,436 +0,0 @@ -"use strict"; - -var services = require("./services"); -var hooks = require("./hooks"); -var config = require("./config"); -var messages = require("./messages"); -var utils = require("./utils"); -var logger = require("./logger"); - -var _ = require("lodash"); -var EE = require("easy-extender"); -var filePath = require("path"); -var events = require("events"); -var objectPath = require("object-path"); - -/** - * Required internal plugin, all can be overridden. - */ -var defaultPlugins = { - "logger": logger, - "socket": require("./sockets"), - "file:watcher": require("./file-watcher"), - "server": require("./server"), - "tunnel": require("./tunnel"), - "client:script": require("browser-sync-client") -}; - -/** - * @constructor - */ -var BrowserSync = function () { - - this.cwd = process.cwd(); - this.active = false; - this.config = config; - - // Events - this.events = new events.EventEmitter(); - this.events.setMaxListeners(20); - - this._reloadQueue = []; - this._browserReload = false; - - // Plugin management - this.pluginManager = new EE(defaultPlugins, hooks); - - this._userPlugins = []; - - this.clientEvents = [ - "scroll", - "input:text", - "input:toggles", - "form:submit", - "form:reset", - "click" - ]; -}; - -/** - * @param module - * @param opts - * @param cb - */ -BrowserSync.prototype.registerPlugin = function (module, opts, cb) { - - this.pluginManager.registerPlugin(module, opts, cb); - - if (module["plugin:name"]) { - this._userPlugins.push(module); - } -}; - -/** - * @param {Function} [filter] - */ -BrowserSync.prototype.getUserPlugins = function (filter) { - - filter = filter || function () { - return true; - }; - - /** - * Transform Plugins option - */ - this.userPlugins = this._userPlugins.filter(filter).map(function (plugin) { - return { - name: plugin["plugin:name"], - active: plugin._enabled - }; - }); - - return this.userPlugins; -}; - -/** - * Get middleware - * @returns {*} - */ -BrowserSync.prototype.getMiddleware = function (type) { - - var types = { - "connector": messages.socketConnector(this.options.port, this.options, true), - "socket-js": require("./snippet").utils.getSocketScript() - }; - - if (type in types) { - return function (req, res) { - res.setHeader("Content-Type", "text/javascript"); - res.end(types[type]); - }; - } -}; - -/** - * @param {Array} files - * @param {Object} options - * @param {String} version - * @param {Function} cb - * @returns {BrowserSync} - */ -BrowserSync.prototype.init = function (files, options, version, cb) { - - var err; - this.version = options.version = version; - this.cb = cb; - - this.pluginManager.init(); - - this.pluginManager.wrap(require("localtunnel"), "tunnel:runner"); - - this.logger = this.pluginManager.get("logger")(this.events, options); - this.debugger = this.logger.clone({useLevelPrefixes: true}); - this.debug = this.debugger.debug; - - // Die if both server & proxy options provided - if (options.server && options.proxy) { - - err = "Invalid config. You cannot specify both a server & proxy option."; - - this.events.emit("config:error", {msg: err}); - - return utils.fail(true, err, this.cb); - } - - this.debug("Looking for an empty port..."); - - utils.getPorts(options) - .then(this.handleSuccess.bind(this, options)) - .catch(this.handleError.bind(this, options)); - - return this; -}; - -/** - * @param options - * @param err - */ -BrowserSync.prototype.handleError = function (options, err) { - this.logger.mute(false).error(err); - utils.fail(true, err, this.cb); -}; - -/** - * @param options - * @param ports - */ -BrowserSync.prototype.handleSuccess = function (options, ports) { - - var debug = this.debug; - - debug("Using port {magenta:%s", ports[0]); - - options.port = ports[0]; - - var init = function () { - services.init(this)(options); - }.bind(this); - - if (_.isUndefined(options.online) && _.isUndefined(process.env.TESTING)) { - - debug("Checking if you're online"); - require("dns").resolve("www.google.com", function (err) { - if (err) { - debug("Could not resolve www.google.com, setting {magenta:online: false}"); - options.online = false; - } else { - debug("Resolved www.google.com, setting {magenta:online: true}"); - options.online = true; - } - init(); - }); - } else { - init(); - } -}; - -/** - * Callback helper - * @param err - * @param [data] - */ -BrowserSync.prototype.callback = function (err, data) { - - if (_.isFunction(this.cb)) { - this.cb(err, data, this); - } - - this.events.emit("service:ready"); -}; - -/** - * Callback helper - * @param name - * @param [defaultValue] - */ -BrowserSync.prototype.getOption = function (name, defaultValue) { - this.debug("Getting option: {magenta:%s", name); - return objectPath.get(this.options, name, defaultValue); -}; - -/** - * @returns {BrowserSync.options} - */ -BrowserSync.prototype.getOptions = function () { - return this.options; -}; - -/** - * @returns {BrowserSync.options} - */ -BrowserSync.prototype.getLogger = logger.getLogger; - -/** - * @param {String} name - * @param {*} value - * @returns {BrowserSync.options|*} - */ -BrowserSync.prototype.setOption = function (name, value) { - - var objectPath = require("object-path"); - - if (!_.isUndefined(objectPath.get(this.options, name))) { - this.debug("Setting option: {magenta:%s", name); - objectPath.set(this.options, name, value); - this.events.emit("options:set", {name: name, value: value, options: this.options}); - } - - return this.options; -}; - -/** - * Internal Events - * @param {Object} options - */ -BrowserSync.prototype.registerInternalEvents = function (options) { - - var events = { - "file:changed": function (data) { - if (data.namespace === "core") { - if (_.isUndefined(data.log)) { - data.log = this.getOption("logFileChanges"); - } - this.changeFile(data, options); - } - }, - "file:reload": function (data) { - this.doFileReload(data); - }, - "browser:reload": function () { - this.doBrowserReload(); - }, - "browser:notify": function (data) { - this.io.sockets.emit("browser:notify", data); - }, - /** - * Things that happened after the service is running - * @param data - */ - "service:running": function (data) { - - if (data.type !== "snippet") { - utils.openBrowser(data.url, options); - } - - // log about any file watching - if (this.watchers) { - this.events.emit("file:watching", this.watchers); - } - }, - "options:set": function (data) { - this.io.sockets.emit("options:set", data); - }, - "init": function () { - this.active = true; - }, - "plugins:configure": function (data) { - if (data.active) { - this.pluginManager.enablePlugin(data.name); - } else { - this.pluginManager.disablePlugin(data.name); - } - this.options.userPlugins = this.getUserPlugins(); - } - }; - - _.each(events, function (func, event) { - this.events.on(event, func.bind(this)); - }, this); -}; - -/** - * Handle Browser Reloads - */ -BrowserSync.prototype.doBrowserReload = function () { - var bs = this; - if (bs._browserReload) { - return; - } - bs._browserReload = setTimeout(function () { - bs.io.sockets.emit("browser:reload"); - clearTimeout(bs._browserReload); - bs._browserReload = false; - }, this.getOption("reloadDelay")); -}; - -/** - * Handle a queue of reloads - * @param {Object} data - */ -BrowserSync.prototype.doFileReload = function (data) { - - var bs = this; - - bs._reloadQueue = bs._reloadQueue || []; - bs._reloadQueue.push(data); - - if (bs._reloadTimer) { - return; - } - - bs._reloadTimer = setTimeout(function () { - if (utils.willCauseReload(bs._reloadQueue.map(function (item) { return item.path; }), bs.getOption("injectFileTypes"))) { - bs.io.sockets.emit("browser:reload"); - } else { - bs._reloadQueue.forEach(function (item) { - bs.io.sockets.emit("file:reload", item); - }); - } - clearTimeout(bs._reloadTimer); - bs._reloadTimer = undefined; - bs._reloadQueue = []; - }, bs.getOption("reloadDelay")); -}; - -/** - * Instance Cleanup - */ -BrowserSync.prototype.cleanup = function (cb) { - - if (!this.active) { - return; - } - - // Close any servers - if (this.server) { - this.debug("Closing server..."); - this.server.close(); - } - - // Stop any file watching - if (this.watchers) { - this.debug("Stopping watchers..."); - _.each(this.watchers, function (item) { - item.watcher.end(); - }); - } - - // Remove all event listeners - if (this.events) { - this.debug("Removing event listeners..."); - this.events.removeAllListeners(); - } - - // Reset the flag - this.debug("Setting {magenta:active: false"); - this.active = false; - - this.pluginManager.plugins = {}; - this.pluginManager.pluginOptions = {}; - - this._userPlugins = []; - this._reloadTimer = undefined; - this._reloadQueue = undefined; - - if (_.isFunction(cb)) { - cb(null); - } -}; - -/** - * @param {Object} data - * @param {Object} options - * @returns {{assetFileName: String}} - */ -BrowserSync.prototype.changeFile = function (data, options) { - - var path = data.path; - var fileName = filePath.basename(path); - - var fileExtension = utils.getFileExtension(path); - - var obj = { - assetFileName: fileName, - fileExtension: fileExtension - }; - - var message = "inject"; - - // RELOAD page - if (!_.contains(options.injectFileTypes, fileExtension)) { - obj.url = path; - message = "reload"; - } - - obj.cwd = this.cwd; - obj.path = path; - obj.type = message; - obj.log = data.log; - - // emit the event through socket - this.events.emit("file:reload", obj); - - return obj; -}; - -module.exports = BrowserSync; diff --git a/node_modules/browser-sync/lib/cli/cli-info.js b/node_modules/browser-sync/lib/cli/cli-info.js deleted file mode 100644 index 25d3ce0..0000000 --- a/node_modules/browser-sync/lib/cli/cli-info.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -var config = require("./../config"); -var utils = require("./../utils"); -var logger = require("./../logger").logger; - -var fs = require("fs"); -var _ = require("lodash"); -var path = require("path"); - -var info = { - /** - * Version info - * @param {Object} pjson - * @returns {String} - */ - getVersion: function (pjson) { - console.log(pjson.version); - return pjson.version; - }, - /** - * Retrieve the config file - * @returns {*} - * @private - * @param filePath - */ - _getConfigFile: function (filePath) { - var relPath = path.resolve(process.cwd() + "/" + filePath); - if (fs.existsSync(relPath)) { - return require(relPath); - } - return false; - }, - /** - * Generate an example Config file. - */ - makeConfig: function (cwd) { - - var opts = require(__dirname + "/../" + config.configFile); - var userOpts = {}; - - var ignore = ["excludedFileTypes", "injectFileTypes"]; - - Object.keys(opts).forEach(function (key) { - if (!_.contains(ignore, key)) { - userOpts[key] = opts[key]; - } - }); - - var file = fs.readFileSync(__dirname + config.template); - - file = file.toString().replace("//OPTS", JSON.stringify(userOpts, null, 4)); - - var path = cwd + config.userFile; - - fs.writeFile(path, file, function () { - logger.info("Config file created {magenta:%s}", utils.resolveRelativeFilePath(path, cwd)); - logger.info( - "To use it, in the same directory run: " + - "{cyan:browser-sync start --config bs-config.js}" - ); - }); - } -}; - -module.exports = info; diff --git a/node_modules/browser-sync/lib/cli/cli-init.js b/node_modules/browser-sync/lib/cli/cli-init.js deleted file mode 100644 index b3a74b0..0000000 --- a/node_modules/browser-sync/lib/cli/cli-init.js +++ /dev/null @@ -1,91 +0,0 @@ -"use strict"; - -var defaultConfig = require("./../default-config"); -var cliOptions = require("./cli-options"); -var info = require("./cli-info"); -var opts = require("./opts.json"); -var tfunk = require("tfunk"); - -var program = require("commander"); -var merge = require("opt-merger").merge; - -module.exports.allowedOptions = ["host", "server", "proxy"]; - -/** - * Handle command-line usage with 'start' - * @param args - * @param cb - */ -module.exports.startFromCommandLine = function (args, cb) { - - var userConfig; - - // First look for provided --config option - if (args.config) { - userConfig = info._getConfigFile(args.config); - } - - var options = merge(defaultConfig, userConfig || {}, cliOptions.callbacks); - - cb(null, { - files: options.files || [], - config: options - }); -}; - -/** - * @param {String} version - * @param {Object} args - minimist object - * @param {Object} argv - * @param {Function} cb - */ -module.exports.parse = function (version, args, argv, cb) { - - program - .version(version) - .usage(" [options]"); - - Object.keys(opts).forEach(function (key) { - program.option(key, opts[key]); - }); - - program - .on("--help", exports.help); - - program - .command("init") - .description("Creates a default config file") - .action(function () { - cb(null, {configFile: true}); - }); - - program - .command("start") - .description("Start Browser Sync") - .action(exports.startFromCommandLine.bind(null, args, cb)); - - program.parse(argv); - - if (!args._.length) { - program.help(); - } -}; - -/** - * Help screen - */ -module.exports.help = function () { - - console.log(tfunk(" {bold:Server Example:")); - console.log(" ---------------"); - console.log(" Use current directory as root & watch CSS files"); - console.log(""); - console.log(tfunk(" {magenta:$}{cyan: browser-sync start --server --files=\"css/*.css\"")); - console.log(""); - console.log(tfunk(" {bold:Proxy Example:")); - console.log(" --------------"); - console.log(" Proxy `localhost:8080` & watch CSS files"); - console.log(""); - console.log(tfunk(" {magenta:$}{cyan: browser-sync start --proxy=\"localhost:8080\" --files=\"css/*.css\"")); - console.log(""); -}; diff --git a/node_modules/browser-sync/lib/cli/cli-options.js b/node_modules/browser-sync/lib/cli/cli-options.js deleted file mode 100644 index 07ec201..0000000 --- a/node_modules/browser-sync/lib/cli/cli-options.js +++ /dev/null @@ -1,266 +0,0 @@ -"use strict"; - -var path = require("path"); -var _ = require("lodash"); - -var utils = { - /** - * @param pattern - * @returns {*|string} - * @private - */ - wrapPattern: function (pattern) { - var prefix = "!"; - var suffix = "/**"; - var lastChar = pattern.charAt(pattern.length - 1); - var extName = path.extname(pattern); - - // If there's a file ext, don't append any suffix - if (extName.length) { - suffix = ""; - } else { - - if (lastChar === "/") { - suffix = "**"; - } - - if (lastChar === "*") { - suffix = ""; - } - } - - return [prefix, pattern, suffix].join(""); - } -}; -module.exports.utils = utils; - -module.exports.callbacks = { - - /** - * Merge server options - * @param defaultValue - * @param merged - * @param newValue - * @param args - * @returns {*} - */ - server: function (defaultValue, merged, newValue, args) { - - // Return if object or array given - if (typeof merged === "undefined" || merged === false) { - return defaultValue; - } - - if (newValue.baseDir) { - return newValue; - } - - var obj = { - baseDir: "./" - }; - - if (newValue !== true) { - obj.baseDir = newValue; - } - - if (args) { - - if (args.index) { - obj.index = args.index; - } - - if (args.directory) { - obj.directory = true; - } - } - - return obj; - }, - /** - * @param defaultValue - * @param newValue - * @returns {*} - */ - proxy: function (defaultValue, newValue) { - - var protocol = "http"; - var host = "localhost"; - var port = 80; - var segs; - var startPath = false; - var returnObj; - - if (typeof newValue !== "string") { - return false; - } - - var url = newValue.replace(/^(https?):\/\//, function (match, solo) { - protocol = solo; - return ""; - }); - - if (~url.indexOf(":")) { - segs = url.split(":"); - host = segs[0]; - port = parseInt(segs[1], 10); - } else { - host = url; - } - - if (~host.indexOf("/")) { - segs = host.split("/"); - host = segs.shift(); - startPath = segs.join("/"); - } - - returnObj = { - protocol: protocol, - host: host, - port: port, - target: protocol + "://" + host + (port > 80 ? ":" + port : "") - }; - - if (startPath) { - returnObj.startPath = startPath; - } - - return returnObj; - }, - /** - * @param {Object} defaultValue - * @param {String} newValue - * @returns {String} - * @private - */ - host: function (defaultValue, newValue) { - if (newValue && typeof newValue === "string") { - return newValue; - } - return null; - }, - /** - * @param defaultValue - * @param newValue - * @private - */ - ports: function (defaultValue, newValue) { - - var segs; - var obj = {}; - - if (typeof newValue === "string") { - - if (~newValue.indexOf(",")) { - segs = newValue.split(","); - obj.min = parseInt(segs[0], 10); - obj.max = parseInt(segs[1], 10); - } else { - obj.min = parseInt(newValue, 10); - obj.max = null; - } - - return obj; - - } else { - return { - min: newValue.min, - max: newValue.max || null - }; - } - }, - /** - * @param defaultValue - * @returns {*} - */ - ghostMode: function (defaultValue, merged, newValue, args) { - - var def = _.cloneDeep(merged); - - var trueAll = { - clicks: true, - scroll: true, - location: false, - forms: { - submit: true, - inputs: true, - toggles: true - } - }; - var falseAll = { - clicks: false, - scroll: false, - location: false, - forms: { - submit: false, - inputs: false, - toggles: false - } - }; - - if (merged === false || merged === "false" || args && args.ghost === false) { - return falseAll; - } - - if (merged === true || merged === "true" || args && args.ghost === true) { - return trueAll; - } - - if (merged.forms === false || newValue === false || newValue === "false") { - def.forms = { - submit: false, - inputs: false, - toggles: false - }; - } - if (merged.forms === true || newValue === true || newValue === "true") { - def.forms = { - submit: true, - inputs: true, - toggles: true - }; - } - - return def; - }, - /** - * @param defaultValue - * @param newValue - * @param args - * @param config - * @returns {*} - */ - files: function (defaultValue, newValue, args, config) { - - var merged = []; - var exclude = config && config.exclude ? config.exclude : false; - - if (newValue) { - if (typeof newValue === "string") { - if (~newValue.indexOf(",")) { - merged = merged.concat(newValue.split(",").map(function (item) { - return item.trim(); - })); - } else { - merged.push(newValue); - } - } else { - merged = newValue; - } - - if (typeof exclude === "string") { - - merged.push(utils.wrapPattern(exclude)); - - } else { - - if (Array.isArray(exclude)) { - exclude.forEach(function (pattern) { - merged.push(utils.wrapPattern(pattern)); - }, this); - } - } - } - - return merged; - } -}; diff --git a/node_modules/browser-sync/lib/cli/cli-template.js b/node_modules/browser-sync/lib/cli/cli-template.js deleted file mode 100644 index e496e44..0000000 --- a/node_modules/browser-sync/lib/cli/cli-template.js +++ /dev/null @@ -1,15 +0,0 @@ - -/* - |-------------------------------------------------------------------------- - | Browser-sync config file - |-------------------------------------------------------------------------- - | - | For up-to-date information about the options: - | http://www.browsersync.io/docs/options/ - | - | There are more options than you see here, these are just the ones that are - | set internally. See the website for more info. - | - | - */ -module.exports = //OPTS; \ No newline at end of file diff --git a/node_modules/browser-sync/lib/cli/index.js b/node_modules/browser-sync/lib/cli/index.js deleted file mode 100644 index ad42d05..0000000 --- a/node_modules/browser-sync/lib/cli/index.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; - -module.exports = { - init: require("./cli-init"), - options: require("./cli-options"), - info: require("./cli-info") -}; diff --git a/node_modules/browser-sync/lib/cli/opts.json b/node_modules/browser-sync/lib/cli/opts.json deleted file mode 100644 index ece7e79..0000000 --- a/node_modules/browser-sync/lib/cli/opts.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "--files": "File paths to watch", - "--exclude": "File patterns to ignore", - "--server": "Run a Local server (uses your cwd as the web root)", - "--index": "Specify which file should be used as the index page", - "--startPath": "Specify the start path for the opened browser", - "--https": "Enable SSL for local development", - "--directory": "Show a directory listing for the server", - "--proxy": "Proxy an existing server", - "--xip": "Use xip.io domain routing", - "--tunnel": "Use a public URL", - "--open": "Choose which URL is auto-opened (local, external or tunnel)", - "--config": "Specify a path to a bs-config.js file", - "--host": "Specify a hostname to use", - "--logLevel": "Set the logger output level (silent, info or debug)", - "--port": "Specify a port to use", - "--no-notify": "Disable the notify element in browsers", - "--no-open": "Don't open a new browser window", - "--no-ghost": "Disable Ghost Mode", - "--no-online": "Force offline usage" -} diff --git a/node_modules/browser-sync/lib/config.js b/node_modules/browser-sync/lib/config.js deleted file mode 100644 index 8326c29..0000000 --- a/node_modules/browser-sync/lib/config.js +++ /dev/null @@ -1,23 +0,0 @@ -"use strict"; - -var path = require("path"); -/** - * @type {{controlPanel: {jsFile: string, baseDir: *}, socketIoScript: string, configFile: string, client: {shims: string}}} - */ -module.exports = { - controlPanel: { - jsFile: "/js/app.js", - baseDir: path.resolve(__dirname + "/control-panel") - }, - templates: { - scriptTag: path.resolve(__dirname + "/templates/script-tags.tmpl"), - connector: path.resolve(__dirname + "/templates/connector.tmpl") - }, - socketIoScript: "/public/socket.io.js", - configFile: "/default-config.js", - userFile: "/bs-config.js", - template: "/cli-template.js", - client: { - shims: "/client/client-shims.js" - } -}; diff --git a/node_modules/browser-sync/lib/default-config.js b/node_modules/browser-sync/lib/default-config.js deleted file mode 100644 index 3771b0f..0000000 --- a/node_modules/browser-sync/lib/default-config.js +++ /dev/null @@ -1,310 +0,0 @@ -"use strict"; -/** - * @module BrowserSync.options - */ -module.exports = { - /** - * BrowserSync can watch your files as you work. Changes you make will either - * be injected into the page (CSS & images) or will cause all browsers to do - * a full-page refresh. See [isaacs's minimatch](https://github.com/isaacs/minimatch) for more information on glob patterns. - * @property files - * @type Array|String - * @default false - */ - files: false, - - /** - * File watching options that get passed along to [Gaze](https://github.com/shama/gaze). Check out the [properties](https://github.com/shama/gaze#properties) - * section of their docs to see which options they support. - * for availbable options - * @property watchOptions - * @type Object - * @default undefined - * @since 1.3.0 - */ - - /** - * Use the built-in static server for basic HTML/JS/CSS websites. - * @property server - * @type Object|Boolean - * @default false - */ - server: false, - - /** - * Proxy an EXISTING vhost. BrowserSync will wrap your existing url and provide a different one to use. - * @property proxy - * @type String|Boolean - * @default false - */ - proxy: false, - - /** - * @property port - * @type Number - * @default 3000 - */ - port: 3000, - - /** - * Enable https for localhost development. **Note:** Proxy and Tunnel not currently supported. - * @property https - * @type Boolean - * @default undefined - * @since 1.3.0 - */ - - /** - * @property ghostMode - * @param {Boolean} [clicks=true] - * @param {Boolean} [scroll=true] - * @param {Boolean} [location=false] - * @param {Boolean} [forms=true] - * @param {Boolean} [forms.submit=true] - * @param {Boolean} [forms.inputs=true] - * @param {Boolean} [forms.toggles=true] - * @type Object - */ - ghostMode: { - clicks: true, - scroll: true, - location: false, - forms: { - submit: true, - inputs: true, - toggles: true - } - }, - - /** - * Can be either "info", "debug", "warn", or "silent" - * @property logLevel - * @type String - * @default info - */ - logLevel: "info", - - /** - * Change the console logging prefix. Useful if you're creating your - * own project based on BrowserSync - * @property logPrefix - * @type String - * @default BS - * @since 1.5.1 - */ - logPrefix: "BS", - - /** - * @property logConnections - * @type Boolean - * @default false - */ - logConnections: false, - - /** - * @property logFileChanges - * @type Boolean - * @default true - */ - logFileChanges: true, - - /** - * Log the snippet to the console when you're in snippet mode (no proxy/server) - * @property logSnippet - * @type: Boolean - * @default true - * @since 1.5.2 - */ - logSnippet: true, - - /** - * SINCE 1.7.0! You can control how the snippet is injected - * onto each page via a custom regex + function. - * You can also provide patterns for certain urls - * that should be ignored from the snippet injection. - * @property snippetOptions - * @since 1.7.0 - * @param {String|Array} [ignorePaths=undefined] - * @param {RegExp} [rule.match=/<body[^>]*>/i] - * @param {Function} [rule.fn=Function] - * @type Object - */ - snippetOptions: { - rule: { - match: /]*>/i, - fn: function (snippet, match) { - return match + snippet; - } - } - }, - - /** - * @property tunnel - * @type String|Boolean - * @default null - */ - - /** - * Some features of BrowserSync (such as `xip` & `tunnel`) require an internet connection, but if you're - * working offline, you can reduce start-up time by setting this option to `false` - * @property online - * @type Boolean - * @default undefined - */ - - /** - * Decide which URL to open automatically when BrowserSync starts. Defaults to "local" if none set. - * Can be true, "local", "external" or "tunnel" - * @property open - * @type Boolean|String - * @default true - */ - open: "local", - - /** - * @property browser - * @type String|Array - * @default default - */ - browser: "default", - - /** - * Requires an internet connection - useful for services such as [Typekit](https://typekit.com/) - * as it allows you to configure domains such as `*.xip.io` in your kit settings - * @property xip - * @type Boolean - * @default false - */ - xip: false, - - hostnameSuffix: false, - - /** - * The small pop-over notifications in the browser are not always needed/wanted. - * @property notify - * @type Boolean - * @default true - */ - notify: true, - - /** - * @property scrollProportionally - * @type Boolean - * @default true - */ - scrollProportionally: true, - - /** - * @property scrollThrottle - * @type Number - * @default 0 - */ - scrollThrottle: 0, - - /** - * @property reloadDelay - * @type Number - * @default 0 - */ - reloadDelay: 0, - - /** - * @property injectChanges - * @type Boolean - * @default true - */ - injectChanges: true, - - /** - * @property startPath - * @type String|Null - * @default null - */ - startPath: null, - - /** - * Whether to minify client script, or not. - * @property minify - * @type Boolean - * @default true - */ - minify: true, - - /** - * @property host - * @type String - * @default null - */ - host: null, - - /** - * @property codeSync - * @type Boolean - * @default true - */ - codeSync: true, - - /** - * @property timestamps - * @type Boolean - * @default true - */ - timestamps: true, - - /** - * Alter the script path for complete control over where the BrowserSync - * Javascript is served from. Whatever you return from this function - * will be used as the script path. - * @property scriptPath - * @default undefined - * @since 1.5.0 - * @type Function - */ - - /** - * Configure the Socket.IO path and namespace to avoid collisions. Note: `namespace` can also be a function - * @property socket - * @param {String} [path="/browser-sync/socket.io"] - * @param {String} [clientPath="/browser-sync"] - * @param {String|Function} [namespace="/browser-sync"] - * @since 1.6.2 - * @type Object - */ - socket: { - path: "/browser-sync/socket.io", - clientPath: "/browser-sync", - namespace: "/browser-sync" - }, - - injectFileTypes: ["css", "png", "jpg", "jpeg", "svg", "gif", "webp"], - excludedFileTypes: [ - "js", - "css", - "pdf", - "map", - "svg", - "ico", - "woff", - "json", - "eot", - "ttf", - "png", - "jpg", - "jpeg", - "webp", - "gif", - "mp4", - "mp3", - "3gp", - "ogg", - "ogv", - "webm", - "m4a", - "flv", - "wmv", - "avi", - "swf", - "scss" - ], - debugInfo: true -}; diff --git a/node_modules/browser-sync/lib/file-watcher.js b/node_modules/browser-sync/lib/file-watcher.js deleted file mode 100644 index 2944765..0000000 --- a/node_modules/browser-sync/lib/file-watcher.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; - -var globWatcher = require("glob-watcher"); -var _ = require("lodash"); - -/** - * Plugin interface - * @returns {*|function(this:exports)} - */ -module.exports.plugin = function (globs, options, emitter) { - - // Options to pass along to Gaze - var watchOptions = options.watchOptions || options.watchoptions || {}; - var tempWatcher; - var watchers = {}; - - _.each(globs, function (glob, namespace) { - - tempWatcher = globWatcher(glob, watchOptions, function (data) { - data.namespace = namespace; - emitter.emit("file:changed", data); - }); - - // Ignore dir-related errors from gaze - tempWatcher.on("error", function () {/*noop*/}); - - watchers[namespace] = { - glob: glob, - watcher: tempWatcher - }; - }); - - return watchers; -}; diff --git a/node_modules/browser-sync/lib/hooks.js b/node_modules/browser-sync/lib/hooks.js deleted file mode 100644 index 0fcfcf6..0000000 --- a/node_modules/browser-sync/lib/hooks.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; - -var _ = require("lodash"); -var snippetUtils = require("./snippet").utils; - -module.exports = { - - /** - * - * @this {BrowserSync} - * @returns {String} - */ - "client:js": function (hooks, data) { - - var js = snippetUtils.getClientJs(data.port, data.options); - - return hooks.reduce(function (joined, hook) { - return joined += hook; - }, js); - }, - /** - * @this {BrowserSync} - * @returns {Array} - */ - "client:events": function (hooks, clientEvents) { - - hooks.forEach(function (hook) { - - var result = hook(this); - - if (Array.isArray(result)) { - clientEvents = _.union(clientEvents, result); - } else { - clientEvents.push(result); - } - }, this); - - return clientEvents; - }, - /** - * @returns {Array} - */ - "server:middleware": function (hooks, initial) { - - initial = initial || []; - - _.each(hooks, function (hook) { - var result = hook(this); - if (Array.isArray(result)) { - result.forEach(function (res) { - if (_.isFunction(res)) { - initial.push(res); - } - }); - } else { - if (_.isFunction(result)) { - initial.push(result); - } - } - }, this); - - return initial; - }, - /** - * Allow plugins to have their own watchers - * @param hooks - * @param bs - * @param obj - * @returns {{core: *}} - */ - "files:watch": function (hooks, bs, obj) { - - var added = false; - - var namespaces = {}; - - if (Array.isArray(obj)) { - if (obj.length) { - namespaces["core"] = obj; - if (obj.length === 1) { - added = true; - } - } - } - - if (!added && Object.keys(obj).length) { - _.each(obj, function (val, key) { - namespaces[key] = val; - }); - } - - if (bs.pluginManager.pluginOptions) { - _.each(bs.pluginManager.pluginOptions, function (value, key) { - if (value && value.files) { - namespaces[key] = value.files; - } - }, this); - } - - return namespaces; - } -}; diff --git a/node_modules/browser-sync/lib/logger.js b/node_modules/browser-sync/lib/logger.js deleted file mode 100644 index 30a25e2..0000000 --- a/node_modules/browser-sync/lib/logger.js +++ /dev/null @@ -1,194 +0,0 @@ -"use strict"; - -var messages = require("./messages"); -var utils = require("./utils"); - -var _ = require("lodash"); - -var template = "[{blue:%s}] "; - -var logger = require("eazy-logger").Logger({ - prefix: template.replace("%s", "BS"), - useLevelPrefixes: false -}); - -module.exports.logger = logger; - -/** - * @param name - * @returns {*} - */ -module.exports.getLogger = function (name) { - return logger.clone(function (config) { - config.prefix = config.prefix + template.replace("%s", name); - return config; - }); -}; - -/** - * Logging Callbacks - */ -module.exports.callbacks = { - /** - * Log when file-watching has started - * @param options - * @param data - */ - "file:watching": function (options, data) { - if (Object.keys(data).length) { - logger.info("Watching files..."); - } - }, - /** - * Log when a file changes - * @param options - * @param data - */ - "file:reload": function (options, data) { - if (data.log) { - var path = utils.resolveRelativeFilePath(data.path, data.cwd); - logger.info("{cyan:File changed: {magenta:%s", path); - } - }, - /** - * - */ - "service:exit": function () { - logger.debug("Exiting..."); - }, - /** - * - */ - "browser:reload": function () { - logger.info("{cyan:Reloading Browsers..."); - }, - /** - * @param options - * @param data - */ - "config:error": function (options, data) { - logger.setOnce("useLevelPrefixes", true).error(data.msg); - }, - /** - * @param options - * @param data - */ - "config:warn": function (options, data) { - logger.setOnce("useLevelPrefixes", true).warn(data.msg); - }, - /** - * @param options - * @param data - */ - "stream:changed": function (options, data) { - - var changed = data.changed; - - logger.info("{cyan:%s %s changed} ({magenta:%s})", - changed.length, - changed.length > 1 ? "files" : "file", - changed.join(", ") - ); - }, - /** - * Client connected logging - * @param options - * @param data - */ - "client:connected": function (options, data) { - - var uaString = utils.getUaString(data.ua); - var msg = "{cyan:Browser Connected: {magenta:%s, version: %s}"; - var method = "info"; - - if (!options.logConnections) { - method = "debug"; - } - - logger.log(method, msg, - uaString.name, - uaString.version - ); - }, - /** - * Main logging when the service is running - * @param options - * @param data - */ - "service:running": function (options, data) { - - var type = data.type; - var baseDir = options.server.baseDir; - var proxy = options.proxy; - - if (type === "server") { - - logUrls(options.urls); - - if (baseDir) { - if (Array.isArray(baseDir)) { - _.each(baseDir, serveFiles); - } else { - serveFiles(baseDir); - } - } - } - - if (type === "proxy") { - - logger.info("Proxying: {cyan:%s}", proxy.target); - logger.info("Now you can access your site through the following addresses:"); - logUrls(options.urls); - } - - if (type === "snippet" && options.logSnippet) { - - logger.info( - "Copy the following snippet into your website, " + - "just before the closing {cyan:} tag" - ); - logger.unprefixed("info", - messages.scriptTags(options.port, options) - ); - } - - function serveFiles (base) { - logger.info("Serving files from: {magenta:%s}", base); - } - - function logUrls (urls) { - _.each(urls, function (value, key) { - logger.info("%s URL: {magenta:%s}", - utils.ucfirst(key), - value); - }); - } - } -}; - -/** - * Plugin interface - only to be called once to register all events - */ -module.exports.plugin = function (emitter, options) { - - // Should set logger level here! - if (options.logLevel === "silent") { - logger.mute(true); - } else { - logger.setLevel(options.logLevel); - } - - if (options.logPrefix) { - if (_.isFunction(options.logPrefix)) { - logger.setPrefix(options.logPrefix); - } else { - logger.setPrefix(template.replace("%s", options.logPrefix)); - } - } - - _.each(exports.callbacks, function (func, event) { - emitter.on(event, func.bind(this, options)); - }); - - return logger; -}; diff --git a/node_modules/browser-sync/lib/messages.js b/node_modules/browser-sync/lib/messages.js deleted file mode 100644 index c3a7abe..0000000 --- a/node_modules/browser-sync/lib/messages.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; - -var objectPath = require("object-path"); -var _ = require("lodash"); -var fs = require("fs"); -var config = require("./config"); - -var messages = { - /** - * @param {Number} port - * @param {Object} options - * @returns {String} - */ - scriptTags: function (port, options) { - - function getPath(relative, port) { - return "//HOST:" + port + relative; - } - - var template = fs.readFileSync(config.templates.scriptTag, "utf-8"); - - var scriptPath = this.clientScript(options); - var script; - var override = false; - - if (options.scriptPath && _.isFunction(options.scriptPath)) { - script = options.scriptPath(scriptPath, port, options); - override = true; - } else { - script = getPath(scriptPath, port); - } - - if (!override && (options.server || options.proxy)) { - script = scriptPath; - } - - template = template - .replace("%script%", script); - - return template; - }, - /** - * @param {String|Number} port - * @param {Object} options - * @returns {String} - */ - socketConnector: function (port, options, external) { - - var path = objectPath.get(options, "socket.path"); - var namespace = objectPath.get(options, "socket.namespace"); - var override = false; - var withPort = "location.hostname + ':%port+ns%'".replace("%port+ns%", port + namespace); - - if (_.isFunction(namespace)) { - namespace = "'" + namespace(path, port, options) + "'"; - override = true; - } - - if (!override) { - // Ensure snippet mode always has PORT - if (!options.server && !options.proxy || external) { - namespace = withPort; - } else { - namespace = "'%ns'".replace("%ns", namespace); - } - } - - var template = fs.readFileSync(config.templates.connector, "utf-8"); - - template = template - .replace("%path%", path) - .replace("%url%", namespace); - - return template; - }, - /** - * @param {Object} [options] - * @param {Boolean} [both] - */ - clientScript: function (options, both) { - - var prefix = options.socket && options.socket.clientPath || "/browser-sync"; - var script = prefix + "/browser-sync-client.js"; - var template = prefix + "/browser-sync-client.%s.js"; - - var compiled = template.replace("%s", options.version); - - if (both) { - return { - path: script, - versioned: compiled - }; - } - - return compiled; - } -}; - -module.exports = messages; diff --git a/node_modules/browser-sync/lib/public/exit.js b/node_modules/browser-sync/lib/public/exit.js deleted file mode 100644 index 263c7ee..0000000 --- a/node_modules/browser-sync/lib/public/exit.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -/** - * @param {BrowserSync} browserSync - * @returns {Function} - */ -module.exports = function (browserSync) { - - function exit() { - if (browserSync.active) { - browserSync.events.emit("service:exit"); - browserSync.cleanup(); - } - process.exit(); - } - - process.on("SIGINT", exit); - - return exit; -}; diff --git a/node_modules/browser-sync/lib/public/init.js b/node_modules/browser-sync/lib/public/init.js deleted file mode 100644 index 64117db..0000000 --- a/node_modules/browser-sync/lib/public/init.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; - -var defaultConfig = require("../default-config"); -var cliOptions = require("../cli/cli-options"); - -var merger = require("opt-merger"); - -/** - * @param {BrowserSync} browserSync - * @param {Object} pjson - * @returns {Function} - */ -module.exports = function (browserSync, pjson) { - - return function () { - - var args = Array.prototype.slice.call(arguments); - args = require("../args")(args); - - var config = merger.set({ignoreCli: true}).merge(defaultConfig, args.config || {}, cliOptions.callbacks); - - if (!config.server && !config.proxy) { - config.open = false; - } - - return browserSync.init(config.files || [], config, pjson.version, args.cb); - }; -}; diff --git a/node_modules/browser-sync/lib/public/notify.js b/node_modules/browser-sync/lib/public/notify.js deleted file mode 100644 index 1755a8f..0000000 --- a/node_modules/browser-sync/lib/public/notify.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -/** - * @param {BrowserSync} browserSync - * @returns {Function} - */ -module.exports = function (browserSync) { - - return function (msg, timeout) { - - if (msg) { - browserSync.events.emit("browser:notify", { - message: msg, - timeout: timeout || 2000 - }); - } - }; -}; diff --git a/node_modules/browser-sync/lib/public/reload.js b/node_modules/browser-sync/lib/public/reload.js deleted file mode 100644 index d42a2e4..0000000 --- a/node_modules/browser-sync/lib/public/reload.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; - -var path = require("path"); -var utils = require("../utils"); -var defaultConfig = require("../default-config"); - -/** - * @param {BrowserSync} browserSync - * @returns {Function} - */ -module.exports = function (browserSync) { - - var events = browserSync.events; - - function emitReload(path, log) { - events.emit("file:changed", { - path: path, - log: log, - namespace: "core" - }); - } - - function emitBrowserReload() { - events.emit("browser:reload"); - } - - function emitInfo(changed) { - events.emit("stream:changed", {changed: changed}); - } - - return function (arg) { - - if (typeof arg === "string") { - return emitReload(arg, true); - } - - if (Array.isArray(arg)) { - - if (utils.willCauseReload(arg, defaultConfig.injectFileTypes)) { - return emitBrowserReload(); - } - - return arg.forEach(function (filepath) { - emitReload(filepath, true); - }); - } - - if (arg && arg.stream === true) { - - // Handle Streams here... - var emitted = false; - var once = arg.once || false; - var Transform = require("stream").Transform; - var reload = new Transform({objectMode:true}); - var changed = []; - - reload._transform = function (file, encoding, next) { - - if (once === true && !emitted) { - - emitBrowserReload(); - - emitted = true; - - } else { // handle multiple - - if (once === true && emitted) { - - } else { - - if (file.path) { - - emitted = true; - emitReload(file.path, false); - changed.push(path.basename(file.path)); - } - } - } - - this.push(file); // always send the file down-stream - - next(); - }; - - reload._flush = function (next) { - - emitInfo(changed); - - next(); - }; - - return reload; - } - - return emitBrowserReload(); - - }; -}; diff --git a/node_modules/browser-sync/lib/public/socket.io.js b/node_modules/browser-sync/lib/public/socket.io.js deleted file mode 100644 index abeae09..0000000 --- a/node_modules/browser-sync/lib/public/socket.io.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.io=e()}}(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0&&!this.encoding){var pack=this.packetBuffer.shift();this.packet(pack)}};Manager.prototype.cleanup=function(){var sub;while(sub=this.subs.shift())sub.destroy();this.packetBuffer=[];this.encoding=false;this.decoder.destroy()};Manager.prototype.close=Manager.prototype.disconnect=function(){this.skipReconnect=true;this.readyState="closed";this.engine&&this.engine.close()};Manager.prototype.onclose=function(reason){debug("close");this.cleanup();this.readyState="closed";this.emit("close",reason);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};Manager.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var self=this;this.attempts++;if(this.attempts>this._reconnectionAttempts){debug("reconnect failed");this.emitAll("reconnect_failed");this.reconnecting=false}else{var delay=this.attempts*this.reconnectionDelay();delay=Math.min(delay,this.reconnectionDelayMax());debug("will wait %dms before reconnect attempt",delay);this.reconnecting=true;var timer=setTimeout(function(){if(self.skipReconnect)return;debug("attempting reconnect");self.emitAll("reconnect_attempt",self.attempts);self.emitAll("reconnecting",self.attempts);if(self.skipReconnect)return;self.open(function(err){if(err){debug("reconnect attempt error");self.reconnecting=false;self.reconnect();self.emitAll("reconnect_error",err.data)}else{debug("reconnect success");self.onreconnect()}})},delay);this.subs.push({destroy:function(){clearTimeout(timer)}})}};Manager.prototype.onreconnect=function(){var attempt=this.attempts;this.attempts=0;this.reconnecting=false;this.emitAll("reconnect",attempt)}},{"./on":4,"./socket":5,"./url":6,"component-bind":7,"component-emitter":8,debug:9,"engine.io-client":10,indexof:39,"object-component":40,"socket.io-parser":43}],4:[function(_dereq_,module,exports){module.exports=on;function on(obj,ev,fn){obj.on(ev,fn);return{destroy:function(){obj.removeListener(ev,fn)}}}},{}],5:[function(_dereq_,module,exports){var parser=_dereq_("socket.io-parser");var Emitter=_dereq_("component-emitter");var toArray=_dereq_("to-array");var on=_dereq_("./on");var bind=_dereq_("component-bind");var debug=_dereq_("debug")("socket.io-client:socket");var hasBin=_dereq_("has-binary");module.exports=exports=Socket;var events={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1};var emit=Emitter.prototype.emit;function Socket(io,nsp){this.io=io;this.nsp=nsp;this.json=this;this.ids=0;this.acks={};if(this.io.autoConnect)this.open();this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true}Emitter(Socket.prototype);Socket.prototype.subEvents=function(){if(this.subs)return;var io=this.io;this.subs=[on(io,"open",bind(this,"onopen")),on(io,"packet",bind(this,"onpacket")),on(io,"close",bind(this,"onclose"))]};Socket.prototype.open=Socket.prototype.connect=function(){if(this.connected)return this;this.subEvents();this.io.open();if("open"==this.io.readyState)this.onopen();return this};Socket.prototype.send=function(){var args=toArray(arguments);args.unshift("message");this.emit.apply(this,args);return this};Socket.prototype.emit=function(ev){if(events.hasOwnProperty(ev)){emit.apply(this,arguments);return this}var args=toArray(arguments);var parserType=parser.EVENT;if(hasBin(args)){parserType=parser.BINARY_EVENT}var packet={type:parserType,data:args};if("function"==typeof args[args.length-1]){debug("emitting packet with ack id %d",this.ids);this.acks[this.ids]=args.pop();packet.id=this.ids++}if(this.connected){this.packet(packet)}else{this.sendBuffer.push(packet)}return this};Socket.prototype.packet=function(packet){packet.nsp=this.nsp;this.io.packet(packet)};Socket.prototype.onopen=function(){debug("transport is open - connecting");if("/"!=this.nsp){this.packet({type:parser.CONNECT})}};Socket.prototype.onclose=function(reason){debug("close (%s)",reason);this.connected=false;this.disconnected=true;this.emit("disconnect",reason)};Socket.prototype.onpacket=function(packet){if(packet.nsp!=this.nsp)return;switch(packet.type){case parser.CONNECT:this.onconnect();break;case parser.EVENT:this.onevent(packet);break;case parser.BINARY_EVENT:this.onevent(packet);break;case parser.ACK:this.onack(packet);break;case parser.BINARY_ACK:this.onack(packet);break;case parser.DISCONNECT:this.ondisconnect();break;case parser.ERROR:this.emit("error",packet.data);break}};Socket.prototype.onevent=function(packet){var args=packet.data||[];debug("emitting event %j",args);if(null!=packet.id){debug("attaching ack callback to event");args.push(this.ack(packet.id))}if(this.connected){emit.apply(this,args)}else{this.receiveBuffer.push(args)}};Socket.prototype.ack=function(id){var self=this;var sent=false;return function(){if(sent)return;sent=true;var args=toArray(arguments);debug("sending ack %j",args);var type=hasBin(args)?parser.BINARY_ACK:parser.ACK;self.packet({type:type,id:id,data:args})}};Socket.prototype.onack=function(packet){debug("calling ack %s with %j",packet.id,packet.data);var fn=this.acks[packet.id];fn.apply(this,packet.data);delete this.acks[packet.id]};Socket.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};Socket.prototype.emitBuffered=function(){var i;for(i=0;i=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i';iframe=document.createElement(html)}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId;iframe.src="javascript:0"}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();data=data.replace(rEscapedNewline,"\\\n");this.area.value=data.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(self.iframe.readyState=="complete"){complete()}}}else{this.iframe.onload=complete}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./polling":17,"component-inherit":20}],16:[function(_dereq_,module,exports){(function(global){var XMLHttpRequest=_dereq_("xmlhttprequest");var Polling=_dereq_("./polling");var Emitter=_dereq_("component-emitter");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:polling-xhr");module.exports=XHR;module.exports.Request=Request;function empty(){}function XHR(opts){Polling.call(this,opts);if(global.location){var isSSL="https:"==location.protocol;var port=location.port;if(!port){port=isSSL?443:80}this.xd=opts.hostname!=global.location.hostname||port!=opts.port;this.xs=opts.secure!=isSSL}}inherit(XHR,Polling);XHR.prototype.supportsBinary=true;XHR.prototype.request=function(opts){opts=opts||{};opts.uri=this.uri();opts.xd=this.xd;opts.xs=this.xs;opts.agent=this.agent||false;opts.supportsBinary=this.supportsBinary;opts.enablesXDR=this.enablesXDR;return new Request(opts)};XHR.prototype.doWrite=function(data,fn){var isBinary=typeof data!=="string"&&data!==undefined;var req=this.request({method:"POST",data:data,isBinary:isBinary});var self=this;req.on("success",fn);req.on("error",function(err){self.onError("xhr post error",err)});this.sendXhr=req};XHR.prototype.doPoll=function(){debug("xhr poll");var req=this.request();var self=this;req.on("data",function(data){self.onData(data)});req.on("error",function(err){self.onError("xhr poll error",err)});this.pollXhr=req};function Request(opts){this.method=opts.method||"GET";this.uri=opts.uri;this.xd=!!opts.xd;this.xs=!!opts.xs;this.async=false!==opts.async;this.data=undefined!=opts.data?opts.data:null;this.agent=opts.agent;this.isBinary=opts.isBinary;this.supportsBinary=opts.supportsBinary;this.enablesXDR=opts.enablesXDR;this.create()}Emitter(Request.prototype);Request.prototype.create=function(){var xhr=this.xhr=new XMLHttpRequest({agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR});var self=this;try{debug("xhr open %s: %s",this.method,this.uri);xhr.open(this.method,this.uri,this.async);if(this.supportsBinary){xhr.responseType="arraybuffer"}if("POST"==this.method){try{if(this.isBinary){xhr.setRequestHeader("Content-type","application/octet-stream")}else{xhr.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(e){}}if("withCredentials"in xhr){xhr.withCredentials=true}if(this.hasXDR()){xhr.onload=function(){self.onLoad()};xhr.onerror=function(){self.onError(xhr.responseText)}}else{xhr.onreadystatechange=function(){if(4!=xhr.readyState)return;if(200==xhr.status||1223==xhr.status){self.onLoad()}else{setTimeout(function(){self.onError(xhr.status)},0)}}}debug("xhr data %s",this.data);xhr.send(this.data)}catch(e){setTimeout(function(){self.onError(e)},0);return}if(global.document){this.index=Request.requestsCount++;Request.requests[this.index]=this}};Request.prototype.onSuccess=function(){this.emit("success");this.cleanup()};Request.prototype.onData=function(data){this.emit("data",data);this.onSuccess()};Request.prototype.onError=function(err){this.emit("error",err);this.cleanup()};Request.prototype.cleanup=function(){if("undefined"==typeof this.xhr||null===this.xhr){return}if(this.hasXDR()){this.xhr.onload=this.xhr.onerror=empty}else{this.xhr.onreadystatechange=empty}try{this.xhr.abort()}catch(e){}if(global.document){delete Request.requests[this.index]}this.xhr=null};Request.prototype.onLoad=function(){var data;try{var contentType;try{contentType=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch(e){}if(contentType==="application/octet-stream"){data=this.xhr.response}else{if(!this.supportsBinary){data=this.xhr.responseText}else{data="ok"}}}catch(e){this.onError(e)}if(null!=data){this.onData(data)}};Request.prototype.hasXDR=function(){return"undefined"!==typeof global.XDomainRequest&&!this.xs&&this.enablesXDR};Request.prototype.abort=function(){this.cleanup()};if(global.document){Request.requestsCount=0;Request.requests={};if(global.attachEvent){global.attachEvent("onunload",unloadHandler)}else if(global.addEventListener){global.addEventListener("beforeunload",unloadHandler,false)}}function unloadHandler(){for(var i in Request.requests){if(Request.requests.hasOwnProperty(i)){Request.requests[i].abort()}}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./polling":17,"component-emitter":8,"component-inherit":20,debug:21,xmlhttprequest:19}],17:[function(_dereq_,module,exports){var Transport=_dereq_("../transport");var parseqs=_dereq_("parseqs");var parser=_dereq_("engine.io-parser");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:polling");module.exports=Polling;var hasXHR2=function(){var XMLHttpRequest=_dereq_("xmlhttprequest");var xhr=new XMLHttpRequest({xdomain:false});return null!=xhr.responseType}();function Polling(opts){var forceBase64=opts&&opts.forceBase64;if(!hasXHR2||forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(Polling,Transport);Polling.prototype.name="polling";Polling.prototype.doOpen=function(){this.poll()};Polling.prototype.pause=function(onPause){var pending=0;var self=this;this.readyState="pausing";function pause(){debug("paused");self.readyState="paused";onPause()}if(this.polling||!this.writable){var total=0;if(this.polling){debug("we are currently polling - waiting to pause");total++;this.once("pollComplete",function(){debug("pre-pause polling complete");--total||pause()})}if(!this.writable){debug("we are currently writing - waiting to pause");total++;this.once("drain",function(){debug("pre-pause writing complete");--total||pause()})}}else{pause()}};Polling.prototype.poll=function(){debug("polling");this.polling=true;this.doPoll();this.emit("poll")};Polling.prototype.onData=function(data){var self=this;debug("polling got data %s",data);var callback=function(packet,index,total){if("opening"==self.readyState){self.onOpen()}if("close"==packet.type){self.onClose();return false}self.onPacket(packet)};parser.decodePayload(data,this.socket.binaryType,callback);if("closed"!=this.readyState){this.polling=false;this.emit("pollComplete");if("open"==this.readyState){this.poll()}else{debug('ignoring poll - transport state "%s"',this.readyState)}}};Polling.prototype.doClose=function(){var self=this;function close(){debug("writing close packet");self.write([{type:"close"}])}if("open"==this.readyState){debug("transport open - closing");close()}else{debug("transport not open - deferring close");this.once("open",close)}};Polling.prototype.write=function(packets){var self=this;this.writable=false;var callbackfn=function(){self.writable=true;self.emit("drain")};var self=this;parser.encodePayload(packets,this.supportsBinary,function(data){self.doWrite(data,callbackfn)})};Polling.prototype.uri=function(){var query=this.query||{};var schema=this.secure?"https":"http";var port="";if(false!==this.timestampRequests){query[this.timestampParam]=+new Date+"-"+Transport.timestamps++}if(!this.supportsBinary&&!query.sid){query.b64=1}query=parseqs.encode(query);if(this.port&&("https"==schema&&this.port!=443||"http"==schema&&this.port!=80)){port=":"+this.port}if(query.length){query="?"+query}return schema+"://"+this.hostname+port+this.path+query}},{"../transport":13,"component-inherit":20,debug:21,"engine.io-parser":24,parseqs:32,xmlhttprequest:19}],18:[function(_dereq_,module,exports){var Transport=_dereq_("../transport");var parser=_dereq_("engine.io-parser");var parseqs=_dereq_("parseqs");var inherit=_dereq_("component-inherit");var debug=_dereq_("debug")("engine.io-client:websocket");var WebSocket=_dereq_("ws");module.exports=WS;function WS(opts){var forceBase64=opts&&opts.forceBase64;if(forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(WS,Transport);WS.prototype.name="websocket";WS.prototype.supportsBinary=true;WS.prototype.doOpen=function(){if(!this.check()){return}var self=this;var uri=this.uri();var protocols=void 0;var opts={agent:this.agent};this.ws=new WebSocket(uri,protocols,opts);if(this.ws.binaryType===undefined){this.supportsBinary=false}this.ws.binaryType="arraybuffer";this.addEventListeners()};WS.prototype.addEventListeners=function(){var self=this;this.ws.onopen=function(){self.onOpen()};this.ws.onclose=function(){self.onClose()};this.ws.onmessage=function(ev){self.onData(ev.data)};this.ws.onerror=function(e){self.onError("websocket error",e)}};if("undefined"!=typeof navigator&&/iPad|iPhone|iPod/i.test(navigator.userAgent)){WS.prototype.onData=function(data){var self=this;setTimeout(function(){Transport.prototype.onData.call(self,data)},0)}}WS.prototype.write=function(packets){var self=this;this.writable=false;for(var i=0,l=packets.length;i=31}exports.formatters.j=function(v){return JSON.stringify(v)};function formatArgs(){var args=arguments;var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return args;var c="color: "+this.color;args=[args[0],c,"color: inherit"].concat(Array.prototype.slice.call(args,1));var index=0;var lastC=0;args[0].replace(/%[a-z%]/g,function(match){if("%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c);return args}function log(){return"object"==typeof console&&"function"==typeof console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){localStorage.removeItem("debug")}else{localStorage.debug=namespaces}}catch(e){}}function load(){var r;try{r=localStorage.debug}catch(e){}return r}exports.enable(load())},{"./debug":22}],22:[function(_dereq_,module,exports){exports=module.exports=debug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=_dereq_("ms");exports.names=[];exports.skips=[];exports.formatters={};var prevColor=0;var prevTime;function selectColor(){return exports.colors[prevColor++%exports.colors.length]}function debug(namespace){function disabled(){}disabled.enabled=false;function enabled(){var self=enabled;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;if(null==self.useColors)self.useColors=exports.useColors();if(null==self.color&&self.useColors)self.color=selectColor();var args=Array.prototype.slice.call(arguments);args[0]=exports.coerce(args[0]);if("string"!==typeof args[0]){args=["%o"].concat(args)}var index=0;args[0]=args[0].replace(/%([a-z%])/g,function(match,format){if(match==="%")return match;index++;var formatter=exports.formatters[format];if("function"===typeof formatter){var val=args[index];match=formatter.call(self,val);args.splice(index,1);index--}return match});if("function"===typeof exports.formatArgs){args=exports.formatArgs.apply(self,args)}var logFn=enabled.log||exports.log||console.log.bind(console);logFn.apply(self,args)}enabled.enabled=true;var fn=exports.enabled(namespace)?enabled:disabled;fn.namespace=namespace;return fn}function enable(namespaces){exports.save(namespaces);var split=(namespaces||"").split(/[\s,]+/);var len=split.length;for(var i=0;i=d)return Math.round(ms/d)+"d";if(ms>=h)return Math.round(ms/h)+"h";if(ms>=m)return Math.round(ms/m)+"m";if(ms>=s)return Math.round(ms/s)+"s";return ms+"ms"}function long(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms1){return{type:packetslist[type],data:data.substring(1)}}else{return{type:packetslist[type]}}}var asArray=new Uint8Array(data);var type=asArray[0];var rest=sliceBuffer(data,1);if(Blob&&binaryType==="blob"){rest=new Blob([rest])}return{type:packetslist[type],data:rest}};exports.decodeBase64Packet=function(msg,binaryType){var type=packetslist[msg.charAt(0)];if(!global.ArrayBuffer){return{type:type,data:{base64:true,data:msg.substr(1)}}}var data=base64encoder.decode(msg.substr(1));if(binaryType==="blob"&&Blob){data=new Blob([data])}return{type:type,data:data}};exports.encodePayload=function(packets,supportsBinary,callback){if(typeof supportsBinary=="function"){callback=supportsBinary;supportsBinary=null}if(supportsBinary){if(Blob&&!isAndroid){return exports.encodePayloadAsBlob(packets,callback)}return exports.encodePayloadAsArrayBuffer(packets,callback)}if(!packets.length){return callback("0:")}function setLengthHeader(message){return message.length+":"+message}function encodeOne(packet,doneCallback){exports.encodePacket(packet,supportsBinary,true,function(message){doneCallback(null,setLengthHeader(message))})}map(packets,encodeOne,function(err,results){return callback(results.join(""))})};function map(ary,each,done){var result=new Array(ary.length);var next=after(ary.length,done);var eachWithIndex=function(i,el,cb){each(el,function(error,msg){result[i]=msg;cb(error,result)})};for(var i=0;i0){var tailArray=new Uint8Array(bufferTail);var isString=tailArray[0]===0;var msgLength="";for(var i=1;;i++){if(tailArray[i]==255)break;if(msgLength.length>310){numberTooLong=true;break}msgLength+=tailArray[i]}if(numberTooLong)return callback(err,0,1);bufferTail=sliceBuffer(bufferTail,2+msgLength.length);msgLength=parseInt(msgLength);var msg=sliceBuffer(bufferTail,0,msgLength);if(isString){try{msg=String.fromCharCode.apply(null,new Uint8Array(msg))}catch(e){var typed=new Uint8Array(msg);msg="";for(var i=0;ibytes){end=bytes}if(start>=bytes||start>=end||bytes===0){return new ArrayBuffer(0)}var abv=new Uint8Array(arraybuffer);var result=new Uint8Array(end-start);for(var i=start,ii=0;i>2];base64+=chars[(bytes[i]&3)<<4|bytes[i+1]>>4];base64+=chars[(bytes[i+1]&15)<<2|bytes[i+2]>>6];base64+=chars[bytes[i+2]&63]}if(len%3===2){base64=base64.substring(0,base64.length-1)+"="}else if(len%3===1){base64=base64.substring(0,base64.length-2)+"=="}return base64};exports.decode=function(base64){var bufferLength=base64.length*.75,len=base64.length,i,p=0,encoded1,encoded2,encoded3,encoded4;if(base64[base64.length-1]==="="){bufferLength--;if(base64[base64.length-2]==="="){bufferLength--}}var arraybuffer=new ArrayBuffer(bufferLength),bytes=new Uint8Array(arraybuffer);for(i=0;i>4;bytes[p++]=(encoded2&15)<<4|encoded3>>2;bytes[p++]=(encoded3&3)<<6|encoded4&63}return arraybuffer}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],29:[function(_dereq_,module,exports){(function(global){var BlobBuilder=global.BlobBuilder||global.WebKitBlobBuilder||global.MSBlobBuilder||global.MozBlobBuilder;var blobSupported=function(){try{var b=new Blob(["hi"]);return b.size==2}catch(e){return false}}();var blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;function BlobBuilderConstructor(ary,options){options=options||{};var bb=new BlobBuilder;for(var i=0;i=55296&&value<=56319&&counter65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value)}return output}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint){if((codePoint&4294967168)==0){return stringFromCharCode(codePoint)}var symbol="";if((codePoint&4294965248)==0){symbol=stringFromCharCode(codePoint>>6&31|192)}else if((codePoint&4294901760)==0){symbol=stringFromCharCode(codePoint>>12&15|224);symbol+=createByte(codePoint,6)}else if((codePoint&4292870144)==0){symbol=stringFromCharCode(codePoint>>18&7|240);symbol+=createByte(codePoint,12);symbol+=createByte(codePoint,6)}symbol+=stringFromCharCode(codePoint&63|128);return symbol}function utf8encode(string){var codePoints=ucs2decode(string);var length=codePoints.length;var index=-1;var codePoint;var byteString="";while(++index=byteCount){throw Error("Invalid byte index")}var continuationByte=byteArray[byteIndex]&255;byteIndex++;if((continuationByte&192)==128){return continuationByte&63}throw Error("Invalid continuation byte")}function decodeSymbol(){var byte1;var byte2;var byte3;var byte4;var codePoint;if(byteIndex>byteCount){throw Error("Invalid byte index")}if(byteIndex==byteCount){return false}byte1=byteArray[byteIndex]&255;byteIndex++;if((byte1&128)==0){return byte1}if((byte1&224)==192){var byte2=readContinuationByte();codePoint=(byte1&31)<<6|byte2;if(codePoint>=128){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&240)==224){byte2=readContinuationByte();byte3=readContinuationByte();codePoint=(byte1&15)<<12|byte2<<6|byte3;if(codePoint>=2048){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&248)==240){byte2=readContinuationByte();byte3=readContinuationByte();byte4=readContinuationByte();codePoint=(byte1&15)<<18|byte2<<12|byte3<<6|byte4;if(codePoint>=65536&&codePoint<=1114111){return codePoint}}throw Error("Invalid UTF-8 detected")}var byteArray;var byteCount;var byteIndex;function utf8decode(byteString){byteArray=ucs2decode(byteString);byteCount=byteArray.length;byteIndex=0;var codePoints=[];var tmp;while((tmp=decodeSymbol())!==false){codePoints.push(tmp)}return ucs2encode(codePoints)}var utf8={version:"2.0.0",encode:utf8encode,decode:utf8decode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return utf8})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=utf8}else{var object={};var hasOwnProperty=object.hasOwnProperty;for(var key in utf8){hasOwnProperty.call(utf8,key)&&(freeExports[key]=utf8[key])}}}else{root.utf8=utf8}})(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],31:[function(_dereq_,module,exports){(function(global){var rvalidchars=/^[\],:{}\s]*$/;var rvalidescape=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;var rvalidtokens=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;var rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g;var rtrimLeft=/^\s+/;var rtrimRight=/\s+$/;module.exports=function parsejson(data){if("string"!=typeof data||!data){return null}data=data.replace(rtrimLeft,"").replace(rtrimRight,"");if(global.JSON&&JSON.parse){return JSON.parse(data)}if(rvalidchars.test(data.replace(rvalidescape,"@").replace(rvalidtokens,"]").replace(rvalidbraces,""))){return new Function("return "+data)()}}}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],32:[function(_dereq_,module,exports){exports.encode=function(obj){var str="";for(var i in obj){if(obj.hasOwnProperty(i)){if(str.length)str+="&";str+=encodeURIComponent(i)+"="+encodeURIComponent(obj[i])}}return str};exports.decode=function(qs){var qry={};var pairs=qs.split("&");for(var i=0,l=pairs.length;i1)))/4)-floor((year-1901+month)/100)+floor((year-1601+month)/400)}}if(!(isProperty={}.hasOwnProperty)){isProperty=function(property){var members={},constructor;if((members.__proto__=null,members.__proto__={toString:1},members).toString!=getClass){isProperty=function(property){var original=this.__proto__,result=property in(this.__proto__=null,this);this.__proto__=original;return result}}else{constructor=members.constructor;isProperty=function(property){var parent=(this.constructor||constructor).prototype;return property in this&&!(property in parent&&this[property]===parent[property])}}members=null;return isProperty.call(this,property)}}var PrimitiveTypes={"boolean":1,number:1,string:1,undefined:1};var isHostType=function(object,property){var type=typeof object[property];return type=="object"?!!object[property]:!PrimitiveTypes[type]};forEach=function(object,callback){var size=0,Properties,members,property;(Properties=function(){this.valueOf=0}).prototype.valueOf=0;members=new Properties;for(property in members){if(isProperty.call(members,property)){size++}}Properties=members=null;if(!size){members=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,length;var hasProperty=!isFunction&&typeof object.constructor!="function"&&isHostType(object,"hasOwnProperty")?object.hasOwnProperty:isProperty;for(property in object){if(!(isFunction&&property=="prototype")&&hasProperty.call(object,property)){callback(property)}}for(length=members.length;property=members[--length];hasProperty.call(object,property)&&callback(property));}}else if(size==2){forEach=function(object,callback){var members={},isFunction=getClass.call(object)==functionClass,property;for(property in object){if(!(isFunction&&property=="prototype")&&!isProperty.call(members,property)&&(members[property]=1)&&isProperty.call(object,property)){callback(property)}}}}else{forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,isConstructor;for(property in object){if(!(isFunction&&property=="prototype")&&isProperty.call(object,property)&&!(isConstructor=property==="constructor")){callback(property)}}if(isConstructor||isProperty.call(object,property="constructor")){callback(property)}}}return forEach(object,callback)};if(!has("json-stringify")){var Escapes={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var leadingZeroes="000000";var toPaddedString=function(width,value){return(leadingZeroes+(value||0)).slice(-width)};var unicodePrefix="\\u00";var quote=function(value){var result='"',index=0,length=value.length,isLarge=length>10&&charIndexBuggy,symbols;if(isLarge){symbols=value.split("")}for(;index-1/0&&value<1/0){if(getDay){date=floor(value/864e5);for(year=floor(date/365.2425)+1970-1;getDay(year+1,0)<=date;year++);for(month=floor((date-getDay(year,0))/30.42);getDay(year,month+1)<=date;month++);date=1+date-getDay(year,month);time=(value%864e5+864e5)%864e5;hours=floor(time/36e5)%24;minutes=floor(time/6e4)%60;seconds=floor(time/1e3)%60;milliseconds=time%1e3}else{year=value.getUTCFullYear();month=value.getUTCMonth();date=value.getUTCDate();hours=value.getUTCHours();minutes=value.getUTCMinutes();seconds=value.getUTCSeconds();milliseconds=value.getUTCMilliseconds()}value=(year<=0||year>=1e4?(year<0?"-":"+")+toPaddedString(6,year<0?-year:year):toPaddedString(4,year))+"-"+toPaddedString(2,month+1)+"-"+toPaddedString(2,date)+"T"+toPaddedString(2,hours)+":"+toPaddedString(2,minutes)+":"+toPaddedString(2,seconds)+"."+toPaddedString(3,milliseconds)+"Z"}else{value=null}}else if(typeof value.toJSON=="function"&&(className!=numberClass&&className!=stringClass&&className!=arrayClass||isProperty.call(value,"toJSON"))){value=value.toJSON(property)}}if(callback){value=callback.call(object,property,value)}if(value===null){return"null"}className=getClass.call(value);if(className==booleanClass){return""+value}else if(className==numberClass){return value>-1/0&&value<1/0?""+value:"null"}else if(className==stringClass){return quote(""+value)}if(typeof value=="object"){for(length=stack.length;length--;){if(stack[length]===value){throw TypeError()}}stack.push(value);results=[];prefix=indentation;indentation+=whitespace;if(className==arrayClass){for(index=0,length=value.length;index0){for(whitespace="",width>10&&(width=10);whitespace.length=48&&charCode<=57||charCode>=97&&charCode<=102||charCode>=65&&charCode<=70)){abort()}}value+=fromCharCode("0x"+source.slice(begin,Index));break;default:abort()}}else{if(charCode==34){break}charCode=source.charCodeAt(Index);begin=Index;while(charCode>=32&&charCode!=92&&charCode!=34){charCode=source.charCodeAt(++Index)}value+=source.slice(begin,Index)}}if(source.charCodeAt(Index)==34){Index++;return value}abort();default:begin=Index;if(charCode==45){isSigned=true;charCode=source.charCodeAt(++Index)}if(charCode>=48&&charCode<=57){if(charCode==48&&(charCode=source.charCodeAt(Index+1),charCode>=48&&charCode<=57)){abort()}isSigned=false;for(;Index=48&&charCode<=57);Index++);if(source.charCodeAt(Index)==46){position=++Index;for(;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}charCode=source.charCodeAt(Index);if(charCode==101||charCode==69){charCode=source.charCodeAt(++Index);if(charCode==43||charCode==45){Index++}for(position=Index;position=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}return+source.slice(begin,Index)}if(isSigned){abort()}if(source.slice(Index,Index+4)=="true"){Index+=4;return true}else if(source.slice(Index,Index+5)=="false"){Index+=5;return false}else if(source.slice(Index,Index+4)=="null"){Index+=4;return null}abort()}}return"$"};var get=function(value){var results,hasMembers;if(value=="$"){abort()}if(typeof value=="string"){if((charIndexBuggy?value.charAt(0):value[0])=="@"){return value.slice(1)}if(value=="["){results=[];for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="]"){break}if(hasMembers){if(value==","){value=lex();if(value=="]"){abort()}}else{abort()}}if(value==","){abort()}results.push(get(value))}return results}else if(value=="{"){results={};for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="}"){break}if(hasMembers){if(value==","){value=lex();if(value=="}"){abort()}}else{abort()}}if(value==","||typeof value!="string"||(charIndexBuggy?value.charAt(0):value[0])!="@"||lex()!=":"){abort()}results[value.slice(1)]=get(lex())}return results}abort()}return value};var update=function(source,property,callback){var element=walk(source,property,callback);if(element===undef){delete source[property]}else{source[property]=element}};var walk=function(source,property,callback){var value=source[property],length;if(typeof value=="object"&&value){if(getClass.call(value)==arrayClass){for(length=value.length;length--;){update(value,length,callback)}}else{forEach(value,function(property){update(value,property,callback)})}}return callback.call(source,property,value)};JSON3.parse=function(source,callback){var result,value;Index=0;Source=""+source;result=get(lex());if(lex()!="$"){abort()}Index=Source=null;return callback&&getClass.call(callback)==functionClass?walk((value={},value[""]=result,value),"",callback):result}}}if(isLoader){define(function(){return JSON3})}})(this)},{}],47:[function(_dereq_,module,exports){module.exports=toArray;function toArray(list,index){var array=[];index=index||0;for(var i=index||0;i -1) { - res.writeHead(200, {"Content-Type": "text/javascript"}); - res.write(scripts); - res.end(); - return next(true); - } else { - return next(false); - } - }; - }, - /** - * @param {Object} req - * @param {Array} [excludeList] - * @returns {Object} - */ - isOldIe: function (req, excludeList) { - var ua = req.headers["user-agent"]; - var match = /MSIE (\d)\.\d/.exec(ua); - if (match) { - if (parseInt(match[1], 10) < 9) { - if (!utils.isExcluded(req.url, excludeList)) { - req.headers["accept"] = "text/html"; - } - } - } - return req; - }, - getNoConflictJs: function () { - return "window.___browserSync___oldSocketIo = window.io;"; - }, - /** - * @param {Number} port - * @param {BrowserSync.options} options - * @returns {String} - */ - getClientJs: function (port, options) { - var socket = utils.getSocketScript(); - return utils.getNoConflictJs() + socket + ";" + messages.socketConnector(port, options); - }, - /** - * @returns {String} - */ - getSocketScript: function () { - return fs.readFileSync(path.resolve(__dirname + config.socketIoScript), "utf-8"); - } -}; -module.exports.utils = utils; diff --git a/node_modules/browser-sync/lib/sockets.js b/node_modules/browser-sync/lib/sockets.js deleted file mode 100644 index ca2be01..0000000 --- a/node_modules/browser-sync/lib/sockets.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; - -var socket = require("socket.io"); -var Steward = require("emitter-steward"); - -/** - * Plugin interface - * @returns {*|function(this:exports)} - */ -module.exports.plugin = function (server, clientEvents, bs) { - return exports.init(server, clientEvents, bs); -}; - -/** - * @param {http.Server} server - * @param clientEvents - * @param {BrowserSync} bs - */ -module.exports.init = function (server, clientEvents, bs) { - - var emitter = bs.events; - - var io = socket.listen(server, {log: false, path: bs.getOption("socket.path")}); - - // Override default namespace. - io.sockets = io.of(bs.getOption("socket.namespace", "/browser-sync")); - - var steward = new Steward(emitter); - - /** - * Listen for new connections - */ - io.sockets.on("connection", handleConnection); - - /** - * Handle each new connection - * @param {Object} client - */ - function handleConnection (client) { - - // set ghostmode callbacks - if (bs.getOption("ghostMode")) { - - addGhostMode(client); - } - - client.emit("connection", bs.getOptions()); - - emitter.emit("client:connected", { - ua: client.handshake.headers["user-agent"] - }); - } - - /** - * @param {string} event - * @param {Socket.client} client - * @param {Object} data - */ - function handleClientEvent(event, client, data) { - - if (steward.valid(client.id)) { - - client.broadcast.emit(event, data); - } - } - - /** - * @param client - */ - function addGhostMode (client) { - - clientEvents.forEach(addEvent); - - function addEvent(event) { - - client.on(event, handleClientEvent.bind(null, event, client)); - } - } - - return io; -}; diff --git a/node_modules/browser-sync/lib/templates/connector.tmpl b/node_modules/browser-sync/lib/templates/connector.tmpl deleted file mode 100644 index 1231af4..0000000 --- a/node_modules/browser-sync/lib/templates/connector.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -window.___browserSync___ = {}; -___browserSync___.io = window.io; -window.io = window.___browserSync___oldSocketIo; -window.___browserSync___oldSocketIo=undefined; -___browserSync___.socketConfig = {}; ___browserSync___.socketConfig.path = '%path%'; -___browserSync___.socket = ___browserSync___.io(%url%, ___browserSync___.socketConfig); \ No newline at end of file diff --git a/node_modules/browser-sync/lib/templates/script-tags.tmpl b/node_modules/browser-sync/lib/templates/script-tags.tmpl deleted file mode 100644 index a0f0335..0000000 --- a/node_modules/browser-sync/lib/templates/script-tags.tmpl +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/node_modules/browser-sync/lib/tunnel.js b/node_modules/browser-sync/lib/tunnel.js deleted file mode 100644 index 6b3e662..0000000 --- a/node_modules/browser-sync/lib/tunnel.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -var _ = require("lodash"); - -/** - * @param {BrowserSync} bs - * @param {Function} tunnelRunner - * @param {Function} cb - */ -module.exports.plugin = function (bs, tunnelRunner, cb) { - - var opts = {}; - var options = bs.options; - var port = bs.options.port; - //var debug = bs.debug; - - if (_.isString(options.tunnel)) { - opts.subdomain = options.tunnel; - } - - //debug("Trying tunnel connection with: %s ", options.tunnel || "no subdomain specified"); - - tunnelRunner(port, opts, function (err, tunnel) { - if (err) { - throw err; - } - cb(tunnel.url, true); - }); - -}; diff --git a/node_modules/browser-sync/lib/utils.js b/node_modules/browser-sync/lib/utils.js deleted file mode 100644 index 6b006cd..0000000 --- a/node_modules/browser-sync/lib/utils.js +++ /dev/null @@ -1,271 +0,0 @@ -"use strict"; - -var devIp = require("dev-ip"); -var open = require("opn"); -var filePath = require("path"); -var portScanner = require("portscanner-plus"); -var _ = require("lodash"); -var UAParser = require("ua-parser-js"); - -var parser = new UAParser(); - -var utils = { - /** - * @param {Object} options - * @returns {String|boolean} - the IP address - */ - getHostIp: function (options) { - - var returnValue = devIp.getIp(null); - - if (options) { - if (options.host && options.host !== "localhost") { - return options.host; - } - if (options.detect === false || !devIp) { - return false; - } - } - - if (Array.isArray(returnValue)) { - returnValue = returnValue[0]; - } - - return returnValue || false; - }, - /** - * Take the path provided in options & transform into CWD for serving files - * @param {String} [baseDir] - * @returns {String} - */ - getBaseDir: function (baseDir) { - - if (Array.isArray(baseDir)) { - return baseDir; - } - - var suffix = ""; - var validRoots = ["./", "/", "."]; - - if (!baseDir || _.contains(validRoots, baseDir)) { - return process.cwd(); - } - - if (baseDir.charAt(0) === "/") { - suffix = baseDir; - } else { - if (/^.\//.test(baseDir)) { - suffix = baseDir.replace(".", ""); - } else { - suffix = "/" + baseDir; - } - } - - return process.cwd() + suffix; - }, - /** - * Set URL Options - */ - setUrlOptions: function (port, options) { - - var urls = {}; - var scheme = (options.https && !options.proxy && !options.tunnel) ? "https" : "http"; - - if (!options.online) { - urls.local = utils.getUrl(scheme + "://localhost:" + port, options); - return urls; - } - - var external = utils.xip(utils.getHostIp(options), options); - - var localhost = "localhost"; - - if (options.xip) { - localhost = "127.0.0.1"; - } - - var local = utils.xip(localhost, options); - - options.external = options.host = external; - - return utils.getUrls(external, local, scheme, port, options); - }, - /** - * Append a start path if given in options - * @param {String} url - * @param {Object} options - * @returns {String} - */ - getUrl: function (url, options) { - - var prefix = "/"; - var startPath = options.startPath; - - if (options.proxy && options.proxy.startPath) { - startPath = options.proxy.startPath; - } - - if (startPath) { - if (startPath.charAt(0) === "/") { - prefix = ""; - } - url = url + prefix + startPath; - } - - return url; - }, - /** - * @param {String} external - * @param {String} local - * @param {String} scheme - * @param {number|string} port - * @param {Object} options - * @returns {{local: string, external: string}} - */ - getUrls: function (external, local, scheme, port, options) { - - var urls = { - local: utils.getUrl(utils._makeUrl(scheme, local, port), options) - }; - - if (external !== local) { - urls.external = utils.getUrl(utils._makeUrl(scheme, external, port), options); - } - - return urls; - }, - /** - * @param {String} scheme - * @param {String} host - * @param {Number} port - * @returns {String} - * @private - */ - _makeUrl: function (scheme, host, port) { - return scheme + "://" + host + ":" + port; - }, - /** - * Get ports - * @param {Object} options - * @returns {Q.promise} - */ - getPorts: function (options) { - - var port = options.port; - var ports = options.ports; // backwards compatibility - var max; - - if (ports) { - port = ports.min; - max = ports.max; - } - - return portScanner.getPorts(1, port, max); - }, - /** - * @param {String} ua - * @returns {Object} - */ - getUaString: function (ua) { - return parser.setUA(ua).getBrowser(); - }, - /** - * @param {String} filepath - * @param {String} cwd - * @returns {String} - */ - resolveRelativeFilePath: function (filepath, cwd) { - return filepath.replace(cwd + "/", ""); - }, - /** - * @param {String} path - * @returns {String} - */ - getFileExtension: function (path) { - return filePath.extname(path).replace(".", ""); - }, - /** - * Open the page in browser - * @param {String} url - * @param {Object} options - */ - openBrowser: function (url, options) { - - if (_.isString(options.open)) { - if (options.urls[options.open]) { - url = options.urls[options.open]; - } - } - - if (options.open) { - - if (options.browser !== "default") { - if (Array.isArray(options.browser)) { - options.browser.forEach(function (browser) { - utils.open(url, browser); - }); - } else { - utils.open(url, options.browser); // single - } - } else { - utils.open(url); - } - } - }, - /** - * Wrapper for open module - for easier stubbin' - * @param url - * @param name - */ - open: function (url, name) { - open(url, name || null); - }, - /** - * @param {Boolean} kill - * @param err - * @param cb - */ - fail: function (kill, err, cb) { - if (kill) { - if (cb && _.isFunction(cb)) { - cb(err); - } - process.exit(1); - } - }, - /** - * Add support for xip.io urls - * @param {String} host - * @param {Object} options - * @returns {String} - */ - xip: function (host, options) { - if (options.xip) { - return host + ".xip.io"; - } - if (options.hostnameSuffix) { - return host + options.hostnameSuffix; - } - return host; - }, - /** - * @param {String} string - * @returns {string} - */ - ucfirst: function (string) { - return string.charAt(0).toUpperCase() + string.slice(1); - }, - /** - * Determine if an array of file paths will cause a full page reload. - * @param {Array} needles - filepath such as ["core.css", "index.html"] - * @param {Array} haystack - * @returns {Boolean} - */ - willCauseReload: function (needles, haystack) { - return needles.some(function (needle) { - return !_.contains(haystack, filePath.extname(needle).replace(".", "")); - }); - } -}; - -module.exports = utils; diff --git a/node_modules/browser-sync/node_modules/.bin/dev-ip b/node_modules/browser-sync/node_modules/.bin/dev-ip deleted file mode 120000 index 138e5ac..0000000 --- a/node_modules/browser-sync/node_modules/.bin/dev-ip +++ /dev/null @@ -1 +0,0 @@ -../dev-ip/lib/dev-ip.js \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/.bin/lt b/node_modules/browser-sync/node_modules/.bin/lt deleted file mode 120000 index f79fff9..0000000 --- a/node_modules/browser-sync/node_modules/.bin/lt +++ /dev/null @@ -1 +0,0 @@ -../localtunnel/bin/client \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/.bin/opn b/node_modules/browser-sync/node_modules/.bin/opn deleted file mode 120000 index 6ac0ab7..0000000 --- a/node_modules/browser-sync/node_modules/.bin/opn +++ /dev/null @@ -1 +0,0 @@ -../opn/cli.js \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/.name b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/.name deleted file mode 100644 index e4edeaa..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -browser-sync-client \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/browser-sync-client.iml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/browser-sync-client.iml deleted file mode 100644 index 00dffed..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/browser-sync-client.iml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/dictionaries/shakyshane.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/dictionaries/shakyshane.xml deleted file mode 100644 index f81915d..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/dictionaries/shakyshane.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - browserify - fucntion - minified - minify - - - \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/encodings.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/encodings.xml deleted file mode 100644 index e206d70..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/encodings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/inspectionProfiles/Project_Default.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 731facf..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/inspectionProfiles/profiles_settings.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 3b31283..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/jsLibraryMappings.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/jsLibraryMappings.xml deleted file mode 100644 index 0a1be63..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/libraries/browser_sync_client_node_modules.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/libraries/browser_sync_client_node_modules.xml deleted file mode 100644 index d348e4c..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/libraries/browser_sync_client_node_modules.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/misc.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/misc.xml deleted file mode 100644 index 1162f43..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/misc.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/modules.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/modules.xml deleted file mode 100644 index 52420b7..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/scopes/scope_settings.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/vcs.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/vcs.xml deleted file mode 100644 index 9d32e50..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/vcs.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/workspace.xml b/node_modules/browser-sync/node_modules/browser-sync-client/.idea/workspace.xml deleted file mode 100644 index daa0936..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.idea/workspace.xml +++ /dev/null @@ -1,1362 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - $PROJECT_DIR$/gulpfile.js - - - - - $PROJECT_DIR$/node_modules/karma - - - $PROJECT_DIR$/node_modules/mocha - - - - - - - - - - - - - Cucumber - - - PHP - - - Probably bugPHP - - - Type compatibilityPHP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $PROJECT_DIR$ - true - - BDD - - - false - - - - - - - - - - - - true - - - - - - - - - - - - - - - - $PROJECT_DIR$ - true - - BDD - - $PROJECT_DIR$/test/middleware - false - - - - - - - - - $PROJECT_DIR$ - true - - BDD - - $PROJECT_DIR$/test/middleware - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1393536849511 - - - 1393539332416 - - - 1393539401284 - - - 1393539966201 - - - 1393539990883 - - - 1393540051064 - - - 1393611157598 - - - 1393611459036 - - - 1393611603316 - - - 1393611900400 - - - 1394389735725 - - - 1395183828532 - - - 1396212780882 - - - 1396213148425 - - - 1396213350494 - - - 1396213448438 - - - 1396213701514 - - - 1396213952342 - - - 1396214952848 - - - 1396219281983 - - - 1396219309689 - - - 1396246522325 - - - 1396246641287 - - - 1396246649989 - - - 1396249789491 - - - 1396301286213 - - - 1396511224202 - - - 1396513592104 - - - 1396546010089 - - - 1396548514339 - - - 1396695297575 - - - 1396743760381 - - - 1396743886380 - - - 1396743968209 - - - 1396744173827 - - - 1396790426135 - - - 1396800452476 - - - 1396800550694 - - - 1396805093484 - - - 1396805131716 - - - 1396808699502 - - - 1396809421471 - - - 1396811775748 - - - 1396813954564 - - - 1396986371568 - - - 1396990206865 - - - 1397201674416 - - - 1397248768962 - - - 1397316173407 - - - 1397319908610 - - - 1397320414692 - - - 1397322980240 - - - 1397323243835 - - - 1397332448425 - - - 1397337198148 - - - 1397412347718 - - - 1397413594277 - - - 1397413615221 - - - 1397413688727 - - - 1397414383119 - - - 1397421709186 - - - 1397460427560 - - - 1397460469669 - - - 1397460568252 - - - 1397460652659 - - - 1397460877107 - - - 1397460906512 - - - 1397461017362 - - - 1397461033480 - - - 1397461151217 - - - 1397506819203 - - - 1397506908059 - - - 1397509494831 - - - 1397752345848 - - - 1397752628464 - - - 1398023056692 - - - 1398202211888 - - - 1400445197304 - - - 1402859830629 - - - 1402863215466 - - - 1403115183289 - - - 1403981616587 - - - 1404846240535 - - - 1405375207663 - - - 1412596885856 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.npmignore b/node_modules/browser-sync/node_modules/browser-sync-client/.npmignore deleted file mode 100644 index b59f7e3..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test/ \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/.travis.yml b/node_modules/browser-sync/node_modules/browser-sync-client/.travis.yml deleted file mode 100644 index 1c6de88..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - '0.10' -before_script: - - "npm install -g gulp" - - "export DISPLAY=:99.0" - - "sh -e /etc/init.d/xvfb start" diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/LICENSE-MIT b/node_modules/browser-sync/node_modules/browser-sync-client/LICENSE-MIT deleted file mode 100644 index 49491e1..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 Shane Osbourne - -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 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/node_modules/browser-sync/node_modules/browser-sync-client/README.md b/node_modules/browser-sync/node_modules/browser-sync-client/README.md deleted file mode 100644 index 028f9cd..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# browser-sync-client [![Build Status](https://travis-ci.org/shakyShane/browser-sync-client.png?branch=master)](https://travis-ci.org/shakyShane/browser-sync-client) - -Client-side script for BrowserSync - -## Contributors - -``` - 68 Shane Osbourne - 1 Hugo Dias - 1 Sergey Slipchenko -``` - -## License -Copyright (c) 2014 Shane Osbourne -Licensed under the MIT license. diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/dist/.gitkeep b/node_modules/browser-sync/node_modules/browser-sync-client/dist/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/dist/index.js b/node_modules/browser-sync/node_modules/browser-sync-client/dist/index.js deleted file mode 100644 index 9942e62..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/dist/index.js +++ /dev/null @@ -1,1510 +0,0 @@ -(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;on;n++){if(!t||"object"!=typeof t)return!1;t=t[o[n]]}return"undefined"==typeof t?!1:t}var i=t("./socket"),r=t("./emitter"),s=(t("./notify"),t("./browser.utils")),c=function(t){this.options=t,this.socket=i,this.emitter=r,this.utils=s.utils;var e=this;i.on("options:set",function(t){r.emit("notify","Setting options..."),e.options=t.options})};c.prototype.canSync=function(t,e){t=t||{};var n=!0;return e&&(n=this.getOption(e)),n&&t.url===window.location.pathname},c.prototype.getOption=function(t){if(t&&t.match(/\./))return o(this.options,t);var e=this.options[t];return n(e)?!1:e},e.exports=c},{"./browser.utils":2,"./emitter":5,"./notify":16,"./socket":17}],2:[function(t,e,n){"use strict";n.getWindow=function(){return window},n.getDocument=function(){return document},n.utils={getBrowserScrollPosition:function(){var t,e,o=n.getWindow(),i=n.getDocument(),r=i.documentElement,s=i.body;return void 0!==o.pageYOffset?(t=o.pageXOffset,e=o.pageYOffset):(t=r.scrollLeft||s.scrollLeft||0,e=r.scrollTop||s.scrollTop||0),{x:t,y:e}},getScrollSpace:function(){var t=n.getDocument(),e=t.documentElement,o=t.body;return{x:o.scrollHeight-e.clientWidth,y:o.scrollHeight-e.clientHeight}},saveScrollPosition:function(){var t=n.utils.getBrowserScrollPosition();t=[t.x,t.y],document.cookie="bs_scroll_pos="+t.join(",")},restoreScrollPosition:function(){var t=document.cookie.replace(/(?:(?:^|.*;\s*)bs_scroll_pos\s*\=\s*([^;]*).*$)|^.*$/,"$1").split(",");window.scrollTo(t[0],t[1])},getElementIndex:function(t,e){var n=document.getElementsByTagName(t);return Array.prototype.indexOf.call(n,e)},forceChange:function(t){t.blur(),t.focus()},getElementData:function(t){var e=t.tagName,o=n.utils.getElementIndex(e,t);return{tagName:e,index:o}},getSingleElement:function(t,e){var n=document.getElementsByTagName(t);return n[e]},getBody:function(){return document.getElementsByTagName("body")[0]},reloadBrowser:function(){n.getWindow().location.reload(!0)},getWindow:n.getWindow,getDocument:n.getDocument,isOldIe:function(){return"undefined"!=typeof window.attachEvent}}},{}],3:[function(){"indexOf"in Array.prototype||(Array.prototype.indexOf=function(t,e){void 0===e&&(e=0),0>e&&(e+=this.length),0>e&&(e=0);for(var n=this.length;n>e;e+=1)if(e in this&&this[e]===t)return e;return-1})},{}],4:[function(t,e,n){"use strict";var o,i=t("./events"),r=t("./browser.utils").utils,s={tagNames:{css:"link",jpg:"img",jpeg:"img",png:"img",svg:"img",gif:"img",js:"script"},attrs:{link:"href",img:"src",script:"src"}},c="codeSync",a=function(){return window.location.pathname};n.init=function(t){n.saveScroll(r.getWindow(),r.getDocument()),t.socket.on("file:reload",n.reload(t)),t.socket.on("browser:reload",function(){t.canSync({url:a()},c)&&n.reloadBrowser(!0)})},n.saveScroll=function(t,e){r.isOldIe()&&("complete"===e.readyState?r.restoreScrollPosition():i.manager.addEvent(e,"readystatechange",function(){"complete"===e.readyState&&r.restoreScrollPosition()}),i.manager.addEvent(window,"beforeunload",r.saveScrollPosition))},n.swapFile=function(t,e,n){var i=t[e],r=(new Date).getTime(),s="?rel="+r,c=/^[^\?]+(?=\?)/.exec(i);c&&(i=c[0]),n&&(n.timestamps||(s="")),t[e]=i+s;var a=document.body;return setTimeout(function(){o?(o.style.display="none",o.style.display="block"):(o=document.createElement("DIV"),a.appendChild(o))},200),{elem:t,timeStamp:r}},n.reload=function(t){return function(e){if(t.canSync({url:a()},c)){var o,i=t.options,r=t.emitter;if((e.url||!i.injectChanges)&&n.reloadBrowser(!0),e.assetFileName&&e.fileExtension){var s=n.getElems(e.fileExtension),u=n.getMatches(s.elems,e.assetFileName,s.attr);u.length&&i.notify&&r.emit("notify",{message:"Injected: "+e.assetFileName});for(var l=0,f=u.length;f>l;l+=1)o=n.swapFile(u[l],s.attr,i)}return o}}},n.getTagName=function(t){return s.tagNames[t]},n.getAttr=function(t){return s.attrs[t]},n.getMatches=function(t,e,n){for(var o=[],i=0,r=t.length;r>i;i+=1)-1!==t[i][n].indexOf(e)&&o.push(t[i]);return o},n.getElems=function(t){var e=n.getTagName(t),o=n.getAttr(e);return{elems:document.getElementsByTagName(e),attr:o}},n.getWindow=function(){return window},n.reloadBrowser=function(t){var e=n.getWindow();t&&e.location.reload(!0)}},{"./browser.utils":2,"./events":6}],5:[function(t,e,n){"use strict";n.events={},n.emit=function(t,e){var o,i=n.events[t];if(i&&i.listeners){o=i.listeners;for(var r=0,s=o.length;s>r;r+=1)o[r](e)}},n.on=function(t,e){var o=n.events;o[t]?o[t].listeners.push(e):o[t]={listeners:[e]}}},{}],6:[function(t,e,n){n._ElementCache=function(){var t={},e=1,n="data"+(new Date).getTime();this.getData=function(o){var i=o[n];return i||(i=o[n]=e++,t[i]={}),t[i]},this.removeData=function(e){var o=e[n];if(o){delete t[o];try{delete e[n]}catch(i){e.removeAttribute&&e.removeAttribute(n)}}}},n._fixEvent=function(t){function e(){return!0}function n(){return!1}if(!t||!t.stopPropagation){var o=t||window.event;t={};for(var i in o)t[i]=o[i];if(t.target||(t.target=t.srcElement||document),t.relatedTarget=t.fromElement===t.target?t.toElement:t.fromElement,t.preventDefault=function(){t.returnValue=!1,t.isDefaultPrevented=e},t.isDefaultPrevented=n,t.stopPropagation=function(){t.cancelBubble=!0,t.isPropagationStopped=e},t.isPropagationStopped=n,t.stopImmediatePropagation=function(){this.isImmediatePropagationStopped=e,this.stopPropagation()},t.isImmediatePropagationStopped=n,null!=t.clientX){var r=document.documentElement,s=document.body;t.pageX=t.clientX+(r&&r.scrollLeft||s&&s.scrollLeft||0)-(r&&r.clientLeft||s&&s.clientLeft||0),t.pageY=t.clientY+(r&&r.scrollTop||s&&s.scrollTop||0)-(r&&r.clientTop||s&&s.clientTop||0)}t.which=t.charCode||t.keyCode,null!=t.button&&(t.button=1&t.button?0:4&t.button?1:2&t.button?2:0)}return t},n._EventManager=function(t){function e(e,n){function o(t){for(var e in t)return!1;return!0}var i=t.getData(e);0===i.handlers[n].length&&(delete i.handlers[n],document.removeEventListener?e.removeEventListener(n,i.dispatcher,!1):document.detachEvent&&e.detachEvent("on"+n,i.dispatcher)),o(i.handlers)&&(delete i.handlers,delete i.dispatcher),o(i)&&t.removeData(e)}var o=1;this.addEvent=function(e,i,r){var s=t.getData(e);s.handlers||(s.handlers={}),s.handlers[i]||(s.handlers[i]=[]),r.guid||(r.guid=o++),s.handlers[i].push(r),s.dispatcher||(s.disabled=!1,s.dispatcher=function(t){if(!s.disabled){t=n._fixEvent(t);var o=s.handlers[t.type];if(o)for(var i=0;io;o+=1)t.addEvent(n[o],"change",e)}var o=document.getElementsByTagName("select"),i=document.getElementsByTagName("input");n(o),n(i)},n.browserEvent=function(t){return function(e){if(n.canEmitEvents){var i,r=e.target||e.srcElement;("radio"===r.type||"checkbox"===r.type||"SELECT"===r.tagName)&&(i=t.utils.getElementData(r),i.type=r.type,i.value=r.value,i.checked=r.checked,t.socket.emit(o,i))}else n.canEmitEvents=!0}},n.socketEvent=function(t){return function(e){if(t.canSync(e,i)){n.canEmitEvents=!1;var o=t.utils.getSingleElement(e.tagName,e.index);return o?("radio"===e.type&&(o.checked=!0),"checkbox"===e.type&&(o.checked=e.checked),"SELECT"===e.tagName&&(o.value=e.value),o):!1}return!1}}},{}],13:[function(t,e,n){"use strict";var o=t("./events").manager;n.plugins={scroll:t("./ghostmode.scroll"),clicks:t("./ghostmode.clicks"),forms:t("./ghostmode.forms"),location:t("./ghostmode.location")},n.init=function(t){for(var e in n.plugins)n.plugins[e].init(t,o)}},{"./events":6,"./ghostmode.clicks":8,"./ghostmode.forms":10,"./ghostmode.location":14,"./ghostmode.scroll":15}],14:[function(t,e,n){"use strict";var o="browser:location",i="ghostMode.location";n.canEmitEvents=!0,n.init=function(t){t.socket.on(o,n.socketEvent())},n.socketEvent=function(t){return function(e){(e.override||t.canSync(e,i))&&(e.path?n.setPath(e.path):n.setUrl(e.url))}},n.setUrl=function(t){window.location=t},n.setPath=function(t){window.location.pathname=t}},{}],15:[function(t,e,n){"use strict";var o,i="scroll",r="ghostMode.scroll";n.canEmitEvents=!0,n.init=function(t,e){o=t.utils,e.addEvent(window,i,n.browserEvent(t)),t.socket.on(i,n.socketEvent(t))},n.socketEvent=function(t){return function(e){var i=o.getScrollSpace();return n.canEmitEvents=!1,t.canSync(e,r)?t.options&&t.options.scrollProportionally?window.scrollTo(0,i.y*e.position.proportional):window.scrollTo(0,e.position.raw):!1}},n.browserEvent=function(t){return function(){var e=n.canEmitEvents;e&&t.socket.emit(i,{position:n.getScrollPosition()}),n.canEmitEvents=!0}},n.getScrollPosition=function(){var t=o.getBrowserScrollPosition();return{raw:t,proportional:n.getScrollTopPercentage(t)}},n.getScrollPercentage=function(t,e){var n=e.x/t.x,o=e.y/t.y;return{x:n||0,y:o}},n.getScrollTopPercentage=function(t){var e=o.getScrollSpace(),i=n.getScrollPercentage(e,t);return i.y}},{}],16:[function(t,e,n){"use strict";var o,i,r,s,c=(t("./ghostmode.scroll"),["display: none","padding: 15px","font-family: sans-serif","position: fixed","font-size: 0.9em","z-index: 9999","right: 0px","top: 0px","border-bottom-left-radius: 5px","background-color: #1B2032","margin: 0","color: white","text-align: center"]);n.init=function(t){o=t,r=t.options;var e=c;r.notify.styles&&(e=r.notify.styles),i=document.createElement("DIV"),i.id="__bs_notify__",i.style.cssText=e.join(";"),document.getElementsByTagName("body")[0].appendChild(i);var s=n.watchEvent();return o.emitter.on("notify",s),o.socket.on("browser:notify",s),i},n.watchEvent=function(){return function(t){return"string"==typeof t?n.flash(t):void n.flash(t.message,t.timeout)}},n.getElem=function(){return i},n.getScrollTop=function(){return o.utils.getBrowserScrollPosition().y},n.flash=function(t,e){var o=n.getElem();return o?(o.innerHTML=t,o.style.display="block",s&&(clearTimeout(s),s=void 0),s=window.setTimeout(function(){o.style.display="none"},e||2e3),o):!1}},{"./ghostmode.scroll":15}],17:[function(t,e,n){"use strict";var o=window.___browserSync___||{};n.socket=o.socket||{emit:function(){},on:function(){}},n.getPath=function(){return window.location.pathname},n.emit=function(t,e){var o=n.socket;o&&o.emit&&(e.url=n.getPath(),o.emit(t,e))},n.on=function(t,e){n.socket.on(t,e)}},{}]},{},[7]); \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/example.js b/node_modules/browser-sync/node_modules/browser-sync-client/example.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/gulpfile.js b/node_modules/browser-sync/node_modules/browser-sync-client/gulpfile.js deleted file mode 100644 index 4fefe32..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/gulpfile.js +++ /dev/null @@ -1,89 +0,0 @@ -var gulp = require("gulp"); -var karma = require('gulp-karma'); -var jshint = require('gulp-jshint'); -var uglify = require('gulp-uglify'); -var contribs = require('gulp-contribs'); -var browserify = require('gulp-browserify'); -var through2 = require('through2'); -var rename = require('gulp-rename'); - -var testFiles = [ - 'test/todo.js' -]; - -gulp.task('test', function() { - // Be sure to return the stream - return gulp.src(testFiles) - .pipe(karma({ - configFile: 'test/karma.conf.ci.js', - action: 'run' - })); -}); - -gulp.task('test:watch', function() { - gulp.src(testFiles) - .pipe(karma({ - configFile: 'test/karma.conf.js', - action: 'watch' - })); -}); - -gulp.task('lint-test', function () { - gulp.src(['test/client-new/*.js', 'test/middleware/*.js']) - .pipe(jshint('test/.jshintrc')) - .pipe(jshint.reporter("default")) - .pipe(jshint.reporter("fail")) -}); - -gulp.task('lint-lib', function () { - return gulp.src(['lib/*', '!lib/browser-sync-client.js', '!lib/events.js']) - .pipe(jshint('lib/.jshintrc')) - .pipe(jshint.reporter("default")) - .pipe(jshint.reporter("fail")) -}); - -gulp.task('contribs', function () { - gulp.src('README.md') - .pipe(contribs()) - .pipe(gulp.dest("./")) -}); - -/** - * Strip debug statements - * @returns {*} - */ -var stripDebug = function () { - return through2.obj(function (file, enc, cb) { - var string = file.contents.toString(); - var regex = /\/\*\*debug:start\*\*\/[\s\S]*\/\*\*debug:end\*\*\//g; - var stripped = string.replace(regex, ""); - file.contents = new Buffer(stripped); - this.push(file); - cb(); - }); -}; - -// Basic usage -gulp.task('build-dist', function() { - // Single entry point to browserify - gulp.src('lib/index.js') - .pipe(browserify()) - .pipe(gulp.dest('./dist')) - .pipe(stripDebug()) - .pipe(uglify()) - .pipe(rename("index.min.js")) - .pipe(gulp.dest('./dist')); -}); - -gulp.task('build-dev', function() { - // Single entry point to browserify - gulp.src('lib/index.js') - .pipe(browserify()) - .pipe(gulp.dest('./dist')) -}); - -gulp.task("dev", ['build-dist'], function () { - gulp.watch(["lib/*.js", "test/client-new/**/*.js"], ['build-dist']); -}); - -gulp.task('default', ["lint-lib", "lint-test", "build-dist", "test"]); diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/index.js b/node_modules/browser-sync/node_modules/browser-sync-client/index.js deleted file mode 100644 index 4f6ca4e..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/index.js +++ /dev/null @@ -1,30 +0,0 @@ -"use strict"; - -var fs = require("fs"); -var path = require("path"); - -var script = path.resolve(__dirname + "/dist/index.min.js"); - -function init(options, connector, type) { - - var result; - - if (options && options.minify) { - result = fs.readFileSync(script); - } else { - script = path.resolve(__dirname + "/dist/index.js"); - result = fs.readFileSync(script); - } - - if (type && type === "file") { - return connector + result; - } - - return function (req, res) { - res.setHeader("Content-Type", "text/javascript"); - res.end(connector + result); - }; -} - -module.exports.middleware = init; -module.exports.plugin = init; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/.jshintrc b/node_modules/browser-sync/node_modules/browser-sync-client/lib/.jshintrc deleted file mode 100644 index ebfcc97..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/.jshintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "curly": true, - "eqeqeq": true, - "immed": true, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "sub": true, - "undef": false, - "unused": false, - "quotmark": "double", - "boss": true, - "eqnull": true, - "node": true, - "globals": { - "window" : false, - "document" : false - } -} diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/browser-sync.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/browser-sync.js deleted file mode 100644 index 270e38d..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/browser-sync.js +++ /dev/null @@ -1,102 +0,0 @@ -"use strict"; - -var socket = require("./socket"); -var emitter = require("./emitter"); -var notify = require("./notify"); -var utils = require("./browser.utils"); - -/** - * @constructor - */ -var BrowserSync = function (options) { - - this.options = options; - this.socket = socket; - this.emitter = emitter; - this.utils = utils.utils; - - var _this = this; - - /** - * Options set - */ - socket.on("options:set", function (data) { - emitter.emit("notify", "Setting options..."); - _this.options = data.options; - }); -}; - -/** - * Helper to check if syncing is allowed - * @param data - * @param optPath - * @returns {boolean} - */ -BrowserSync.prototype.canSync = function (data, optPath) { - - data = data || {}; - - var canSync = true; - - if (optPath) { - canSync = this.getOption(optPath); - } - - return canSync && data.url === window.location.pathname; -}; - -/** - * Helper to check if syncing is allowed - * @returns {boolean} - */ -BrowserSync.prototype.getOption = function (path) { - - if (path && path.match(/\./)) { - - return getByPath(this.options, path); - - } else { - - var opt = this.options[path]; - - if (isUndefined(opt)) { - return false; - } else { - return opt; - } - } -}; - -/** - * @type {Function} - */ -module.exports = BrowserSync; - -/** - * @param {String} val - * @returns {boolean} - */ -function isUndefined(val) { - - return "undefined" === typeof val; -} - -/** - * @param obj - * @param path - */ -function getByPath(obj, path) { - - for(var i = 0, tempPath = path.split("."), len = tempPath.length; i < len; i++){ - if(!obj || typeof obj !== "object") { - return false; - } - obj = obj[tempPath[i]]; - } - - if(typeof obj === "undefined") { - return false; - } - - return obj; -} \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/browser.utils.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/browser.utils.js deleted file mode 100644 index 9c51b7c..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/browser.utils.js +++ /dev/null @@ -1,132 +0,0 @@ -"use strict"; - -/** - * @returns {window} - */ -exports.getWindow = function () { - return window; -}; - -/** - * - * @returns {HTMLDocument} - */ -exports.getDocument = function () { - return document; -}; - -/** - * @type {{getScrollPosition: getScrollPosition, getScrollSpace: getScrollSpace}} - */ -exports.utils = { - /** - * Cross-browser scroll position - * @returns {{x: number, y: number}} - */ - getBrowserScrollPosition: function () { - - var $window = exports.getWindow(); - var $document = exports.getDocument(); - var scrollX; - var scrollY; - var dElement = $document.documentElement; - var dBody = $document.body; - - if ($window.pageYOffset !== undefined) { - scrollX = $window.pageXOffset; - scrollY = $window.pageYOffset; - } else { - scrollX = dElement.scrollLeft || dBody.scrollLeft || 0; - scrollY = dElement.scrollTop || dBody.scrollTop || 0; - } - - return { - x: scrollX, - y: scrollY - }; - }, - /** - * @returns {{x: number, y: number}} - */ - getScrollSpace: function () { - var $document = exports.getDocument(); - var dElement = $document.documentElement; - var dBody = $document.body; - return { - x: dBody.scrollHeight - dElement.clientWidth, - y: dBody.scrollHeight - dElement.clientHeight - }; - }, - /** - * Saves scroll position into cookies - */ - saveScrollPosition: function () { - var pos = exports.utils.getBrowserScrollPosition(); - pos = [pos.x, pos.y]; - document.cookie = "bs_scroll_pos=" + pos.join(","); - }, - /** - * Restores scroll position from cookies - */ - restoreScrollPosition: function () { - var pos = document.cookie.replace(/(?:(?:^|.*;\s*)bs_scroll_pos\s*\=\s*([^;]*).*$)|^.*$/, "$1").split(","); - window.scrollTo(pos[0], pos[1]); - }, - /** - * @param tagName - * @param elem - * @returns {*|number} - */ - getElementIndex: function (tagName, elem) { - var allElems = document.getElementsByTagName(tagName); - return Array.prototype.indexOf.call(allElems, elem); - }, - /** - * Force Change event on radio & checkboxes (IE) - */ - forceChange: function (elem) { - elem.blur(); - elem.focus(); - }, - /** - * @param elem - * @returns {{tagName: (elem.tagName|*), index: *}} - */ - getElementData: function (elem) { - var tagName = elem.tagName; - var index = exports.utils.getElementIndex(tagName, elem); - return { - tagName: tagName, - index: index - }; - }, - /** - * @param {string} tagName - * @param {number} index - */ - getSingleElement: function (tagName, index) { - var elems = document.getElementsByTagName(tagName); - return elems[index]; - }, - /** - * - */ - getBody: function () { - return document.getElementsByTagName("body")[0]; - }, - /** - * - */ - reloadBrowser: function () { - exports.getWindow().location.reload(true); - }, - getWindow: exports.getWindow, - getDocument: exports.getDocument, - /** - * Are we dealing with old IE? - * @returns {boolean} - */ - isOldIe: function () { - return typeof window.attachEvent !== "undefined"; - } -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/client-shims.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/client-shims.js deleted file mode 100644 index c33f016..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/client-shims.js +++ /dev/null @@ -1,20 +0,0 @@ -if (!("indexOf" in Array.prototype)) { - - Array.prototype.indexOf= function(find, i) { - if (i === undefined) { - i = 0; - } - if (i < 0) { - i += this.length; - } - if (i < 0) { - i= 0; - } - for (var n = this.length; i < n; i += 1) { - if (i in this && this[i]===find) { - return i; - } - } - return -1; - }; -} \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/code-sync.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/code-sync.js deleted file mode 100644 index 3ab2519..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/code-sync.js +++ /dev/null @@ -1,218 +0,0 @@ -"use strict"; -var events = require("./events"); -var utils = require("./browser.utils").utils; - -var options = { - - tagNames: { - "css": "link", - "jpg": "img", - "jpeg": "img", - "png": "img", - "svg": "img", - "gif": "img", - "js": "script" - }, - attrs: { - "link": "href", - "img": "src", - "script": "src" - } -}; - -var hiddenElem; -var OPT_PATH = "codeSync"; - -var current = function () { - return window.location.pathname; -}; - -/** - * @param {BrowserSync} bs - */ -exports.init = function (bs) { - exports.saveScroll(utils.getWindow(), utils.getDocument()); - bs.socket.on("file:reload", exports.reload(bs)); - bs.socket.on("browser:reload", function () { - if (bs.canSync({url: current()}, OPT_PATH)) { - exports.reloadBrowser(true); - } - }); -}; - -/** - * Use a cookie-drop to save scroll position of - * @param $window - * @param $document - */ -exports.saveScroll = function ($window, $document) { - - if (!utils.isOldIe()) { - return; - } - - if ($document.readyState === "complete") { - utils.restoreScrollPosition(); - } else { - events.manager.addEvent($document, "readystatechange", function() { - if ($document.readyState === "complete") { - utils.restoreScrollPosition(); - } - }); - } - - events.manager.addEvent(window, "beforeunload", utils.saveScrollPosition); -}; - -/** - * @param elem - * @param attr - * @param options - * @returns {{elem: HTMLElement, timeStamp: number}} - */ -exports.swapFile = function (elem, attr, options) { - - var currentValue = elem[attr]; - var timeStamp = new Date().getTime(); - var suffix = "?rel=" + timeStamp; - - var justUrl = /^[^\?]+(?=\?)/.exec(currentValue); - - if (justUrl) { - currentValue = justUrl[0]; - } - - if (options) { - if (!options.timestamps) { - suffix = ""; - } - } - - elem[attr] = currentValue + suffix; - - - var body = document.body; - - setTimeout(function () { - if (!hiddenElem) { - hiddenElem = document.createElement("DIV"); - body.appendChild(hiddenElem); - } else { - hiddenElem.style.display = "none"; - hiddenElem.style.display = "block"; - } - }, 200); - - - return { - elem: elem, - timeStamp: timeStamp - }; -}; - -/** - * @param {BrowserSync} bs - * @returns {*} - */ -exports.reload = function (bs) { - - /** - * @param data - from socket - */ - return function (data) { - - if (!bs.canSync({url: current()}, OPT_PATH)) { - return; - } - var transformedElem; - var options = bs.options; - var emitter = bs.emitter; - - if (data.url || !options.injectChanges) { - exports.reloadBrowser(true); - } - - if (data.assetFileName && data.fileExtension) { - - var domData = exports.getElems(data.fileExtension); - var elems = exports.getMatches(domData.elems, data.assetFileName, domData.attr); - - if (elems.length && options.notify) { - emitter.emit("notify", {message: "Injected: " + data.assetFileName}); - } - - for (var i = 0, n = elems.length; i < n; i += 1) { - transformedElem = exports.swapFile(elems[i], domData.attr, options); - } - } - - return transformedElem; - }; -}; - -/** - * @param fileExtension - * @returns {*} - */ -exports.getTagName = function (fileExtension) { - return options.tagNames[fileExtension]; -}; - -/** - * @param tagName - * @returns {*} - */ -exports.getAttr = function (tagName) { - return options.attrs[tagName]; -}; - -/** - * @param elems - * @param url - * @param attr - * @returns {Array} - */ -exports.getMatches = function (elems, url, attr) { - - var matches = []; - - for (var i = 0, len = elems.length; i < len; i += 1) { - if (elems[i][attr].indexOf(url) !== -1) { - matches.push(elems[i]); - } - } - - return matches; -}; - -/** - * @param fileExtension - * @returns {{elems: NodeList, attr: *}} - */ -exports.getElems = function(fileExtension) { - - var tagName = exports.getTagName(fileExtension); - var attr = exports.getAttr(tagName); - - return { - elems: document.getElementsByTagName(tagName), - attr: attr - }; -}; - -/** - * @returns {window} - */ -exports.getWindow = function () { - return window; -}; - -/** - * @param confirm - */ -exports.reloadBrowser = function (confirm) { - var $window = exports.getWindow(); - if (confirm) { - $window.location.reload(true); - } -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/emitter.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/emitter.js deleted file mode 100644 index dbbbf2e..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/emitter.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -exports.events = {}; - -/** - * @param name - * @param data - */ -exports.emit = function (name, data) { - var event = exports.events[name]; - var listeners; - if (event && event.listeners) { - listeners = event.listeners; - for (var i = 0, n = listeners.length; i < n; i += 1) { - listeners[i](data); - } - } -}; - -/** - * @param name - * @param func - */ -exports.on = function (name, func) { - var events = exports.events; - if (!events[name]) { - events[name] = { - listeners: [func] - }; - } else { - events[name].listeners.push(func); - } -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/events.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/events.js deleted file mode 100644 index bc03c45..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/events.js +++ /dev/null @@ -1,279 +0,0 @@ -exports._ElementCache = function () { - - var cache = {}, - guidCounter = 1, - expando = "data" + (new Date).getTime(); - - this.getData = function (elem) { - var guid = elem[expando]; - if (!guid) { - guid = elem[expando] = guidCounter++; - cache[guid] = {}; - } - return cache[guid]; - }; - - this.removeData = function (elem) { - var guid = elem[expando]; - if (!guid) return; - delete cache[guid]; - try { - delete elem[expando]; - } - catch (e) { - if (elem.removeAttribute) { - elem.removeAttribute(expando); - } - } - }; -}; - -/** - * Fix an event - * @param event - * @returns {*} - */ -exports._fixEvent = function (event) { - - function returnTrue() { - return true; - } - - function returnFalse() { - return false; - } - - if (!event || !event.stopPropagation) { - var old = event || window.event; - - // Clone the old object so that we can modify the values - event = {}; - - for (var prop in old) { - event[prop] = old[prop]; - } - - // The event occurred on this element - if (!event.target) { - event.target = event.srcElement || document; - } - - // Handle which other element the event is related to - event.relatedTarget = event.fromElement === event.target ? - event.toElement : - event.fromElement; - - // Stop the default browser action - event.preventDefault = function () { - event.returnValue = false; - event.isDefaultPrevented = returnTrue; - }; - - event.isDefaultPrevented = returnFalse; - - // Stop the event from bubbling - event.stopPropagation = function () { - event.cancelBubble = true; - event.isPropagationStopped = returnTrue; - }; - - event.isPropagationStopped = returnFalse; - - // Stop the event from bubbling and executing other handlers - event.stopImmediatePropagation = function () { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }; - - event.isImmediatePropagationStopped = returnFalse; - - // Handle mouse position - if (event.clientX != null) { - var doc = document.documentElement, body = document.body; - - event.pageX = event.clientX + - (doc && doc.scrollLeft || body && body.scrollLeft || 0) - - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = event.clientY + - (doc && doc.scrollTop || body && body.scrollTop || 0) - - (doc && doc.clientTop || body && body.clientTop || 0); - } - - // Handle key presses - event.which = event.charCode || event.keyCode; - - // Fix button for mouse clicks: - // 0 == left; 1 == middle; 2 == right - if (event.button != null) { - event.button = (event.button & 1 ? 0 : - (event.button & 4 ? 1 : - (event.button & 2 ? 2 : 0))); - } - } - - return event; -}; - -/** - * @constructor - */ -exports._EventManager = function (cache) { - - var nextGuid = 1; - - this.addEvent = function (elem, type, fn) { - - var data = cache.getData(elem); - - if (!data.handlers) data.handlers = {}; - - if (!data.handlers[type]) - data.handlers[type] = []; - - if (!fn.guid) fn.guid = nextGuid++; - - data.handlers[type].push(fn); - - if (!data.dispatcher) { - data.disabled = false; - data.dispatcher = function (event) { - - if (data.disabled) return; - event = exports._fixEvent(event); - - var handlers = data.handlers[event.type]; - if (handlers) { - for (var n = 0; n < handlers.length; n++) { - handlers[n].call(elem, event); - } - } - }; - } - - if (data.handlers[type].length == 1) { - if (document.addEventListener) { - elem.addEventListener(type, data.dispatcher, false); - } - else if (document.attachEvent) { - elem.attachEvent("on" + type, data.dispatcher); - } - } - - }; - - function tidyUp(elem, type) { - - function isEmpty(object) { - for (var prop in object) { - return false; - } - return true; - } - - var data = cache.getData(elem); - - if (data.handlers[type].length === 0) { - - delete data.handlers[type]; - - if (document.removeEventListener) { - elem.removeEventListener(type, data.dispatcher, false); - } - else if (document.detachEvent) { - elem.detachEvent("on" + type, data.dispatcher); - } - } - - if (isEmpty(data.handlers)) { - delete data.handlers; - delete data.dispatcher; - } - - if (isEmpty(data)) { - cache.removeData(elem); - } - } - - this.removeEvent = function (elem, type, fn) { - - var data = cache.getData(elem); - - if (!data.handlers) return; - - var removeType = function (t) { - data.handlers[t] = []; - tidyUp(elem, t); - }; - - if (!type) { - for (var t in data.handlers) removeType(t); - return; - } - - var handlers = data.handlers[type]; - if (!handlers) return; - - if (!fn) { - removeType(type); - return; - } - - if (fn.guid) { - for (var n = 0; n < handlers.length; n++) { - if (handlers[n].guid === fn.guid) { - handlers.splice(n--, 1); - } - } - } - tidyUp(elem, type); - - }; - - this.proxy = function (context, fn) { - if (!fn.guid) { - fn.guid = nextGuid++; - } - var ret = function () { - return fn.apply(context, arguments); - }; - ret.guid = fn.guid; - return ret; - }; -}; - - - -/** - * Trigger a click on an element - * @param elem - */ -exports.triggerClick = function (elem) { - - var evObj; - - if (document.createEvent) { - window.setTimeout(function () { - evObj = document.createEvent("MouseEvents"); - evObj.initEvent("click", true, true); - elem.dispatchEvent(evObj); - }, 0); - } else { - window.setTimeout(function () { - if (document.createEventObject) { - evObj = document.createEventObject(); - evObj.cancelBubble = true; - elem.fireEvent("on" + "click", evObj); - } - }, 0); - } -}; - -var cache = new exports._ElementCache(); -var eventManager = new exports._EventManager(cache); - -eventManager.triggerClick = exports.triggerClick; - -exports.manager = eventManager; - - - diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.clicks.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.clicks.js deleted file mode 100644 index 234d5cb..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.clicks.js +++ /dev/null @@ -1,65 +0,0 @@ -"use strict"; - -/** - * This is the plugin for syncing clicks between browsers - * @type {string} - */ -var EVENT_NAME = "click"; -var OPT_PATH = "ghostMode.clicks"; -exports.canEmitEvents = true; - -/** - * @param {BrowserSync} bs - * @param eventManager - */ -exports.init = function (bs, eventManager) { - eventManager.addEvent(document.body, EVENT_NAME, exports.browserEvent(bs)); - bs.socket.on(EVENT_NAME, exports.socketEvent(bs, eventManager)); -}; - -/** - * Uses event delegation to determine the clicked element - * @param {BrowserSync} bs - * @returns {Function} - */ -exports.browserEvent = function (bs) { - - return function (event) { - - if (exports.canEmitEvents) { - - var elem = event.target || event.srcElement; - - if (elem.type === "checkbox" || elem.type === "radio") { - bs.utils.forceChange(elem); - return; - } - - bs.socket.emit(EVENT_NAME, bs.utils.getElementData(elem)); - - } else { - exports.canEmitEvents = true; - } - }; -}; - -/** - * @param {BrowserSync} bs - * @param {manager} eventManager - * @returns {Function} - */ -exports.socketEvent = function (bs, eventManager) { - - return function (data) { - - if (bs.canSync(data, OPT_PATH)) { - - var elem = bs.utils.getSingleElement(data.tagName, data.index); - - if (elem) { - exports.canEmitEvents = false; - eventManager.triggerClick(elem); - } - } - }; -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.input.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.input.js deleted file mode 100644 index 54e2491..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.input.js +++ /dev/null @@ -1,67 +0,0 @@ -"use strict"; - -/** - * This is the plugin for syncing clicks between browsers - * @type {string} - */ -var EVENT_NAME = "input:text"; -var OPT_PATH = "ghostMode.forms.inputs"; -exports.canEmitEvents = true; - -/** - * @param {BrowserSync} bs - * @param eventManager - */ -exports.init = function (bs, eventManager) { - eventManager.addEvent(document.body, "keyup", exports.browserEvent(bs)); - bs.socket.on(EVENT_NAME, exports.socketEvent(bs, eventManager)); -}; - -/** - * @param {BrowserSync} bs - * @returns {Function} - */ -exports.browserEvent = function (bs) { - - return function (event) { - - var elem = event.target || event.srcElement; - var data; - - if (exports.canEmitEvents) { - - if (elem.tagName === "INPUT" || elem.tagName === "TEXTAREA") { - - data = bs.utils.getElementData(elem); - data.value = elem.value; - - bs.socket.emit(EVENT_NAME, data); - } - - } else { - exports.canEmitEvents = true; - } - }; -}; - -/** - * @param {BrowserSync} bs - * @returns {Function} - */ -exports.socketEvent = function (bs) { - - return function (data) { - - if (bs.canSync(data, OPT_PATH)) { - - var elem = bs.utils.getSingleElement(data.tagName, data.index); - - if (elem) { - elem.value = data.value; - return elem; - } - } - - return false; - }; -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.js deleted file mode 100644 index 2df7d38..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -exports.plugins = { - "inputs": require("./ghostmode.forms.input"), - "toggles": require("./ghostmode.forms.toggles"), - "submit": require("./ghostmode.forms.submit") -}; - -/** - * Load plugins for enabled options - * @param bs - */ -exports.init = function (bs, eventManager) { - - var checkOpt = true; - var options = bs.options.ghostMode.forms; - - if (options === true) { - checkOpt = false; - } - - function init(name) { - exports.plugins[name].init(bs, eventManager); - } - - for (var name in exports.plugins) { - if (!checkOpt) { - init(name); - } else { - if (options[name]) { - init(name); - } - } - } -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.submit.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.submit.js deleted file mode 100644 index d610cce..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.submit.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -/** - * This is the plugin for syncing clicks between browsers - * @type {string} - */ -var EVENT_NAME = "form:submit"; -var OPT_PATH = "ghostMode.forms.submit"; -exports.canEmitEvents = true; - -/** - * @param {BrowserSync} bs - * @param eventManager - */ -exports.init = function (bs, eventManager) { - var browserEvent = exports.browserEvent(bs); - eventManager.addEvent(document.body, "submit", browserEvent); - eventManager.addEvent(document.body, "reset", browserEvent); - bs.socket.on(EVENT_NAME, exports.socketEvent(bs, eventManager)); -}; - -/** - * @param {BrowserSync} bs - * @returns {Function} - */ -exports.browserEvent = function (bs) { - - return function (event) { - if (exports.canEmitEvents) { - var elem = event.target || event.srcElement; - var data = bs.utils.getElementData(elem); - data.type = event.type; - bs.socket.emit(EVENT_NAME, data); - } else { - exports.canEmitEvents = true; - } - }; -}; - -/** - * @param {BrowserSync} bs - * @returns {Function} - */ -exports.socketEvent = function (bs) { - - return function (data) { - if (bs.canSync(data, OPT_PATH)) { - var elem = bs.utils.getSingleElement(data.tagName, data.index); - exports.canEmitEvents = false; - if (elem && data.type === "submit") { - elem.submit(); - } - if (elem && data.type === "reset") { - elem.reset(); - } - return false; - } - return false; - }; -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.toggles.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.toggles.js deleted file mode 100644 index 1d6dbce..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.forms.toggles.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; - -/** - * This is the plugin for syncing clicks between browsers - * @type {string} - */ -var EVENT_NAME = "input:toggles"; -var OPT_PATH = "ghostMode.forms.toggles"; -exports.canEmitEvents = true; - -/** - * @param {BrowserSync} bs - * @param eventManager - */ -exports.init = function (bs, eventManager) { - var browserEvent = exports.browserEvent(bs); - exports.addEvents(eventManager, browserEvent); - bs.socket.on(EVENT_NAME, exports.socketEvent(bs, eventManager)); -}; - -/** - * @param eventManager - * @param event - */ -exports.addEvents = function (eventManager, event) { - - var elems = document.getElementsByTagName("select"); - var inputs = document.getElementsByTagName("input"); - - addEvents(elems); - addEvents(inputs); - - function addEvents(domElems) { - for (var i = 0, n = domElems.length; i < n; i += 1) { - eventManager.addEvent(domElems[i], "change", event); - } - } -}; - -/** - * @param {BrowserSync} bs - * @returns {Function} - */ -exports.browserEvent = function (bs) { - - return function (event) { - - if (exports.canEmitEvents) { - var elem = event.target || event.srcElement; - var data; - if (elem.type === "radio" || elem.type === "checkbox" || elem.tagName === "SELECT") { - data = bs.utils.getElementData(elem); - data.type = elem.type; - data.value = elem.value; - data.checked = elem.checked; - bs.socket.emit(EVENT_NAME, data); - } - } else { - exports.canEmitEvents = true; - } - - }; -}; - -/** - * @param {BrowserSync} bs - * @returns {Function} - */ -exports.socketEvent = function (bs) { - - return function (data) { - - if (bs.canSync(data, OPT_PATH)) { - - exports.canEmitEvents = false; - - var elem = bs.utils.getSingleElement(data.tagName, data.index); - - if (elem) { - if (data.type === "radio") { - elem.checked = true; - } - if (data.type === "checkbox") { - elem.checked = data.checked; - } - if (data.tagName === "SELECT") { - elem.value = data.value; - } - return elem; - } - return false; - } - - return false; - }; -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.js deleted file mode 100644 index af41313..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; - -var eventManager = require("./events").manager; - -exports.plugins = { - "scroll": require("./ghostmode.scroll"), - "clicks": require("./ghostmode.clicks"), - "forms": require("./ghostmode.forms"), - "location": require("./ghostmode.location") -}; - -/** - * Load plugins for enabled options - * @param bs - */ -exports.init = function (bs) { - for (var name in exports.plugins) { - exports.plugins[name].init(bs, eventManager); - } -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.location.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.location.js deleted file mode 100644 index b297a90..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.location.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; - -/** - * This is the plugin for syncing location - * @type {string} - */ -var EVENT_NAME = "browser:location"; -var OPT_PATH = "ghostMode.location"; -exports.canEmitEvents = true; - -/** - * @param {BrowserSync} bs - */ -exports.init = function (bs) { - bs.socket.on(EVENT_NAME, exports.socketEvent()); -}; - -/** - * Respond to socket event - */ -exports.socketEvent = function (bs) { - return function (data) { - if (data.override || bs.canSync(data, OPT_PATH)) { - if (data.path) { - exports.setPath(data.path); - } else { - exports.setUrl(data.url); - } - } - }; -}; - -/** - * @param url - */ -exports.setUrl = function (url) { - window.location = url; -}; - -/** - * @param path - */ -exports.setPath = function (path) { - window.location.pathname = path; -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.scroll.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.scroll.js deleted file mode 100644 index e518329..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/ghostmode.scroll.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; - -/** - * This is the plugin for syncing scroll between devices - * @type {string} - */ -var EVENT_NAME = "scroll"; -var OPT_PATH = "ghostMode.scroll"; -var utils; - -exports.canEmitEvents = true; - -/** - * @param {BrowserSync} bs - * @param eventManager - */ -exports.init = function (bs, eventManager) { - utils = bs.utils; - eventManager.addEvent(window, EVENT_NAME, exports.browserEvent(bs)); - bs.socket.on(EVENT_NAME, exports.socketEvent(bs)); -}; - -/** - * @param {BrowserSync} bs - */ -exports.socketEvent = function (bs) { - - return function (data) { - - var scrollSpace = utils.getScrollSpace(); - - exports.canEmitEvents = false; - - if (!bs.canSync(data, OPT_PATH)) { - return false; - } - - if (bs.options && bs.options.scrollProportionally) { - return window.scrollTo(0, scrollSpace.y * data.position.proportional); // % of y axis of scroll to px - } else { - return window.scrollTo(0, data.position.raw); - } - }; -}; - -/** - * @param bs - */ -exports.browserEvent = function (bs) { - - return function () { - - var canSync = exports.canEmitEvents; - - if (canSync) { - bs.socket.emit(EVENT_NAME, { - position: exports.getScrollPosition() - }); - } - - exports.canEmitEvents = true; - }; -}; - - -/** - * @returns {{raw: number, proportional: number}} - */ -exports.getScrollPosition = function () { - var pos = utils.getBrowserScrollPosition(); - return { - raw: pos, // Get px of y axis of scroll - proportional: exports.getScrollTopPercentage(pos) // Get % of y axis of scroll - }; -}; - -/** - * @param {{x: number, y: number}} scrollSpace - * @param scrollPosition - * @returns {{x: number, y: number}} - */ -exports.getScrollPercentage = function (scrollSpace, scrollPosition) { - - var x = scrollPosition.x / scrollSpace.x; - var y = scrollPosition.y / scrollSpace.y; - - return { - x: x || 0, - y: y - }; -}; - -/** - * Get just the percentage of Y axis of scroll - * @returns {number} - */ -exports.getScrollTopPercentage = function (pos) { - var scrollSpace = utils.getScrollSpace(); - var percentage = exports.getScrollPercentage(scrollSpace, pos); - return percentage.y; -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/index.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/index.js deleted file mode 100644 index 94f1b68..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; - -var socket = require("./socket"); -var shims = require("./client-shims"); -var notify = require("./notify"); -var codeSync = require("./code-sync"); -var BrowserSync = require("./browser-sync"); -var ghostMode = require("./ghostmode"); -var emitter = require("./emitter"); -var events = require("./events"); -var utils = require("./browser.utils").utils; - -var shouldReload = false; - -/** - * @param options - */ -exports.init = function (options) { - - if (shouldReload) { - utils.reloadBrowser(); - } - - var BS = window.___browserSync___ || {}; - if (!BS.client) { - - BS.client = true; - - var browserSync = new BrowserSync(options); - - // Always init on page load - ghostMode.init(browserSync); - codeSync.init(browserSync); - - if (options.notify) { - notify.init(browserSync); - notify.flash("Connected to BrowserSync"); - } - } -}; - -/** - * Handle individual socket connections - */ -socket.on("connection", exports.init); -socket.on("disconnect", function () { - notify.flash("Disconnected From BrowserSync"); - shouldReload = true; -}); - - -/**debug:start**/ -if (window.__karma__) { - window.__bs_scroll__ = require("./ghostmode.scroll"); - window.__bs_clicks__ = require("./ghostmode.clicks"); - window.__bs_location__ = require("./ghostmode.location"); - window.__bs_inputs__ = require("./ghostmode.forms.input"); - window.__bs_toggles__ = require("./ghostmode.forms.toggles"); - window.__bs_submit__ = require("./ghostmode.forms.submit"); - window.__bs_forms__ = require("./ghostmode.forms"); - window.__bs_utils__ = require("./browser.utils"); - window.__bs_emitter__ = emitter; - window.__bs = BrowserSync; - window.__bs_notify__ = notify; - window.__bs_code_sync__ = codeSync; - window.__bs_ghost_mode__ = ghostMode; - window.__bs_socket__ = socket; - window.__bs_index__ = exports; -} -/**debug:end**/ \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/notify.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/notify.js deleted file mode 100644 index 3acc715..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/notify.js +++ /dev/null @@ -1,108 +0,0 @@ -"use strict"; - -var scroll = require("./ghostmode.scroll"); - -var styles = [ - "display: none", - "padding: 15px", - "font-family: sans-serif", - "position: fixed", - "font-size: 0.9em", - "z-index: 9999", - "right: 0px", - "top: 0px", - "border-bottom-left-radius: 5px", - "background-color: #1B2032", - "margin: 0", - "color: white", - "text-align: center" - -]; - -var browserSync; -var elem; -var options; -var timeoutInt; - -/** - * @param {BrowserSync} bs - * @returns {*} - */ -exports.init = function (bs) { - - browserSync = bs; - options = bs.options; - - var cssStyles = styles; - - if (options.notify.styles) { - cssStyles = options.notify.styles; - } - - elem = document.createElement("DIV"); - elem.id = "__bs_notify__"; - elem.style.cssText = cssStyles.join(";"); - document.getElementsByTagName("body")[0].appendChild(elem); - - var flashFn = exports.watchEvent(); - - browserSync.emitter.on("notify", flashFn); - browserSync.socket.on("browser:notify", flashFn); - - return elem; -}; - -/** - * @returns {Function} - */ -exports.watchEvent = function () { - return function (data) { - if (typeof data === "string") { - return exports.flash(data); - } - exports.flash(data.message, data.timeout); - }; -}; - -/** - * - */ -exports.getElem = function () { - return elem; -}; - -/** - * @returns {number|*} - */ -exports.getScrollTop = function () { - return browserSync.utils.getBrowserScrollPosition().y; -}; - -/** - * @param message - * @param [timeout] - * @returns {*} - */ -exports.flash = function (message, timeout) { - - var elem = exports.getElem(); - - // return if notify was never initialised - if (!elem) { - return false; - } - - elem.innerHTML = message; - elem.style.display = "block"; - - if (timeoutInt) { - clearTimeout(timeoutInt); - timeoutInt = undefined; - } - - timeoutInt = window.setTimeout(function () { - elem.style.display = "none"; - }, timeout || 2000); - - return elem; -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/lib/socket.js b/node_modules/browser-sync/node_modules/browser-sync-client/lib/socket.js deleted file mode 100644 index a4e376b..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/lib/socket.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -/** - * @type {{emit: emit, on: on}} - */ -var BS = window.___browserSync___ || {}; -exports.socket = BS.socket || { - emit: function(){}, - on: function(){} -}; - - -/** - * @returns {string} - */ -exports.getPath = function () { - return window.location.pathname; -}; -/** - * Alias for socket.emit - * @param name - * @param data - */ -exports.emit = function (name, data) { - var socket = exports.socket; - if (socket && socket.emit) { - // send relative path of where the event is sent - data.url = exports.getPath(); - socket.emit(name, data); - } -}; - -/** - * Alias for socket.on - * @param name - * @param func - */ -exports.on = function (name, func) { - exports.socket.on(name, func); -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/browser-sync-client/package.json b/node_modules/browser-sync/node_modules/browser-sync-client/package.json deleted file mode 100644 index cd30a09..0000000 --- a/node_modules/browser-sync/node_modules/browser-sync-client/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "browser-sync-client", - "description": "Client-side scripts for BrowserSync", - "version": "0.5.1", - "homepage": "https://github.com/shakyshane/browser-sync-client", - "author": { - "name": "Shane Osbourne", - "email": "shane.osbourne8@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/shakyshane/browser-sync-client.git" - }, - "bugs": { - "url": "https://github.com/shakyshane/browser-sync-client/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/shakyshane/browser-sync-client/blob/master/LICENSE-MIT" - } - ], - "main": "index.js", - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "gulp && mocha test/middleware" - }, - "devDependencies": { - "gulp-karma": "0.0.4", - "gulp-jshint": "~1.4.0", - "chai": "~1.9.0", - "sinon": "~1.8.2", - "karma-mocha": "~0.1.1", - "karma-sinon": "~1.0.0", - "gulp-contribs": "0.0.2", - "karma-firefox-launcher": "^0.1.3", - "karma-html2js-preprocessor": "^0.1.0", - "gulp-browserify": "^0.5.0", - "gulp-uglify": "^0.2.1", - "gulp": "^3.6.0", - "karma-coverage": "^0.2.1", - "karma-chrome-launcher": "^0.1.3", - "express": "^4.0.0", - "gulp-rename": "^1.2.0", - "mocha": "^1.18.2", - "through2": "^0.4.1", - "supertest": "^0.10.0" - }, - "keywords": [], - "dependencies": {}, - "gitHead": "da3e9b6d8c964abff8d583d5c8d0a51d24dfb08e", - "_id": "browser-sync-client@0.5.1", - "_shasum": "83d7022f1ceefb43d6b81a28bef9a5f7aab71a4e", - "_from": "browser-sync-client@^0.5.1", - "_npmVersion": "2.0.0", - "_npmUser": { - "name": "shakyshane", - "email": "shakyshane@gmail.com" - }, - "maintainers": [ - { - "name": "shakyshane", - "email": "shane.osbourne8@gmail.com" - } - ], - "dist": { - "shasum": "83d7022f1ceefb43d6b81a28bef9a5f7aab71a4e", - "tarball": "http://registry.npmjs.org/browser-sync-client/-/browser-sync-client-0.5.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/browser-sync-client/-/browser-sync-client-0.5.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/commander/Readme.md b/node_modules/browser-sync/node_modules/commander/Readme.md deleted file mode 100644 index 0fa7356..0000000 --- a/node_modules/browser-sync/node_modules/commander/Readme.md +++ /dev/null @@ -1,239 +0,0 @@ -# Commander.js - - [![Build Status](https://api.travis-ci.org/tj/commander.js.svg)](http://travis-ci.org/tj/commander.js) -[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander) -[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://www.npmjs.org/package/commander) - - The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/tj/commander). - - -## Installation - - $ npm install commander - -## Option parsing - - Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .option('-p, --peppers', 'Add peppers') - .option('-P, --pineapple', 'Add pineapple') - .option('-b, --bbq', 'Add bbq sauce') - .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble') - .parse(process.argv); - -console.log('you ordered a pizza with:'); -if (program.peppers) console.log(' - peppers'); -if (program.pineapple) console.log(' - pineapple'); -if (program.bbq) console.log(' - bbq'); -console.log(' - %s cheese', program.cheese); -``` - - Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. - -## Variadic arguments - - The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to - append `...` to the argument name. Here is an example: - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('commander'); - -program - .version('0.0.1') - .command('rmdir [otherDirs...]') - .action(function (dir, otherDirs) { - console.log('rmdir %s', dir); - if (otherDirs) { - otherDirs.forEach(function (oDir) { - console.log('rmdir %s', oDir); - }); - } - }); - -program.parse(process.argv); -``` - - An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed - to your action as demonstrated above. - -## Automated --help - - The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free: - -``` - $ ./examples/pizza --help - - Usage: pizza [options] - - Options: - - -V, --version output the version number - -p, --peppers Add peppers - -P, --pineapple Add pineapple - -b, --bbq Add bbq sauce - -c, --cheese Add the specified type of cheese [marble] - -h, --help output usage information - -``` - -## Coercion - -```js -function range(val) { - return val.split('..').map(Number); -} - -function list(val) { - return val.split(','); -} - -function collect(val, memo) { - memo.push(val); - return memo; -} - -function increaseVerbosity(v, total) { - return total + 1; -} - -program - .version('0.0.1') - .usage('[options] ') - .option('-i, --integer ', 'An integer argument', parseInt) - .option('-f, --float ', 'A float argument', parseFloat) - .option('-r, --range ..', 'A range', range) - .option('-l, --list ', 'A list', list) - .option('-o, --optional [value]', 'An optional value') - .option('-c, --collect [value]', 'A repeatable value', collect, []) - .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0) - .parse(process.argv); - -console.log(' int: %j', program.integer); -console.log(' float: %j', program.float); -console.log(' optional: %j', program.optional); -program.range = program.range || []; -console.log(' range: %j..%j', program.range[0], program.range[1]); -console.log(' list: %j', program.list); -console.log(' collect: %j', program.collect); -console.log(' verbosity: %j', program.verbose); -console.log(' args: %j', program.args); -``` - -## Custom help - - You can display arbitrary `-h, --help` information - by listening for "--help". Commander will automatically - exit once you are done so that the remainder of your program - does not execute causing undesired behaviours, for example - in the following executable "stuff" will not output when - `--help` is used. - -```js -#!/usr/bin/env node - -/** - * Module dependencies. - */ - -var program = require('../'); - -program - .version('0.0.1') - .option('-f, --foo', 'enable some foo') - .option('-b, --bar', 'enable some bar') - .option('-B, --baz', 'enable some baz'); - -// must be before .parse() since -// node's emit() is immediate - -program.on('--help', function(){ - console.log(' Examples:'); - console.log(''); - console.log(' $ custom-help --help'); - console.log(' $ custom-help -h'); - console.log(''); -}); - -program.parse(process.argv); - -console.log('stuff'); -``` - -yielding the following help output: - -``` - -Usage: custom-help [options] - -Options: - - -h, --help output usage information - -V, --version output the version number - -f, --foo enable some foo - -b, --bar enable some bar - -B, --baz enable some baz - -Examples: - - $ custom-help --help - $ custom-help -h - -``` - -## .outputHelp() - - Output help information without exiting. - -## .help() - - Output help information and exit immediately. - -## Links - - - [API documentation](http://tj.github.com/commander.js/) - - [ascii tables](https://github.com/LearnBoost/cli-table) - - [progress bars](https://github.com/tj/node-progress) - - [more progress bars](https://github.com/substack/node-multimeter) - - [examples](https://github.com/tj/commander.js/tree/master/examples) - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -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 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/node_modules/browser-sync/node_modules/commander/index.js b/node_modules/browser-sync/node_modules/commander/index.js deleted file mode 100644 index b700006..0000000 --- a/node_modules/browser-sync/node_modules/commander/index.js +++ /dev/null @@ -1,981 +0,0 @@ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var spawn = require('child_process').spawn; -var path = require('path'); -var dirname = path.dirname; -var basename = path.basename; - -/** - * Expose the root command. - */ - -exports = module.exports = new Command(); - -/** - * Expose `Command`. - */ - -exports.Command = Command; - -/** - * Expose `Option`. - */ - -exports.Option = Option; - -/** - * Initialize a new `Option` with the given `flags` and `description`. - * - * @param {String} flags - * @param {String} description - * @api public - */ - -function Option(flags, description) { - this.flags = flags; - this.required = ~flags.indexOf('<'); - this.optional = ~flags.indexOf('['); - this.bool = !~flags.indexOf('-no-'); - flags = flags.split(/[ ,|]+/); - if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift(); - this.long = flags.shift(); - this.description = description || ''; -} - -/** - * Return option name. - * - * @return {String} - * @api private - */ - -Option.prototype.name = function() { - return this.long - .replace('--', '') - .replace('no-', ''); -}; - -/** - * Check if `arg` matches the short or long flag. - * - * @param {String} arg - * @return {Boolean} - * @api private - */ - -Option.prototype.is = function(arg) { - return arg == this.short || arg == this.long; -}; - -/** - * Initialize a new `Command`. - * - * @param {String} name - * @api public - */ - -function Command(name) { - this.commands = []; - this.options = []; - this._execs = []; - this._args = []; - this._name = name; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Command.prototype.__proto__ = EventEmitter.prototype; - -/** - * 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 ', 'change the working directory') - * .option('-c, --config ', '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 ') - * .description('run the given remote command') - * .action(function(cmd) { - * console.log('exec "%s"', cmd); - * }); - * - * program - * .command('teardown [otherDirs...]') - * .description('run teardown commands') - * .action(function(dir, otherDirs) { - * console.log('dir "%s"', dir); - * if (otherDirs) { - * otherDirs.forEach(function (oDir) { - * console.log('dir "%s"', oDir); - * }); - * } - * }); - * - * 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] - * @return {Command} the new command - * @api public - */ - -Command.prototype.command = function(name, desc) { - var args = name.split(/ +/); - var cmd = new Command(args.shift()); - if (desc) cmd.description(desc); - if (desc) this.executables = true; - if (desc) this._execs[cmd._name] = true; - this.commands.push(cmd); - cmd.parseExpectedArgs(args); - cmd.parent = this; - if (desc) return this; - return cmd; -}; - -/** - * Add an implicit `help [cmd]` subcommand - * which invokes `--help` for the given command. - * - * @api private - */ - -Command.prototype.addImplicitHelpCommand = function() { - this.command('help [cmd]', 'display help for [cmd]'); -}; - -/** - * Parse expected `args`. - * - * For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`. - * - * @param {Array} args - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parseExpectedArgs = function(args) { - if (!args.length) return; - var self = this; - args.forEach(function(arg) { - var argDetails = { - required: false, - name: '', - variadic: false - }; - - switch (arg[0]) { - case '<': - argDetails.required = true; - argDetails.name = arg.slice(1, -1); - break; - case '[': - argDetails.name = arg.slice(1, -1); - break; - } - - if (argDetails.name.indexOf('...') === argDetails.name.length - 3) { - argDetails.variadic = true; - argDetails.name = argDetails.name.slice(0, -3); - } - - if (argDetails.name) { - self._args.push(argDetails); - } - }); - return 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 - */ - -Command.prototype.action = function(fn) { - var self = this; - var listener = function(args, unknown) { - // Parse any so-far unknown options - args = args || []; - unknown = unknown || []; - - var parsed = self.parseOptions(unknown); - - // Output help if necessary - outputHelpIfNecessary(self, parsed.unknown); - - // If there are still any unknown options, then we simply - // die, unless someone asked for help, in which case we give it - // to them, and then we die. - if (parsed.unknown.length > 0) { - self.unknownOption(parsed.unknown[0]); - } - - // Leftover arguments need to be pushed back. Fixes issue #56 - if (parsed.args.length) args = parsed.args.concat(args); - - self._args.forEach(function(arg, i) { - if (arg.required && null == args[i]) { - self.missingArgument(arg.name); - } else if (arg.variadic) { - if (i !== self._args.length - 1) { - self.variadicArgNotLast(arg.name); - } - - args[i] = args.slice(i); - } - }); - - // Always append ourselves to the end of the arguments, - // to make sure we match the number of arguments the user - // expects - if (self._args.length) { - args[self._args.length] = self; - } else { - args.push(self); - } - - fn.apply(self, args); - }; - this.parent.on(this._name, listener); - if (this._alias) this.parent.on(this._alias, listener); - return 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 ', '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 - */ - -Command.prototype.option = function(flags, description, fn, defaultValue) { - var self = this - , option = new Option(flags, description) - , oname = option.name() - , name = camelcase(oname); - - // default as 3rd arg - if (typeof fn != 'function') { - defaultValue = fn; - fn = null; - } - - // preassign default value only for --no-*, [optional], or - if (false == option.bool || option.optional || option.required) { - // when --no-* we make sure default is true - if (false == option.bool) defaultValue = true; - // preassign only if we have a default - if (undefined !== defaultValue) self[name] = defaultValue; - } - - // register the option - this.options.push(option); - - // when it's passed assign the value - // and conditionally invoke the callback - this.on(oname, function(val) { - // coercion - if (null !== val && fn) val = fn(val, undefined === self[name] - ? defaultValue - : self[name]); - - // unassigned or bool - if ('boolean' == typeof self[name] || 'undefined' == typeof self[name]) { - // if no value, bool true, and we have a default, then use it! - if (null == val) { - self[name] = option.bool - ? defaultValue || true - : false; - } else { - self[name] = val; - } - } else if (null !== val) { - // reassign - self[name] = val; - } - }); - - return this; -}; - -/** - * Parse `argv`, settings options and invoking commands when defined. - * - * @param {Array} argv - * @return {Command} for chaining - * @api public - */ - -Command.prototype.parse = function(argv) { - // implicit help - if (this.executables) this.addImplicitHelpCommand(); - - // store raw args - this.rawArgs = argv; - - // guess name - this._name = this._name || basename(argv[1], '.js'); - - // process argv - var parsed = this.parseOptions(this.normalize(argv.slice(2))); - var args = this.args = parsed.args; - - var result = this.parseArgs(this.args, parsed.unknown); - - // executable sub-commands - var name = result.args[0]; - if (this._execs[name] && typeof this._execs[name] != "function") { - return this.executeSubCommand(argv, args, parsed.unknown); - } - - return result; -}; - -/** - * Execute a sub-command executable. - * - * @param {Array} argv - * @param {Array} args - * @param {Array} unknown - * @api private - */ - -Command.prototype.executeSubCommand = function(argv, args, unknown) { - args = args.concat(unknown); - - if (!args.length) this.help(); - if ('help' == args[0] && 1 == args.length) this.help(); - - // --help - if ('help' == args[0]) { - args[0] = args[1]; - args[1] = '--help'; - } - - // executable - var dir = dirname(argv[1]); - var bin = basename(argv[1], '.js') + '-' + args[0]; - - // check for ./ first - var local = path.join(dir, bin); - - // run it - args = args.slice(1); - args.unshift(local); - var proc = spawn('node', args, { stdio: 'inherit', customFds: [0, 1, 2] }); - proc.on('error', function(err) { - if (err.code == "ENOENT") { - console.error('\n %s(1) does not exist, try --help\n', bin); - } else if (err.code == "EACCES") { - console.error('\n %s(1) not executable. try chmod or run with root\n', bin); - } - }); - - this.runningCommand = proc; -}; - -/** - * Normalize `args`, splitting joined short flags. For example - * the arg "-abc" is equivalent to "-a -b -c". - * This also normalizes equal sign and splits "--abc=def" into "--abc def". - * - * @param {Array} args - * @return {Array} - * @api private - */ - -Command.prototype.normalize = function(args) { - var ret = [] - , arg - , lastOpt - , index; - - for (var i = 0, len = args.length; i < len; ++i) { - arg = args[i]; - if (i > 0) { - lastOpt = this.optionFor(args[i-1]); - } - - if (arg === '--') { - // Honor option terminator - ret = ret.concat(args.slice(i)); - break; - } else if (lastOpt && lastOpt.required) { - ret.push(arg); - } else if (arg.length > 1 && '-' == arg[0] && '-' != arg[1]) { - arg.slice(1).split('').forEach(function(c) { - ret.push('-' + c); - }); - } else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) { - ret.push(arg.slice(0, index), arg.slice(index + 1)); - } else { - ret.push(arg); - } - } - - return ret; -}; - -/** - * Parse command `args`. - * - * When listener(s) are available those - * callbacks are invoked, otherwise the "*" - * event is emitted and those actions are invoked. - * - * @param {Array} args - * @return {Command} for chaining - * @api private - */ - -Command.prototype.parseArgs = function(args, unknown) { - var name; - - if (args.length) { - name = args[0]; - if (this.listeners(name).length) { - this.emit(args.shift(), args, unknown); - } else { - this.emit('*', args); - } - } else { - outputHelpIfNecessary(this, unknown); - - // If there were no args and we have unknown options, - // then they are extraneous and we need to error. - if (unknown.length > 0) { - this.unknownOption(unknown[0]); - } - } - - return this; -}; - -/** - * Return an option matching `arg` if any. - * - * @param {String} arg - * @return {Option} - * @api private - */ - -Command.prototype.optionFor = function(arg) { - for (var i = 0, len = this.options.length; i < len; ++i) { - if (this.options[i].is(arg)) { - return this.options[i]; - } - } -}; - -/** - * Parse options from `argv` returning `argv` - * void of these options. - * - * @param {Array} argv - * @return {Array} - * @api public - */ - -Command.prototype.parseOptions = function(argv) { - var args = [] - , len = argv.length - , literal - , option - , arg; - - var unknownOptions = []; - - // parse options - for (var i = 0; i < len; ++i) { - arg = argv[i]; - - // literal args after -- - if ('--' == arg) { - literal = true; - continue; - } - - if (literal) { - args.push(arg); - continue; - } - - // find matching Option - option = this.optionFor(arg); - - // option is defined - if (option) { - // requires arg - if (option.required) { - arg = argv[++i]; - if (null == arg) return this.optionMissingArgument(option); - this.emit(option.name(), arg); - // optional arg - } else if (option.optional) { - arg = argv[i+1]; - if (null == arg || ('-' == arg[0] && '-' != arg)) { - arg = null; - } else { - ++i; - } - this.emit(option.name(), arg); - // bool - } else { - this.emit(option.name()); - } - continue; - } - - // looks like an option - if (arg.length > 1 && '-' == arg[0]) { - unknownOptions.push(arg); - - // If the next argument looks like it might be - // an argument for this option, we pass it on. - // If it isn't, then it'll simply be ignored - if (argv[i+1] && '-' != argv[i+1][0]) { - unknownOptions.push(argv[++i]); - } - continue; - } - - // arg - args.push(arg); - } - - return { args: args, unknown: unknownOptions }; -}; - -/** - * Return an object containing options as key-value pairs - * - * @return {Object} - * @api public - */ -Command.prototype.opts = function() { - var result = {} - , len = this.options.length; - - for (var i = 0 ; i < len; i++) { - var key = this.options[i].name(); - result[key] = key === 'version' ? this._version : this[key]; - } - return result; -}; - -/** - * Argument `name` is missing. - * - * @param {String} name - * @api private - */ - -Command.prototype.missingArgument = function(name) { - console.error(); - console.error(" error: missing required argument `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * `Option` is missing an argument, but received `flag` or nothing. - * - * @param {String} option - * @param {String} flag - * @api private - */ - -Command.prototype.optionMissingArgument = function(option, flag) { - console.error(); - if (flag) { - console.error(" error: option `%s' argument missing, got `%s'", option.flags, flag); - } else { - console.error(" error: option `%s' argument missing", option.flags); - } - console.error(); - process.exit(1); -}; - -/** - * Unknown option `flag`. - * - * @param {String} flag - * @api private - */ - -Command.prototype.unknownOption = function(flag) { - console.error(); - console.error(" error: unknown option `%s'", flag); - console.error(); - process.exit(1); -}; - -/** - * Variadic argument with `name` is not the last argument as required. - * - * @param {String} name - * @api private - */ - -Command.prototype.variadicArgNotLast = function(name) { - console.error(); - console.error(" error: variadic arguments must be last `%s'", name); - console.error(); - process.exit(1); -}; - -/** - * 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 - */ - -Command.prototype.version = function(str, flags) { - if (0 == arguments.length) return this._version; - this._version = str; - flags = flags || '-V, --version'; - this.option(flags, 'output the version number'); - this.on('version', function() { - process.stdout.write(str + '\n'); - process.exit(0); - }); - return this; -}; - -/** - * Set the description to `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.description = function(str) { - if (0 == arguments.length) return this._description; - this._description = str; - return this; -}; - -/** - * Set an alias for the command - * - * @param {String} alias - * @return {String|Command} - * @api public - */ - -Command.prototype.alias = function(alias) { - if (0 == arguments.length) return this._alias; - this._alias = alias; - return this; -}; - -/** - * Set / get the command usage `str`. - * - * @param {String} str - * @return {String|Command} - * @api public - */ - -Command.prototype.usage = function(str) { - var args = this._args.map(function(arg) { - return humanReadableArgName(arg); - }); - - var usage = '[options]' - + (this.commands.length ? ' [command]' : '') - + (this._args.length ? ' ' + args.join(' ') : ''); - - if (0 == arguments.length) return this._usage || usage; - this._usage = str; - - return this; -}; - -/** - * Get the name of the command - * - * @param {String} name - * @return {String|Command} - * @api public - */ - -Command.prototype.name = function(name) { - return this._name; -}; - -/** - * Return the largest option length. - * - * @return {Number} - * @api private - */ - -Command.prototype.largestOptionLength = function() { - return this.options.reduce(function(max, option) { - return Math.max(max, option.flags.length); - }, 0); -}; - -/** - * Return help for options. - * - * @return {String} - * @api private - */ - -Command.prototype.optionHelp = function() { - var width = this.largestOptionLength(); - - // Prepend the help information - return [pad('-h, --help', width) + ' ' + 'output usage information'] - .concat(this.options.map(function(option) { - return pad(option.flags, width) + ' ' + option.description; - })) - .join('\n'); -}; - -/** - * Return command help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.commandHelp = function() { - if (!this.commands.length) return ''; - - var commands = this.commands.map(function(cmd) { - var args = cmd._args.map(function(arg) { - return humanReadableArgName(arg); - }).join(' '); - - return [ - cmd._name - + (cmd._alias - ? '|' + cmd._alias - : '') - + (cmd.options.length - ? ' [options]' - : '') - + ' ' + args - , cmd.description() - ]; - }); - - var width = commands.reduce(function(max, command) { - return Math.max(max, command[0].length); - }, 0); - - return [ - '' - , ' Commands:' - , '' - , commands.map(function(cmd) { - return pad(cmd[0], width) + ' ' + cmd[1]; - }).join('\n').replace(/^/gm, ' ') - , '' - ].join('\n'); -}; - -/** - * Return program help documentation. - * - * @return {String} - * @api private - */ - -Command.prototype.helpInformation = function() { - return [ - '' - , ' Usage: ' + this._name - + (this._alias - ? '|' + this._alias - : '') - + ' ' + this.usage() - , '' + this.commandHelp() - , ' Options:' - , '' - , '' + this.optionHelp().replace(/^/gm, ' ') - , '' - , '' - ].join('\n'); -}; - -/** - * Output help information for this command - * - * @api public - */ - -Command.prototype.outputHelp = function() { - process.stdout.write(this.helpInformation()); - this.emit('--help'); -}; - -/** - * Output help information and exit. - * - * @api public - */ - -Command.prototype.help = function() { - this.outputHelp(); - process.exit(); -}; - -/** - * Camel-case the given `flag` - * - * @param {String} flag - * @return {String} - * @api private - */ - -function camelcase(flag) { - return flag.split('-').reduce(function(str, word) { - return str + word[0].toUpperCase() + word.slice(1); - }); -} - -/** - * Pad `str` to `width`. - * - * @param {String} str - * @param {Number} width - * @return {String} - * @api private - */ - -function pad(str, width) { - var len = Math.max(0, width - str.length); - return str + Array(len + 1).join(' '); -} - -/** - * Output help information if necessary - * - * @param {Command} command to output help for - * @param {Array} array of options to search for -h or --help - * @api private - */ - -function outputHelpIfNecessary(cmd, options) { - options = options || []; - for (var i = 0; i < options.length; i++) { - if (options[i] == '--help' || options[i] == '-h') { - cmd.outputHelp(); - process.exit(0); - } - } -} - -/** - * Takes an argument an returns its human readable equivalent for help usage. - * - * @param {Object} arg - * @return {String} - * @api private - */ - -function humanReadableArgName(arg) { - var nameOutput = arg.name + (arg.variadic === true ? '...' : ''); - - return arg.required - ? '<' + nameOutput + '>' - : '[' + nameOutput + ']' -} diff --git a/node_modules/browser-sync/node_modules/commander/package.json b/node_modules/browser-sync/node_modules/commander/package.json deleted file mode 100644 index 3236914..0000000 --- a/node_modules/browser-sync/node_modules/commander/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "commander", - "version": "2.5.0", - "description": "the complete solution for node.js command-line programs", - "keywords": [ - "command", - "option", - "parser", - "prompt" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/tj/commander.js.git" - }, - "devDependencies": { - "should": ">= 0.0.1" - }, - "scripts": { - "test": "make test" - }, - "main": "index", - "engines": { - "node": ">= 0.6.x" - }, - "files": [ - "index.js" - ], - "bugs": { - "url": "https://github.com/tj/commander.js/issues" - }, - "homepage": "https://github.com/tj/commander.js", - "_id": "commander@2.5.0", - "_shasum": "d777b6a4d847d423e5d475da864294ac1ff5aa9d", - "_from": "commander@^2.3.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "zhiyelee", - "email": "zhiyelee@gmail.com" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "somekittens", - "email": "rkoutnik@gmail.com" - }, - { - "name": "zhiyelee", - "email": "zhiyelee@gmail.com" - }, - { - "name": "thethomaseffect", - "email": "thethomaseffect@gmail.com" - } - ], - "dist": { - "shasum": "d777b6a4d847d423e5d475da864294ac1ff5aa9d", - "tarball": "http://registry.npmjs.org/commander/-/commander-2.5.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/commander/-/commander-2.5.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/connect/.npmignore b/node_modules/browser-sync/node_modules/connect/.npmignore deleted file mode 100644 index 078c11e..0000000 --- a/node_modules/browser-sync/node_modules/connect/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -coverage/ -docs/ -test/ -.travis.yml diff --git a/node_modules/browser-sync/node_modules/connect/History.md b/node_modules/browser-sync/node_modules/connect/History.md deleted file mode 100644 index 0240523..0000000 --- a/node_modules/browser-sync/node_modules/connect/History.md +++ /dev/null @@ -1,1930 +0,0 @@ -3.3.3 / 2014-11-09 -================== - - * Correctly invoke async callback asynchronously - -3.3.2 / 2014-10-28 -================== - - * Fix handling of URLs containing `://` in the path - -3.3.1 / 2014-10-22 -================== - - * deps: finalhandler@0.3.2 - - deps: on-finished@~2.1.1 - -3.3.0 / 2014-10-17 -================== - - * deps: debug@~2.1.0 - - Implement `DEBUG_FD` env variable support - * deps: finalhandler@0.3.1 - - Terminate in progress response only on error - - Use `on-finished` to determine request status - - deps: debug@~2.1.0 - -3.2.0 / 2014-09-08 -================== - - * deps: debug@~2.0.0 - * deps: finalhandler@0.2.0 - - Set `X-Content-Type-Options: nosniff` header - - deps: debug@~2.0.0 - -3.1.1 / 2014-08-10 -================== - - * deps: parseurl@~1.3.0 - -3.1.0 / 2014-07-22 -================== - - * deps: debug@1.0.4 - * deps: finalhandler@0.1.0 - - Respond after request fully read - - deps: debug@1.0.4 - * deps: parseurl@~1.2.0 - - Cache URLs based on original value - - Remove no-longer-needed URL mis-parse work-around - - Simplify the "fast-path" `RegExp` - * perf: reduce executed logic in routing - * perf: refactor location of `try` block - -3.0.2 / 2014-07-10 -================== - - * deps: debug@1.0.3 - - Add support for multiple wildcards in namespaces - * deps: parseurl@~1.1.3 - - faster parsing of href-only URLs - -3.0.1 / 2014-06-19 -================== - - * use `finalhandler` for final response handling - * deps: debug@1.0.2 - -3.0.0 / 2014-05-29 -================== - - * No changes - -3.0.0-rc.2 / 2014-05-04 -======================= - - * Call error stack even when response has been sent - * Prevent default 404 handler after response sent - * dep: debug@0.8.1 - * encode stack in HTML for default error handler - * remove `proto` export - -3.0.0-rc.1 / 2014-03-06 -======================= - - * move middleware to separate repos - * remove docs - * remove node patches - * remove connect(middleware...) - * remove the old `connect.createServer()` method - * remove various private `connect.utils` functions - * drop node.js 0.8 support - -2.27.3 / 2014-11-09 -=================== - - * Correctly invoke async callback asynchronously - * deps: csurf@~1.6.3 - - bump csrf - - bump http-errors - -2.27.2 / 2014-10-28 -=================== - - * Fix handling of URLs containing `://` in the path - * deps: body-parser@~1.9.2 - - deps: qs@2.3.2 - * deps: qs@2.3.2 - - Fix parsing of mixed objects and values - -2.27.1 / 2014-10-22 -=================== - - * deps: body-parser@~1.9.1 - - deps: on-finished@~2.1.1 - - deps: qs@2.3.0 - - deps: type-is@~1.5.2 - * deps: express-session@~1.9.1 - - Remove unnecessary empty write call - * deps: finalhandler@0.3.2 - - deps: on-finished@~2.1.1 - * deps: morgan@~1.4.1 - - deps: on-finished@~2.1.1 - * deps: qs@2.3.0 - - Fix parsing of mixed implicit and explicit arrays - * deps: serve-static@~1.7.1 - - deps: send@0.10.1 - -2.27.0 / 2014-10-16 -=================== - - * Use `http-errors` module for creating errors - * Use `utils-merge` module for merging objects - * deps: body-parser@~1.9.0 - - include the charset in "unsupported charset" error message - - include the encoding in "unsupported content encoding" error message - - deps: depd@~1.0.0 - * deps: compression@~1.2.0 - - deps: debug@~2.1.0 - * deps: connect-timeout@~1.4.0 - - Create errors with `http-errors` - - deps: debug@~2.1.0 - * deps: debug@~2.1.0 - - Implement `DEBUG_FD` env variable support - * deps: depd@~1.0.0 - * deps: express-session@~1.9.0 - - deps: debug@~2.1.0 - - deps: depd@~1.0.0 - * deps: finalhandler@0.3.1 - - Terminate in progress response only on error - - Use `on-finished` to determine request status - - deps: debug@~2.1.0 - * deps: method-override@~2.3.0 - - deps: debug@~2.1.0 - * deps: morgan@~1.4.0 - - Add `debug` messages - - deps: depd@~1.0.0 - * deps: response-time@~2.2.0 - - Add `header` option for custom header name - - Add `suffix` option - - Change `digits` argument to an `options` argument - - deps: depd@~1.0.0 - * deps: serve-favicon@~2.1.6 - - deps: etag@~1.5.0 - * deps: serve-index@~1.5.0 - - Add `dir` argument to `filter` function - - Add icon for mkv files - - Create errors with `http-errors` - - Fix incorrect 403 on Windows and Node.js 0.11 - - Lookup icon by mime type for greater icon support - - Support using tokens multiple times - - deps: accepts@~1.1.2 - - deps: debug@~2.1.0 - - deps: mime-types@~2.0.2 - * deps: serve-static@~1.7.0 - - deps: send@0.10.0 - -2.26.6 / 2014-10-15 -=================== - - * deps: compression@~1.1.2 - - deps: accepts@~1.1.2 - - deps: compressible@~2.0.1 - * deps: csurf@~1.6.2 - - bump http-errors - - fix cookie name when using `cookie: true` - * deps: errorhandler@~1.2.2 - - deps: accepts@~1.1.2 - -2.26.5 / 2014-10-08 -=================== - - * Fix accepting non-object arguments to `logger` - * deps: serve-static@~1.6.4 - - Fix redirect loop when index file serving disabled - -2.26.4 / 2014-10-02 -=================== - - * deps: morgan@~1.3.2 - - Fix `req.ip` integration when `immediate: false` - * deps: type-is@~1.5.2 - - deps: mime-types@~2.0.2 - -2.26.3 / 2014-09-24 -=================== - - * deps: body-parser@~1.8.4 - - fix content encoding to be case-insensitive - * deps: serve-favicon@~2.1.5 - - deps: etag@~1.4.0 - * deps: serve-static@~1.6.3 - - deps: send@0.9.3 - -2.26.2 / 2014-09-19 -=================== - - * deps: body-parser@~1.8.3 - - deps: qs@2.2.4 - * deps: qs@2.2.4 - - Fix issue with object keys starting with numbers truncated - -2.26.1 / 2014-09-15 -=================== - - * deps: body-parser@~1.8.2 - - deps: depd@0.4.5 - * deps: depd@0.4.5 - * deps: express-session@~1.8.2 - - Use `crc` instead of `buffer-crc32` for speed - - deps: depd@0.4.5 - * deps: morgan@~1.3.1 - - Remove un-used `bytes` dependency - - deps: depd@0.4.5 - * deps: serve-favicon@~2.1.4 - - Fix content headers being sent in 304 response - - deps: etag@~1.3.1 - * deps: serve-static@~1.6.2 - - deps: send@0.9.2 - -2.26.0 / 2014-09-08 -=================== - - * deps: body-parser@~1.8.1 - - add `parameterLimit` option to `urlencoded` parser - - change `urlencoded` extended array limit to 100 - - make empty-body-handling consistent between chunked requests - - respond with 415 when over `parameterLimit` in `urlencoded` - - deps: media-typer@0.3.0 - - deps: qs@2.2.3 - - deps: type-is@~1.5.1 - * deps: compression@~1.1.0 - - deps: accepts@~1.1.0 - - deps: compressible@~2.0.0 - - deps: debug@~2.0.0 - * deps: connect-timeout@~1.3.0 - - deps: debug@~2.0.0 - * deps: cookie-parser@~1.3.3 - - deps: cookie-signature@1.0.5 - * deps: cookie-signature@1.0.5 - * deps: csurf@~1.6.1 - - add `ignoreMethods` option - - bump cookie-signature - - csrf-tokens -> csrf - - set `code` property on CSRF token errors - * deps: debug@~2.0.0 - * deps: errorhandler@~1.2.0 - - Display error using `util.inspect` if no other representation - - deps: accepts@~1.1.0 - * deps: express-session@~1.8.1 - - Do not resave already-saved session at end of request - - Prevent session prototype methods from being overwritten - - deps: cookie-signature@1.0.5 - - deps: debug@~2.0.0 - * deps: finalhandler@0.2.0 - - Set `X-Content-Type-Options: nosniff` header - - deps: debug@~2.0.0 - * deps: fresh@0.2.4 - * deps: media-typer@0.3.0 - - Throw error when parameter format invalid on parse - * deps: method-override@~2.2.0 - - deps: debug@~2.0.0 - * deps: morgan@~1.3.0 - - Assert if `format` is not a function or string - * deps: qs@2.2.3 - - Fix issue where first empty value in array is discarded - * deps: serve-favicon@~2.1.3 - - Accept string for `maxAge` (converted by `ms`) - - Use `etag` to generate `ETag` header - - deps: fresh@0.2.4 - * deps: serve-index@~1.2.1 - - Add `debug` messages - - Resolve relative paths at middleware setup - - deps: accepts@~1.1.0 - * deps: serve-static@~1.6.1 - - Add `lastModified` option - - deps: send@0.9.1 - * deps: type-is@~1.5.1 - - fix `hasbody` to be true for `content-length: 0` - - deps: media-typer@0.3.0 - - deps: mime-types@~2.0.1 - * deps: vhost@~3.0.0 - -2.25.10 / 2014-09-04 -==================== - - * deps: serve-static@~1.5.4 - - deps: send@0.8.5 - -2.25.9 / 2014-08-29 -=================== - - * deps: body-parser@~1.6.7 - - deps: qs@2.2.2 - * deps: qs@2.2.2 - -2.25.8 / 2014-08-27 -=================== - - * deps: body-parser@~1.6.6 - - deps: qs@2.2.0 - * deps: csurf@~1.4.1 - * deps: qs@2.2.0 - - Array parsing fix - - Performance improvements - -2.25.7 / 2014-08-18 -=================== - - * deps: body-parser@~1.6.5 - - deps: on-finished@2.1.0 - * deps: express-session@~1.7.6 - - Fix exception on `res.end(null)` calls - * deps: morgan@~1.2.3 - - deps: on-finished@2.1.0 - * deps: serve-static@~1.5.3 - - deps: send@0.8.3 - -2.25.6 / 2014-08-14 -=================== - - * deps: body-parser@~1.6.4 - - deps: qs@1.2.2 - * deps: qs@1.2.2 - * deps: serve-static@~1.5.2 - - deps: send@0.8.2 - -2.25.5 / 2014-08-11 -=================== - - * Fix backwards compatibility in `logger` - -2.25.4 / 2014-08-10 -=================== - - * Fix `query` middleware breaking with argument - - It never really took one in the first place - * deps: body-parser@~1.6.3 - - deps: qs@1.2.1 - * deps: compression@~1.0.11 - - deps: on-headers@~1.0.0 - - deps: parseurl@~1.3.0 - * deps: connect-timeout@~1.2.2 - - deps: on-headers@~1.0.0 - * deps: express-session@~1.7.5 - - Fix parsing original URL - - deps: on-headers@~1.0.0 - - deps: parseurl@~1.3.0 - * deps: method-override@~2.1.3 - * deps: on-headers@~1.0.0 - * deps: parseurl@~1.3.0 - * deps: qs@1.2.1 - * deps: response-time@~2.0.1 - - deps: on-headers@~1.0.0 - * deps: serve-index@~1.1.6 - - Fix URL parsing - * deps: serve-static@~1.5.1 - - Fix parsing of weird `req.originalUrl` values - - deps: parseurl@~1.3.0 - = deps: utils-merge@1.0.0 - -2.25.3 / 2014-08-07 -=================== - - * deps: multiparty@3.3.2 - - Fix potential double-callback - -2.25.2 / 2014-08-07 -=================== - - * deps: body-parser@~1.6.2 - - deps: qs@1.2.0 - * deps: qs@1.2.0 - - Fix parsing array of objects - -2.25.1 / 2014-08-06 -=================== - - * deps: body-parser@~1.6.1 - - deps: qs@1.1.0 - * deps: qs@1.1.0 - - Accept urlencoded square brackets - - Accept empty values in implicit array notation - -2.25.0 / 2014-08-05 -=================== - - * deps: body-parser@~1.6.0 - - deps: qs@1.0.2 - * deps: compression@~1.0.10 - - Fix upper-case Content-Type characters prevent compression - - deps: compressible@~1.1.1 - * deps: csurf@~1.4.0 - - Support changing `req.session` after `csurf` middleware - - Calling `res.csrfToken()` after `req.session.destroy()` will now work - * deps: express-session@~1.7.4 - - Fix `res.end` patch to call correct upstream `res.write` - - Fix response end delay for non-chunked responses - * deps: qs@1.0.2 - - Complete rewrite - - Limits array length to 20 - - Limits object depth to 5 - - Limits parameters to 1,000 - * deps: serve-static@~1.5.0 - - Add `extensions` option - - deps: send@0.8.1 - -2.24.3 / 2014-08-04 -=================== - - * deps: serve-index@~1.1.5 - - Fix Content-Length calculation for multi-byte file names - - deps: accepts@~1.0.7 - * deps: serve-static@~1.4.4 - - Fix incorrect 403 on Windows and Node.js 0.11 - - deps: send@0.7.4 - -2.24.2 / 2014-07-27 -=================== - - * deps: body-parser@~1.5.2 - * deps: depd@0.4.4 - - Work-around v8 generating empty stack traces - * deps: express-session@~1.7.2 - * deps: morgan@~1.2.2 - * deps: serve-static@~1.4.2 - -2.24.1 / 2014-07-26 -=================== - - * deps: body-parser@~1.5.1 - * deps: depd@0.4.3 - - Fix exception when global `Error.stackTraceLimit` is too low - * deps: express-session@~1.7.1 - * deps: morgan@~1.2.1 - * deps: serve-index@~1.1.4 - * deps: serve-static@~1.4.1 - -2.24.0 / 2014-07-22 -=================== - - * deps: body-parser@~1.5.0 - - deps: depd@0.4.2 - - deps: iconv-lite@0.4.4 - - deps: raw-body@1.3.0 - - deps: type-is@~1.3.2 - * deps: compression@~1.0.9 - - Add `debug` messages - - deps: accepts@~1.0.7 - * deps: connect-timeout@~1.2.1 - - Accept string for `time` (converted by `ms`) - - deps: debug@1.0.4 - * deps: debug@1.0.4 - * deps: depd@0.4.2 - - Add `TRACE_DEPRECATION` environment variable - - Remove non-standard grey color from color output - - Support `--no-deprecation` argument - - Support `--trace-deprecation` argument - * deps: express-session@~1.7.0 - - Improve session-ending error handling - - deps: debug@1.0.4 - - deps: depd@0.4.2 - * deps: finalhandler@0.1.0 - - Respond after request fully read - - deps: debug@1.0.4 - * deps: method-override@~2.1.2 - - deps: debug@1.0.4 - - deps: parseurl@~1.2.0 - * deps: morgan@~1.2.0 - - Add `:remote-user` token - - Add `combined` log format - - Add `common` log format - - Remove non-standard grey color from `dev` format - * deps: multiparty@3.3.1 - * deps: parseurl@~1.2.0 - - Cache URLs based on original value - - Remove no-longer-needed URL mis-parse work-around - - Simplify the "fast-path" `RegExp` - * deps: serve-static@~1.4.0 - - Add `dotfiles` option - - deps: parseurl@~1.2.0 - - deps: send@0.7.0 - -2.23.0 / 2014-07-10 -=================== - - * deps: debug@1.0.3 - - Add support for multiple wildcards in namespaces - * deps: express-session@~1.6.4 - * deps: method-override@~2.1.0 - - add simple debug output - - deps: methods@1.1.0 - - deps: parseurl@~1.1.3 - * deps: parseurl@~1.1.3 - - faster parsing of href-only URLs - * deps: serve-static@~1.3.1 - - deps: parseurl@~1.1.3 - -2.22.0 / 2014-07-03 -=================== - - * deps: csurf@~1.3.0 - - Fix `cookie.signed` option to actually sign cookie - * deps: express-session@~1.6.1 - - Fix `res.end` patch to return correct value - - Fix `res.end` patch to handle multiple `res.end` calls - - Reject cookies with missing signatures - * deps: multiparty@3.3.0 - - Always emit close after all parts ended - - Fix callback hang in node.js 0.8 on errors - * deps: serve-static@~1.3.0 - - Accept string for `maxAge` (converted by `ms`) - - Add `setHeaders` option - - Include HTML link in redirect response - - deps: send@0.5.0 - -2.21.1 / 2014-06-26 -=================== - - * deps: cookie-parser@1.3.2 - - deps: cookie-signature@1.0.4 - * deps: cookie-signature@1.0.4 - - fix for timing attacks - * deps: express-session@~1.5.2 - - deps: cookie-signature@1.0.4 - * deps: type-is@~1.3.2 - - more mime types - -2.21.0 / 2014-06-20 -=================== - - * deprecate `connect(middleware)` -- use `app.use(middleware)` instead - * deprecate `connect.createServer()` -- use `connect()` instead - * fix `res.setHeader()` patch to work with get -> append -> set pattern - * deps: compression@~1.0.8 - * deps: errorhandler@~1.1.1 - * deps: express-session@~1.5.0 - - Deprecate integration with `cookie-parser` middleware - - Deprecate looking for secret in `req.secret` - - Directly read cookies; `cookie-parser` no longer required - - Directly set cookies; `res.cookie` no longer required - - Generate session IDs with `uid-safe`, faster and even less collisions - * deps: serve-index@~1.1.3 - -2.20.2 / 2014-06-19 -=================== - - * deps: body-parser@1.4.3 - - deps: type-is@1.3.1 - -2.20.1 / 2014-06-19 -=================== - - * deps: type-is@1.3.1 - - fix global variable leak - -2.20.0 / 2014-06-19 -=================== - - * deprecate `verify` option to `json` -- use `body-parser` npm module instead - * deprecate `verify` option to `urlencoded` -- use `body-parser` npm module instead - * deprecate things with `depd` module - * use `finalhandler` for final response handling - * use `media-typer` to parse `content-type` for charset - * deps: body-parser@1.4.2 - - check accepted charset in content-type (accepts utf-8) - - check accepted encoding in content-encoding (accepts identity) - - deprecate `urlencoded()` without provided `extended` option - - lazy-load urlencoded parsers - - support gzip and deflate bodies - - set `inflate: false` to turn off - - deps: raw-body@1.2.2 - - deps: type-is@1.3.0 - - Support all encodings from `iconv-lite` - * deps: connect-timeout@1.1.1 - - deps: debug@1.0.2 - * deps: cookie-parser@1.3.1 - - export parsing functions - - `req.cookies` and `req.signedCookies` are now plain objects - - slightly faster parsing of many cookies - * deps: csurf@1.2.2 - * deps: errorhandler@1.1.0 - - Display error on console formatted like `throw` - - Escape HTML in stack trace - - Escape HTML in title - - Fix up edge cases with error sent in response - - Set `X-Content-Type-Options: nosniff` header - - Use accepts for negotiation - * deps: express-session@1.4.0 - - Add `genid` option to generate custom session IDs - - Add `saveUninitialized` option to control saving uninitialized sessions - - Add `unset` option to control unsetting `req.session` - - Generate session IDs with `rand-token` by default; reduce collisions - - Integrate with express "trust proxy" by default - - deps: buffer-crc32@0.2.3 - - deps: debug@1.0.2 - * deps: multiparty@3.2.9 - * deps: serve-index@1.1.2 - - deps: batch@0.5.1 - * deps: type-is@1.3.0 - - improve type parsing - * deps: vhost@2.0.0 - - Accept `RegExp` object for `hostname` - - Provide `req.vhost` object - - Support IPv6 literal in `Host` header - -2.19.6 / 2014-06-11 -=================== - - * deps: body-parser@1.3.1 - - deps: type-is@1.2.1 - * deps: compression@1.0.7 - - use vary module for better `Vary` behavior - - deps: accepts@1.0.3 - - deps: compressible@1.1.0 - * deps: debug@1.0.2 - * deps: serve-index@1.1.1 - - deps: accepts@1.0.3 - * deps: serve-static@1.2.3 - - Do not throw un-catchable error on file open race condition - - deps: send@0.4.3 - -2.19.5 / 2014-06-09 -=================== - - * deps: csurf@1.2.1 - - refactor to use csrf-tokens@~1.0.2 - * deps: debug@1.0.1 - * deps: serve-static@1.2.2 - - fix "event emitter leak" warnings - - deps: send@0.4.2 - * deps: type-is@1.2.1 - - Switch dependency from `mime` to `mime-types@1.0.0` - -2.19.4 / 2014-06-05 -=================== - - * deps: errorhandler@1.0.2 - - Pass on errors from reading error files - * deps: method-override@2.0.2 - - use vary module for better `Vary` behavior - * deps: serve-favicon@2.0.1 - - Reduce byte size of `ETag` header - -2.19.3 / 2014-06-03 -=================== - - * deps: compression@1.0.6 - - fix listeners for delayed stream creation - - fix regression for certain `stream.pipe(res)` situations - - fix regression when negotiation fails - -2.19.2 / 2014-06-03 -=================== - - * deps: compression@1.0.4 - - fix adding `Vary` when value stored as array - - fix back-pressure behavior - - fix length check for `res.end` - -2.19.1 / 2014-06-02 -=================== - - * fix deprecated `utils.escape` - -2.19.0 / 2014-06-02 -=================== - - * deprecate `methodOverride()` -- use `method-override` npm module instead - * deps: body-parser@1.3.0 - - add `extended` option to urlencoded parser - * deps: method-override@2.0.1 - - set `Vary` header - - deps: methods@1.0.1 - * deps: multiparty@3.2.8 - * deps: response-time@2.0.0 - - add `digits` argument - - do not override existing `X-Response-Time` header - - timer not subject to clock drift - - timer resolution down to nanoseconds - * deps: serve-static@1.2.1 - - send max-age in Cache-Control in correct format - - use `escape-html` for escaping - - deps: send@0.4.1 - -2.18.0 / 2014-05-29 -=================== - - * deps: compression@1.0.3 - * deps: serve-index@1.1.0 - - Fix content negotiation when no `Accept` header - - Properly support all HTTP methods - - Support vanilla node.js http servers - - Treat `ENAMETOOLONG` as code 414 - - Use accepts for negotiation - * deps: serve-static@1.2.0 - - Calculate ETag with md5 for reduced collisions - - Fix wrong behavior when index file matches directory - - Ignore stream errors after request ends - - Skip directories in index file search - - deps: send@0.4.0 - -2.17.3 / 2014-05-27 -=================== - - * deps: express-session@1.2.1 - - Fix `resave` such that `resave: true` works - -2.17.2 / 2014-05-27 -=================== - - * deps: body-parser@1.2.2 - - invoke `next(err)` after request fully read - - deps: raw-body@1.1.6 - * deps: method-override@1.0.2 - - Handle `req.body` key referencing array or object - - Handle multiple HTTP headers - -2.17.1 / 2014-05-21 -=================== - - * fix `res.charset` appending charset when `content-type` has one - -2.17.0 / 2014-05-20 -=================== - - * deps: express-session@1.2.0 - - Add `resave` option to control saving unmodified sessions - * deps: morgan@1.1.1 - - "dev" format will use same tokens as other formats - - `:response-time` token is now empty when immediate used - - `:response-time` token is now monotonic - - `:response-time` token has precision to 1 μs - - fix `:status` + immediate output in node.js 0.8 - - improve `buffer` option to prevent indefinite event loop holding - - simplify method to get remote address - - deps: bytes@1.0.0 - * deps: serve-index@1.0.3 - - Fix error from non-statable files in HTML view - -2.16.2 / 2014-05-18 -=================== - - * fix edge-case in `res.appendHeader` that would append in wrong order - * deps: method-override@1.0.1 - -2.16.1 / 2014-05-17 -=================== - - * remove usages of `res.headerSent` from core - -2.16.0 / 2014-05-17 -=================== - - * deprecate `res.headerSent` -- use `res.headersSent` - * deprecate `res.on("header")` -- use on-headers module instead - * fix `connect.version` to reflect the actual version - * json: use body-parser - - add `type` option - - fix repeated limit parsing with every request - - improve parser speed - * urlencoded: use body-parser - - add `type` option - - fix repeated limit parsing with every request - * dep: bytes@1.0.0 - * add negative support - * dep: cookie-parser@1.1.0 - - deps: cookie@0.1.2 - * dep: csurf@1.2.0 - - add support for double-submit cookie - * dep: express-session@1.1.0 - - Add `name` option; replacement for `key` option - - Use `setImmediate` in MemoryStore for node.js >= 0.10 - -2.15.0 / 2014-05-04 -=================== - - * Add simple `res.cookie` support - * Add `res.appendHeader` - * Call error stack even when response has been sent - * Patch `res.headerSent` to return Boolean - * Patch `res.headersSent` for node.js 0.8 - * Prevent default 404 handler after response sent - * dep: compression@1.0.2 - * support headers given to `res.writeHead` - * deps: bytes@0.3.0 - * deps: negotiator@0.4.3 - * dep: connect-timeout@1.1.0 - * Add `req.timedout` property - * Add `respond` option to constructor - * Clear timer on socket destroy - * deps: debug@0.8.1 - * dep: debug@^0.8.0 - * add `enable()` method - * change from stderr to stdout - * dep: errorhandler@1.0.1 - * Clean up error CSS - * Do not respond after headers sent - * dep: express-session@1.0.4 - * Remove import of `setImmediate` - * Use `res.cookie()` instead of `res.setHeader()` - * deps: cookie@0.1.2 - * deps: debug@0.8.1 - * dep: morgan@1.0.1 - * Make buffer unique per morgan instance - * deps: bytes@0.3.0 - * dep: serve-favicon@2.0.0 - * Accept `Buffer` of icon as first argument - * Non-GET and HEAD requests are denied - * Send valid max-age value - * Support conditional requests - * Support max-age=0 - * Support OPTIONS method - * Throw if `path` argument is directory - * dep: serve-index@1.0.2 - * Add stylesheet option - * deps: negotiator@0.4.3 - -2.14.5 / 2014-04-24 -=================== - - * dep: raw-body@1.1.4 - * allow true as an option - * deps: bytes@0.3.0 - * dep: serve-static@1.1.0 - * Accept options directly to `send` module - * deps: send@0.3.0 - -2.14.4 / 2014-04-07 -=================== - - * dep: bytes@0.3.0 - * added terabyte support - * dep: csurf@1.1.0 - * add constant-time string compare - * dep: serve-static@1.0.4 - * Resolve relative paths at middleware setup - * Use parseurl to parse the URL from request - * fix node.js 0.8 compatibility with memory session - -2.14.3 / 2014-03-18 -=================== - - * dep: static-favicon@1.0.2 - * Fixed content of default icon - -2.14.2 / 2014-03-11 -=================== - - * dep: static-favicon@1.0.1 - * Fixed path to default icon - -2.14.1 / 2014-03-06 -=================== - - * dep: fresh@0.2.2 - * no real changes - * dep: serve-index@1.0.1 - * deps: negotiator@0.4.2 - * dep: serve-static@1.0.2 - * deps: send@0.2.0 - -2.14.0 / 2014-03-05 -=================== - - * basicAuth: use basic-auth-connect - * cookieParser: use cookie-parser - * compress: use compression - * csrf: use csurf - * dep: cookie-signature@1.0.3 - * directory: use serve-index - * errorHandler: use errorhandler - * favicon: use static-favicon - * logger: use morgan - * methodOverride: use method-override - * responseTime: use response-time - * session: use express-session - * static: use serve-static - * timeout: use connect-timeout - * vhost: use vhost - -2.13.1 / 2014-03-05 -=================== - - * cookieSession: compare full value rather than crc32 - * deps: raw-body@1.1.3 - -2.13.0 / 2014-02-14 -=================== - - * fix typo in memory store warning #974 @rvagg - * compress: use compressible - * directory: add template option #990 @gottaloveit @Earl-Brown - * csrf: prevent deprecated warning with old sessions - -2.12.0 / 2013-12-10 -=================== - - * bump qs - * directory: sort folders before files - * directory: add folder icons - * directory: de-duplicate icons, details/mobile views #968 @simov - * errorHandler: end default 404 handler with a newline #972 @rlidwka - * session: remove long cookie expire check #870 @undoZen - -2.11.2 / 2013-12-01 -=================== - - * bump raw-body - -2.11.1 / 2013-11-27 -=================== - - * bump raw-body - * errorHandler: use `res.setHeader()` instead of `res.writeHead()` #949 @lo1tuma - -2.11.0 / 2013-10-29 -=================== - - * update bytes - * update uid2 - * update negotiator - * sessions: add rolling session option #944 @ilmeo - * sessions: property set cookies when given FQDN - * cookieSessions: properly set cookies when given FQDN #948 @bmancini55 - * proto: fix FQDN mounting when multiple handlers #945 @bmancini55 - -2.10.1 / 2013-10-23 -=================== - - * fixed; fixed a bug with static middleware at root and trailing slashes #942 (@dougwilson) - -2.10.0 / 2013-10-22 -=================== - - * fixed: set headers written by writeHead before emitting 'header' - * fixed: mounted path should ignore querystrings on FQDNs #940 (@dougwilson) - * fixed: parsing protocol-relative URLs with @ as pathnames #938 (@dougwilson) - * fixed: fix static directory redirect for mount's root #937 (@dougwilson) - * fixed: setting set-cookie header when mixing arrays and strings #893 (@anuj123) - * bodyParser: optional verify function for urlencoded and json parsers for signing request bodies - * compress: compress checks content-length to check threshold - * compress: expose `res.flush()` for flushing responses - * cookieParser: pass options into node-cookie #803 (@cauldrath) - * errorHandler: replace `\n`s with `
`s in error handler - -2.9.2 / 2013-10-18 -================== - - * warn about multiparty and limit middleware deprecation for v3 - * fix fully qualified domain name mounting. #920 (@dougwilson) - * directory: Fix potential security issue with serving files outside the root. #929 (@dougwilson) - * logger: store IP at beginning in case socket prematurely closes #930 (@dougwilson) - -2.9.1 / 2013-10-15 -================== - - * update multiparty - * compress: Set vary header only if Content-Type passes filter #904 - * directory: Fix directory middleware URI escaping #917 (@dougwilson) - * directory: Fix directory seperators for Windows #914 (@dougwilson) - * directory: Keep query string intact during directory redirect #913 (@dougwilson) - * directory: Fix paths in links #730 (@JacksonTian) - * errorHandler: Don't escape text/plain as HTML #875 (@johan) - * logger: Write '0' instead of '-' when response time is zero #910 (@dougwilson) - * logger: Log even when connections are aborted #760 (@dylanahsmith) - * methodOverride: Check req.body is an object #907 (@kbjr) - * multipart: Add .type back to file parts for backwards compatibility #912 (@dougwilson) - * multipart: Allow passing options to the Multiparty constructor #902 (@niftylettuce) - -2.9.0 / 2013-09-07 -================== - - * multipart: add docs regarding tmpfiles - * multipart: add .name back to file parts - * multipart: use multiparty instead of formidable - -2.8.8 / 2013-09-02 -================== - - * csrf: change to math.random() salt and remove csrfToken() callback - -2.8.7 / 2013-08-28 -================== - - * csrf: prevent salt generation on every request, and add async req.csrfToken(fn) - -2.8.6 / 2013-08-28 -================== - - * csrf: refactor to use HMAC tokens (BREACH attack) - * compress: add compression of SVG and common font files by default. - -2.8.5 / 2013-08-11 -================== - - * add: compress Dart source files by default - * update fresh - -2.8.4 / 2013-07-08 -================== - - * update send - -2.8.3 / 2013-07-04 -================== - - * add a name back to static middleware ("staticMiddleware") - * fix .hasBody() utility to require transfer-encoding or content-length - -2.8.2 / 2013-07-03 -================== - - * update send - * update cookie dep. - * add better debug() for middleware - * add whitelisting of supported methods to methodOverride() - -2.8.1 / 2013-06-27 -================== - - * fix: escape req.method in 404 response - -2.8.0 / 2013-06-26 -================== - - * add `threshold` option to `compress()` to prevent compression of small responses - * add support for vendor JSON mime types in json() - * add X-Forwarded-Proto initial https proxy support - * change static redirect to 303 - * change octal escape sequences for strict mode - * change: replace utils.uid() with uid2 lib - * remove other "static" function name. Fixes #794 - * fix: hasBody() should return false if Content-Length: 0 - -2.7.11 / 2013-06-02 -================== - - * update send - -2.7.10 / 2013-05-21 -================== - - * update qs - * update formidable - * fix: write/end to noop() when request aborted - -2.7.9 / 2013-05-07 -================== - - * update qs - * drop support for node < v0.8 - -2.7.8 / 2013-05-03 -================== - - * update qs - -2.7.7 / 2013-04-29 -================== - - * update qs dependency - * remove "static" function name. Closes #794 - * update node-formidable - * update buffer-crc32 - -2.7.6 / 2013-04-15 -================== - - * revert cookie signature which was creating session race conditions - -2.7.5 / 2013-04-12 -================== - - * update cookie-signature - * limit: do not consume request in node 0.10.x - -2.7.4 / 2013-04-01 -================== - - * session: add long expires check and prevent excess set-cookie - * session: add console.error() of session#save() errors - -2.7.3 / 2013-02-19 -================== - - * add name to compress middleware - * add appending Accept-Encoding to Vary when set but missing - * add tests for csrf middleware - * add 'next' support for connect() server handler - * change utils.uid() to return url-safe chars. Closes #753 - * fix treating '.' as a regexp in vhost() - * fix duplicate bytes dep in package.json. Closes #743 - * fix #733 - parse x-forwarded-proto in a more generally compatibly way - * revert "add support for `next(status[, msg])`"; makes composition hard - -2.7.2 / 2013-01-04 -================== - - * add support for `next(status[, msg])` back - * add utf-8 meta tag to support foreign characters in filenames/directories - * change `timeout()` 408 to 503 - * replace 'node-crc' with 'buffer-crc32', fixes licensing - * fix directory.html IE support - -2.7.1 / 2012-12-05 -================== - - * add directory() tests - * add support for bodyParser to ignore Content-Type if no body is present (jquery primarily does this poorely) - * fix errorHandler signature - -2.7.0 / 2012-11-13 -================== - - * add support for leading JSON whitespace - * add logging of `req.ip` when present - * add basicAuth support for `:`-delimited string - * update cookie module. Closes #688 - -2.6.2 / 2012-11-01 -================== - - * add `debug()` for disconnected session store - * fix session regeneration bug. Closes #681 - -2.6.1 / 2012-10-25 -================== - - * add passing of `connect.timeout()` errors to `next()` - * replace signature utils with cookie-signature module - -2.6.0 / 2012-10-09 -================== - - * add `defer` option to `multipart()` [Blake Miner] - * fix mount path case sensitivity. Closes #663 - * fix default of ascii encoding from `logger()`, now utf8. Closes #293 - -2.5.0 / 2012-09-27 -================== - - * add `err.status = 400` to multipart() errors - * add double-encoding protection to `compress()`. Closes #659 - * add graceful handling cookie parsing errors [shtylman] - * fix typo X-Response-time to X-Response-Time - -2.4.6 / 2012-09-18 -================== - - * update qs - -2.4.5 / 2012-09-03 -================== - - * add session store "connect" / "disconnect" support [louischatriot] - * fix `:url` log token - -2.4.4 / 2012-08-21 -================== - - * fix `static()` pause regression from "send" integration - -2.4.3 / 2012-08-07 -================== - - * fix `.write()` encoding for zlib inconstancy. Closes #561 - -2.4.2 / 2012-07-25 -================== - - * remove limit default from `urlencoded()` - * remove limit default from `json()` - * remove limit default from `multipart()` - * fix `cookieSession()` clear cookie path / domain bug. Closes #636 - -2.4.1 / 2012-07-24 -================== - - * fix `options` mutation in `static()` - -2.4.0 / 2012-07-23 -================== - - * add `connect.timeout()` - * add __GET__ / __HEAD__ check to `directory()`. Closes #634 - * add "pause" util dep - * update send dep for normalization bug - -2.3.9 / 2012-07-16 -================== - - * add more descriptive invalid json error message - * update send dep for root normalization regression - * fix staticCache fresh dep - -2.3.8 / 2012-07-12 -================== - - * fix `connect.static()` 404 regression, pass `next()`. Closes #629 - -2.3.7 / 2012-07-05 -================== - - * add `json()` utf-8 illustration test. Closes #621 - * add "send" dependency - * change `connect.static()` internals to use "send" - * fix `session()` req.session generation with pathname mismatch - * fix `cookieSession()` req.session generation with pathname mismatch - * fix mime export. Closes #618 - -2.3.6 / 2012-07-03 -================== - - * Fixed cookieSession() with cookieParser() secret regression. Closes #602 - * Fixed set-cookie header fields on cookie.path mismatch. Closes #615 - -2.3.5 / 2012-06-28 -================== - - * Remove `logger()` mount check - * Fixed `staticCache()` dont cache responses with set-cookie. Closes #607 - * Fixed `staticCache()` when Cookie is present - -2.3.4 / 2012-06-22 -================== - - * Added `err.buf` to urlencoded() and json() - * Update cookie to 0.0.4. Closes #604 - * Fixed: only send 304 if original response in 2xx or 304 [timkuijsten] - -2.3.3 / 2012-06-11 -================== - - * Added ETags back to `static()` [timkuijsten] - * Replaced `utils.parseRange()` with `range-parser` module - * Replaced `utils.parseBytes()` with `bytes` module - * Replaced `utils.modified()` with `fresh` module - * Fixed `cookieSession()` regression with invalid cookie signing [shtylman] - -2.3.2 / 2012-06-08 -================== - - * expose mime module - * Update crc dep (which bundled nodeunit) - -2.3.1 / 2012-06-06 -================== - - * Added `secret` option to `cookieSession` middleware [shtylman] - * Added `secret` option to `session` middleware [shtylman] - * Added `req.remoteUser` back to `basicAuth()` as alias of `req.user` - * Performance: improve signed cookie parsing - * Update `cookie` dependency [shtylman] - -2.3.0 / 2012-05-20 -================== - - * Added limit option to `json()` - * Added limit option to `urlencoded()` - * Added limit option to `multipart()` - * Fixed: remove socket error event listener on callback - * Fixed __ENOTDIR__ error on `static` middleware - -2.2.2 / 2012-05-07 -================== - - * Added support to csrf middle for pre-flight CORS requests - * Updated `engines` to allow newer version of node - * Removed duplicate repo prop. Closes #560 - -2.2.1 / 2012-04-28 -================== - - * Fixed `static()` redirect when mounted. Closes #554 - -2.2.0 / 2012-04-25 -================== - - * Added `make benchmark` - * Perf: memoize url parsing (~20% increase) - * Fixed `connect(fn, fn2, ...)`. Closes #549 - -2.1.3 / 2012-04-20 -================== - - * Added optional json() `reviver` function to be passed to JSON.parse [jed] - * Fixed: emit drain in compress middleware [nsabovic] - -2.1.2 / 2012-04-11 -================== - - * Fixed cookieParser() `req.cookies` regression - -2.1.1 / 2012-04-11 -================== - - * Fixed `session()` browser-session length cookies & examples - * Fixed: make `query()` "self-aware" [jed] - -2.1.0 / 2012-04-05 -================== - - * Added `debug()` calls to `.use()` (`DEBUG=connect:displatcher`) - * Added `urlencoded()` support for GET - * Added `json()` support for GET. Closes #497 - * Added `strict` option to `json()` - * Changed: `session()` only set-cookie when modified - * Removed `Session#lastAccess` property. Closes #399 - -2.0.3 / 2012-03-20 -================== - - * Added: `cookieSession()` only sets cookie on change. Closes #442 - * Added `connect:dispatcher` debug() probes - -2.0.2 / 2012-03-04 -================== - - * Added test for __ENAMETOOLONG__ now that node is fixed - * Fixed static() index "/" check on windows. Closes #498 - * Fixed Content-Range behaviour to match RFC2616 [matthiasdg / visionmedia] - -2.0.1 / 2012-02-29 -================== - - * Added test coverage for `vhost()` middleware - * Changed `cookieParser()` signed cookie support to use SHA-2 [senotrusov] - * Fixed `static()` Range: respond with 416 when unsatisfiable - * Fixed `vhost()` middleware. Closes #494 - -2.0.0 / 2011-10-05 -================== - - * Added `cookieSession()` middleware for cookie-only sessions - * Added `compress()` middleware for gzip / deflate support - * Added `session()` "proxy" setting to trust `X-Forwarded-Proto` - * Added `json()` middleware to parse "application/json" - * Added `urlencoded()` middleware to parse "application/x-www-form-urlencoded" - * Added `multipart()` middleware to parse "multipart/form-data" - * Added `cookieParser(secret)` support so anything using this middleware may access signed cookies - * Added signed cookie support to `cookieParser()` - * Added support for JSON-serialized cookies to `cookieParser()` - * Added `err.status` support in Connect's default end-point - * Added X-Cache MISS / HIT to `staticCache()` - * Added public `res.headerSent` checking nodes `res._headerSent` until node does - * Changed `basicAuth()` req.remoteUser to req.user - * Changed: default `session()` to a browser-session cookie. Closes #475 - * Changed: no longer lowercase cookie names - * Changed `bodyParser()` to use `json()`, `urlencoded()`, and `multipart()` - * Changed: `errorHandler()` is now a development-only middleware - * Changed middleware to `next()` errors when possible so applications can unify logging / handling - * Removed `http[s].Server` inheritance, now just a function, making it easy to have an app providing both http and https - * Removed `.createServer()` (use `connect()`) - * Removed `secret` option from `session()`, use `cookieParser(secret)` - * Removed `connect.session.ignore` array support - * Removed `router()` middleware. Closes #262 - * Fixed: set-cookie only once for browser-session cookies - * Fixed FQDN support. dont add leading "/" - * Fixed 404 XSS attack vector. Closes #473 - * Fixed __HEAD__ support for 404s and 500s generated by Connect's end-point - -1.8.5 / 2011-12-22 -================== - - * Fixed: actually allow empty body for json - -1.8.4 / 2011-12-22 -================== - - * Changed: allow empty body for json/urlencoded requests. Backport for #443 - -1.8.3 / 2011-12-16 -================== - - * Fixed `static()` _index.html_ support on windows - -1.8.2 / 2011-12-03 -================== - - * Fixed potential security issue, store files in req.files. Closes #431 [reported by dobesv] - -1.8.1 / 2011-11-21 -================== - - * Added nesting support for _multipart/form-data_ [jackyz] - -1.8.0 / 2011-11-17 -================== - - * Added _multipart/form-data_ support to `bodyParser()` using formidable - -1.7.3 / 2011-11-11 -================== - - * Fixed `req.body`, always default to {} - * Fixed HEAD support for 404s and 500s - -1.7.2 / 2011-10-24 -================== - - * "node": ">= 0.4.1 < 0.7.0" - * Added `static()` redirect option. Closes #398 - * Changed `limit()`: respond with 413 when content-length exceeds the limit - * Removed socket error listener in static(). Closes #389 - * Fixed `staticCache()` Age header field - * Fixed race condition causing errors reported in #329. - -1.7.1 / 2011-09-12 -================== - - * Added: make `Store` inherit from `EventEmitter` - * Added session `Store#load(sess, fn)` to fetch a `Session` instance - * Added backpressure support to `staticCache()` - * Changed `res.socket.destroy()` to `req.socket.destroy()` - -1.7.0 / 2011-08-31 -================== - - * Added `staticCache()` middleware, a memory cache for `static()` - * Added public `res.headerSent` checking nodes `res._headerSent` (remove when node adds this) - * Changed: ignore error handling middleware when header is sent - * Changed: dispatcher errors after header is sent destroy the sock - -1.6.4 / 2011-08-26 -================== - - * Revert "Added double-next reporting" - -1.6.3 / 2011-08-26 -================== - - * Added double-`next()` reporting - * Added `immediate` option to `logger()`. Closes #321 - * Dependency `qs >= 0.3.1` - -1.6.2 / 2011-08-11 -================== - - * Fixed `connect.static()` null byte vulnerability - * Fixed `connect.directory()` null byte vulnerability - * Changed: 301 redirect in `static()` to postfix "/" on directory. Closes #289 - -1.6.1 / 2011-08-03 -================== - - * Added: allow retval `== null` from logger callback to ignore line - * Added `getOnly` option to `connect.static.send()` - * Added response "header" event allowing augmentation - * Added `X-CSRF-Token` header field check - * Changed dep `qs >= 0.3.0` - * Changed: persist csrf token. Closes #322 - * Changed: sort directory middleware files alphabetically - -1.6.0 / 2011-07-10 -================== - - * Added :response-time to "dev" logger format - * Added simple `csrf()` middleware. Closes #315 - * Fixed `res._headers` logger regression. Closes #318 - * Removed support for multiple middleware being passed to `.use()` - -1.5.2 / 2011-07-06 -================== - - * Added `filter` function option to `directory()` [David Rio Deiros] - * Changed: re-write of the `logger()` middleware, with extensible tokens and formats - * Changed: `static.send()` ".." in path without root considered malicious - * Fixed quotes in docs. Closes #312 - * Fixed urls when mounting `directory()`, use `originalUrl` [Daniel Dickison] - - -1.5.1 / 2011-06-20 -================== - - * Added malicious path check to `directory()` middleware - * Added `utils.forbidden(res)` - * Added `connect.query()` middleware - -1.5.0 / 2011-06-20 -================== - - * Added `connect.directory()` middleware for serving directory listings - -1.4.6 / 2011-06-18 -================== - - * Fixed `connect.static()` root with `..` - * Fixed `connect.static()` __EBADF__ - -1.4.5 / 2011-06-17 -================== - - * Fixed EBADF in `connect.static()`. Closes #297 - -1.4.4 / 2011-06-16 -================== - - * Changed `connect.static()` to check resolved dirname. Closes #294 - -1.4.3 / 2011-06-06 -================== - - * Fixed fd leak in `connect.static()` when the socket is closed - * Fixed; `bodyParser()` ignoring __GET/HEAD__. Closes #285 - -1.4.2 / 2011-05-27 -================== - - * Changed to `devDependencies` - * Fixed stream creation on `static()` __HEAD__ request. [Andreas Lind Petersen] - * Fixed Win32 support for `static()` - * Fixed monkey-patch issue. Closes #261 - -1.4.1 / 2011-05-08 -================== - - * Added "hidden" option to `static()`. ignores hidden files by default. Closes * Added; expose `connect.static.mime.define()`. Closes #251 - * Fixed `errorHandler` middleware for missing stack traces. [aseemk] -#274 - -1.4.0 / 2011-04-25 -================== - - * Added route-middleware `next('route')` support to jump passed the route itself - * Added Content-Length support to `limit()` - * Added route-specific middleware support (used to be in express) - * Changed; refactored duplicate session logic - * Changed; prevent redefining `store.generate` per request - * Fixed; `static()` does not set Content-Type when explicitly set [nateps] - * Fixed escape `errorHandler()` {error} contents - * NOTE: `router` will be removed in 2.0 - - -1.3.0 / 2011-04-06 -================== - - * Added `router.remove(path[, method])` to remove a route - -1.2.3 / 2011-04-05 -================== - - * Fixed basicAuth realm issue when passing strings. Closes #253 - -1.2.2 / 2011-04-05 -================== - - * Added `basicAuth(username, password)` support - * Added `errorHandler.title` defaulting to "Connect" - * Changed `errorHandler` css - -1.2.1 / 2011-03-30 -================== - - * Fixed `logger()` https `remoteAddress` logging [Alexander Simmerl] - -1.2.0 / 2011-03-30 -================== - - * Added `router.lookup(path[, method])` - * Added `router.match(url[, method])` - * Added basicAuth async support. Closes #223 - -1.1.5 / 2011-03-27 -================== - - * Added; allow `logger()` callback function to return an empty string to ignore logging - * Fixed; utilizing `mime.charsets.lookup()` for `static()`. Closes 245 - -1.1.4 / 2011-03-23 -================== - - * Added `logger()` support for format function - * Fixed `logger()` to support mess of writeHead()/progressive api for node 0.4.x - -1.1.3 / 2011-03-21 -================== - - * Changed; `limit()` now calls `req.destroy()` - -1.1.2 / 2011-03-21 -================== - - * Added request "limit" event to `limit()` middleware - * Changed; `limit()` middleware will `next(err)` on failure - -1.1.1 / 2011-03-18 -================== - - * Fixed session middleware for HTTPS. Closes #241 [reported by mt502] - -1.1.0 / 2011-03-17 -================== - - * Added `Session#reload(fn)` - -1.0.6 / 2011-03-09 -================== - - * Fixed `res.setHeader()` patch, preserve casing - -1.0.5 / 2011-03-09 -================== - - * Fixed; `logger()` using `req.originalUrl` instead of `req.url` - -1.0.4 / 2011-03-09 -================== - - * Added `res.charset` - * Added conditional sessions example - * Added support for `session.ignore` to be replaced. Closes #227 - * Fixed `Cache-Control` delimiters. Closes #228 - -1.0.3 / 2011-03-03 -================== - - * Fixed; `static.send()` invokes callback with connection error - -1.0.2 / 2011-03-02 -================== - - * Fixed exported connect function - * Fixed package.json; node ">= 0.4.1 < 0.5.0" - -1.0.1 / 2011-03-02 -================== - - * Added `Session#save(fn)`. Closes #213 - * Added callback support to `connect.static.send()` for express - * Added `connect.static.send()` "path" option - * Fixed content-type in `static()` for _index.html_ - -1.0.0 / 2011-03-01 -================== - - * Added `stack`, `message`, and `dump` errorHandler option aliases - * Added `req.originalMethod` to methodOverride - * Added `favicon()` maxAge option support - * Added `connect()` alternative to `connect.createServer()` - * Added new [documentation](http://senchalabs.github.com/connect) - * Added Range support to `static()` - * Added HTTPS support - * Rewrote session middleware. The session API now allows for - session-specific cookies, so you may alter each individually. - Click to view the new [session api](http://senchalabs.github.com/connect/middleware-session.html). - * Added middleware self-awareness. This helps prevent - middleware breakage when used within mounted servers. - For example `cookieParser()` will not parse cookies more - than once even when within a mounted server. - * Added new examples in the `./examples` directory - * Added [limit()](http://senchalabs.github.com/connect/middleware-limit.html) middleware - * Added [profiler()](http://senchalabs.github.com/connect/middleware-profiler.html) middleware - * Added [responseTime()](http://senchalabs.github.com/connect/middleware-responseTime.html) middleware - * Renamed `staticProvider` to `static` - * Renamed `bodyDecoder` to `bodyParser` - * Renamed `cookieDecoder` to `cookieParser` - * Fixed ETag quotes. [reported by papandreou] - * Fixed If-None-Match comma-delimited ETag support. [reported by papandreou] - * Fixed; only set req.originalUrl once. Closes #124 - * Fixed symlink support for `static()`. Closes #123 - -0.5.10 / 2011-02-14 -================== - - * Fixed SID space issue. Closes #196 - * Fixed; proxy `res.end()` to commit session data - * Fixed directory traversal attack in `staticProvider`. Closes #198 - -0.5.9 / 2011-02-09 -================== - - * qs >= 0.0.4 - -0.5.8 / 2011-02-04 -================== - - * Added `qs` dependency - * Fixed router race-condition causing possible failure - when `next()`ing to one or more routes with parallel - requests - -0.5.7 / 2011-02-01 -================== - - * Added `onvhost()` call so Express (and others) can know when they are - * Revert "Added stylus support" (use the middleware which ships with stylus) - * Removed custom `Server#listen()` to allow regular `http.Server#listen()` args to work properly - * Fixed long standing router issue (#83) that causes '.' to be disallowed within named placeholders in routes [Andreas Lind Petersen] - * Fixed `utils.uid()` length error [Jxck] -mounted - -0.5.6 / 2011-01-23 -================== - - * Added stylus support to `compiler` - * _favicon.js_ cleanup - * _compiler.js_ cleanup - * _bodyDecoder.js_ cleanup - -0.5.5 / 2011-01-13 -================== - - * Changed; using sha256 HMAC instead of md5. [Paul Querna] - * Changed; generated a longer random UID, without time influence. [Paul Querna] - * Fixed; session middleware throws when secret is not present. [Paul Querna] - -0.5.4 / 2011-01-07 -================== - - * Added; throw when router path or callback is missing - * Fixed; `next(err)` on cookie parse exception instead of ignoring - * Revert "Added utils.pathname(), memoized url.parse(str).pathname" - -0.5.3 / 2011-01-05 -================== - - * Added _docs/api.html_ - * Added `utils.pathname()`, memoized url.parse(str).pathname - * Fixed `session.id` issue. Closes #183 - * Changed; Defaulting `staticProvider` maxAge to 0 not 1 year. Closes #179 - * Removed bad outdated docs, we need something new / automated eventually - -0.5.2 / 2010-12-28 -================== - - * Added default __OPTIONS__ support to _router_ middleware - -0.5.1 / 2010-12-28 -================== - - * Added `req.session.id` mirroring `req.sessionID` - * Refactored router, exposing `connect.router.methods` - * Exclude non-lib files from npm - * Removed imposed headers `X-Powered-By`, `Server`, etc - -0.5.0 / 2010-12-06 -================== - - * Added _./index.js_ - * Added route segment precondition support and example - * Added named capture group support to router - -0.4.0 / 2010-11-29 -================== - - * Added `basicAuth` middleware - * Added more HTTP methods to the `router` middleware - -0.3.0 / 2010-07-21 -================== - - * Added _staticGzip_ middleware - * Added `connect.utils` to expose utils - * Added `connect.session.Session` - * Added `connect.session.Store` - * Added `connect.session.MemoryStore` - * Added `connect.middleware` to expose the middleware getters - * Added `buffer` option to _logger_ for performance increase - * Added _favicon_ middleware for serving your own favicon or the connect default - * Added option support to _staticProvider_, can now pass _root_ and _lifetime_. - * Added; mounted `Server` instances now have the `route` property exposed for reflection - * Added support for callback as first arg to `Server#use()` - * Added support for `next(true)` in _router_ to bypass match attempts - * Added `Server#listen()` _host_ support - * Added `Server#route` when `Server#use()` is called with a route on a `Server` instance - * Added _methodOverride_ X-HTTP-Method-Override support - * Refactored session internals, adds _secret_ option - * Renamed `lifetime` option to `maxAge` in _staticProvider_ - * Removed connect(1), it is now [spark(1)](http://github.com/senchalabs/spark) - * Removed connect(1) dependency on examples, they can all now run with node(1) - * Remove a typo that was leaking a global. - * Removed `Object.prototype` forEach() and map() methods - * Removed a few utils not used - * Removed `connect.createApp()` - * Removed `res.simpleBody()` - * Removed _format_ middleware - * Removed _flash_ middleware - * Removed _redirect_ middleware - * Removed _jsonrpc_ middleware, use [visionmedia/connect-jsonrpc](http://github.com/visionmedia/connect-jsonrpc) - * Removed _pubsub_ middleware - * Removed need for `params.{captures,splat}` in _router_ middleware, `params` is an array - * Changed; _compiler_ no longer 404s - * Changed; _router_ signature now matches connect middleware signature - * Fixed a require in _session_ for default `MemoryStore` - * Fixed nasty request body bug in _router_. Closes #54 - * Fixed _less_ support in _compiler_ - * Fixed bug preventing proper bubbling of exceptions in mounted servers - * Fixed bug in `Server#use()` preventing `Server` instances as the first arg - * Fixed **ENOENT** special case, is now treated as any other exception - * Fixed spark env support - -0.2.1 / 2010-07-09 -================== - - * Added support for _router_ `next()` to continue calling matched routes - * Added mime type for _cache.manifest_ files. - * Changed _compiler_ middleware to use async require - * Changed session api, stores now only require `#get()`, and `#set()` - * Fixed _cacheManifest_ by adding `utils.find()` back - -0.2.0 / 2010-07-01 -================== - - * Added calls to `Session()` casts the given object as a `Session` instance - * Added passing of `next()` to _router_ callbacks. Closes #46 - * Changed; `MemoryStore#destroy()` removes `req.session` - * Changed `res.redirect("back")` to default to "/" when Referr?er is not present - * Fixed _staticProvider_ urlencoded paths issue. Closes #47 - * Fixed _staticProvider_ middleware responding to **GET** requests - * Fixed _jsonrpc_ middleware `Accept` header check. Closes #43 - * Fixed _logger_ format option - * Fixed typo in _compiler_ middleware preventing the _dest_ option from working - -0.1.0 / 2010-06-25 -================== - - * Revamped the api, view the [Connect documentation](http://extjs.github.com/Connect/index.html#Middleware-Authoring) for more info (hover on the right for menu) - * Added [extended api docs](http://extjs.github.com/Connect/api.html) - * Added docs for several more middleware layers - * Added `connect.Server#use()` - * Added _compiler_ middleware which provides arbitrary static compilation - * Added `req.originalUrl` - * Removed _blog_ example - * Removed _sass_ middleware (use _compiler_) - * Removed _less_ middleware (use _compiler_) - * Renamed middleware to be camelcase, _body-decoder_ is now _bodyDecoder_ etc. - * Fixed `req.url` mutation bug when matching `connect.Server#use()` routes - * Fixed `mkdir -p` implementation used in _bin/connect_. Closes #39 - * Fixed bug in _bodyDecoder_ throwing exceptions on request empty bodies - * `make install` installing lib to $LIB_PREFIX aka $HOME/.node_libraries - -0.0.6 / 2010-06-22 -================== - - * Added _static_ middleware usage example - * Added support for regular expressions as paths for _router_ - * Added `util.merge()` - * Increased performance of _static_ by ~ 200 rps - * Renamed the _rest_ middleware to _router_ - * Changed _rest_ api to accept a callback function - * Removed _router_ middleware - * Removed _proto.js_, only `Object#forEach()` remains - -0.0.5 / 2010-06-21 -================== - - * Added Server#use() which contains the Layer normalization logic - * Added documentation for several middleware - * Added several new examples - * Added _less_ middleware - * Added _repl_ middleware - * Added _vhost_ middleware - * Added _flash_ middleware - * Added _cookie_ middleware - * Added _session_ middleware - * Added `utils.htmlEscape()` - * Added `utils.base64Decode()` - * Added `utils.base64Encode()` - * Added `utils.uid()` - * Added bin/connect app path and --config path support for .js suffix, although optional. Closes #26 - * Moved mime code to `utils.mime`, ex `utils.mime.types`, and `utils.mime.type()` - * Renamed req.redirect() to res.redirect(). Closes #29 - * Fixed _sass_ 404 on **ENOENT** - * Fixed +new Date duplication. Closes #24 - -0.0.4 / 2010-06-16 -================== - - * Added workerPidfile() to bin/connect - * Added --workers support to bin/connect stop and status commands - * Added _redirect_ middleware - * Added better --config support to bin/connect. All flags can be utilized - * Added auto-detection of _./config.js_ - * Added config example - * Added `net.Server` support to bin/connect - * Writing worker pids relative to `env.pidfile` - * s/parseQuery/parse/g - * Fixed npm support - -0.0.3 / 2010-06-16 -================== - - * Fixed node dependency in package.json, now _">= 0.1.98-0"_ to support __HEAD__ - -0.0.2 / 2010-06-15 -================== - - * Added `-V, --version` to bin/connect - * Added `utils.parseCookie()` - * Added `utils.serializeCookie()` - * Added `utils.toBoolean()` - * Added _sass_ middleware - * Added _cookie_ middleware - * Added _format_ middleware - * Added _lint_ middleware - * Added _rest_ middleware - * Added _./package.json_ (npm install connect) - * Added `handleError()` support - * Added `process.connectEnv` - * Added custom log format support to _log_ middleware - * Added arbitrary env variable support to bin/connect (ext: --logFormat ":method :url") - * Added -w, --workers to bin/connect - * Added bin/connect support for --user NAME and --group NAME - * Fixed url re-writing support - -0.0.1 / 2010-06-03 -================== - - * Initial release - diff --git a/node_modules/browser-sync/node_modules/connect/LICENSE b/node_modules/browser-sync/node_modules/connect/LICENSE deleted file mode 100644 index 6dd4c1c..0000000 --- a/node_modules/browser-sync/node_modules/connect/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2010 Sencha Inc. -Copyright (c) 2011 LearnBoost -Copyright (c) 2011-2014 TJ Holowaychuk - -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 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/node_modules/browser-sync/node_modules/connect/Readme.md b/node_modules/browser-sync/node_modules/connect/Readme.md deleted file mode 100644 index f169243..0000000 --- a/node_modules/browser-sync/node_modules/connect/Readme.md +++ /dev/null @@ -1,194 +0,0 @@ -# Connect - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] -[![Gittip][gittip-image]][gittip-url] - - Connect is an extensible HTTP server framework for [node](http://nodejs.org) using "plugins" known as _middleware_. - -```js -var connect = require('connect') -var http = require('http') - -var app = connect() - -// gzip/deflate outgoing responses -var compression = require('compression') -app.use(compression()) - -// store session state in browser cookie -var cookieSession = require('cookie-session') -app.use(cookieSession({ - keys: ['secret1', 'secret2'] -})) - -// parse urlencoded request bodies into req.body -var bodyParser = require('body-parser') -app.use(bodyParser.urlencoded()) - -// respond to all requests -app.use(function(req, res){ - res.end('Hello from Connect!\n'); -}) - -//create node.js http server and listen on port -http.createServer(app).listen(3000) -``` - -## Getting Started - -Connect is a simple framework to glue together various "middleware" to handle requests. - -### Install Connect - -```sh -$ npm install connect -``` - -### Create an app - -The main component is a Connect "app". This will store all the middleware -added and is, itself, a function. - -```js -var app = connect(); -``` - -### Use middleware - -The core of Connect is "using" middleware. Middleware are added as a "stack" -where incoming requests will execute each middleware one-by-one until a middleware -does not call `next()` within it. - -```js -app.use(function middleware1(req, res, next) { - // middleware 1 - next(); -}); -app.use(function middleware2(req, res, next) { - // middleware 2 - next(); -}); -``` - -### Mount middleware - -The `.use()` method also takes an optional path string that is matched against -the beginning of the incoming request URL. This allows for basic routing. - -```js -app.use('/foo', function fooMiddleware(req, res, next) { - // req.url starts with "/foo" - next(); -}); -app.use('/bar', function barMiddleware(req, res, next) { - // req.url starts with "/bar" - next(); -}); -``` - -### Error middleware - -There are special cases of "error-handling" middleware. There are middleware -where the function takes exactly 4 arguments. Errors that occur in the middleware -added before the error middleware will invoke this middleware when errors occur. - -```js -app.use(function onerror(err, req, res, next) { - // an error occurred! -}); -``` - -### Create a server from the app - -The last step is to actually use the Connect app in a server. The `.listen()` method -is a convenience to start a HTTP server. - -```js -var server = app.listen(port); -``` - -The app itself is really just a function with three arguments, so it can also be handed -to `.createServer()` in Node.js. - -```js -var server = http.createServer(app); -``` - -## Middleware - -These middleware and libraries are officially supported by the Connect/Express team: - - - [body-parser](https://github.com/expressjs/body-parser) - previous `bodyParser`, `json`, and `urlencoded`. You may also be interested in: - - [body](https://github.com/raynos/body) - - [co-body](https://github.com/visionmedia/co-body) - - [raw-body](https://github.com/stream-utils/raw-body) - - [compression](https://github.com/expressjs/compression) - previously `compress` - - [connect-timeout](https://github.com/expressjs/timeout) - previously `timeout` - - [cookie-parser](https://github.com/expressjs/cookie-parser) - previously `cookieParser` - - [cookie-session](https://github.com/expressjs/cookie-session) - previously `cookieSession` - - [csurf](https://github.com/expressjs/csurf) - previously `csrf` - - [errorhandler](https://github.com/expressjs/errorhandler) - previously `error-handler` - - [express-session](https://github.com/expressjs/session) - previously `session` - - [method-override](https://github.com/expressjs/method-override) - previously `method-override` - - [morgan](https://github.com/expressjs/morgan) - previously `logger` - - [response-time](https://github.com/expressjs/response-time) - previously `response-time` - - [serve-favicon](https://github.com/expressjs/serve-favicon) - previously `favicon` - - [serve-index](https://github.com/expressjs/serve-index) - previously `directory` - - [serve-static](https://github.com/expressjs/serve-static) - previously `static` - - [vhost](https://github.com/expressjs/vhost) - previously `vhost` - -Most of these are exact ports of their Connect 2.x equivalents. The primary exception is `cookie-session`. - -Some middleware previously included with Connect are no longer supported by the Connect/Express team, are replaced by an alternative module, or should be superseded by a better module. Use one of these alternatives instead: - - - `cookieParser` - - [cookies](https://github.com/jed/cookies) and [keygrip](https://github.com/jed/keygrip) - - `limit` - - [raw-body](https://github.com/stream-utils/raw-body) - - `multipart` - - [connect-multiparty](https://github.com/superjoe30/connect-multiparty) - - [connect-busboy](https://github.com/mscdex/connect-busboy) - - `query` - - [qs](https://github.com/visionmedia/node-querystring) - - `staticCache` - - [st](https://github.com/isaacs/st) - - [connect-static](https://github.com/andrewrk/connect-static) - -Checkout [http-framework](https://github.com/Raynos/http-framework/wiki/Modules) for many other compatible middleware! - -## Running Tests - -```bash -npm install -npm test -``` - -## Contributors - - https://github.com/senchalabs/connect/graphs/contributors - -## Node Compatibility - - - Connect `< 1.x` - node `0.2` - - Connect `1.x` - node `0.4` - - Connect `< 2.8` - node `0.6` - - Connect `>= 2.8 < 3` - node `0.8` - - Connect `>= 3` - node `0.10` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/connect.svg?style=flat -[npm-url]: https://npmjs.org/package/connect -[travis-image]: https://img.shields.io/travis/senchalabs/connect.svg?style=flat -[travis-url]: https://travis-ci.org/senchalabs/connect -[coveralls-image]: https://img.shields.io/coveralls/senchalabs/connect.svg?style=flat -[coveralls-url]: https://coveralls.io/r/senchalabs/connect -[downloads-image]: https://img.shields.io/npm/dm/connect.svg?style=flat -[downloads-url]: https://npmjs.org/package/connect -[gittip-image]: https://img.shields.io/gittip/dougwilson.svg?style=flat -[gittip-url]: https://www.gittip.com/dougwilson/ diff --git a/node_modules/browser-sync/node_modules/connect/index.js b/node_modules/browser-sync/node_modules/connect/index.js deleted file mode 100644 index 02befb4..0000000 --- a/node_modules/browser-sync/node_modules/connect/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/connect'); diff --git a/node_modules/browser-sync/node_modules/connect/lib/connect.js b/node_modules/browser-sync/node_modules/connect/lib/connect.js deleted file mode 100644 index cc4cf35..0000000 --- a/node_modules/browser-sync/node_modules/connect/lib/connect.js +++ /dev/null @@ -1,34 +0,0 @@ -/*! - * Connect - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter; -var merge = require('utils-merge'); -var proto = require('./proto'); - -// expose createServer() as the module - -module.exports = createServer; - -/** - * Create a new connect server. - * - * @return {Function} - * @api public - */ - -function createServer() { - function app(req, res, next){ app.handle(req, res, next); } - merge(app, proto); - merge(app, EventEmitter.prototype); - app.route = '/'; - app.stack = []; - return app; -} diff --git a/node_modules/browser-sync/node_modules/connect/lib/proto.js b/node_modules/browser-sync/node_modules/connect/lib/proto.js deleted file mode 100644 index b4114d5..0000000 --- a/node_modules/browser-sync/node_modules/connect/lib/proto.js +++ /dev/null @@ -1,231 +0,0 @@ -/*! - * Connect - HTTPServer - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var finalhandler = require('finalhandler'); -var http = require('http'); -var debug = require('debug')('connect:dispatcher'); -var parseUrl = require('parseurl'); - -// prototype - -var app = module.exports = {}; - -// environment - -var env = process.env.NODE_ENV || 'development'; - -/* istanbul ignore next */ -var defer = typeof setImmediate === 'function' - ? setImmediate - : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } - -/** - * Utilize the given middleware `handle` to the given `route`, - * defaulting to _/_. This "route" is the mount-point for the - * middleware, when given a value other than _/_ the middleware - * is only effective when that segment is present in the request's - * pathname. - * - * For example if we were to mount a function at _/admin_, it would - * be invoked on _/admin_, and _/admin/settings_, however it would - * not be invoked for _/_, or _/posts_. - * - * @param {String|Function|Server} route, callback or server - * @param {Function|Server} callback or server - * @return {Server} for chaining - * @api public - */ - -app.use = function(route, fn){ - // default route to '/' - if ('string' != typeof route) { - fn = route; - route = '/'; - } - - // wrap sub-apps - if ('function' == typeof fn.handle) { - var server = fn; - server.route = route; - fn = function(req, res, next){ - server.handle(req, res, next); - }; - } - - // wrap vanilla http.Servers - if (fn instanceof http.Server) { - fn = fn.listeners('request')[0]; - } - - // strip trailing slash - if ('/' == route[route.length - 1]) { - route = route.slice(0, -1); - } - - // add the middleware - debug('use %s %s', route || '/', fn.name || 'anonymous'); - this.stack.push({ route: route, handle: fn }); - - return this; -}; - -/** - * Handle server requests, punting them down - * the middleware stack. - * - * @api private - */ - -app.handle = function(req, res, out) { - var stack = this.stack - , searchIndex = req.url.indexOf('?') - , pathlength = searchIndex !== -1 ? searchIndex : req.url.length - , fqdn = req.url[0] !== '/' && 1 + req.url.substr(0, pathlength).indexOf('://') - , protohost = fqdn ? req.url.substr(0, req.url.indexOf('/', 2 + fqdn)) : '' - , removed = '' - , slashAdded = false - , index = 0; - - // final function handler - var done = out || finalhandler(req, res, { - env: env, - onerror: logerror - }); - - // store the original URL - req.originalUrl = req.originalUrl || req.url; - - function next(err) { - if (slashAdded) { - req.url = req.url.substr(1); - slashAdded = false; - } - - if (removed.length !== 0) { - req.url = protohost + removed + req.url.substr(protohost.length); - removed = ''; - } - - // next callback - var layer = stack[index++]; - - // all done - if (!layer) { - defer(done, err); - return; - } - - // route data - var path = parseUrl(req).pathname || '/'; - var route = layer.route; - - // skip this layer if the route doesn't match - if (path.toLowerCase().substr(0, route.length) !== route.toLowerCase()) { - return next(err); - } - - // skip if route match does not border "/", ".", or end - var c = path[route.length]; - if (c !== undefined && '/' !== c && '.' !== c) { - return next(err); - } - - // trim off the part of the url that matches the route - if (route.length !== 0 && route !== '/') { - removed = route; - req.url = protohost + req.url.substr(protohost.length + removed.length); - - // ensure leading slash - if (!fqdn && req.url[0] !== '/') { - req.url = '/' + req.url; - slashAdded = true; - } - } - - // call the layer handle - call(layer.handle, route, err, req, res, next); - } - - next(); -}; - -/** - * Listen for connections. - * - * This method takes the same arguments - * as node's `http.Server#listen()`. - * - * HTTP and HTTPS: - * - * If you run your application both as HTTP - * and HTTPS you may wrap them individually, - * since your Connect "server" is really just - * a JavaScript `Function`. - * - * var connect = require('connect') - * , http = require('http') - * , https = require('https'); - * - * var app = connect(); - * - * http.createServer(app).listen(80); - * https.createServer(options, app).listen(443); - * - * @return {http.Server} - * @api public - */ - -app.listen = function(){ - var server = http.createServer(this); - return server.listen.apply(server, arguments); -}; - -/** - * Invoke a route handle. - * - * @api private - */ - -function call(handle, route, err, req, res, next) { - var arity = handle.length; - var hasError = Boolean(err); - - debug('%s %s : %s', handle.name || '', route, req.originalUrl); - - try { - if (hasError && arity === 4) { - // error-handling middleware - handle(err, req, res, next); - return; - } else if (!hasError && arity < 4) { - // request-handling middleware - handle(req, res, next); - return; - } - } catch (e) { - // reset the error - err = e; - } - - // continue - next(err); -} - -/** - * Log error using console.error. - * - * @param {Error} err - * @api public - */ - -function logerror(err){ - if (env !== 'test') console.error(err.stack || err.toString()); -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/.jshintrc b/node_modules/browser-sync/node_modules/connect/node_modules/debug/.jshintrc deleted file mode 100644 index 299877f..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "laxbreak": true -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/.npmignore b/node_modules/browser-sync/node_modules/connect/node_modules/debug/.npmignore deleted file mode 100644 index 7e6163d..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -support -test -examples -example -*.sock -dist diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/History.md b/node_modules/browser-sync/node_modules/connect/node_modules/debug/History.md deleted file mode 100644 index bcbc3bd..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/History.md +++ /dev/null @@ -1,157 +0,0 @@ - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/Makefile b/node_modules/browser-sync/node_modules/connect/node_modules/debug/Makefile deleted file mode 100644 index b0bde6e..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 -THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) - -# BIN directory -BIN := $(THIS_DIR)/node_modules/.bin - -# applications -NODE ?= $(shell which node) -NPM ?= $(NODE) $(shell which npm) -BROWSERIFY ?= $(NODE) $(BIN)/browserify - -all: dist/debug.js - -install: node_modules - -clean: - @rm -rf node_modules dist - -dist: - @mkdir -p $@ - -dist/debug.js: node_modules browser.js debug.js dist - @$(BROWSERIFY) \ - --standalone debug \ - . > $@ - -node_modules: package.json - @NODE_ENV= $(NPM) install - @touch node_modules - -.PHONY: all install clean diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/Readme.md b/node_modules/browser-sync/node_modules/connect/node_modules/debug/Readme.md deleted file mode 100644 index e59b9ad..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/Readme.md +++ /dev/null @@ -1,156 +0,0 @@ -# debug - - tiny node.js debugging utility modelled after node core's debugging technique. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - - With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. - -Example _app.js_: - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example _worker.js_: - -```js -var debug = require('debug')('worker'); - -setInterval(function(){ - debug('doing some work'); -}, 1000); -``` - - The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: - - ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) - - ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - -#### Web Inspector Colors - - Colors are also enabled on "Web Inspectors" that understand the `%c` formatting - option. These are WebKit web inspectors, Firefox ([since version - 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) - and the Firebug plugin for Firefox (any version). - - Colored output looks something like: - - ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) - -### stderr vs stdout - -You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: - -Example _stderr.js_: - -```js -var debug = require('../'); -var log = debug('app:log'); - -// by default console.log is used -log('goes to stdout!'); - -var error = debug('app:error'); -// set this namespace to log via console.error -error.log = console.error.bind(console); // don't forget to bind to console! -error('goes to stderr'); -log('still goes to stdout!'); - -// set all output to go via console.warn -// overrides all per-namespace log settings -debug.log = console.warn.bind(console); -log('now goes to stderr via console.warn'); -error('still goes to stderr, but via console.warn now'); -``` - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - -## License - -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> - -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 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/node_modules/browser-sync/node_modules/connect/node_modules/debug/browser.js b/node_modules/browser-sync/node_modules/connect/node_modules/debug/browser.js deleted file mode 100644 index ce6369f..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/browser.js +++ /dev/null @@ -1,147 +0,0 @@ - -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args; - - var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // This hackery is required for IE8, - // where the `console.log` function doesn't have 'apply' - return 'object' == typeof console - && 'function' == typeof console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - localStorage.removeItem('debug'); - } else { - localStorage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = localStorage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/component.json b/node_modules/browser-sync/node_modules/connect/node_modules/debug/component.json deleted file mode 100644 index 7ee3d13..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "debug", - "repo": "visionmedia/debug", - "description": "small debugging utility", - "version": "2.1.0", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "guille/ms.js": "0.6.1" - } -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/debug.js b/node_modules/browser-sync/node_modules/connect/node_modules/debug/debug.js deleted file mode 100644 index 7571a86..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/debug.js +++ /dev/null @@ -1,197 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = debug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - -exports.formatters = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function debug(namespace) { - - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; - - // define the `enabled` version - function enabled() { - - var self = enabled; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - enabled.enabled = true; - - var fn = exports.enabled(namespace) ? enabled : disabled; - - fn.namespace = namespace; - - return fn; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node.js b/node_modules/browser-sync/node_modules/connect/node_modules/debug/node.js deleted file mode 100644 index 5dc999f..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node.js +++ /dev/null @@ -1,209 +0,0 @@ - -/** - * Module dependencies. - */ - -var tty = require('tty'); -var util = require('util'); - -/** - * This is the Node.js implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -/** - * The file descriptor to write the `debug()` calls to. - * Set the `DEBUG_FD` env variable to override with another value. i.e.: - * - * $ DEBUG_FD=3 node script.js 3>debug.log - */ - -var fd = parseInt(process.env.DEBUG_FD, 10) || 2; -var stream = 1 === fd ? process.stdout : - 2 === fd ? process.stderr : - createWritableStdioStream(fd); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); - if (0 === debugColors.length) { - return tty.isatty(fd); - } else { - return '0' !== debugColors - && 'no' !== debugColors - && 'false' !== debugColors - && 'disabled' !== debugColors; - } -} - -/** - * Map %o to `util.inspect()`, since Node doesn't do that out of the box. - */ - -var inspect = (4 === util.inspect.length ? - // node <= 0.8.x - function (v, colors) { - return util.inspect(v, void 0, void 0, colors); - } : - // node > 0.8.x - function (v, colors) { - return util.inspect(v, { colors: colors }); - } -); - -exports.formatters.o = function(v) { - return inspect(v, this.useColors) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - var name = this.namespace; - - if (useColors) { - var c = this.color; - - args[0] = ' \u001b[9' + c + 'm' + name + ' ' - + '\u001b[0m' - + args[0] + '\u001b[3' + c + 'm' - + ' +' + exports.humanize(this.diff) + '\u001b[0m'; - } else { - args[0] = new Date().toUTCString() - + ' ' + name + ' ' + args[0]; - } - return args; -} - -/** - * Invokes `console.error()` with the specified arguments. - */ - -function log() { - return stream.write(util.format.apply(this, arguments) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Copied from `node/src/node.js`. - * - * XXX: It's lame that node doesn't expose this API out-of-the-box. It also - * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. - */ - -function createWritableStdioStream (fd) { - var stream; - var tty_wrap = process.binding('tty_wrap'); - - // Note stream._type is used for test-module-load-list.js - - switch (tty_wrap.guessHandleType(fd)) { - case 'TTY': - stream = new tty.WriteStream(fd); - stream._type = 'tty'; - - // Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - case 'FILE': - var fs = require('fs'); - stream = new fs.SyncWriteStream(fd, { autoClose: false }); - stream._type = 'fs'; - break; - - case 'PIPE': - case 'TCP': - var net = require('net'); - stream = new net.Socket({ - fd: fd, - readable: false, - writable: true - }); - - // FIXME Should probably have an option in net.Socket to create a - // stream from an existing fd which is writable only. But for now - // we'll just add this hack and set the `readable` member to false. - // Test: ./node test/fixtures/echo.js < /etc/passwd - stream.readable = false; - stream.read = null; - stream._type = 'pipe'; - - // FIXME Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - default: - // Probably an error on in uv_guess_handle() - throw new Error('Implement me. Unknown stream file type!'); - } - - // For supporting legacy API we put the FD here. - stream.fd = fd; - - stream._isStdio = true; - - return stream; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/.npmignore b/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/.npmignore deleted file mode 100644 index d1aa0ce..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -test -History.md -Makefile -component.json diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/README.md b/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/README.md deleted file mode 100644 index d4ab12a..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# ms.js: miliseconds conversion utility - -```js -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5s') // 5000 -ms('100') // 100 -``` - -```js -ms(60000) // "1m" -ms(2 * 60000) // "2m" -ms(ms('10 hours')) // "10h" -``` - -```js -ms(60000, { long: true }) // "1 minute" -ms(2 * 60000, { long: true }) // "2 minutes" -ms(ms('10 hours', { long: true })) // "10 hours" -``` - -- Node/Browser compatible. Published as `ms` in NPM. -- If a number is supplied to `ms`, a string with a unit is returned. -- If a string that contains the number is supplied, it returns it as -a number (e.g: it returns `100` for `'100'`). -- If you pass a string with a number and a valid unit, the number of -equivalent ms is returned. - -## License - -MIT \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/index.js b/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/index.js deleted file mode 100644 index c5847f8..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/index.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 's': - return n * s; - case 'ms': - return n; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/package.json deleted file mode 100644 index 9ad9189..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/node_modules/ms/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "ms", - "version": "0.6.2", - "description": "Tiny ms conversion utility", - "repository": { - "type": "git", - "url": "git://github.com/guille/ms.js.git" - }, - "main": "./index", - "devDependencies": { - "mocha": "*", - "expect.js": "*", - "serve": "*" - }, - "component": { - "scripts": { - "ms/index.js": "index.js" - } - }, - "bugs": { - "url": "https://github.com/guille/ms.js/issues" - }, - "_id": "ms@0.6.2", - "dist": { - "shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.6.2.tgz" - }, - "_from": "ms@0.6.2", - "_npmVersion": "1.2.30", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "directories": {}, - "_shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c", - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/guille/ms.js", - "scripts": {} -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/debug/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/debug/package.json deleted file mode 100644 index 3e41f8f..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/debug/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "debug", - "version": "2.1.0", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - } - ], - "license": "MIT", - "dependencies": { - "ms": "0.6.2" - }, - "devDependencies": { - "browserify": "6.1.0", - "mocha": "*" - }, - "main": "./node.js", - "browser": "./browser.js", - "component": { - "scripts": { - "debug/index.js": "browser.js", - "debug/debug.js": "debug.js" - } - }, - "gitHead": "953162b4fa8849268d147f4bac91c737baee55bb", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "homepage": "https://github.com/visionmedia/debug", - "_id": "debug@2.1.0", - "scripts": {}, - "_shasum": "33ab915659d8c2cc8a41443d94d6ebd37697ed21", - "_from": "debug@~2.1.0", - "_npmVersion": "2.1.3", - "_nodeVersion": "0.10.32", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "dist": { - "shasum": "33ab915659d8c2cc8a41443d94d6ebd37697ed21", - "tarball": "http://registry.npmjs.org/debug/-/debug-2.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/debug/-/debug-2.1.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/HISTORY.md b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/HISTORY.md deleted file mode 100644 index 2c7e1ef..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/HISTORY.md +++ /dev/null @@ -1,51 +0,0 @@ -0.3.2 / 2014-10-22 -================== - - * deps: on-finished@~2.1.1 - - Fix handling of pipelined requests - -0.3.1 / 2014-10-16 -================== - - * deps: debug@~2.1.0 - - Implement `DEBUG_FD` env variable support - -0.3.0 / 2014-09-17 -================== - - * Terminate in progress response only on error - * Use `on-finished` to determine request status - -0.2.0 / 2014-09-03 -================== - - * Set `X-Content-Type-Options: nosniff` header - * deps: debug@~2.0.0 - -0.1.0 / 2014-07-16 -================== - - * Respond after request fully read - - prevents hung responses and socket hang ups - * deps: debug@1.0.4 - -0.0.3 / 2014-07-11 -================== - - * deps: debug@1.0.3 - - Add support for multiple wildcards in namespaces - -0.0.2 / 2014-06-19 -================== - - * Handle invalid status codes - -0.0.1 / 2014-06-05 -================== - - * deps: debug@1.0.2 - -0.0.0 / 2014-06-05 -================== - - * Extracted from connect/express diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/LICENSE b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/LICENSE deleted file mode 100644 index eda2305..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/README.md b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/README.md deleted file mode 100644 index 2015ac0..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/README.md +++ /dev/null @@ -1,133 +0,0 @@ -# finalhandler - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-image]][node-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Node.js function to invoke as the final step to respond to HTTP request. - -## Installation - -```sh -$ npm install finalhandler -``` - -## API - -```js -var finalhandler = require('finalhandler') -``` - -### finalhandler(req, res, [options]) - -Returns function to be invoked as the final step for the given `req` and `res`. -This function is to be invoked as `fn(err)`. If `err` is falsy, the handler will -write out a 404 response to the `res`. If it is truthy, an error response will -be written out to the `res`, and `res.statusCode` is set from `err.status`. - -The final handler will also unpipe anything from `req` when it is invoked. - -#### options.env - -By default, the environment is determined by `NODE_ENV` variable, but it can be -overridden by this option. - -#### options.onerror - -Provide a function to be called with the `err` when it exists. Can be used for -writing errors to a central location without excessive function generation. Called -as `onerror(err, req, res)`. - -## Examples - -### always 404 - -```js -var finalhandler = require('finalhandler') -var http = require('http') - -var server = http.createServer(function (req, res) { - var done = finalhandler(req, res) - done() -}) - -server.listen(3000) -``` - -### perform simple action - -```js -var finalhandler = require('finalhandler') -var fs = require('fs') -var http = require('http') - -var server = http.createServer(function (req, res) { - var done = finalhandler(req, res) - - fs.readFile('index.html', function (err, buf) { - if (err) return done(err) - res.setHeader('Content-Type', 'text/html') - res.end(buf) - }) -}) - -server.listen(3000) -``` - -### use with middleware-style functions - -```js -var finalhandler = require('finalhandler') -var http = require('http') -var serveStatic = require('serve-static') - -var serve = serveStatic('public') - -var server = http.createServer(function (req, res) { - var done = finalhandler(req, res) - serve(req, res, done) -}) - -server.listen(3000) -``` - -### keep log of all errors - -```js -var finalhandler = require('finalhandler') -var fs = require('fs') -var http = require('http') - -var server = http.createServer(function (req, res) { - var done = finalhandler(req, res, {onerror: logerror}) - - fs.readFile('index.html', function (err, buf) { - if (err) return done(err) - res.setHeader('Content-Type', 'text/html') - res.end(buf) - }) -}) - -server.listen(3000) - -function logerror(err) { - console.error(err.stack || err.toString()) -} -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/finalhandler.svg?style=flat -[npm-url]: https://npmjs.org/package/finalhandler -[node-image]: https://img.shields.io/node/v/finalhandler.svg?style=flat -[node-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/pillarjs/finalhandler.svg?style=flat -[travis-url]: https://travis-ci.org/pillarjs/finalhandler -[coveralls-image]: https://img.shields.io/coveralls/pillarjs/finalhandler.svg?style=flat -[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master -[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg?style=flat -[downloads-url]: https://npmjs.org/package/finalhandler diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/index.js b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/index.js deleted file mode 100644 index bb2bb58..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/index.js +++ /dev/null @@ -1,171 +0,0 @@ -/*! - * finalhandler - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var debug = require('debug')('finalhandler') -var escapeHtml = require('escape-html') -var http = require('http') -var onFinished = require('on-finished') - -/** - * Variables. - */ - -/* istanbul ignore next */ -var defer = typeof setImmediate === 'function' - ? setImmediate - : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } -var isFinished = onFinished.isFinished - -/** - * Module exports. - */ - -module.exports = finalhandler - -/** - * Final handler: - * - * @param {Request} req - * @param {Response} res - * @param {Object} [options] - * @return {Function} - * @api public - */ - -function finalhandler(req, res, options) { - options = options || {} - - // get environment - var env = options.env || process.env.NODE_ENV || 'development' - - // get error callback - var onerror = options.onerror - - return function (err) { - var msg - - // ignore 404 on in-flight response - if (!err && res._header) { - debug('cannot 404 after headers sent') - return - } - - // unhandled error - if (err) { - // default status code to 500 - if (!res.statusCode || res.statusCode < 400) { - res.statusCode = 500 - } - - // respect err.status - if (err.status) { - res.statusCode = err.status - } - - // production gets a basic error message - var msg = env === 'production' - ? http.STATUS_CODES[res.statusCode] - : err.stack || err.toString() - msg = escapeHtml(msg) - .replace(/\n/g, '
') - .replace(/ /g, '  ') + '\n' - } else { - res.statusCode = 404 - msg = 'Cannot ' + escapeHtml(req.method) + ' ' + escapeHtml(req.originalUrl || req.url) + '\n' - } - - debug('default %s', res.statusCode) - - // schedule onerror callback - if (err && onerror) { - defer(onerror, err, req, res) - } - - // cannot actually respond - if (res._header) { - return req.socket.destroy() - } - - send(req, res, res.statusCode, msg) - } -} - -/** - * Send response. - * - * @param {IncomingMessage} req - * @param {OutgoingMessage} res - * @param {number} status - * @param {string} body - * @api private - */ - -function send(req, res, status, body) { - function write() { - res.statusCode = status - - // security header for content sniffing - res.setHeader('X-Content-Type-Options', 'nosniff') - - // standard headers - res.setHeader('Content-Type', 'text/html; charset=utf-8') - res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8')) - - if (req.method === 'HEAD') { - res.end() - return - } - - res.end(body, 'utf8') - } - - if (isFinished(req)) { - write() - return - } - - // unpipe everything from the request - unpipe(req) - - // flush the request - onFinished(req, write) - req.resume() -} - -/** - * Unpipe everything from a stream. - * - * @param {Object} stream - * @api private - */ - -/* istanbul ignore next: implementation differs between versions */ -function unpipe(stream) { - if (typeof stream.unpipe === 'function') { - // new-style - stream.unpipe() - return - } - - // Node.js 0.8 hack - var listener - var listeners = stream.listeners('close') - - for (var i = 0; i < listeners.length; i++) { - listener = listeners[i] - - if (listener.name !== 'cleanup' && listener.name !== 'onclose') { - continue - } - - // invoke the listener - listener.call(stream) - } -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/.npmignore b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/.npmignore deleted file mode 100644 index 48a2e24..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -components -build diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/Makefile b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/Makefile deleted file mode 100644 index 3f6119d..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/Makefile +++ /dev/null @@ -1,11 +0,0 @@ - -build: components index.js - @component build - -components: - @Component install - -clean: - rm -fr build components template.js - -.PHONY: clean diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/Readme.md b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/Readme.md deleted file mode 100644 index 2cfcc99..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/Readme.md +++ /dev/null @@ -1,15 +0,0 @@ - -# escape-html - - Escape HTML entities - -## Example - -```js -var escape = require('escape-html'); -escape(str); -``` - -## License - - MIT \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/component.json b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/component.json deleted file mode 100644 index cb9740f..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "escape-html", - "description": "Escape HTML entities", - "version": "1.0.1", - "keywords": ["escape", "html", "utility"], - "dependencies": {}, - "scripts": [ - "index.js" - ] -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/index.js b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/index.js deleted file mode 100644 index 2765211..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Escape special characters in the given string of html. - * - * @param {String} html - * @return {String} - * @api private - */ - -module.exports = function(html) { - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(/'/g, ''') - .replace(//g, '>'); -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/package.json deleted file mode 100644 index 33476ea..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/escape-html/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "escape-html", - "description": "Escape HTML entities", - "version": "1.0.1", - "keywords": [ - "escape", - "html", - "utility" - ], - "dependencies": {}, - "main": "index.js", - "component": { - "scripts": { - "escape-html/index.js": "index.js" - } - }, - "repository": { - "type": "git", - "url": "https://github.com/component/escape-html.git" - }, - "readme": "\n# escape-html\n\n Escape HTML entities\n\n## Example\n\n```js\nvar escape = require('escape-html');\nescape(str);\n```\n\n## License\n\n MIT", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/component/escape-html/issues" - }, - "homepage": "https://github.com/component/escape-html", - "_id": "escape-html@1.0.1", - "dist": { - "shasum": "181a286ead397a39a92857cfb1d43052e356bff0", - "tarball": "http://registry.npmjs.org/escape-html/-/escape-html-1.0.1.tgz" - }, - "_from": "escape-html@1.0.1", - "_npmVersion": "1.3.15", - "_npmUser": { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - } - ], - "directories": {}, - "_shasum": "181a286ead397a39a92857cfb1d43052e356bff0", - "_resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.1.tgz", - "scripts": {} -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/HISTORY.md b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/HISTORY.md deleted file mode 100644 index 1a4063d..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/HISTORY.md +++ /dev/null @@ -1,71 +0,0 @@ -2.1.1 / 2014-10-22 -================== - - * Fix handling of pipelined requests - -2.1.0 / 2014-08-16 -================== - - * Check if `socket` is detached - * Return `undefined` for `isFinished` if state unknown - -2.0.0 / 2014-08-16 -================== - - * Add `isFinished` function - * Move to `jshttp` organization - * Remove support for plain socket argument - * Rename to `on-finished` - * Support both `req` and `res` as arguments - * deps: ee-first@1.0.5 - -1.2.2 / 2014-06-10 -================== - - * Reduce listeners added to emitters - - avoids "event emitter leak" warnings when used multiple times on same request - -1.2.1 / 2014-06-08 -================== - - * Fix returned value when already finished - -1.2.0 / 2014-06-05 -================== - - * Call callback when called on already-finished socket - -1.1.4 / 2014-05-27 -================== - - * Support node.js 0.8 - -1.1.3 / 2014-04-30 -================== - - * Make sure errors passed as instanceof `Error` - -1.1.2 / 2014-04-18 -================== - - * Default the `socket` to passed-in object - -1.1.1 / 2014-01-16 -================== - - * Rename module to `finished` - -1.1.0 / 2013-12-25 -================== - - * Call callback when called on already-errored socket - -1.0.1 / 2013-12-20 -================== - - * Actually pass the error to the callback - -1.0.0 / 2013-12-20 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/LICENSE b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/LICENSE deleted file mode 100644 index 5931fd2..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Jonathan Ong -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/README.md b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/README.md deleted file mode 100644 index 6fb0e4d..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# on-finished - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Execute a callback when a request closes, finishes, or errors. - -## Install - -```sh -$ npm install on-finished -``` - -## API - -```js -var onFinished = require('on-finished') -``` - -### onFinished(res, listener) - -Attach a listener to listen for the response to finish. The listener will -be invoked only once when the response finished. If the response finished -to to an error, the first argument will contain the error. - -Listening to the end of a response would be used to close things associated -with the response, like open files. - -```js -onFinished(res, function (err) { - // clean up open fds, etc. -}) -``` - -### onFinished(req, listener) - -Attach a listener to listen for the request to finish. The listener will -be invoked only once when the request finished. If the request finished -to to an error, the first argument will contain the error. - -Listening to the end of a request would be used to know when to continue -after reading the data. - -```js -var data = '' - -req.setEncoding('utf8') -res.on('data', function (str) { - data += str -}) - -onFinished(req, function (err) { - // data is read unless there is err -}) -``` - -### onFinished.isFinished(res) - -Determine if `res` is already finished. This would be useful to check and -not even start certain operations if the response has already finished. - -### onFinished.isFinished(req) - -Determine if `req` is already finished. This would be useful to check and -not even start certain operations if the request has already finished. - -### Example - -The following code ensures that file descriptors are always closed -once the response finishes. - -```js -var destroy = require('destroy') -var http = require('http') -var onFinished = require('on-finished') - -http.createServer(function onRequest(req, res) { - var stream = fs.createReadStream('package.json') - stream.pipe(res) - onFinished(res, function (err) { - destroy(stream) - }) -}) -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/on-finished.svg?style=flat -[npm-url]: https://npmjs.org/package/on-finished -[node-version-image]: https://img.shields.io/node/v/on-finished.svg?style=flat -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/on-finished.svg?style=flat -[travis-url]: https://travis-ci.org/jshttp/on-finished -[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished.svg?style=flat -[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master -[downloads-image]: https://img.shields.io/npm/dm/on-finished.svg?style=flat -[downloads-url]: https://npmjs.org/package/on-finished diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/index.js b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/index.js deleted file mode 100644 index e75a7e9..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/index.js +++ /dev/null @@ -1,191 +0,0 @@ -/*! - * on-finished - * Copyright(c) 2013 Jonathan Ong - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module exports. - */ - -module.exports = onFinished; -module.exports.isFinished = isFinished; - -/** -* Module dependencies. -*/ - -var first = require('ee-first') - -/** -* Variables. -*/ - -/* istanbul ignore next */ -var defer = typeof setImmediate === 'function' - ? setImmediate - : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } - -/** - * Invoke callback when the response has finished, useful for - * cleaning up resources afterwards. - * - * @param {object} msg - * @param {function} listener - * @return {object} - * @api public - */ - -function onFinished(msg, listener) { - if (isFinished(msg) !== false) { - defer(listener) - return msg - } - - // attach the listener to the message - attachListener(msg, listener) - - return msg -} - -/** - * Determine if message is already finished. - * - * @param {object} msg - * @return {boolean} - * @api public - */ - -function isFinished(msg) { - var socket = msg.socket - - if (typeof msg.finished === 'boolean') { - // OutgoingMessage - return Boolean(msg.finished || (socket && !socket.writable)) - } - - if (typeof msg.complete === 'boolean') { - // IncomingMessage - return Boolean(!socket || msg.complete || !socket.readable) - } - - // don't know - return undefined -} - -/** - * Attach a finished listener to the message. - * - * @param {object} msg - * @param {function} callback - * @private - */ - -function attachFinishedListener(msg, callback) { - var eeMsg - var eeSocket - var finished = false - - function onFinish(error) { - eeMsg.cancel() - eeSocket.cancel() - - finished = true - callback(error) - } - - // finished on first message event - eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish) - - function onSocket(socket) { - // remove listener - msg.removeListener('socket', onSocket) - - if (finished) return - if (eeMsg !== eeSocket) return - - // finished on first socket event - eeSocket = first([[socket, 'error', 'close']], onFinish) - } - - if (msg.socket) { - // socket already assigned - onSocket(msg.socket) - return - } - - // wait for socket to be assigned - msg.on('socket', onSocket) - - if (msg.socket === undefined) { - // node.js 0.8 patch - patchAssignSocket(msg, onSocket) - } -} - -/** - * Attach the listener to the message. - * - * @param {object} msg - * @return {function} - * @api private - */ - -function attachListener(msg, listener) { - var attached = msg.__onFinished - - // create a private single listener with queue - if (!attached || !attached.queue) { - attached = msg.__onFinished = createListener(msg) - attachFinishedListener(msg, attached) - } - - attached.queue.push(listener) -} - -/** - * Create listener on message. - * - * @param {object} msg - * @return {function} - * @api private - */ - -function createListener(msg) { - function listener(err) { - if (msg.__onFinished === listener) msg.__onFinished = null - if (!listener.queue) return - - var queue = listener.queue - listener.queue = null - - for (var i = 0; i < queue.length; i++) { - queue[i](err) - } - } - - listener.queue = [] - - return listener -} - -/** - * Patch ServerResponse.prototype.assignSocket for node.js 0.8. - * - * @param {ServerResponse} res - * @param {function} callback - * @private - */ - -function patchAssignSocket(res, callback) { - var assignSocket = res.assignSocket - - if (typeof assignSocket !== 'function') return - - // res.on('socket', callback) is broken in 0.8 - res.assignSocket = function _assignSocket(socket) { - assignSocket.call(this, socket) - callback(socket) - } -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/LICENSE b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/LICENSE deleted file mode 100644 index c1b15a1..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2014 Jonathan Ong me@jongleberry.com - -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 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/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/README.md b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/README.md deleted file mode 100644 index bb16aab..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# EE First - -[![NPM version][npm-image]][npm-url] -[![Build status][travis-image]][travis-url] -[![Test coverage][coveralls-image]][coveralls-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] -[![Gittip][gittip-image]][gittip-url] - -Get the first event in a set of event emitters and event pairs, -then clean up after itself. - -## Install - -```sh -$ npm install ee-first -``` - -## API - -```js -var first = require('ee-first') -``` - -### first(arr, listener) - -Invoke `listener` on the first event from the list specified in `arr`. `arr` is -an array of arrays, with each array in the format `[ee, ...event]`. `listener` -will be called only once, the first time any of the given events are emitted. If -`error` is one of the listened events, then if that fires first, the `listener` -will be given the `err` argument. - -The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the -first argument emitted from an `error` event, if applicable; `ee` is the event -emitter that fired; `event` is the string event name that fired; and `args` is an -array of the arguments that were emitted on the event. - -```js -var ee1 = new EventEmitter() -var ee2 = new EventEmitter() - -first([ - [ee1, 'close', 'end', 'error'], - [ee2, 'error'] -], function (err, ee, event, args) { - // listener invoked -}) -``` - -#### .cancel() - -The group of listeners can be cancelled before being invoked and have all the event -listeners removed from the underlying event emitters. - -```js -var thunk = first([ - [ee1, 'close', 'end', 'error'], - [ee2, 'error'] -], function (err, ee, event, args) { - // listener invoked -}) - -// cancel and clean up -thunk.cancel() -``` - -[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square -[npm-url]: https://npmjs.org/package/ee-first -[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square -[github-url]: https://github.com/jonathanong/ee-first/tags -[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square -[travis-url]: https://travis-ci.org/jonathanong/ee-first -[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square -[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master -[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square -[license-url]: LICENSE.md -[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square -[downloads-url]: https://npmjs.org/package/ee-first -[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square -[gittip-url]: https://www.gittip.com/jonathanong/ diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/index.js b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/index.js deleted file mode 100644 index 1d66203..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/index.js +++ /dev/null @@ -1,68 +0,0 @@ - -module.exports = function first(stuff, done) { - if (!Array.isArray(stuff)) - throw new TypeError('arg must be an array of [ee, events...] arrays') - - var cleanups = [] - - for (var i = 0; i < stuff.length; i++) { - var arr = stuff[i] - - if (!Array.isArray(arr) || arr.length < 2) - throw new TypeError('each array member must be [ee, events...]') - - var ee = arr[0] - - for (var j = 1; j < arr.length; j++) { - var event = arr[j] - var fn = listener(event, callback) - - // listen to the event - ee.on(event, fn) - // push this listener to the list of cleanups - cleanups.push({ - ee: ee, - event: event, - fn: fn, - }) - } - } - - function callback() { - cleanup() - done.apply(null, arguments) - } - - function cleanup() { - var x - for (var i = 0; i < cleanups.length; i++) { - x = cleanups[i] - x.ee.removeListener(x.event, x.fn) - } - } - - function thunk(fn) { - done = fn - } - - thunk.cancel = cleanup - - return thunk -} - -function listener(event, done) { - return function onevent(arg1) { - var args = new Array(arguments.length) - var ee = this - var err = event === 'error' - ? arg1 - : null - - // copy args to prevent arguments escaping scope - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - - done(err, ee, event, args) - } -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/package.json deleted file mode 100644 index 5b39931..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/node_modules/ee-first/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "ee-first", - "description": "return the first event in a set of ee/event pairs", - "version": "1.1.0", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/jonathanong/ee-first" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "1" - }, - "files": [ - "index.js", - "LICENSE" - ], - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "gitHead": "a6412004da4745941af2fc98ec30c8da570da7ea", - "bugs": { - "url": "https://github.com/jonathanong/ee-first/issues" - }, - "homepage": "https://github.com/jonathanong/ee-first", - "_id": "ee-first@1.1.0", - "_shasum": "6a0d7c6221e490feefd92ec3f441c9ce8cd097f4", - "_from": "ee-first@1.1.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "dist": { - "shasum": "6a0d7c6221e490feefd92ec3f441c9ce8cd097f4", - "tarball": "http://registry.npmjs.org/ee-first/-/ee-first-1.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/package.json deleted file mode 100644 index ea60078..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/node_modules/on-finished/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "on-finished", - "description": "Execute a callback when a request closes, finishes, or errors", - "version": "2.1.1", - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/jshttp/on-finished" - }, - "dependencies": { - "ee-first": "1.1.0" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "~2.0.0" - }, - "engines": { - "node": ">= 0.8" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "index.js" - ], - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "gitHead": "8ec5fa639ace400b543b5bc1821ce909b9acdc03", - "bugs": { - "url": "https://github.com/jshttp/on-finished/issues" - }, - "homepage": "https://github.com/jshttp/on-finished", - "_id": "on-finished@2.1.1", - "_shasum": "f82ca1c9e3a4f3286b1b9938610e5b8636bd3cb2", - "_from": "on-finished@~2.1.1", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - } - ], - "dist": { - "shasum": "f82ca1c9e3a4f3286b1b9938610e5b8636bd3cb2", - "tarball": "http://registry.npmjs.org/on-finished/-/on-finished-2.1.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.1.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/package.json deleted file mode 100644 index 19b9ecf..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/finalhandler/package.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "name": "finalhandler", - "description": "Node.js final http responder", - "version": "0.3.2", - "author": { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/pillarjs/finalhandler" - }, - "dependencies": { - "debug": "~2.1.0", - "escape-html": "1.0.1", - "on-finished": "~2.1.1" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "~2.0.0", - "readable-stream": "~1.0.33", - "should": "~4.1.0", - "supertest": "~0.14.0" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "index.js" - ], - "engines": { - "node": ">= 0.8" - }, - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "gitHead": "1dc292faf576fade3b0218caab39060f4da5fe9c", - "bugs": { - "url": "https://github.com/pillarjs/finalhandler/issues" - }, - "homepage": "https://github.com/pillarjs/finalhandler", - "_id": "finalhandler@0.3.2", - "_shasum": "7b389b0fd3647a6f90bd564e22624bf8a4a77fb5", - "_from": "finalhandler@0.3.2", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "shtylman", - "email": "shtylman@gmail.com" - }, - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "fishrock123", - "email": "fishrock123@rocketmail.com" - } - ], - "dist": { - "shasum": "7b389b0fd3647a6f90bd564e22624bf8a4a77fb5", - "tarball": "http://registry.npmjs.org/finalhandler/-/finalhandler-0.3.2.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-0.3.2.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/.npmignore b/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/.npmignore deleted file mode 100644 index 85c82a5..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -benchmark/ -coverage/ -test/ -.travis.yml diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/HISTORY.md b/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/HISTORY.md deleted file mode 100644 index 65a0860..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/HISTORY.md +++ /dev/null @@ -1,42 +0,0 @@ -1.3.0 / 2014-08-09 -================== - - * Add `parseurl.original` for parsing `req.originalUrl` with fallback - * Return `undefined` if `req.url` is `undefined` - -1.2.0 / 2014-07-21 -================== - - * Cache URLs based on original value - * Remove no-longer-needed URL mis-parse work-around - * Simplify the "fast-path" `RegExp` - -1.1.3 / 2014-07-08 -================== - - * Fix typo - -1.1.2 / 2014-07-08 -================== - - * Seriously fix Node.js 0.8 compatibility - -1.1.1 / 2014-07-08 -================== - - * Fix Node.js 0.8 compatibility - -1.1.0 / 2014-07-08 -================== - - * Incorporate URL href-only parse fast-path - -1.0.1 / 2014-03-08 -================== - - * Add missing `require` - -1.0.0 / 2014-03-08 -================== - - * Genesis from `connect` diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/LICENSE b/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/LICENSE deleted file mode 100644 index ec7dfe7..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ - -(The MIT License) - -Copyright (c) 2014 Jonathan Ong -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/README.md b/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/README.md deleted file mode 100644 index 0db1d02..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# parseurl - -[![NPM version](https://badge.fury.io/js/parseurl.svg)](http://badge.fury.io/js/parseurl) -[![Build Status](https://travis-ci.org/expressjs/parseurl.svg?branch=master)](https://travis-ci.org/expressjs/parseurl) -[![Coverage Status](https://img.shields.io/coveralls/expressjs/parseurl.svg?branch=master)](https://coveralls.io/r/expressjs/parseurl) - -Parse a URL with memoization. - -## Install - -```bash -$ npm install parseurl -``` - -## API - -```js -var parseurl = require('parseurl') -``` - -### parseurl(req) - -Parse the URL of the given request object (looks at the `req.url` property) -and return the result. The result is the same as `url.parse` in Node.js core. -Calling this function multiple times on the same `req` where `req.url` does -not change will return a cached parsed object, rather than parsing again. - -### parseurl.original(req) - -Parse the original URL of the given request object and return the result. -This works by trying to parse `req.originalUrl` if it is a string, otherwise -parses `req.url`. The result is the same as `url.parse` in Node.js core. -Calling this function multiple times on the same `req` where `req.originalUrl` -does not change will return a cached parsed object, rather than parsing again. - -## Benchmark - -```bash -$ npm run-script bench - -> parseurl@1.3.0 bench nodejs-parseurl -> node benchmark/index.js - -> node benchmark/fullurl.js - - Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 1,290,780 ops/sec ±0.46% (195 runs sampled) - nativeurl x 56,401 ops/sec ±0.22% (196 runs sampled) - parseurl x 55,231 ops/sec ±0.22% (194 runs sampled) - -> node benchmark/pathquery.js - - Parsing URL "/foo/bar?user=tj&pet=fluffy" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 1,986,668 ops/sec ±0.27% (190 runs sampled) - nativeurl x 98,740 ops/sec ±0.21% (195 runs sampled) - parseurl x 2,628,171 ops/sec ±0.36% (195 runs sampled) - -> node benchmark/samerequest.js - - Parsing URL "/foo/bar?user=tj&pet=fluffy" on same request object - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 2,184,468 ops/sec ±0.40% (194 runs sampled) - nativeurl x 99,437 ops/sec ±0.71% (194 runs sampled) - parseurl x 10,498,005 ops/sec ±0.61% (186 runs sampled) - -> node benchmark/simplepath.js - - Parsing URL "/foo/bar" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 4,535,825 ops/sec ±0.27% (191 runs sampled) - nativeurl x 98,769 ops/sec ±0.54% (191 runs sampled) - parseurl x 4,164,865 ops/sec ±0.34% (192 runs sampled) - -> node benchmark/slash.js - - Parsing URL "/" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 4,908,405 ops/sec ±0.42% (191 runs sampled) - nativeurl x 100,945 ops/sec ±0.59% (188 runs sampled) - parseurl x 4,333,208 ops/sec ±0.27% (194 runs sampled) -``` - -## License - - [MIT](LICENSE) diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/index.js b/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/index.js deleted file mode 100644 index 8632347..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/index.js +++ /dev/null @@ -1,136 +0,0 @@ -/*! - * parseurl - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url') -var parse = url.parse -var Url = url.Url - -/** - * Pattern for a simple path case. - * See: https://github.com/joyent/node/pull/7878 - */ - -var simplePathRegExp = /^(\/\/?(?!\/)[^\?#\s]*)(\?[^#\s]*)?$/ - -/** - * Exports. - */ - -module.exports = parseurl -module.exports.original = originalurl - -/** - * Parse the `req` url with memoization. - * - * @param {ServerRequest} req - * @return {Object} - * @api public - */ - -function parseurl(req) { - var url = req.url - - if (url === undefined) { - // URL is undefined - return undefined - } - - var parsed = req._parsedUrl - - if (fresh(url, parsed)) { - // Return cached URL parse - return parsed - } - - // Parse the URL - parsed = fastparse(url) - parsed._raw = url - - return req._parsedUrl = parsed -}; - -/** - * Parse the `req` original url with fallback and memoization. - * - * @param {ServerRequest} req - * @return {Object} - * @api public - */ - -function originalurl(req) { - var url = req.originalUrl - - if (typeof url !== 'string') { - // Fallback - return parseurl(req) - } - - var parsed = req._parsedOriginalUrl - - if (fresh(url, parsed)) { - // Return cached URL parse - return parsed - } - - // Parse the URL - parsed = fastparse(url) - parsed._raw = url - - return req._parsedOriginalUrl = parsed -}; - -/** - * Parse the `str` url with fast-path short-cut. - * - * @param {string} str - * @return {Object} - * @api private - */ - -function fastparse(str) { - // Try fast path regexp - // See: https://github.com/joyent/node/pull/7878 - var simplePath = typeof str === 'string' && simplePathRegExp.exec(str) - - // Construct simple URL - if (simplePath) { - var pathname = simplePath[1] - var search = simplePath[2] || null - var url = Url !== undefined - ? new Url() - : {} - url.path = str - url.href = str - url.pathname = pathname - url.search = search - url.query = search && search.substr(1) - - return url - } - - return parse(str) -} - -/** - * Determine if parsed is still fresh for url. - * - * @param {string} url - * @param {object} parsedUrl - * @return {boolean} - * @api private - */ - -function fresh(url, parsedUrl) { - return typeof parsedUrl === 'object' - && parsedUrl !== null - && (Url === undefined || parsedUrl instanceof Url) - && parsedUrl._raw === url -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/package.json deleted file mode 100644 index 6fbd23e..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/parseurl/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "parseurl", - "description": "parse a url with memoization", - "version": "1.3.0", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "repository": { - "type": "git", - "url": "https://github.com/expressjs/parseurl" - }, - "license": "MIT", - "devDependencies": { - "benchmark": "1.0.0", - "beautify-benchmark": "0.2.4", - "fast-url-parser": "~1.0.0", - "istanbul": "0.3.0", - "mocha": "~1.21.4" - }, - "scripts": { - "bench": "node benchmark/index.js", - "test": "mocha --check-leaks --bail --reporter spec test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/" - }, - "gitHead": "03b7ccca240e2bef5df6c25797e99175d28fb2cb", - "bugs": { - "url": "https://github.com/expressjs/parseurl/issues" - }, - "homepage": "https://github.com/expressjs/parseurl", - "_id": "parseurl@1.3.0", - "_shasum": "b58046db4223e145afa76009e61bac87cc2281b3", - "_from": "parseurl@~1.3.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "shtylman", - "email": "shtylman@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "mscdex", - "email": "mscdex@mscdex.net" - }, - { - "name": "fishrock123", - "email": "fishrock123@rocketmail.com" - } - ], - "dist": { - "shasum": "b58046db4223e145afa76009e61bac87cc2281b3", - "tarball": "http://registry.npmjs.org/parseurl/-/parseurl-1.3.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/.travis.yml b/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/.travis.yml deleted file mode 100644 index af92b02..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: "node_js" -node_js: - - "0.4" - - "0.6" - - "0.8" - - "0.10" diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/LICENSE b/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/LICENSE deleted file mode 100644 index e33bd10..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Jared Hanson - -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 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/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/README.md b/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/README.md deleted file mode 100644 index 2f94e9b..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# utils-merge - -Merges the properties from a source object into a destination object. - -## Install - - $ npm install utils-merge - -## Usage - -```javascript -var a = { foo: 'bar' } - , b = { bar: 'baz' }; - -merge(a, b); -// => { foo: 'bar', bar: 'baz' } -``` - -## Tests - - $ npm install - $ npm test - -[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge) - -## Credits - - - [Jared Hanson](http://github.com/jaredhanson) - -## License - -[The MIT License](http://opensource.org/licenses/MIT) - -Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/index.js b/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/index.js deleted file mode 100644 index 4265c69..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ - -exports = module.exports = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; - } - } - return a; -}; diff --git a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/package.json b/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/package.json deleted file mode 100644 index e655383..0000000 --- a/node_modules/browser-sync/node_modules/connect/node_modules/utils-merge/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "utils-merge", - "version": "1.0.0", - "description": "merge() utility function", - "keywords": [ - "util" - ], - "repository": { - "type": "git", - "url": "git://github.com/jaredhanson/utils-merge.git" - }, - "bugs": { - "url": "http://github.com/jaredhanson/utils-merge/issues" - }, - "author": { - "name": "Jared Hanson", - "email": "jaredhanson@gmail.com", - "url": "http://www.jaredhanson.net/" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "main": "./index", - "dependencies": {}, - "devDependencies": { - "mocha": "1.x.x", - "chai": "1.x.x" - }, - "scripts": { - "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js" - }, - "engines": { - "node": ">= 0.4.0" - }, - "readme": "# utils-merge\n\nMerges the properties from a source object into a destination object.\n\n## Install\n\n $ npm install utils-merge\n\n## Usage\n\n```javascript\nvar a = { foo: 'bar' }\n , b = { bar: 'baz' };\n\nmerge(a, b);\n// => { foo: 'bar', bar: 'baz' }\n```\n\n## Tests\n\n $ npm install\n $ npm test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge)\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n", - "readmeFilename": "README.md", - "_id": "utils-merge@1.0.0", - "dist": { - "shasum": "0294fb922bb9375153541c4f7096231f287c8af8", - "tarball": "http://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz" - }, - "_from": "utils-merge@1.0.0", - "_npmVersion": "1.2.25", - "_npmUser": { - "name": "jaredhanson", - "email": "jaredhanson@gmail.com" - }, - "maintainers": [ - { - "name": "jaredhanson", - "email": "jaredhanson@gmail.com" - } - ], - "directories": {}, - "_shasum": "0294fb922bb9375153541c4f7096231f287c8af8", - "_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", - "homepage": "https://github.com/jaredhanson/utils-merge" -} diff --git a/node_modules/browser-sync/node_modules/connect/package.json b/node_modules/browser-sync/node_modules/connect/package.json deleted file mode 100644 index 5db76e6..0000000 --- a/node_modules/browser-sync/node_modules/connect/package.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "name": "connect", - "description": "High performance middleware framework", - "version": "3.3.3", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Jonathan Ong", - "email": "me@jongleberry.com" - }, - { - "name": "Tim Caswell", - "email": "tim@creationix.com" - } - ], - "keywords": [ - "framework", - "web", - "middleware", - "connect", - "rack" - ], - "repository": { - "type": "git", - "url": "https://github.com/senchalabs/connect" - }, - "dependencies": { - "debug": "~2.1.0", - "finalhandler": "0.3.2", - "parseurl": "~1.3.0", - "utils-merge": "1.0.0" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "~2.0.1", - "should": "~4.2.1", - "supertest": "~0.14.0" - }, - "license": "MIT", - "engines": { - "node": ">= 0.10.0" - }, - "scripts": { - "test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/" - }, - "gitHead": "0509cb8cfa4cd0922076e1c8926b13970d8a6ef5", - "bugs": { - "url": "https://github.com/senchalabs/connect/issues" - }, - "homepage": "https://github.com/senchalabs/connect", - "_id": "connect@3.3.3", - "_shasum": "4b37b2cbb27a36e6ae18c9e7d3252ee6260c5941", - "_from": "connect@^3.3.3", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "creationix", - "email": "tim@creationix.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "dist": { - "shasum": "4b37b2cbb27a36e6ae18c9e7d3252ee6260c5941", - "tarball": "http://registry.npmjs.org/connect/-/connect-3.3.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/connect/-/connect-3.3.3.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/dev-ip/.jshintrc b/node_modules/browser-sync/node_modules/dev-ip/.jshintrc deleted file mode 100644 index 2b7e39b..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/.jshintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "curly": true, - "eqeqeq": true, - "immed": true, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "sub": true, - "undef": true, - "unused": true, - "boss": true, - "eqnull": true, - "node": true -} diff --git a/node_modules/browser-sync/node_modules/dev-ip/.npmignore b/node_modules/browser-sync/node_modules/dev-ip/.npmignore deleted file mode 100644 index f454dec..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -.idea -npm-debug.log \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/dev-ip/.travis.yml b/node_modules/browser-sync/node_modules/dev-ip/.travis.yml deleted file mode 100644 index 17b81ec..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - '0.10' -before_script: - - npm install -g gulp diff --git a/node_modules/browser-sync/node_modules/dev-ip/LICENSE-MIT b/node_modules/browser-sync/node_modules/dev-ip/LICENSE-MIT deleted file mode 100644 index 49491e1..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 Shane Osbourne - -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 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/node_modules/browser-sync/node_modules/dev-ip/README.md b/node_modules/browser-sync/node_modules/dev-ip/README.md deleted file mode 100644 index 9bbfa54..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# dev-ip [![Build Status](https://travis-ci.org/shakyShane/dev-ip.png?branch=master)](https://travis-ci.org/shakyShane/dev-ip) - -Find a suitable IP host to view local websites on. - -## Command line -Install it globally to use on the command line: - -`sudo npm install -g dev-ip` - -then run: - -`dev-ip` - -> "http://192.168.1.46" - -## In your project -`npm install dev-ip` - -```javascript -var dev_ip = require('dev-ip'); -dev_ip.getIp(); // "192.168.1.76" or false if nothing found (ie, offline user) -``` - -## Contributing -In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Run lint & tests with `gulp`. - -## Release History -_(Nothing yet)_ - -## License -Copyright (c) 2013 Shane Osbourne -Licensed under the MIT license. diff --git a/node_modules/browser-sync/node_modules/dev-ip/example.js b/node_modules/browser-sync/node_modules/dev-ip/example.js deleted file mode 100644 index ab4ea48..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/example.js +++ /dev/null @@ -1,7 +0,0 @@ -var devip = require("./lib/dev-ip"); - -var ip = devip.getIp(null); -console.log(ip); - -var ipCli = devip.getIp("cli"); -console.log(ip); \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/dev-ip/gulpfile.js b/node_modules/browser-sync/node_modules/dev-ip/gulpfile.js deleted file mode 100644 index ce7c69f..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/gulpfile.js +++ /dev/null @@ -1,16 +0,0 @@ -var gulp = require('gulp'); -var mocha = require('gulp-mocha'); -var jshint = require('gulp-jshint'); - -gulp.task('lint', function () { - gulp.src(['test/*.js', 'lib/*']) - .pipe(jshint('test/.jshintrc')) - .pipe(jshint.reporter('default')) -}); - -gulp.task('test', function () { - gulp.src('test/*.js') - .pipe(mocha({reporter: 'nyan'})); -}); - -gulp.task('default', ['lint', 'test']); \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/dev-ip/lib/dev-ip.js b/node_modules/browser-sync/node_modules/dev-ip/lib/dev-ip.js deleted file mode 100755 index 28d39aa..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/lib/dev-ip.js +++ /dev/null @@ -1,55 +0,0 @@ -#! /usr/bin/env node -/* - * dev-ip - * https://github.com/shakyshane/dev-ip - * - * Copyright (c) 2013 Shane Osbourne - * Licensed under the MIT license. - */ - -"use strict"; - -var os = require("os"); -var _ = require("lodash"); - -var messages = { - error: "Couldn't find a suitable IP for you to use. (You're probably offline!)" -}; - -exports.getIp = function (env) { - - var networkInterfaces = os.networkInterfaces(); - - var matches = []; - var returnValue; - - // loop through results and check that it's an IPv4 address & it's not internal - _.each(networkInterfaces, function (_interface) { - _.each(_interface, function (address) { - if (address.internal === false && address.family === "IPv4") { - matches.push(address.address); - } - }); - }); - - if (matches.length) { - - if (matches.length === 1) { - returnValue = matches[0]; - } else { - returnValue = matches; - } - - return returnValue; - } - - if (env === "cli") { - return messages.error; - } - - return false; -}; - -if (require.main === module) { - console.log(exports.getIp("cli")); -} \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/LICENSE.txt b/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/LICENSE.txt deleted file mode 100644 index 49869bb..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright 2012-2013 The Dojo Foundation -Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -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 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. \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/README.md b/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/README.md deleted file mode 100644 index 3a2abc5..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# Lo-Dash v2.2.1 -A utility library delivering consistency, [customization](http://lodash.com/custom-builds), [performance](http://lodash.com/benchmarks), & [extras](http://lodash.com/#features). - -## Download - -* Modern builds perfect for newer browsers/environments:
-[Development](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.js) & -[Production](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.min.js) - -* Compatibility builds for older environment support too:
-[Development](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.compat.js) & -[Production](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.compat.min.js) - -* Underscore builds to use as a drop-in replacement:
-[Development](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.underscore.js) & -[Production](https://raw.github.com/lodash/lodash/2.2.1/dist/lodash.underscore.min.js) - -CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash).
-For smaller file sizes, create [custom builds](http://lodash.com/custom-builds) with only the features needed.
-Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-node](https://npmjs.org/package/lodash-node), & [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method. - -## Dive in - -There’s plenty of [documentation](http://lodash.com/docs), [unit tests](http://lodash.com/tests), & [benchmarks](http://lodash.com/benchmarks).
-For a list of upcoming features, check out our [roadmap](https://github.com/lodash/lodash/wiki/Roadmap).
-The full changelog for this release is available on our [wiki](https://github.com/lodash/lodash/wiki/Changelog). - -## Features *not* in Underscore - - * AMD loader support ([curl](https://github.com/cujojs/curl), [dojo](http://dojotoolkit.org/), [requirejs](http://requirejs.org/), etc.) - * [_(…)](http://lodash.com/docs#_) supports intuitive chaining - * [_.at](http://lodash.com/docs#at) for cherry-picking collection values - * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazyâ€*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods - * [_.clone](http://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects - * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays & objects - * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` - * [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins - * [_.curry](http://lodash.com/docs#curry) for creating [curried](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) functions - * [_.debounce](http://lodash.com/docs#debounce) & [_.throttle](http://lodash.com/docs#throttle) accept additional `options` for more control - * [_.findIndex](http://lodash.com/docs#findIndex) & [_.findKey](http://lodash.com/docs#findKey) for finding indexes & keys - * [_.forEach](http://lodash.com/docs#forEach) is chainable & supports exiting early - * [_.forIn](http://lodash.com/docs#forIn) for iterating own & inherited properties - * [_.forOwn](http://lodash.com/docs#forOwn) for iterating own properties - * [_.isPlainObject](http://lodash.com/docs#isPlainObject) for checking if values are created by `Object` - * [_.memoize](http://lodash.com/docs#memoize) exposes the `cache` of memoized functions - * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend) - * [_.parseInt](http://lodash.com/docs#parseInt) for consistent behavior - * [_.partialRight](http://lodash.com/docs#partialRight) for [partial application](http://lodash.com/docs#partial) from the right - * [_.pull](http://lodash.com/docs#pull) & [_.remove](http://lodash.com/docs#remove) for mutating arrays - * [_.random](http://lodash.com/docs#random) supports returning floating-point numbers - * [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking - * [_.support](http://lodash.com/docs#support) for flagging environment features - * [_.template](http://lodash.com/docs#template) supports [*“importsâ€*](http://lodash.com/docs#templateSettings_imports) options & [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6) - * [_.transform](http://lodash.com/docs#transform) as a powerful alternative to [_.reduce](http://lodash.com/docs#reduce) for transforming objects - * [_.where](http://lodash.com/docs#where) supports deep object comparisons - * [_.zip](http://lodash.com/docs#zip) is capable of unzipping values - * [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick), & - [more](http://lodash.com/docs "_.assign, _.clone, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept callbacks - * [_.contains](http://lodash.com/docs#contains), [_.toArray](http://lodash.com/docs#toArray), & - [more](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.forEachRight, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.where") accept strings - * [_.filter](http://lodash.com/docs#filter), [_.map](http://lodash.com/docs#map), & - [more](http://lodash.com/docs "_.countBy, _.every, _.find, _.findKey, _.findLast, _.findLastIndex, _.findLastKey, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluckâ€* & *“_.whereâ€* shorthands - * [_.findLast](http://lodash.com/docs#findLast), [_.findLastIndex](http://lodash.com/docs#findLastIndex), & - [more](http://lodash.com/docs "_.findLastKey, _.forEachRight, _.forInRight, _.forOwnRight") right-associative methods - -## Resources - - * Posts - - [Say “Hello†to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/) - - [Custom builds in Lo-Dash 2.0](http://kitcambridge.be/blog/custom-builds-in-lo-dash-2-dot-0/) - - * Videos - - [Introduction](https://vimeo.com/44154599) - - [Origins](https://vimeo.com/44154600) - - [Optimizations & builds](https://vimeo.com/44154601) - - [Native method use](https://vimeo.com/48576012) - - [Testing](https://vimeo.com/45865290) - - [CascadiaJS ’12](http://www.youtube.com/watch?v=dpPy4f_SeEk) - -## Support - -Tested in Chrome 5~29, Firefox 2~24, IE 6-10, Opera 9.25~16, Safari 3-6, Node.js 0.6.8-0.10.20, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, & Rhino 1.7RC5. - -## Installation & usage - -In browsers: - -```html - -``` - -Using [`npm`](http://npmjs.org/): - -```bash -npm i --save lodash - -{sudo} npm i -g lodash -npm ln lodash -``` - -In [Node.js](http://nodejs.org/) & [Ringo](http://ringojs.org/): - -```js -var _ = require('lodash'); -// or as Underscore -var _ = require('lodash/dist/lodash.underscore'); -``` - -**Notes:** - * Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL - * If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it - * Node.js 0.10.8-0.10.11 [have](https://github.com/joyent/node/issues/5622) [bugs](https://github.com/joyent/node/issues/5688) preventing minified builds - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('lodash.js'); -``` - -In an AMD loader: - -```js -require({ - 'packages': [ - { 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' } - ] -}, -['lodash'], function(_) { - console.log(_.VERSION); -}); -``` - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/blainebublitz](http://gravatar.com/avatar/ac1c67fd906c9fecd823ce302283b4c1?s=70)](http://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | -|---|---|---| -| [Blaine Bublitz](http://iceddev.com/) | [Kit Cambridge](http://kitcambridge.github.io/) | [Mathias Bynens](http://mathiasbynens.be/) | diff --git a/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/dist/lodash.compat.js b/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/dist/lodash.compat.js deleted file mode 100644 index e48344d..0000000 --- a/node_modules/browser-sync/node_modules/dev-ip/node_modules/lodash/dist/lodash.compat.js +++ /dev/null @@ -1,6721 +0,0 @@ -/** - * @license - * Lo-Dash 2.2.1 (Custom Build) - * Build: `lodash -o ./dist/lodash.compat.js` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.5.2 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre ES5 environments */ - var undefined; - - /** Used to pool arrays and objects used internally */ - var arrayPool = [], - objectPool = []; - - /** Used to generate unique IDs */ - var idCounter = 0; - - /** Used internally to indicate various things */ - var indicatorObject = {}; - - /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ - var keyPrefix = +new Date + ''; - - /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 75; - - /** Used as the max size of the `arrayPool` and `objectPool` */ - var maxPoolSize = 40; - - /** Used to detect and test whitespace */ - var whitespace = ( - // whitespace - ' \t\x0B\f\xA0\ufeff' + - - // line terminators - '\n\r\u2028\u2029' + - - // unicode category "Zs" space separators - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' - ); - - /** Used to match empty string literals in compiled template source */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** - * Used to match ES6 template delimiters - * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6 - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match regexp flags from their coerced string values */ - var reFlags = /\w*$/; - - /** Used to detected named functions */ - var reFuncName = /^function[ \n\r\t]+\w/; - - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match leading whitespace and zeros to be removed */ - var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); - - /** Used to ensure capturing order of template delimiters */ - var reNoMatch = /($^)/; - - /** Used to detect functions containing a `this` reference */ - var reThis = /\bthis\b/; - - /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; - - /** Used to assign default `context` object properties */ - var contextProps = [ - 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', - 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', - 'parseInt', 'setImmediate', 'setTimeout' - ]; - - /** Used to fix the JScript [[DontEnum]] bug */ - var shadowedProps = [ - 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', - 'toLocaleString', 'toString', 'valueOf' - ]; - - /** Used to make template sourceURLs easier to identify */ - var templateCounter = 0; - - /** `Object#toString` result shortcuts */ - var argsClass = '[object Arguments]', - arrayClass = '[object Array]', - boolClass = '[object Boolean]', - dateClass = '[object Date]', - errorClass = '[object Error]', - funcClass = '[object Function]', - numberClass = '[object Number]', - objectClass = '[object Object]', - regexpClass = '[object RegExp]', - stringClass = '[object String]'; - - /** Used to identify object classifications that `_.clone` supports */ - var cloneableClasses = {}; - cloneableClasses[funcClass] = false; - cloneableClasses[argsClass] = cloneableClasses[arrayClass] = - cloneableClasses[boolClass] = cloneableClasses[dateClass] = - cloneableClasses[numberClass] = cloneableClasses[objectClass] = - cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; - - /** Used as an internal `_.debounce` options object */ - var debounceOptions = { - 'leading': false, - 'maxWait': 0, - 'trailing': false - }; - - /** Used as the property descriptor for `__bindData__` */ - var descriptor = { - 'configurable': false, - 'enumerable': false, - 'value': null, - 'writable': false - }; - - /** Used as the data object for `iteratorTemplate` */ - var iteratorData = { - 'args': '', - 'array': null, - 'bottom': '', - 'firstArg': '', - 'init': '', - 'keys': null, - 'loop': '', - 'shadowedProps': null, - 'support': null, - 'top': '', - 'useHas': false - }; - - /** Used to determine if values are of the language type Object */ - var objectTypes = { - 'boolean': false, - 'function': true, - 'object': true, - 'number': false, - 'string': false, - 'undefined': false - }; - - /** Used to escape characters for inclusion in compiled string literals */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Used as a reference to the global object */ - var root = (objectTypes[typeof window] && window) || this; - - /** Detect free variable `exports` */ - var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; - - /** Detect free variable `module` */ - var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports` */ - var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; - - /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ - var freeGlobal = objectTypes[typeof global] && global; - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * An implementation of `_.contains` for cache objects that mimics the return - * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. - * - * @private - * @param {Object} cache The cache object to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns `0` if `value` is found, else `-1`. - */ - function cacheIndexOf(cache, value) { - var type = typeof value; - cache = cache.cache; - - if (type == 'boolean' || value == null) { - return cache[value] ? 0 : -1; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = (cache = cache[type]) && cache[key]; - - return type == 'object' - ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) - : (cache ? 0 : -1); - } - - /** - * Adds a given value to the corresponding cache object. - * - * @private - * @param {*} value The value to add to the cache. - */ - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - (typeCache[key] || (typeCache[key] = [])).push(value); - } else { - typeCache[key] = true; - } - } - } - - /** - * Used by `_.max` and `_.min` as the default callback when a given - * collection is a string value. - * - * @private - * @param {string} value The character to inspect. - * @returns {number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` elements, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ac = a.criteria, - bc = b.criteria; - - // ensure a stable sort in V8 and other engines - // http://code.google.com/p/v8/issues/detail?id=90 - if (ac !== bc) { - if (ac > bc || typeof ac == 'undefined') { - return 1; - } - if (ac < bc || typeof bc == 'undefined') { - return -1; - } - } - // The JS engine embedded in Adobe applications like InDesign has a buggy - // `Array#sort` implementation that causes it, under certain circumstances, - // to return the same value for `a` and `b`. - // See https://github.com/jashkenas/underscore/pull/1247 - return a.index - b.index; - } - - /** - * Creates a cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [array=[]] The array to search. - * @returns {null|Object} Returns the cache object or `null` if caching should not be used. - */ - function createCache(array) { - var index = -1, - length = array.length, - first = array[0], - mid = array[(length / 2) | 0], - last = array[length - 1]; - - if (first && typeof first == 'object' && - mid && typeof mid == 'object' && last && typeof last == 'object') { - return false; - } - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return result; - } - - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - - /** - * Gets an array from the array pool or creates a new one if the pool is empty. - * - * @private - * @returns {Array} The array from the pool. - */ - function getArray() { - return arrayPool.pop() || []; - } - - /** - * Gets an object from the object pool or creates a new one if the pool is empty. - * - * @private - * @returns {Object} The object from the pool. - */ - function getObject() { - return objectPool.pop() || { - 'array': null, - 'cache': null, - 'criteria': null, - 'false': false, - 'index': 0, - 'null': false, - 'number': null, - 'object': null, - 'push': null, - 'string': null, - 'true': false, - 'undefined': false, - 'value': null - }; - } - - /** - * Checks if `value` is a DOM node in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM node, else `false`. - */ - function isNode(value) { - // IE < 9 presents DOM nodes as `Object` objects except they have `toString` - // methods that are `typeof` "string" and still can coerce nodes to strings - return typeof value.toString != 'function' && typeof (value + '') == 'string'; - } - - /** - * A no-operation function. - * - * @private - */ - function noop() { - // no operation performed - } - - /** - * Releases the given array back to the array pool. - * - * @private - * @param {Array} [array] The array to release. - */ - function releaseArray(array) { - array.length = 0; - if (arrayPool.length < maxPoolSize) { - arrayPool.push(array); - } - } - - /** - * Releases the given object back to the object pool. - * - * @private - * @param {Object} [object] The object to release. - */ - function releaseObject(object) { - var cache = object.cache; - if (cache) { - releaseObject(cache); - } - object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; - if (objectPool.length < maxPoolSize) { - objectPool.push(object); - } - } - - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used instead of `Array#slice` to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|string} collection The collection to slice. - * @param {number} start The start index. - * @param {number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new `lodash` function using the given context object. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} [context=root] The context object. - * @returns {Function} Returns the `lodash` function. - */ - function runInContext(context) { - // Avoid issues with some ES3 environments that attempt to use values, named - // after built-in constructors like `Object`, for the creation of literals. - // ES5 clears this up by stating that literals must use built-in constructors. - // See http://es5.github.io/#x11.1.5. - context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; - - /** Native constructor references */ - var Array = context.Array, - Boolean = context.Boolean, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Number = context.Number, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** - * Used for `Array` method references. - * - * Normally `Array.prototype` would suffice, however, using an array literal - * avoids issues in Narwhal. - */ - var arrayRef = []; - - /** Used for native method references */ - var errorProto = Error.prototype, - objectProto = Object.prototype, - stringProto = String.prototype; - - /** Used to restore the original `_` reference in `noConflict` */ - var oldDash = context._; - - /** Used to detect if a method is native */ - var reNative = RegExp('^' + - String(objectProto.valueOf) - .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - .replace(/valueOf|for [^\]]+/g, '.+?') + '$' - ); - - /** Native method shortcuts */ - var ceil = Math.ceil, - clearTimeout = context.clearTimeout, - floor = Math.floor, - fnToString = Function.prototype.toString, - getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectProto.hasOwnProperty, - now = reNative.test(now = Date.now) && now || function() { return +new Date; }, - push = arrayRef.push, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - setImmediate = context.setImmediate, - setTimeout = context.setTimeout, - splice = arrayRef.splice, - toString = objectProto.toString, - unshift = arrayRef.unshift; - - var defineProperty = (function() { - try { - var o = {}, - func = reNative.test(func = Object.defineProperty) && func, - result = func(o, o, o) && func; - } catch(e) { } - return result; - }()); - - /* Native method shortcuts for methods with the same name as other `lodash` methods */ - var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, - nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, - nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, - nativeIsFinite = context.isFinite, - nativeIsNaN = context.isNaN, - nativeKeys = reNative.test(nativeKeys = Object.keys) && nativeKeys, - nativeMax = Math.max, - nativeMin = Math.min, - nativeParseInt = context.parseInt, - nativeRandom = Math.random, - nativeSlice = arrayRef.slice; - - /** Detect various environments */ - var isIeOpera = reNative.test(context.attachEvent), - isV8 = nativeBind && !/\n|true/.test(nativeBind + isIeOpera); - - /** Used to lookup a built-in constructor by [[Class]] */ - var ctorByClass = {}; - ctorByClass[arrayClass] = Array; - ctorByClass[boolClass] = Boolean; - ctorByClass[dateClass] = Date; - ctorByClass[funcClass] = Function; - ctorByClass[objectClass] = Object; - ctorByClass[numberClass] = Number; - ctorByClass[regexpClass] = RegExp; - ctorByClass[stringClass] = String; - - /** Used to avoid iterating non-enumerable properties in IE < 9 */ - var nonEnumProps = {}; - nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; - nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; - nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; - nonEnumProps[objectClass] = { 'constructor': true }; - - (function() { - var length = shadowedProps.length; - while (length--) { - var prop = shadowedProps[length]; - for (var className in nonEnumProps) { - if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], prop)) { - nonEnumProps[className][prop] = false; - } - } - } - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps the given value to enable intuitive - * method chaining. - * - * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: - * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, - * and `unshift` - * - * Chaining is supported in custom builds as long as the `value` method is - * implicitly or explicitly included in the build. - * - * The chainable wrapper functions are: - * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `createCallback`, `curry`, `debounce`, - * `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, - * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, - * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, - * `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, `once`, `pairs`, - * `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, `range`, `reject`, - * `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, - * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` - * - * The non-chainable wrapper functions are: - * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, - * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, - * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, - * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, - * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` - * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. - * - * Explicit chaining can be enabled by using the `_.chain` method. - * - * @name _ - * @constructor - * @category Chaining - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - * @example - * - * var wrapped = _([1, 2, 3]); - * - * // returns an unwrapped value - * wrapped.reduce(function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * // returns a wrapped value - * var squares = wrapped.map(function(num) { - * return num * num; - * }); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor - return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__')) - ? value - : new lodashWrapper(value); - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} chainAll A flag to enable chaining for all methods - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value, chainAll) { - this.__chain__ = !!chainAll; - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * An object used to flag environments features. - * - * @static - * @memberOf _ - * @type Object - */ - var support = lodash.support = {}; - - (function() { - var ctor = function() { this.x = 1; }, - object = { '0': 1, 'length': 1 }, - props = []; - - ctor.prototype = { 'valueOf': 1, 'y': 1 }; - for (var prop in new ctor) { props.push(prop); } - for (prop in arguments) { } - - /** - * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.argsClass = toString.call(arguments) == argsClass; - - /** - * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5). - * - * @memberOf _.support - * @type boolean - */ - support.argsObject = arguments.constructor == Object && !(arguments instanceof Array); - - /** - * Detect if `name` or `message` properties of `Error.prototype` are - * enumerable by default. (IE < 9, Safari < 5.1) - * - * @memberOf _.support - * @type boolean - */ - support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); - - /** - * Detect if `prototype` properties are enumerable by default. - * - * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 - * (if the prototype or a property on the prototype has been set) - * incorrectly sets a function's `prototype` property [[Enumerable]] - * value to `true`. - * - * @memberOf _.support - * @type boolean - */ - support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); - - /** - * Detect if `Function#bind` exists and is inferred to be fast (all but V8). - * - * @memberOf _.support - * @type boolean - */ - support.fastBind = nativeBind && !isV8; - - /** - * Detect if functions can be decompiled by `Function#toString` - * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). - * - * @memberOf _.support - * @type boolean - */ - support.funcDecomp = !reNative.test(context.WinRTError) && reThis.test(runInContext); - - /** - * Detect if `Function#name` is supported (all but IE). - * - * @memberOf _.support - * @type boolean - */ - support.funcNames = typeof Function.name == 'string'; - - /** - * Detect if `arguments` object indexes are non-enumerable - * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumArgs = prop != 0; - - /** - * Detect if properties shadowing those on `Object.prototype` are non-enumerable. - * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are - * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumShadows = !/valueOf/.test(props); - - /** - * Detect if own properties are iterated after inherited properties (all but IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.ownLast = props[0] != 'x'; - - /** - * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. - * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()` - * and `splice()` functions that fail to remove the last element, `value[0]`, - * of array-like objects even though the `length` property is set to `0`. - * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()` - * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9. - * - * @memberOf _.support - * @type boolean - */ - support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); - - /** - * Detect lack of support for accessing string characters by index. - * - * IE < 8 can't access characters by index and IE 8 can only access - * characters by index on string literals. - * - * @memberOf _.support - * @type boolean - */ - support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx'; - - /** - * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9) - * and that the JS engine errors when attempting to coerce an object to - * a string without a `toString` function. - * - * @memberOf _.support - * @type boolean - */ - try { - support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); - } catch(e) { - support.nodeClass = true; - } - }(1)); - - /** - * By default, the template delimiters used by Lo-Dash are similar to those in - * embedded Ruby (ERB). Change the following template settings to use alternative - * delimiters. - * - * @static - * @memberOf _ - * @type Object - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'escape': /<%-([\s\S]+?)%>/g, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'evaluate': /<%([\s\S]+?)%>/g, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type string - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type Object - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type Function - */ - '_': lodash - } - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The template used to create iterator functions. - * - * @private - * @param {Object} data The data object used to populate the text. - * @returns {string} Returns the interpolated text. - */ - var iteratorTemplate = function(obj) { - - var __p = 'var index, iterable = ' + - (obj.firstArg) + - ', result = ' + - (obj.init) + - ';\nif (!iterable) return result;\n' + - (obj.top) + - ';'; - if (obj.array) { - __p += '\nvar length = iterable.length; index = -1;\nif (' + - (obj.array) + - ') { '; - if (support.unindexedChars) { - __p += '\n if (isString(iterable)) {\n iterable = iterable.split(\'\')\n } '; - } - __p += '\n while (++index < length) {\n ' + - (obj.loop) + - ';\n }\n}\nelse { '; - } else if (support.nonEnumArgs) { - __p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' + - (obj.loop) + - ';\n }\n } else { '; - } - - if (support.enumPrototypes) { - __p += '\n var skipProto = typeof iterable == \'function\';\n '; - } - - if (support.enumErrorProps) { - __p += '\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n '; - } - - var conditions = []; if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); } if (support.enumErrorProps) { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); } - - if (obj.useHas && obj.keys) { - __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; - if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - } else { - __p += '\n for (index in iterable) {\n'; - if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); } if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - if (support.nonEnumShadows) { - __p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n '; - for (k = 0; k < 7; k++) { - __p += '\n index = \'' + - (obj.shadowedProps[k]) + - '\';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))'; - if (!obj.useHas) { - __p += ' || (!nonEnum[index] && iterable[index] !== objectProto[index])'; - } - __p += ') {\n ' + - (obj.loop) + - ';\n } '; - } - __p += '\n } '; - } - - } - - if (obj.array || support.nonEnumArgs) { - __p += '\n}'; - } - __p += - (obj.bottom) + - ';\nreturn result'; - - return __p - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.clone` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [deep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates clones with source counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, deep, callback, stackA, stackB) { - if (callback) { - var result = callback(value); - if (typeof result != 'undefined') { - return result; - } - } - // inspect [[Class]] - var isObj = isObject(value); - if (isObj) { - var className = toString.call(value); - if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) { - return value; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return new ctor(+value); - - case numberClass: - case stringClass: - return new ctor(value); - - case regexpClass: - result = ctor(value.source, reFlags.exec(value)); - result.lastIndex = value.lastIndex; - return result; - } - } else { - return value; - } - var isArr = isArray(value); - if (deep) { - // check for circular references and return corresponding clone - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; - } - } - result = isArr ? ctor(value.length) : {}; - } - else { - result = isArr ? slice(value) : assign({}, value); - } - // add array properties assigned by `RegExp#exec` - if (isArr) { - if (hasOwnProperty.call(value, 'index')) { - result.index = value.index; - } - if (hasOwnProperty.call(value, 'input')) { - result.input = value.input; - } - } - // exit for shallow clone - if (!deep) { - return result; - } - // add the source value to the stack of traversed objects - // and associate it with its clone - stackA.push(value); - stackB.push(result); - - // recursively populate clone (susceptible to call stack limits) - (isArr ? baseEach : forOwn)(value, function(objValue, key) { - result[key] = baseClone(objValue, deep, callback, stackA, stackB); - }); - - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.createCallback` without support for creating - * "_.pluck" or "_.where" style callbacks. - * - * @private - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - */ - function baseCreateCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - // exit early if there is no `thisArg` - if (typeof thisArg == 'undefined') { - return func; - } - var bindData = func.__bindData__ || (support.funcNames && !func.name); - if (typeof bindData == 'undefined') { - var source = reThis && fnToString.call(func); - if (!support.funcNames && source && !reFuncName.test(source)) { - bindData = true; - } - if (support.funcNames || !bindData) { - // checks if `func` references the `this` keyword and stores the result - bindData = !support.funcDecomp || reThis.test(source); - setBindData(func, bindData); - } - } - // exit early if there are no `this` references or `func` is bound - if (bindData !== true && (bindData && bindData[1] & 1)) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 2: return function(a, b) { - return func.call(thisArg, a, b); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return bind(func, thisArg); - } - - /** - * The base implementation of `_.flatten` without support for callback - * shorthands or `thisArg` binding. - * - * @private - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {boolean} [isArgArrays=false] A flag to restrict flattening to arrays and `arguments` objects. - * @param {number} [fromIndex=0] The index to start from. - * @returns {Array} Returns a new flattened array. - */ - function baseFlatten(array, isShallow, isArgArrays, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - - if (value && typeof value == 'object' && typeof value.length == 'number' - && (isArray(value) || isArguments(value))) { - // recursively flatten arrays (susceptible to call stack limits) - if (!isShallow) { - value = baseFlatten(value, isShallow, isArgArrays); - } - var valIndex = -1, - valLength = value.length, - resIndex = result.length; - - result.length += valLength; - while (++valIndex < valLength) { - result[resIndex++] = value[valIndex]; - } - } else if (!isArgArrays) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.isEqual`, without support for `thisArg` binding, - * that allows partial "_.where" style comparisons. - * - * @private - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. - * @param {Array} [stackA=[]] Tracks traversed `a` objects. - * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { - // used to indicate that when comparing objects, `a` has at least the properties of `b` - if (callback) { - var result = callback(a, b); - if (typeof result != 'undefined') { - return !!result; - } - } - // exit early for identical values - if (a === b) { - // treat `+0` vs. `-0` as not equal - return a !== 0 || (1 / a == 1 / b); - } - var type = typeof a, - otherType = typeof b; - - // exit early for unlike primitive values - if (a === a && - !(a && objectTypes[type]) && - !(b && objectTypes[otherType])) { - return false; - } - // exit early for `null` and `undefined` avoiding ES3's Function#call behavior - // http://es5.github.io/#x15.3.4.4 - if (a == null || b == null) { - return a === b; - } - // compare [[Class]] names - var className = toString.call(a), - otherClass = toString.call(b); - - if (className == argsClass) { - className = objectClass; - } - if (otherClass == argsClass) { - otherClass = objectClass; - } - if (className != otherClass) { - return false; - } - switch (className) { - case boolClass: - case dateClass: - // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal - return +a == +b; - - case numberClass: - // treat `NaN` vs. `NaN` as equal - return (a != +a) - ? b != +b - // but treat `+0` vs. `-0` as not equal - : (a == 0 ? (1 / a == 1 / b) : a == +b); - - case regexpClass: - case stringClass: - // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) - // treat string primitives and their corresponding object instances as equal - return a == String(b); - } - var isArr = className == arrayClass; - if (!isArr) { - // unwrap any `lodash` wrapped values - if (hasOwnProperty.call(a, '__wrapped__ ') || hasOwnProperty.call(b, '__wrapped__')) { - return baseIsEqual(a.__wrapped__ || a, b.__wrapped__ || b, callback, isWhere, stackA, stackB); - } - // exit for functions and DOM nodes - if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { - return false; - } - // in older versions of Opera, `arguments` objects have `Array` constructors - var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, - ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; - - // non `Object` object instances with different constructors are not equal - if (ctorA != ctorB && !( - isFunction(ctorA) && ctorA instanceof ctorA && - isFunction(ctorB) && ctorB instanceof ctorB - )) { - return false; - } - } - // assume cyclic structures are equal - // the algorithm for detecting cyclic structures is adapted from ES 5.1 - // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == a) { - return stackB[length] == b; - } - } - var size = 0; - result = true; - - // add `a` and `b` to the stack of traversed objects - stackA.push(a); - stackB.push(b); - - // recursively compare objects and arrays (susceptible to call stack limits) - if (isArr) { - length = a.length; - size = b.length; - - // compare lengths to determine if a deep comparison is necessary - result = size == a.length; - if (!result && !isWhere) { - return result; - } - // deep compare the contents, ignoring non-numeric properties - while (size--) { - var index = length, - value = b[size]; - - if (isWhere) { - while (index--) { - if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) { - break; - } - } - } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) { - break; - } - } - return result; - } - // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` - // which, in this case, is more costly - forIn(b, function(value, key, b) { - if (hasOwnProperty.call(b, key)) { - // count the number of properties. - size++; - // deep compare each property value. - return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB)); - } - }); - - if (result && !isWhere) { - // ensure both objects have the same number of properties - forIn(a, function(value, key, a) { - if (hasOwnProperty.call(a, key)) { - // `size` will be `-1` if `a` has more properties than `b` - return (result = --size > -1); - } - }); - } - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.merge` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} [callback] The function to customize merging properties. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates values with source counterparts. - */ - function baseMerge(object, source, callback, stackA, stackB) { - (isArray(source) ? forEach : forOwn)(source, function(source, key) { - var found, - isArr, - result = source, - value = object[key]; - - if (source && ((isArr = isArray(source)) || isPlainObject(source))) { - // avoid merging previously merged cyclic sources - var stackLength = stackA.length; - while (stackLength--) { - if ((found = stackA[stackLength] == source)) { - value = stackB[stackLength]; - break; - } - } - if (!found) { - var isShallow; - if (callback) { - result = callback(value, source); - if ((isShallow = typeof result != 'undefined')) { - value = result; - } - } - if (!isShallow) { - value = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); - } - // add `source` and associated `value` to the stack of traversed objects - stackA.push(source); - stackB.push(value); - - // recursively merge objects and arrays (susceptible to call stack limits) - if (!isShallow) { - baseMerge(value, source, callback, stackA, stackB); - } - } - } - else { - if (callback) { - result = callback(value, source); - if (typeof result == 'undefined') { - result = source; - } - } - if (typeof result != 'undefined') { - value = result; - } - } - object[key] = value; - }); - } - - /** - * The base implementation of `_.uniq` without support for callback shorthands - * or `thisArg` binding. - * - * @private - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function} [callback] The function called per iteration. - * @returns {Array} Returns a duplicate-value-free array. - */ - function baseUniq(array, isSorted, callback) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - result = []; - - var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf, - seen = (callback || isLarge) ? getArray() : result; - - if (isLarge) { - var cache = createCache(seen); - if (cache) { - indexOf = cacheIndexOf; - seen = cache; - } else { - isLarge = false; - seen = callback ? seen : (releaseArray(seen), result); - } - } - while (++index < length) { - var value = array[index], - computed = callback ? callback(value, index, array) : value; - - if (isSorted - ? !index || seen[seen.length - 1] !== computed - : indexOf(seen, computed) < 0 - ) { - if (callback || isLarge) { - seen.push(computed); - } - result.push(value); - } - } - if (isLarge) { - releaseArray(seen.array); - releaseObject(seen); - } else if (callback) { - releaseArray(seen); - } - return result; - } - - /** - * Creates a function that aggregates a collection, creating an object composed - * of keys generated from the results of running each element of the collection - * through a callback. The given `setter` function sets the keys and values - * of the composed object. - * - * @private - * @param {Function} setter The setter function. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter) { - return function(collection, callback, thisArg) { - var result = {}; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - setter(result, value, callback(value, index, collection), collection); - } - } else { - baseEach(collection, function(value, key, collection) { - setter(result, value, callback(value, key, collection), collection); - }); - } - return result; - }; - } - - /** - * Creates a function that, when called, either curries or invokes `func` - * with an optional `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to reference. - * @param {number} bitmask The bitmask of method flags to compose. - * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` - * 8 - `_.curry` (bound) - * 16 - `_.partial` - * 32 - `_.partialRight` - * @param {Array} [partialArgs] An array of arguments to prepend to those - * provided to the new function. - * @param {Array} [partialRightArgs] An array of arguments to append to those - * provided to the new function. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new bound function. - */ - function createBound(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) { - var isBind = bitmask & 1, - isBindKey = bitmask & 2, - isCurry = bitmask & 4, - isCurryBound = bitmask & 8, - isPartial = bitmask & 16, - isPartialRight = bitmask & 32, - key = func; - - if (!isBindKey && !isFunction(func)) { - throw new TypeError; - } - if (isPartial && !partialArgs.length) { - bitmask &= ~16; - isPartial = partialArgs = false; - } - if (isPartialRight && !partialRightArgs.length) { - bitmask &= ~32; - isPartialRight = partialRightArgs = false; - } - var bindData = func && func.__bindData__; - if (bindData) { - if (isBind && !(bindData[1] & 1)) { - bindData[4] = thisArg; - } - if (!isBind && bindData[1] & 1) { - bitmask |= 8; - } - if (isCurry && !(bindData[1] & 4)) { - bindData[5] = arity; - } - if (isPartial) { - push.apply(bindData[2] || (bindData[2] = []), partialArgs); - } - if (isPartialRight) { - push.apply(bindData[3] || (bindData[3] = []), partialRightArgs); - } - bindData[1] |= bitmask; - return createBound.apply(null, bindData); - } - // use `Function#bind` if it exists and is fast - // (in V8 `Function#bind` is slower except when partially applied) - if (isBind && !(isBindKey || isCurry || isPartialRight) && - (support.fastBind || (nativeBind && isPartial))) { - if (isPartial) { - var args = [thisArg]; - push.apply(args, partialArgs); - } - var bound = isPartial - ? nativeBind.apply(func, args) - : nativeBind.call(func, thisArg); - } - else { - bound = function() { - // `Function#bind` spec - // http://es5.github.io/#x15.3.4.5 - var args = arguments, - thisBinding = isBind ? thisArg : this; - - if (isCurry || isPartial || isPartialRight) { - args = nativeSlice.call(args); - if (isPartial) { - unshift.apply(args, partialArgs); - } - if (isPartialRight) { - push.apply(args, partialRightArgs); - } - if (isCurry && args.length < arity) { - bitmask |= 16 & ~32; - return createBound(func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity); - } - } - if (isBindKey) { - func = thisBinding[key]; - } - if (this instanceof bound) { - // ensure `new bound` is an instance of `func` - thisBinding = createObject(func.prototype); - - // mimic the constructor's `return` behavior - // http://es5.github.io/#x13.2.2 - var result = func.apply(thisBinding, args); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisBinding, args); - }; - } - setBindData(bound, nativeSlice.call(arguments)); - return bound; - } - - /** - * Creates compiled iteration functions. - * - * @private - * @param {...Object} [options] The compile options object(s). - * @param {string} [options.array] Code to determine if the iterable is an array or array-like. - * @param {boolean} [options.useHas] Specify using `hasOwnProperty` checks in the object loop. - * @param {Function} [options.keys] A reference to `_.keys` for use in own property iteration. - * @param {string} [options.args] A comma separated string of iteration function arguments. - * @param {string} [options.top] Code to execute before the iteration branches. - * @param {string} [options.loop] Code to execute in the object loop. - * @param {string} [options.bottom] Code to execute after the iteration branches. - * @returns {Function} Returns the compiled function. - */ - function createIterator() { - // data properties - iteratorData.shadowedProps = shadowedProps; - - // iterator options - iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = ''; - iteratorData.init = 'iterable'; - iteratorData.useHas = true; - - // merge options into a template data object - for (var object, index = 0; object = arguments[index]; index++) { - for (var key in object) { - iteratorData[key] = object[key]; - } - } - var args = iteratorData.args; - iteratorData.firstArg = /^[^,]+/.exec(args)[0]; - - // create the function factory - var factory = Function( - 'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' + - 'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' + - 'objectTypes, nonEnumProps, stringClass, stringProto, toString', - 'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}' - ); - - // return the compiled function - return factory( - baseCreateCallback, errorClass, errorProto, hasOwnProperty, - indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto, - objectTypes, nonEnumProps, stringClass, stringProto, toString - ); - } - - /** - * Creates a new object with the specified `prototype`. - * - * @private - * @param {Object} prototype The prototype object. - * @returns {Object} Returns the new object. - */ - function createObject(prototype) { - return isObject(prototype) ? nativeCreate(prototype) : {}; - } - // fallback for browsers without `Object.create` - if (!nativeCreate) { - createObject = function(prototype) { - if (isObject(prototype)) { - noop.prototype = prototype; - var result = new noop; - noop.prototype = null; - } - return result || {}; - }; - } - - /** - * Used by `escape` to convert characters to HTML entities. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; - } - - /** - * Gets the appropriate "indexOf" function. If the `_.indexOf` method is - * customized, this method returns the custom method, otherwise it returns - * the `baseIndexOf` function. - * - * @private - * @returns {Function} Returns the "indexOf" function. - */ - function getIndexOf() { - var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; - return result; - } - - /** - * Sets `this` binding data on a given function. - * - * @private - * @param {Function} func The function to set data on. - * @param {*} value The value to set. - */ - var setBindData = !defineProperty ? noop : function(func, value) { - descriptor.value = value; - defineProperty(func, '__bindData__', descriptor); - }; - - /** - * A fallback implementation of `isPlainObject` which checks if a given value - * is an object created by the `Object` constructor, assuming objects created - * by the `Object` constructor have no inherited enumerable properties and that - * there are no `Object.prototype` extensions. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - */ - function shimIsPlainObject(value) { - var ctor, - result; - - // avoid non Object objects, `arguments` objects, and DOM elements - if (!(value && toString.call(value) == objectClass) || - (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) || - (!support.argsClass && isArguments(value)) || - (!support.nodeClass && isNode(value))) { - return false; - } - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - if (support.ownLast) { - forIn(value, function(value, key, object) { - result = hasOwnProperty.call(object, key); - return false; - }); - return result !== false; - } - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - forIn(value, function(value, key) { - result = key; - }); - return typeof result == 'undefined' || hasOwnProperty.call(value, result); - } - - /** - * Used by `unescape` to convert HTML entities to characters. - * - * @private - * @param {string} match The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - function unescapeHtmlChar(match) { - return htmlUnescapes[match]; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Checks if `value` is an `arguments` object. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`. - * @example - * - * (function() { return _.isArguments(arguments); })(1, 2, 3); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - function isArguments(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == argsClass || false; - } - // fallback for browsers that can't detect `arguments` objects by [[Class]] - if (!support.argsClass) { - isArguments = function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - hasOwnProperty.call(value, 'callee') || false; - }; - } - - /** - * Checks if `value` is an array. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an array, else `false`. - * @example - * - * (function() { return _.isArray(arguments); })(); - * // => false - * - * _.isArray([1, 2, 3]); - * // => true - */ - var isArray = nativeIsArray || function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == arrayClass || false; - }; - - /** - * A fallback implementation of `Object.keys` which produces an array of the - * given object's own enumerable property names. - * - * @private - * @type Function - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - */ - var shimKeys = createIterator({ - 'args': 'object', - 'init': '[]', - 'top': 'if (!(objectTypes[typeof object])) return result', - 'loop': 'result.push(index)' - }); - - /** - * Creates an array composed of the own enumerable property names of an object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - * @example - * - * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); - * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) - */ - var keys = !nativeKeys ? shimKeys : function(object) { - if (!isObject(object)) { - return []; - } - if ((support.enumPrototypes && typeof object == 'function') || - (support.nonEnumArgs && object.length && isArguments(object))) { - return shimKeys(object); - } - return nativeKeys(object); - }; - - /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */ - var eachIteratorOptions = { - 'args': 'collection, callback, thisArg', - 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)", - 'array': "typeof length == 'number'", - 'keys': keys, - 'loop': 'if (callback(iterable[index], index, collection) === false) return result' - }; - - /** Reusable iterator options for `assign` and `defaults` */ - var defaultsIteratorOptions = { - 'args': 'object, source, guard', - 'top': - 'var args = arguments,\n' + - ' argsIndex = 0,\n' + - " argsLength = typeof guard == 'number' ? 2 : args.length;\n" + - 'while (++argsIndex < argsLength) {\n' + - ' iterable = args[argsIndex];\n' + - ' if (iterable && objectTypes[typeof iterable]) {', - 'keys': keys, - 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", - 'bottom': ' }\n}' - }; - - /** Reusable iterator options for `forIn` and `forOwn` */ - var forOwnIteratorOptions = { - 'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top, - 'array': false - }; - - /** - * Used to convert characters to HTML entities: - * - * Though the `>` character is escaped for symmetry, characters like `>` and `/` - * don't require escaping in HTML and have no special meaning unless they're part - * of a tag or an unquoted attribute value. - * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact") - */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to convert HTML entities to characters */ - var htmlUnescapes = invert(htmlEscapes); - - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'), - reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g'); - - /** - * A function compiled to iterate `arguments` objects, arrays, objects, and - * strings consistenly across environments, executing the callback for each - * element in the collection. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index|key, collection). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @private - * @type Function - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - */ - var baseEach = createIterator(eachIteratorOptions); - - /*--------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources will overwrite property assignments of previous - * sources. If a callback is provided it will be executed to produce the - * assigned values. The callback is bound to `thisArg` and invoked with two - * arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @type Function - * @alias extend - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize assigning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * _.assign({ 'name': 'moe' }, { 'age': 40 }); - * // => { 'name': 'moe', 'age': 40 } - * - * var defaults = _.partialRight(_.assign, function(a, b) { - * return typeof a == 'undefined' ? b : a; - * }); - * - * var food = { 'name': 'apple' }; - * defaults(food, { 'name': 'banana', 'type': 'fruit' }); - * // => { 'name': 'apple', 'type': 'fruit' } - */ - var assign = createIterator(defaultsIteratorOptions, { - 'top': - defaultsIteratorOptions.top.replace(';', - ';\n' + - "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" + - ' var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n' + - "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" + - ' callback = args[--argsLength];\n' + - '}' - ), - 'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]' - }); - - /** - * Creates a clone of `value`. If `deep` is `true` nested objects will also - * be cloned, otherwise they will be assigned by reference. If a callback - * is provided it will be executed to produce the cloned values. If the - * callback returns `undefined` cloning will be handled by the method instead. - * The callback is bound to `thisArg` and invoked with one argument; (value). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to clone. - * @param {boolean} [deep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the cloned value. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * var shallow = _.clone(stooges); - * shallow[0] === stooges[0]; - * // => true - * - * var deep = _.clone(stooges, true); - * deep[0] === stooges[0]; - * // => false - * - * _.mixin({ - * 'clone': _.partialRight(_.clone, function(value) { - * return _.isElement(value) ? value.cloneNode(false) : undefined; - * }) - * }); - * - * var clone = _.clone(document.body); - * clone.childNodes.length; - * // => 0 - */ - function clone(value, deep, callback, thisArg) { - // allows working with "Collections" methods without using their `index` - // and `collection` arguments for `deep` and `callback` - if (typeof deep != 'boolean' && deep != null) { - thisArg = callback; - callback = deep; - deep = false; - } - return baseClone(value, deep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Creates a deep clone of `value`. If a callback is provided it will be - * executed to produce the cloned values. If the callback returns `undefined` - * cloning will be handled by the method instead. The callback is bound to - * `thisArg` and invoked with one argument; (value). - * - * Note: This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the deep cloned value. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * var deep = _.cloneDeep(stooges); - * deep[0] === stooges[0]; - * // => false - * - * var view = { - * 'label': 'docs', - * 'node': element - * }; - * - * var clone = _.cloneDeep(view, function(value) { - * return _.isElement(value) ? value.cloneNode(true) : undefined; - * }); - * - * clone.node == view.node; - * // => false - */ - function cloneDeep(value, callback, thisArg) { - return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object for all destination properties that resolve to `undefined`. Once a - * property is set, additional defaults of the same property will be ignored. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param- {Object} [guard] Allows working with `_.reduce` without using its - * `key` and `object` arguments as sources. - * @returns {Object} Returns the destination object. - * @example - * - * var food = { 'name': 'apple' }; - * _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); - * // => { 'name': 'apple', 'type': 'fruit' } - */ - var defaults = createIterator(defaultsIteratorOptions); - - /** - * This method is like `_.findIndex` except that it returns the key of the - * first element that passes the callback check, instead of the element itself. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { - * return num % 2 == 0; - * }); - * // => 'b' (property order is not guaranteed across environments) - */ - function findKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwn(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * This method is like `_.findKey` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * _.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { - * return num % 2 == 1; - * }); - * // => returns `c`, assuming `_.findKey` returns `a` - */ - function findLastKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwnRight(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * Iterates over own and inherited enumerable properties of an object, - * executing the callback for each property. The callback is bound to `thisArg` - * and invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Dog(name) { - * this.name = name; - * } - * - * Dog.prototype.bark = function() { - * console.log('Woof, woof!'); - * }; - * - * _.forIn(new Dog('Dagny'), function(value, key) { - * console.log(key); - * }); - * // => logs 'bark' and 'name' (property order is not guaranteed across environments) - */ - var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, { - 'useHas': false - }); - - /** - * This method is like `_.forIn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Dog(name) { - * this.name = name; - * } - * - * Dog.prototype.bark = function() { - * console.log('Woof, woof!'); - * }; - * - * _.forInRight(new Dog('Dagny'), function(value, key) { - * console.log(key); - * }); - * // => logs 'name' and 'bark' assuming `_.forIn ` logs 'bark' and 'name' - */ - function forInRight(object, callback, thisArg) { - var pairs = []; - - forIn(object, function(value, key) { - pairs.push(key, value); - }); - - var length = pairs.length; - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - if (callback(pairs[length--], pairs[length], object) === false) { - break; - } - } - return object; - } - - /** - * Iterates over own enumerable properties of an object, executing the callback - * for each property. The callback is bound to `thisArg` and invoked with three - * arguments; (value, key, object). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) - */ - var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions); - - /** - * This method is like `_.forOwn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' - */ - function forOwnRight(object, callback, thisArg) { - var props = keys(object), - length = props.length; - - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - var key = props[length]; - if (callback(object[key], key, object) === false) { - break; - } - } - return object; - } - - /** - * Creates a sorted array of property names of all enumerable properties, - * own and inherited, of `object` that have function values. - * - * @static - * @memberOf _ - * @alias methods - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names that have function values. - * @example - * - * _.functions(_); - * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] - */ - function functions(object) { - var result = []; - forIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); - } - - /** - * Checks if the specified object `property` exists and is a direct property, - * instead of an inherited property. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to check. - * @param {string} property The property to check for. - * @returns {boolean} Returns `true` if key is a direct property, else `false`. - * @example - * - * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); - * // => true - */ - function has(object, property) { - return object ? hasOwnProperty.call(object, property) : false; - } - - /** - * Creates an object composed of the inverted keys and values of the given object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to invert. - * @returns {Object} Returns the created inverted object. - * @example - * - * _.invert({ 'first': 'moe', 'second': 'larry' }); - * // => { 'moe': 'first', 'larry': 'second' } - */ - function invert(object) { - var index = -1, - props = keys(object), - length = props.length, - result = {}; - - while (++index < length) { - var key = props[index]; - result[object[key]] = key; - } - return result; - } - - /** - * Checks if `value` is a boolean value. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`. - * @example - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || toString.call(value) == boolClass; - } - - /** - * Checks if `value` is a date. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a date, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - */ - function isDate(value) { - return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false; - } - - /** - * Checks if `value` is a DOM element. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - */ - function isElement(value) { - return value ? value.nodeType === 1 : false; - } - - /** - * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a - * length of `0` and objects with no own enumerable properties are considered - * "empty". - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object|string} value The value to inspect. - * @returns {boolean} Returns `true` if the `value` is empty, else `false`. - * @example - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({}); - * // => true - * - * _.isEmpty(''); - * // => true - */ - function isEmpty(value) { - var result = true; - if (!value) { - return result; - } - var className = toString.call(value), - length = value.length; - - if ((className == arrayClass || className == stringClass || - (support.argsClass ? className == argsClass : isArguments(value))) || - (className == objectClass && typeof length == 'number' && isFunction(value.splice))) { - return !length; - } - forOwn(value, function() { - return (result = false); - }); - return result; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If a callback is provided it will be executed - * to compare values. If the callback returns `undefined` comparisons will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (a, b). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var moe = { 'name': 'moe', 'age': 40 }; - * var copy = { 'name': 'moe', 'age': 40 }; - * - * moe == copy; - * // => false - * - * _.isEqual(moe, copy); - * // => true - * - * var words = ['hello', 'goodbye']; - * var otherWords = ['hi', 'goodbye']; - * - * _.isEqual(words, otherWords, function(a, b) { - * var reGreet = /^(?:hello|hi)$/i, - * aGreet = _.isString(a) && reGreet.test(a), - * bGreet = _.isString(b) && reGreet.test(b); - * - * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; - * }); - * // => true - */ - function isEqual(a, b, callback, thisArg) { - return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2)); - } - - /** - * Checks if `value` is, or can be coerced to, a finite number. - * - * Note: This is not the same as native `isFinite` which will return true for - * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is finite, else `false`. - * @example - * - * _.isFinite(-101); - * // => true - * - * _.isFinite('10'); - * // => true - * - * _.isFinite(true); - * // => false - * - * _.isFinite(''); - * // => false - * - * _.isFinite(Infinity); - * // => false - */ - function isFinite(value) { - return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); - } - - /** - * Checks if `value` is a function. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - */ - function isFunction(value) { - return typeof value == 'function'; - } - // fallback for older versions of Chrome and Safari - if (isFunction(/x/)) { - isFunction = function(value) { - return typeof value == 'function' && toString.call(value) == funcClass; - }; - } - - /** - * Checks if `value` is the language type of Object. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ - function isObject(value) { - // check if the value is the ECMAScript language type of Object - // http://es5.github.io/#x8 - // and avoid a V8 bug - // http://code.google.com/p/v8/issues/detail?id=2291 - return !!(value && objectTypes[typeof value]); - } - - /** - * Checks if `value` is `NaN`. - * - * Note: This is not the same as native `isNaN` which will return `true` for - * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(undefined); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is a number. - * - * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a number, else `false`. - * @example - * - * _.isNumber(8.4 * 5); - * // => true - */ - function isNumber(value) { - return typeof value == 'number' || toString.call(value) == numberClass; - } - - /** - * Checks if `value` is an object created by the `Object` constructor. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Stooge(name, age) { - * this.name = name; - * this.age = age; - * } - * - * _.isPlainObject(new Stooge('moe', 40)); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'name': 'moe', 'age': 40 }); - * // => true - */ - var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { - return false; - } - var valueOf = value.valueOf, - objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? (value == objProto || getPrototypeOf(value) == objProto) - : shimIsPlainObject(value); - }; - - /** - * Checks if `value` is a regular expression. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`. - * @example - * - * _.isRegExp(/moe/); - * // => true - */ - function isRegExp(value) { - return (value && objectTypes[typeof value]) ? toString.call(value) == regexpClass : false; - } - - /** - * Checks if `value` is a string. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a string, else `false`. - * @example - * - * _.isString('moe'); - * // => true - */ - function isString(value) { - return typeof value == 'string' || toString.call(value) == stringClass; - } - - /** - * Checks if `value` is `undefined`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - */ - function isUndefined(value) { - return typeof value == 'undefined'; - } - - /** - * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined` into the destination object. Subsequent sources - * will overwrite property assignments of previous sources. If a callback is - * provided it will be executed to produce the merged values of the destination - * and source properties. If the callback returns `undefined` merging will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize merging properties. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * var names = { - * 'stooges': [ - * { 'name': 'moe' }, - * { 'name': 'larry' } - * ] - * }; - * - * var ages = { - * 'stooges': [ - * { 'age': 40 }, - * { 'age': 50 } - * ] - * }; - * - * _.merge(names, ages); - * // => { 'stooges': [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] } - * - * var food = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var otherFood = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.merge(food, otherFood, function(a, b) { - * return _.isArray(a) ? a.concat(b) : undefined; - * }); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } - */ - function merge(object) { - var args = arguments, - length = 2; - - if (!isObject(object)) { - return object; - } - // allows working with `_.reduce` and `_.reduceRight` without using - // their `index` and `collection` arguments - if (typeof args[2] != 'number') { - length = args.length; - } - if (length > 3 && typeof args[length - 2] == 'function') { - var callback = baseCreateCallback(args[--length - 1], args[length--], 2); - } else if (length > 2 && typeof args[length - 1] == 'function') { - callback = args[--length]; - } - var sources = nativeSlice.call(arguments, 1, length), - index = -1, - stackA = getArray(), - stackB = getArray(); - - while (++index < length) { - baseMerge(object, sources[index], callback, stackA, stackB); - } - releaseArray(stackA); - releaseArray(stackB); - return object; - } - - /** - * Creates a shallow clone of `object` excluding the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` omitting the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The properties to omit or the - * function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object without the omitted properties. - * @example - * - * _.omit({ 'name': 'moe', 'age': 40 }, 'age'); - * // => { 'name': 'moe' } - * - * _.omit({ 'name': 'moe', 'age': 40 }, function(value) { - * return typeof value == 'number'; - * }); - * // => { 'name': 'moe' } - */ - function omit(object, callback, thisArg) { - var indexOf = getIndexOf(), - isFunc = typeof callback == 'function', - result = {}; - - if (isFunc) { - callback = lodash.createCallback(callback, thisArg, 3); - } else { - var props = baseFlatten(arguments, true, false, 1); - } - forIn(object, function(value, key, object) { - if (isFunc - ? !callback(value, key, object) - : indexOf(props, key) < 0 - ) { - result[key] = value; - } - }); - return result; - } - - /** - * Creates a two dimensional array of an object's key-value pairs, - * i.e. `[[key1, value1], [key2, value2]]`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns new array of key-value pairs. - * @example - * - * _.pairs({ 'moe': 30, 'larry': 40 }); - * // => [['moe', 30], ['larry', 40]] (property order is not guaranteed across environments) - */ - function pairs(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; - } - return result; - } - - /** - * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` picking the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The function called per - * iteration or property names to pick, specified as individual property - * names or arrays of property names. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object composed of the picked properties. - * @example - * - * _.pick({ 'name': 'moe', '_userid': 'moe1' }, 'name'); - * // => { 'name': 'moe' } - * - * _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { - * return key.charAt(0) != '_'; - * }); - * // => { 'name': 'moe' } - */ - function pick(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var index = -1, - props = baseFlatten(arguments, true, false, 1), - length = isObject(object) ? props.length : 0; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - } else { - callback = lodash.createCallback(callback, thisArg, 3); - forIn(object, function(value, key, object) { - if (callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * An alternative to `_.reduce` this method transforms `object` to a new - * `accumulator` object which is the result of running each of its elements - * through a callback, with each callback execution potentially mutating - * the `accumulator` object. The callback is bound to `thisArg` and invoked - * with four arguments; (accumulator, value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { - * num *= num; - * if (num % 2) { - * return result.push(num) < 3; - * } - * }); - * // => [1, 9, 25] - * - * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * }); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function transform(object, callback, accumulator, thisArg) { - var isArr = isArray(object); - callback = baseCreateCallback(callback, thisArg, 4); - - if (accumulator == null) { - if (isArr) { - accumulator = []; - } else { - var ctor = object && object.constructor, - proto = ctor && ctor.prototype; - - accumulator = createObject(proto); - } - } - (isArr ? baseEach : forOwn)(object, function(value, index, object) { - return callback(accumulator, value, index, object); - }); - return accumulator; - } - - /** - * Creates an array composed of the own enumerable property values of `object`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property values. - * @example - * - * _.values({ 'one': 1, 'two': 2, 'three': 3 }); - * // => [1, 2, 3] (property order is not guaranteed across environments) - */ - function values(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - result[index] = object[props[index]]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array of elements from the specified indexes, or keys, of the - * `collection`. Indexes may be specified as individual arguments or as arrays - * of indexes. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(number|number[]|string|string[])} [index] The indexes of `collection` - * to retrieve, specified as individual indexes or arrays of indexes. - * @returns {Array} Returns a new array of elements corresponding to the - * provided indexes. - * @example - * - * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); - * // => ['a', 'c', 'e'] - * - * _.at(['moe', 'larry', 'curly'], 0, 2); - * // => ['moe', 'curly'] - */ - function at(collection) { - var args = arguments, - index = -1, - props = baseFlatten(args, true, false, 1), - length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length, - result = Array(length); - - if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - while(++index < length) { - result[index] = collection[props[index]]; - } - return result; - } - - /** - * Checks if a given value is present in a collection using strict equality - * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the - * offset from the end of the collection. - * - * @static - * @memberOf _ - * @alias include - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {*} target The value to check for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {boolean} Returns `true` if the `target` element is found, else `false`. - * @example - * - * _.contains([1, 2, 3], 1); - * // => true - * - * _.contains([1, 2, 3], 1, 2); - * // => false - * - * _.contains({ 'name': 'moe', 'age': 40 }, 'moe'); - * // => true - * - * _.contains('curly', 'ur'); - * // => true - */ - function contains(collection, target, fromIndex) { - var index = -1, - indexOf = getIndexOf(), - length = collection ? collection.length : 0, - result = false; - - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (isArray(collection)) { - result = indexOf(collection, target, fromIndex) > -1; - } else if (typeof length == 'number') { - result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1; - } else { - baseEach(collection, function(value) { - if (++index >= fromIndex) { - return !(result = value === target); - } - }); - } - return result; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through the callback. The corresponding value - * of each key is the number of times the key was returned by the callback. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': 1, '6': 2 } - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': 1, '6': 2 } - * - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); - }); - - /** - * Checks if the given callback returns truey value for **all** elements of - * a collection. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias all - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if all elements passed the callback check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.every(stooges, 'age'); - * // => true - * - * // using "_.where" callback shorthand - * _.every(stooges, { 'age': 50 }); - * // => false - */ - function every(collection, callback, thisArg) { - var result = true; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (!(result = !!callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return (result = !!callback(value, index, collection)); - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning an array of all elements - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias select - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that passed the callback check. - * @example - * - * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [2, 4, 6] - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.filter(food, 'organic'); - * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }] - * - * // using "_.where" callback shorthand - * _.filter(food, { 'type': 'fruit' }); - * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }] - */ - function filter(collection, callback, thisArg) { - var result = []; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - } - } - } else { - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result.push(value); - } - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning the first element that - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias detect, findWhere - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * _.find([1, 2, 3, 4], function(num) { - * return num % 2 == 0; - * }); - * // => 2 - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'banana', 'organic': true, 'type': 'fruit' }, - * { 'name': 'beet', 'organic': false, 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.find(food, { 'type': 'vegetable' }); - * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' } - * - * // using "_.pluck" callback shorthand - * _.find(food, 'organic'); - * // => { 'name': 'banana', 'organic': true, 'type': 'fruit' } - */ - function find(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - return value; - } - } - } else { - var result; - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - } - - /** - * This method is like `_.find` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(num) { - * return num % 2 == 1; - * }); - * // => 3 - */ - function findLast(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forEachRight(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - - /** - * Iterates over elements of a collection, executing the callback for each - * element. The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * @static - * @memberOf _ - * @alias each - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(','); - * // => logs each number and returns '1,2,3' - * - * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); - * // => logs each number and returns the object (property order is not guaranteed across environments) - */ - function forEach(collection, callback, thisArg) { - if (callback && typeof thisArg == 'undefined' && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (callback(collection[index], index, collection) === false) { - break; - } - } - } else { - baseEach(collection, callback, thisArg); - } - return collection; - } - - /** - * This method is like `_.forEach` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias eachRight - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); - * // => logs each number from right to left and returns '3,2,1' - */ - function forEachRight(collection, callback, thisArg) { - var iterable = collection, - length = collection ? collection.length : 0; - - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (length--) { - if (callback(collection[length], length, collection) === false) { - break; - } - } - } else { - if (typeof length != 'number') { - var props = keys(collection); - length = props.length; - } else if (support.unindexedChars && isString(collection)) { - iterable = collection.split(''); - } - baseEach(collection, function(value, key, collection) { - key = props ? props[--length] : --length; - return callback(iterable[key], key, collection); - }); - } - return collection; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of a collection through the callback. The corresponding value - * of each key is an array of the elements responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false` - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * // using "_.pluck" callback shorthand - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value); - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of the collection through the given callback. The corresponding - * value of each key is the last element responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var keys = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.indexBy(keys, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(stooges, function(key) { this.fromCharCode(key.code); }, String); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - */ - var indexBy = createAggregator(function(result, value, key) { - result[key] = value; - }); - - /** - * Invokes the method named by `methodName` on each element in the `collection` - * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function it - * will be invoked for, and `this` bound to, each element in the `collection`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|string} methodName The name of the method to invoke or - * the function invoked per iteration. - * @param {...*} [arg] Arguments to invoke the method with. - * @returns {Array} Returns a new array of the results of each invoked method. - * @example - * - * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invoke([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - function invoke(collection, methodName) { - var args = nativeSlice.call(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); - }); - return result; - } - - /** - * Creates an array of values by running each element in the collection - * through the callback. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias collect - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of the results of each `callback` execution. - * @example - * - * _.map([1, 2, 3], function(num) { return num * 3; }); - * // => [3, 6, 9] - * - * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); - * // => [3, 6, 9] (property order is not guaranteed across environments) - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(stooges, 'name'); - * // => ['moe', 'larry'] - */ - function map(collection, callback, thisArg) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - callback = lodash.createCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (++index < length) { - result[index] = callback(collection[index], index, collection); - } - } else { - baseEach(collection, function(value, key, collection) { - result[++index] = callback(value, key, collection); - }); - } - return result; - } - - /** - * Retrieves the maximum value of a collection. If the collection is empty or - * falsey `-Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the maximum value. - * @example - * - * _.max([4, 2, 8, 6]); - * // => 8 - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * _.max(stooges, function(stooge) { return stooge.age; }); - * // => { 'name': 'larry', 'age': 50 }; - * - * // using "_.pluck" callback shorthand - * _.max(stooges, 'age'); - * // => { 'name': 'larry', 'age': 50 }; - */ - function max(collection, callback, thisArg) { - var computed = -Infinity, - result = computed; - - if (!callback && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value > result) { - result = value; - } - } - } else { - callback = (!callback && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current > computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the minimum value of a collection. If the collection is empty or - * falsey `Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the minimum value. - * @example - * - * _.min([4, 2, 8, 6]); - * // => 2 - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * _.min(stooges, function(stooge) { return stooge.age; }); - * // => { 'name': 'moe', 'age': 40 }; - * - * // using "_.pluck" callback shorthand - * _.min(stooges, 'age'); - * // => { 'name': 'moe', 'age': 40 }; - */ - function min(collection, callback, thisArg) { - var computed = Infinity, - result = computed; - - if (!callback && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value < result) { - result = value; - } - } - } else { - callback = (!callback && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current < computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the value of a specified property from all elements in the `collection`. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {string} property The property to pluck. - * @returns {Array} Returns a new array of property values. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * _.pluck(stooges, 'name'); - * // => ['moe', 'larry'] - */ - var pluck = map; - - /** - * Reduces a collection to a value which is the accumulated result of running - * each element in the collection through the callback, where each successive - * callback execution consumes the return value of the previous execution. If - * `accumulator` is not provided the first element of the collection will be - * used as the initial `accumulator` value. The callback is bound to `thisArg` - * and invoked with four arguments; (accumulator, value, index|key, collection). - * - * @static - * @memberOf _ - * @alias foldl, inject - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var sum = _.reduce([1, 2, 3], function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * return result; - * }, {}); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function reduce(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = baseCreateCallback(callback, thisArg, 4); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - if (noaccum) { - accumulator = collection[++index]; - } - while (++index < length) { - accumulator = callback(accumulator, collection[index], index, collection); - } - } else { - baseEach(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection) - }); - } - return accumulator; - } - - /** - * This method is like `_.reduce` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias foldr - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var list = [[0, 1], [2, 3], [4, 5]]; - * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = baseCreateCallback(callback, thisArg, 4); - forEachRight(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The opposite of `_.filter` this method returns the elements of a - * collection that the callback does **not** return truey for. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that failed the callback check. - * @example - * - * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [1, 3, 5] - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.reject(food, 'organic'); - * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }] - * - * // using "_.where" callback shorthand - * _.reject(food, { 'type': 'fruit' }); - * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }] - */ - function reject(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - return filter(collection, function(value, index, collection) { - return !callback(value, index, collection); - }); - } - - /** - * Retrieves a random element or `n` random elements from a collection. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to sample. - * @param {number} [n] The number of elements to sample. - * @param- {Object} [guard] Allows working with functions, like `_.map`, - * without using their `key` and `object` arguments as sources. - * @returns {Array} Returns the random sample(s) of `collection`. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - * - * _.sample([1, 2, 3, 4], 2); - * // => [3, 1] - */ - function sample(collection, n, guard) { - var length = collection ? collection.length : 0; - if (typeof length != 'number') { - collection = values(collection); - } else if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - if (n == null || guard) { - return collection ? collection[random(length - 1)] : undefined; - } - var result = shuffle(collection); - result.length = nativeMin(nativeMax(0, n), result.length); - return result; - } - - /** - * Creates an array of shuffled values, using a version of the Fisher-Yates - * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to shuffle. - * @returns {Array} Returns a new shuffled collection. - * @example - * - * _.shuffle([1, 2, 3, 4, 5, 6]); - * // => [4, 1, 6, 3, 5, 2] - */ - function shuffle(collection) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - var rand = random(++index); - result[index] = result[rand]; - result[rand] = value; - }); - return result; - } - - /** - * Gets the size of the `collection` by returning `collection.length` for arrays - * and array-like objects or the number of own enumerable properties for objects. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns `collection.length` or number of own enumerable properties. - * @example - * - * _.size([1, 2]); - * // => 2 - * - * _.size({ 'one': 1, 'two': 2, 'three': 3 }); - * // => 3 - * - * _.size('curly'); - * // => 5 - */ - function size(collection) { - var length = collection ? collection.length : 0; - return typeof length == 'number' ? length : keys(collection).length; - } - - /** - * Checks if the callback returns a truey value for **any** element of a - * collection. The function returns as soon as it finds a passing value and - * does not iterate over the entire collection. The callback is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias any - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if any element passed the callback check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.some(food, 'organic'); - * // => true - * - * // using "_.where" callback shorthand - * _.some(food, { 'type': 'meat' }); - * // => false - */ - function some(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if ((result = callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return !(result = callback(value, index, collection)); - }); - } - return !!result; - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through the callback. This method - * performs a stable sort, that is, it will preserve the original sort order - * of equal elements. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of sorted elements. - * @example - * - * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); - * // => [3, 1, 2] - * - * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); - * // => [3, 1, 2] - * - * // using "_.pluck" callback shorthand - * _.sortBy(['banana', 'strawberry', 'apple'], 'length'); - * // => ['apple', 'banana', 'strawberry'] - */ - function sortBy(collection, callback, thisArg) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - callback = lodash.createCallback(callback, thisArg, 3); - forEach(collection, function(value, key, collection) { - var object = result[++index] = getObject(); - object.criteria = callback(value, key, collection); - object.index = index; - object.value = value; - }); - - length = result.length; - result.sort(compareAscending); - while (length--) { - var object = result[length]; - result[length] = object.value; - releaseObject(object); - } - return result; - } - - /** - * Converts the `collection` to an array. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to convert. - * @returns {Array} Returns the new converted array. - * @example - * - * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); - * // => [2, 3, 4] - */ - function toArray(collection) { - if (collection && typeof collection.length == 'number') { - return (support.unindexedChars && isString(collection)) - ? collection.split('') - : slice(collection); - } - return values(collection); - } - - /** - * Performs a deep comparison of each element in a `collection` to the given - * `properties` object, returning an array of all elements that have equivalent - * property values. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Object} properties The object of property values to filter by. - * @returns {Array} Returns a new array of elements that have the given properties. - * @example - * - * var stooges = [ - * { 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, - * { 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] } - * ]; - * - * _.where(stooges, { 'age': 40 }); - * // => [{ 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] }] - * - * _.where(stooges, { 'quotes': ['Poifect!'] }); - * // => [{ 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }] - */ - var where = filter; - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are all falsey. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to compact. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result.push(value); - } - } - return result; - } - - /** - * Creates an array excluding all values of the provided arrays using strict - * equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @param {...Array} [array] The arrays of values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.difference([1, 2, 3, 4, 5], [5, 2, 10]); - * // => [1, 3, 4] - */ - function difference(array) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - seen = baseFlatten(arguments, true, true, 1), - result = []; - - var isLarge = length >= largeArraySize && indexOf === baseIndexOf; - - if (isLarge) { - var cache = createCache(seen); - if (cache) { - indexOf = cacheIndexOf; - seen = cache; - } else { - isLarge = false; - } - } - while (++index < length) { - var value = array[index]; - if (indexOf(seen, value) < 0) { - result.push(value); - } - } - if (isLarge) { - releaseObject(seen); - } - return result; - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element that passes the callback check, instead of the element itself. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * _.findIndex(['apple', 'banana', 'beet'], function(food) { - * return /^b/.test(food); - * }); - * // => 1 - */ - function findIndex(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - if (callback(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * _.findLastIndex(['apple', 'banana', 'beet'], function(food) { - * return /^b/.test(food); - * }); - * // => 2 - */ - function findLastIndex(array, callback, thisArg) { - var length = array ? array.length : 0; - callback = lodash.createCallback(callback, thisArg, 3); - while (length--) { - if (callback(array[length], length, array)) { - return length; - } - } - return -1; - } - - /** - * Gets the first element or first `n` elements of an array. If a callback - * is provided elements at the beginning of the array are returned as long - * as the callback returns truey. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias head, take - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the first element(s) of `array`. - * @example - * - * _.first([1, 2, 3]); - * // => 1 - * - * _.first([1, 2, 3], 2); - * // => [1, 2] - * - * _.first([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [1, 2] - * - * var food = [ - * { 'name': 'banana', 'organic': true }, - * { 'name': 'beet', 'organic': false }, - * ]; - * - * // using "_.pluck" callback shorthand - * _.first(food, 'organic'); - * // => [{ 'name': 'banana', 'organic': true }] - * - * var food = [ - * { 'name': 'apple', 'type': 'fruit' }, - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.first(food, { 'type': 'fruit' }); - * // => [{ 'name': 'apple', 'type': 'fruit' }, { 'name': 'banana', 'type': 'fruit' }] - */ - function first(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = -1; - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[0] : undefined; - } - } - return slice(array, 0, nativeMin(nativeMax(0, n), length)); - } - - /** - * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truey, the array will only be flattened a single level. If a callback - * is provided each element of the array is passed through the callback before - * flattening. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new flattened array. - * @example - * - * _.flatten([1, [2], [3, [[4]]]]); - * // => [1, 2, 3, 4]; - * - * _.flatten([1, [2], [3, [[4]]]], true); - * // => [1, 2, 3, [[4]]]; - * - * var stooges = [ - * { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] }, - * { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] } - * ]; - * - * // using "_.pluck" callback shorthand - * _.flatten(stooges, 'quotes'); - * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!'] - */ - function flatten(array, isShallow, callback, thisArg) { - // juggle arguments - if (typeof isShallow != 'boolean' && isShallow != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : null; - isShallow = false; - } - if (callback != null) { - array = map(array, callback, thisArg); - } - return baseFlatten(array, isShallow); - } - - /** - * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the array is already sorted - * providing `true` for `fromIndex` will run a faster binary search. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {boolean|number} [fromIndex=0] The index to search from or `true` - * to perform a binary search on a sorted array. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2); - * // => 1 - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 4 - * - * _.indexOf([1, 1, 2, 2, 3, 3], 2, true); - * // => 2 - */ - function indexOf(array, value, fromIndex) { - if (typeof fromIndex == 'number') { - var length = array ? array.length : 0; - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); - } else if (fromIndex) { - var index = sortedIndex(array, value); - return array[index] === value ? index : -1; - } - return baseIndexOf(array, value, fromIndex); - } - - /** - * Gets all but the last element or last `n` elements of an array. If a - * callback is provided elements at the end of the array are excluded from - * the result as long as the callback returns truey. The callback is bound - * to `thisArg` and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - * - * _.initial([1, 2, 3], 2); - * // => [1] - * - * _.initial([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [1] - * - * var food = [ - * { 'name': 'beet', 'organic': false }, - * { 'name': 'carrot', 'organic': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.initial(food, 'organic'); - * // => [{ 'name': 'beet', 'organic': false }] - * - * var food = [ - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' }, - * { 'name': 'carrot', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.initial(food, { 'type': 'vegetable' }); - * // => [{ 'name': 'banana', 'type': 'fruit' }] - */ - function initial(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : callback || n; - } - return slice(array, 0, nativeMin(nativeMax(0, length - n), length)); - } - - /** - * Creates an array of unique values present in all provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of composite values. - * @example - * - * _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); - * // => [1, 2] - */ - function intersection(array) { - var args = arguments, - argsLength = args.length, - argsIndex = -1, - caches = getArray(), - index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - result = [], - seen = getArray(); - - while (++argsIndex < argsLength) { - var value = args[argsIndex]; - caches[argsIndex] = indexOf === baseIndexOf && - (value ? value.length : 0) >= largeArraySize && - createCache(argsIndex ? args[argsIndex] : seen); - } - outer: - while (++index < length) { - var cache = caches[0]; - value = array[index]; - - if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { - argsIndex = argsLength; - (cache || seen).push(value); - while (--argsIndex) { - cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { - continue outer; - } - } - result.push(value); - } - } - while (argsLength--) { - cache = caches[argsLength]; - if (cache) { - releaseObject(cache); - } - } - releaseArray(caches); - releaseArray(seen); - return result; - } - - /** - * Gets the last element or last `n` elements of an array. If a callback is - * provided elements at the end of the array are returned as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the last element(s) of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - * - * _.last([1, 2, 3], 2); - * // => [2, 3] - * - * _.last([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [2, 3] - * - * var food = [ - * { 'name': 'beet', 'organic': false }, - * { 'name': 'carrot', 'organic': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.last(food, 'organic'); - * // => [{ 'name': 'carrot', 'organic': true }] - * - * var food = [ - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' }, - * { 'name': 'carrot', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.last(food, { 'type': 'vegetable' }); - * // => [{ 'name': 'beet', 'type': 'vegetable' }, { 'name': 'carrot', 'type': 'vegetable' }] - */ - function last(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[length - 1] : undefined; - } - } - return slice(array, nativeMax(0, length - n)); - } - - /** - * Gets the index at which the last occurrence of `value` is found using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); - * // => 4 - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var index = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Removes all provided values from the given array using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {...*} [value] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * _.pull(array, 2, 3); - * console.log(array); - * // => [1, 1] - */ - function pull(array) { - var args = arguments, - argsIndex = 0, - argsLength = args.length, - length = array ? array.length : 0; - - while (++argsIndex < argsLength) { - var index = -1, - value = args[argsIndex]; - while (++index < length) { - if (array[index] === value) { - splice.call(array, index--, 1); - length--; - } - } - } - return array; - } - - /** - * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. If `start` is less than `stop` a - * zero-length range is created unless a negative `step` is specified. - * - * @static - * @memberOf _ - * @category Arrays - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @param {number} [step=1] The value to increment or decrement by. - * @returns {Array} Returns a new range array. - * @example - * - * _.range(10); - * // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - * - * _.range(1, 11); - * // => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - * - * _.range(0, 30, 5); - * // => [0, 5, 10, 15, 20, 25] - * - * _.range(0, -10, -1); - * // => [0, -1, -2, -3, -4, -5, -6, -7, -8, -9] - * - * _.range(1, 4, 0); - * // => [1, 1, 1] - * - * _.range(0); - * // => [] - */ - function range(start, end, step) { - start = +start || 0; - step = typeof step == 'number' ? step : (+step || 1); - - if (end == null) { - end = start; - start = 0; - } - // use `Array(length)` so engines, like Chakra and V8, avoid slower modes - // http://youtu.be/XAqIpGU8ZZk#t=17m25s - var index = -1, - length = nativeMax(0, ceil((end - start) / (step || 1))), - result = Array(length); - - while (++index < length) { - result[index] = start; - start += step; - } - return result; - } - - /** - * Removes all elements from an array that the callback returns truey for - * and returns an array of removed elements. The callback is bound to `thisArg` - * and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4, 5, 6]; - * var evens = _.remove(array, function(num) { return num % 2 == 0; }); - * - * console.log(array); - * // => [1, 3, 5] - * - * console.log(evens); - * // => [2, 4, 6] - */ - function remove(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0, - result = []; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - var value = array[index]; - if (callback(value, index, array)) { - result.push(value); - splice.call(array, index--, 1); - length--; - } - } - return result; - } - - /** - * The opposite of `_.initial` this method gets all but the first element or - * first `n` elements of an array. If a callback function is provided elements - * at the beginning of the array are excluded from the result as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias drop, tail - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.rest([1, 2, 3]); - * // => [2, 3] - * - * _.rest([1, 2, 3], 2); - * // => [3] - * - * _.rest([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [3] - * - * var food = [ - * { 'name': 'banana', 'organic': true }, - * { 'name': 'beet', 'organic': false }, - * ]; - * - * // using "_.pluck" callback shorthand - * _.rest(food, 'organic'); - * // => [{ 'name': 'beet', 'organic': false }] - * - * var food = [ - * { 'name': 'apple', 'type': 'fruit' }, - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.rest(food, { 'type': 'fruit' }); - * // => [{ 'name': 'beet', 'type': 'vegetable' }] - */ - function rest(array, callback, thisArg) { - if (typeof callback != 'number' && callback != null) { - var n = 0, - index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); - } - return slice(array, n); - } - - /** - * Uses a binary search to determine the smallest index at which a value - * should be inserted into a given sorted array in order to maintain the sort - * order of the array. If a callback is provided it will be executed for - * `value` and each element of `array` to compute their sort ranking. The - * callback is bound to `thisArg` and invoked with one argument; (value). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to inspect. - * @param {*} value The value to evaluate. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([20, 30, 50], 40); - * // => 2 - * - * // using "_.pluck" callback shorthand - * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - * // => 2 - * - * var dict = { - * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - * }; - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return dict.wordToNumber[word]; - * }); - * // => 2 - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return this.wordToNumber[word]; - * }, dict); - * // => 2 - */ - function sortedIndex(array, value, callback, thisArg) { - var low = 0, - high = array ? array.length : low; - - // explicitly reference `identity` for better inlining in Firefox - callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity; - value = callback(value); - - while (low < high) { - var mid = (low + high) >>> 1; - (callback(array[mid]) < value) - ? low = mid + 1 - : high = mid; - } - return low; - } - - /** - * Creates an array of unique values, in order, of the provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of composite values. - * @example - * - * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); - * // => [1, 2, 3, 101, 10] - */ - function union(array) { - return baseUniq(baseFlatten(arguments, true, true)); - } - - /** - * Creates a duplicate-value-free version of an array using strict equality - * for comparisons, i.e. `===`. If the array is sorted, providing - * `true` for `isSorted` will use a faster algorithm. If a callback is provided - * each element of `array` is passed through the callback before uniqueness - * is computed. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias unique - * @category Arrays - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a duplicate-value-free array. - * @example - * - * _.uniq([1, 2, 1, 3, 1]); - * // => [1, 2, 3] - * - * _.uniq([1, 1, 2, 2, 3], true); - * // => [1, 2, 3] - * - * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); - * // => ['A', 'b', 'C'] - * - * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2.5, 3] - * - * // using "_.pluck" callback shorthand - * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniq(array, isSorted, callback, thisArg) { - // juggle arguments - if (typeof isSorted != 'boolean' && isSorted != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : null; - isSorted = false; - } - if (callback != null) { - callback = lodash.createCallback(callback, thisArg, 3); - } - return baseUniq(array, isSorted, callback); - } - - /** - * Creates an array excluding all provided values using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to filter. - * @param {...*} [value] The values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); - * // => [2, 3, 4] - */ - function without(array) { - return difference(array, nativeSlice.call(arguments, 1)); - } - - /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second - * elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @alias unzip - * @category Arrays - * @param {...Array} [array] Arrays to process. - * @returns {Array} Returns a new array of grouped elements. - * @example - * - * _.zip(['moe', 'larry'], [30, 40], [true, false]); - * // => [['moe', 30, true], ['larry', 40, false]] - */ - function zip() { - var array = arguments.length > 1 ? arguments : arguments[0], - index = -1, - length = array ? max(pluck(array, 'length')) : 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = pluck(array, index); - } - return result; - } - - /** - * Creates an object composed from arrays of `keys` and `values`. Provide - * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` - * or two arrays, one of `keys` and one of corresponding `values`. - * - * @static - * @memberOf _ - * @alias object - * @category Arrays - * @param {Array} keys The array of keys. - * @param {Array} [values=[]] The array of values. - * @returns {Object} Returns an object composed of the given keys and - * corresponding values. - * @example - * - * _.zipObject(['moe', 'larry'], [30, 40]); - * // => { 'moe': 30, 'larry': 40 } - */ - function zipObject(keys, values) { - var index = -1, - length = keys ? keys.length : 0, - result = {}; - - while (++index < length) { - var key = keys[index]; - if (values) { - result[key] = values[index]; - } else if (key) { - result[key[0]] = key[1]; - } - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that executes `func`, with the `this` binding and - * arguments of the created function, only after being called `n` times. - * - * @static - * @memberOf _ - * @category Functions - * @param {number} n The number of times the function must be called before - * `func` is executed. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('Done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => logs 'Done saving!', after all saves have completed - */ - function after(n, func) { - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that, when called, invokes `func` with the `this` - * binding of `thisArg` and prepends any additional `bind` arguments to those - * provided to the bound function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to bind. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var func = function(greeting) { - * return greeting + ' ' + this.name; - * }; - * - * func = _.bind(func, { 'name': 'moe' }, 'hi'); - * func(); - * // => 'hi moe' - */ - function bind(func, thisArg) { - return arguments.length > 2 - ? createBound(func, 17, nativeSlice.call(arguments, 2), null, thisArg) - : createBound(func, 1, null, null, thisArg); - } - - /** - * Binds methods of an object to the object itself, overwriting the existing - * method. Method names may be specified as individual arguments or as arrays - * of method names. If no method names are provided all the function properties - * of `object` will be bound. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodName] The object method names to - * bind, specified as individual method names or arrays of method names. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'onClick': function() { console.log('clicked ' + this.label); } - * }; - * - * _.bindAll(view); - * jQuery('#docs').on('click', view.onClick); - * // => logs 'clicked docs', when the button is clicked - */ - function bindAll(object) { - var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), - index = -1, - length = funcs.length; - - while (++index < length) { - var key = funcs[index]; - object[key] = createBound(object[key], 1, null, null, object); - } - return object; - } - - /** - * Creates a function that, when called, invokes the method at `object[key]` - * and prepends any additional `bindKey` arguments to those provided to the bound - * function. This method differs from `_.bind` by allowing bound functions to - * reference methods that will be redefined or don't yet exist. - * See http://michaux.ca/articles/lazy-function-definition-pattern. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object the method belongs to. - * @param {string} key The key of the method. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'name': 'moe', - * 'greet': function(greeting) { - * return greeting + ' ' + this.name; - * } - * }; - * - * var func = _.bindKey(object, 'greet', 'hi'); - * func(); - * // => 'hi moe' - * - * object.greet = function(greeting) { - * return greeting + ', ' + this.name + '!'; - * }; - * - * func(); - * // => 'hi, moe!' - */ - function bindKey(object, key) { - return arguments.length > 2 - ? createBound(key, 19, nativeSlice.call(arguments, 2), null, object) - : createBound(key, 3, null, null, object); - } - - /** - * Creates a function that is the composition of the provided functions, - * where each function consumes the return value of the function that follows. - * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. - * Each function is executed with the `this` binding of the composed function. - * - * @static - * @memberOf _ - * @category Functions - * @param {...Function} [func] Functions to compose. - * @returns {Function} Returns the new composed function. - * @example - * - * var realNameMap = { - * 'curly': 'jerome' - * }; - * - * var format = function(name) { - * name = realNameMap[name.toLowerCase()] || name; - * return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase(); - * }; - * - * var greet = function(formatted) { - * return 'Hiya ' + formatted + '!'; - * }; - * - * var welcome = _.compose(greet, format); - * welcome('curly'); - * // => 'Hiya Jerome!' - */ - function compose() { - var funcs = arguments, - length = funcs.length; - - while (length--) { - if (!isFunction(funcs[length])) { - throw new TypeError; - } - } - return function() { - var args = arguments, - length = funcs.length; - - while (length--) { - args = [funcs[length].apply(this, args)]; - } - return args[0]; - }; - } - - /** - * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name the created callback will return the property value for a given element. - * If `func` is an object the created callback will return `true` for elements - * that contain the equivalent object properties, otherwise it will return `false`. - * - * @static - * @memberOf _ - * @category Functions - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * // wrap to create custom callback shorthands - * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) { - * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback); - * return !match ? func(callback, thisArg) : function(object) { - * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; - * }; - * }); - * - * _.filter(stooges, 'age__gt45'); - * // => [{ 'name': 'larry', 'age': 50 }] - */ - function createCallback(func, thisArg, argCount) { - var type = typeof func; - if (func == null || type == 'function') { - return baseCreateCallback(func, thisArg, argCount); - } - // handle "_.pluck" style callback shorthands - if (type != 'object') { - return function(object) { - return object[func]; - }; - } - var props = keys(func), - key = props[0], - a = func[key]; - - // handle "_.where" style callback shorthands - if (props.length == 1 && a === a && !isObject(a)) { - // fast path the common case of providing an object with a single - // property containing a primitive value - return function(object) { - var b = object[key]; - return a === b && (a !== 0 || (1 / a == 1 / b)); - }; - } - return function(object) { - var length = props.length, - result = false; - - while (length--) { - if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { - break; - } - } - return result; - }; - } - - /** - * Creates a function which accepts one or more arguments of `func` that when - * invoked either executes `func` returning its result, if all `func` arguments - * have been provided, or returns a function that accepts one or more of the - * remaining `func` arguments, and so on. The arity of `func` can be specified - * if `func.length` is not sufficient. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @returns {Function} Returns the new curried function. - * @example - * - * var curried = _.curry(function(a, b, c) { - * console.log(a + b + c); - * }); - * - * curried(1)(2)(3); - * // => 6 - * - * curried(1, 2)(3); - * // => 6 - * - * curried(1, 2, 3); - * // => 6 - */ - function curry(func, arity) { - arity = typeof arity == 'number' ? arity : (+arity || func.length); - return createBound(func, 4, null, null, null, arity); - } - - /** - * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. - * Provide an options object to indicate that `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. Subsequent calls - * to the debounced function will return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the debounced function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to debounce. - * @param {number} wait The number of milliseconds to delay. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout. - * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // avoid costly calculations while the window size is in flux - * var lazyLayout = _.debounce(calculateLayout, 150); - * jQuery(window).on('resize', lazyLayout); - * - * // execute `sendMail` when the click event is fired, debouncing subsequent calls - * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * }); - * - * // ensure `batchLog` is executed once after 1 second of debounced calls - * var source = new EventSource('/stream'); - * source.addEventListener('message', _.debounce(batchLog, 250, { - * 'maxWait': 1000 - * }, false); - */ - function debounce(func, wait, options) { - var args, - maxTimeoutId, - result, - stamp, - thisArg, - timeoutId, - trailingCall, - lastCalled = 0, - maxWait = false, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - wait = nativeMax(0, wait) || 0; - if (options === true) { - var leading = true; - trailing = false; - } else if (isObject(options)) { - leading = options.leading; - maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); - trailing = 'trailing' in options ? options.trailing : trailing; - } - var delayed = function() { - var remaining = wait - (now() - stamp); - if (remaining <= 0) { - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - var isCalled = trailingCall; - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - } - } else { - timeoutId = setTimeout(delayed, remaining); - } - }; - - var maxDelayed = function() { - if (timeoutId) { - clearTimeout(timeoutId); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (trailing || (maxWait !== wait)) { - lastCalled = now(); - result = func.apply(thisArg, args); - } - }; - - return function() { - args = arguments; - stamp = now(); - thisArg = this; - trailingCall = trailing && (timeoutId || !leading); - - if (maxWait === false) { - var leadingCall = leading && !timeoutId; - } else { - if (!maxTimeoutId && !leading) { - lastCalled = stamp; - } - var remaining = maxWait - (stamp - lastCalled); - if (remaining <= 0) { - if (maxTimeoutId) { - maxTimeoutId = clearTimeout(maxTimeoutId); - } - lastCalled = stamp; - result = func.apply(thisArg, args); - } - else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(maxDelayed, remaining); - } - } - if (!timeoutId && wait !== maxWait) { - timeoutId = setTimeout(delayed, wait); - } - if (leadingCall) { - result = func.apply(thisArg, args); - } - return result; - }; - } - - /** - * Defers executing the `func` function until the current call stack has cleared. - * Additional arguments will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to defer. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function() { console.log('deferred'); }); - * // returns from the function before 'deferred' is logged - */ - function defer(func) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = nativeSlice.call(arguments, 1); - return setTimeout(function() { func.apply(undefined, args); }, 1); - } - // use `setImmediate` if available in Node.js - if (isV8 && moduleExports && typeof setImmediate == 'function') { - defer = function(func) { - if (!isFunction(func)) { - throw new TypeError; - } - return setImmediate.apply(context, arguments); - }; - } - - /** - * Executes the `func` function after `wait` milliseconds. Additional arguments - * will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay execution. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * var log = _.bind(console.log, console); - * _.delay(log, 1000, 'logged later'); - * // => 'logged later' (Appears after one second.) - */ - function delay(func, wait) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = nativeSlice.call(arguments, 2); - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided it will be used to determine the cache key for storing the result - * based on the arguments provided to the memoized function. By default, the - * first argument provided to the memoized function is used as the cache key. - * The `func` is executed with the `this` binding of the memoized function. - * The result cache is exposed as the `cache` property on the memoized function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] A function used to resolve the cache key. - * @returns {Function} Returns the new memoizing function. - * @example - * - * var fibonacci = _.memoize(function(n) { - * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); - * }); - * - * var data = { - * 'moe': { 'name': 'moe', 'age': 40 }, - * 'curly': { 'name': 'curly', 'age': 60 } - * }; - * - * // modifying the result cache - * var stooge = _.memoize(function(name) { return data[name]; }, _.identity); - * stooge('curly'); - * // => { 'name': 'curly', 'age': 60 } - * - * stooge.cache.curly.name = 'jerome'; - * stooge('curly'); - * // => { 'name': 'jerome', 'age': 60 } - */ - function memoize(func, resolver) { - if (!isFunction(func)) { - throw new TypeError; - } - var memoized = function() { - var cache = memoized.cache, - key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; - - return hasOwnProperty.call(cache, key) - ? cache[key] - : (cache[key] = func.apply(this, arguments)); - } - memoized.cache = {}; - return memoized; - } - - /** - * Creates a function that is restricted to execute `func` once. Repeat calls to - * the function will return the value of the first call. The `func` is executed - * with the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // `initialize` executes `createApplication` once - */ - function once(func) { - var ran, - result; - - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (ran) { - return result; - } - ran = true; - result = func.apply(this, arguments); - - // clear the `func` variable so the function may be garbage collected - func = null; - return result; - }; - } - - /** - * Creates a function that, when called, invokes `func` with any additional - * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind` except it does **not** alter the `this` binding. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var greet = function(greeting, name) { return greeting + ' ' + name; }; - * var hi = _.partial(greet, 'hi'); - * hi('moe'); - * // => 'hi moe' - */ - function partial(func) { - return createBound(func, 16, nativeSlice.call(arguments, 1)); - } - - /** - * This method is like `_.partial` except that `partial` arguments are - * appended to those provided to the new function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var defaultsDeep = _.partialRight(_.merge, _.defaults); - * - * var options = { - * 'variable': 'data', - * 'imports': { 'jq': $ } - * }; - * - * defaultsDeep(options, _.templateSettings); - * - * options.variable - * // => 'data' - * - * options.imports - * // => { '_': _, 'jq': $ } - */ - function partialRight(func) { - return createBound(func, 32, null, nativeSlice.call(arguments, 1)); - } - - /** - * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Provide an options object to - * indicate that `func` should be invoked on the leading and/or trailing edge - * of the `wait` timeout. Subsequent calls to the throttled function will - * return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the throttled function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to throttle. - * @param {number} wait The number of milliseconds to throttle executions to. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // avoid excessively updating the position while scrolling - * var throttled = _.throttle(updatePosition, 100); - * jQuery(window).on('scroll', throttled); - * - * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes - * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { - * 'trailing': false - * })); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - if (options === false) { - leading = false; - } else if (isObject(options)) { - leading = 'leading' in options ? options.leading : leading; - trailing = 'trailing' in options ? options.trailing : trailing; - } - debounceOptions.leading = leading; - debounceOptions.maxWait = wait; - debounceOptions.trailing = trailing; - - var result = debounce(func, wait, debounceOptions); - return result; - } - - /** - * Creates a function that provides `value` to the wrapper function as its - * first argument. Additional arguments provided to the function are appended - * to those provided to the wrapper function. The wrapper is executed with - * the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {*} value The value to wrap. - * @param {Function} wrapper The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var hello = function(name) { return 'hello ' + name; }; - * hello = _.wrap(hello, function(func) { - * return 'before, ' + func('moe') + ', after'; - * }); - * hello(); - * // => 'before, hello moe, after' - */ - function wrap(value, wrapper) { - if (!isFunction(wrapper)) { - throw new TypeError; - } - return function() { - var args = [value]; - push.apply(args, arguments); - return wrapper.apply(this, args); - }; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their - * corresponding HTML entities. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} string The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('Moe, Larry & Curly'); - * // => 'Moe, Larry & Curly' - */ - function escape(string) { - return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar); - } - - /** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var moe = { 'name': 'moe' }; - * moe === _.identity(moe); - * // => true - */ - function identity(value) { - return value; - } - - /** - * Adds function properties of a source object to the `lodash` function and - * chainable wrapper. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} object The object of function properties to add to `lodash`. - * @param {Object} object The object of function properties to add to `lodash`. - * @example - * - * _.mixin({ - * 'capitalize': function(string) { - * return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); - * } - * }); - * - * _.capitalize('moe'); - * // => 'Moe' - * - * _('moe').capitalize(); - * // => 'Moe' - */ - function mixin(object, source) { - var ctor = object, - isFunc = !source || isFunction(ctor); - - if (!source) { - ctor = lodashWrapper; - source = object; - object = lodash; - } - forEach(functions(source), function(methodName) { - var func = object[methodName] = source[methodName]; - if (isFunc) { - ctor.prototype[methodName] = function() { - var value = this.__wrapped__, - args = [value]; - - push.apply(args, arguments); - var result = func.apply(object, args); - if (value && typeof value == 'object' && value === result) { - return this; - } - result = new ctor(result); - result.__chain__ = this.__chain__; - return result; - }; - } - }); - } - - /** - * Reverts the '_' variable to its previous value and returns a reference to - * the `lodash` function. - * - * @static - * @memberOf _ - * @category Utilities - * @returns {Function} Returns the `lodash` function. - * @example - * - * var lodash = _.noConflict(); - */ - function noConflict() { - context._ = oldDash; - return this; - } - - /** - * Converts the given value into an integer of the specified radix. - * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the - * `value` is a hexadecimal, in which case a `radix` of `16` is used. - * - * Note: This method avoids differences in native ES3 and ES5 `parseInt` - * implementations. See http://es5.github.io/#E. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} value The value to parse. - * @param {number} [radix] The radix used to interpret the value to parse. - * @returns {number} Returns the new integer value. - * @example - * - * _.parseInt('08'); - * // => 8 - */ - var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox and Opera still follow the ES3 specified implementation of `parseInt` - return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); - }; - - /** - * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided a number between `0` and the given number will be - * returned. If `floating` is truey or either `min` or `max` are floats a - * floating-point number will be returned instead of an integer. - * - * @static - * @memberOf _ - * @category Utilities - * @param {number} [min=0] The minimum possible value. - * @param {number} [max=1] The maximum possible value. - * @param {boolean} [floating=false] Specify returning a floating-point number. - * @returns {number} Returns a random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(min, max, floating) { - var noMin = min == null, - noMax = max == null; - - if (floating == null) { - if (typeof min == 'boolean' && noMax) { - floating = min; - min = 1; - } - else if (!noMax && typeof max == 'boolean') { - floating = max; - noMax = true; - } - } - if (noMin && noMax) { - max = 1; - } - min = +min || 0; - if (noMax) { - max = min; - min = 0; - } else { - max = +max || 0; - } - var rand = nativeRandom(); - return (floating || min % 1 || max % 1) - ? nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max) - : min + floor(rand * (max - min + 1)); - } - - /** - * Resolves the value of `property` on `object`. If `property` is a function - * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey then `undefined` - * is returned. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} object The object to inspect. - * @param {string} property The property to get the value of. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { - * 'cheese': 'crumpets', - * 'stuff': function() { - * return 'nonsense'; - * } - * }; - * - * _.result(object, 'cheese'); - * // => 'crumpets' - * - * _.result(object, 'stuff'); - * // => 'nonsense' - */ - function result(object, property) { - if (object) { - var value = object[property]; - return isFunction(value) ? object[property]() : value; - } - } - - /** - * A micro-templating method that handles arbitrary delimiters, preserves - * whitespace, and correctly escapes quotes within interpolated code. - * - * Note: In the development build, `_.template` utilizes sourceURLs for easier - * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - * - * For more information on precompiling templates see: - * http://lodash.com/#custom-builds - * - * For more information on Chrome extension sandboxes see: - * http://developer.chrome.com/stable/extensions/sandboxingEval.html - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} text The template text. - * @param {Object} data The data object used to populate the text. - * @param {Object} [options] The options object. - * @param {RegExp} [options.escape] The "escape" delimiter. - * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as local variables. - * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [sourceURL] The sourceURL of the template's compiled source. - * @param {string} [variable] The data object variable name. - * @returns {Function|string} Returns a compiled function when no `data` object - * is given, else it returns the interpolated text. - * @example - * - * // using the "interpolate" delimiter to create a compiled template - * var compiled = _.template('hello <%= name %>'); - * compiled({ 'name': 'moe' }); - * // => 'hello moe' - * - * // using the "escape" delimiter to escape HTML in data property values - * _.template('<%- value %>', { 'value': ' -``` - -Using [`npm`](http://npmjs.org/): - -```bash -npm install lodash - -npm install -g lodash -npm link lodash -``` - -To avoid potential issues, update `npm` before installing Lo-Dash: - -```bash -npm install npm -g -``` - -In [Node.js](http://nodejs.org/) and [RingoJS v0.8.0+](http://ringojs.org/): - -```js -var _ = require('lodash'); - -// or as a drop-in replacement for Underscore -var _ = require('lodash/lodash.underscore'); -``` - -**Note:** If Lo-Dash is installed globally, run [`npm link lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory before requiring it. - -In [RingoJS v0.7.0-](http://ringojs.org/): - -```js -var _ = require('lodash')._; -``` - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('lodash.js'); -``` - -In an AMD loader like [RequireJS](http://requirejs.org/): - -```js -require({ - 'paths': { - 'underscore': 'path/to/lodash' - } -}, -['underscore'], function(_) { - console.log(_.VERSION); -}); -``` - -## Release Notes - -### v1.0.1 - - * Add support for specifying source map URLs in `-p`/`--source-map` build options - * Ensured the second argument passed to `_.assign` is not treated as a `callback` - * Ensured `-p`/`--source-map` build options correctly set the `sourceMappingURL` - * Made `-p`/`--source-map` build options set source map *“sourcesâ€* keys based on the builds performed - * Made `_.defer` use `setImmediate`, in Node.js, when available - * Made `_.where` search arrays for values regardless of their index position - * Removed dead code from `_.template` - -The full changelog is available [here](https://github.com/lodash/lodash/wiki/Changelog). - -## BestieJS - -Lo-Dash is part of the [BestieJS](https://github.com/bestiejs) *“Best in Classâ€* module collection. This means we promote solid browser/environment support, ES5 precedents, unit testing, and plenty of documentation. - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](http://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/blainebublitz](http://gravatar.com/avatar/ac1c67fd906c9fecd823ce302283b4c1?s=70)](http://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | -|---|---|---| -| [Blaine Bublitz](http://iceddev.com/) | [Kit Cambridge](http://kitcambridge.github.io/) | [Mathias Bynens](http://mathiasbynens.be/) | diff --git a/node_modules/browser-sync/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash/dist/lodash.compat.js b/node_modules/browser-sync/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash/dist/lodash.compat.js deleted file mode 100644 index 37ebc92..0000000 --- a/node_modules/browser-sync/node_modules/glob-watcher/node_modules/gaze/node_modules/globule/node_modules/lodash/dist/lodash.compat.js +++ /dev/null @@ -1,5152 +0,0 @@ -/** - * @license - * Lo-Dash 1.0.1 (Custom Build) - * Build: `lodash -o ./dist/lodash.compat.js` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.4.4 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. - * Available under MIT license - */ -;(function(window, undefined) { - - /** Detect free variable `exports` */ - var freeExports = typeof exports == 'object' && exports; - - /** Detect free variable `module` */ - var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; - - /** Detect free variable `global` and use it as `window` */ - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal) { - window = freeGlobal; - } - - /** Used for array and object method references */ - var arrayRef = [], - objectRef = {}; - - /** Used to generate unique IDs */ - var idCounter = 0; - - /** Used internally to indicate various things */ - var indicatorObject = objectRef; - - /** Used by `cachedContains` as the default size when optimizations are enabled for large arrays */ - var largeArraySize = 30; - - /** Used to restore the original `_` reference in `noConflict` */ - var oldDash = window._; - - /** Used to match HTML entities */ - var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g; - - /** Used to match empty string literals in compiled template source */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** Used to match regexp flags from their coerced string values */ - var reFlags = /\w*$/; - - /** Used to detect if a method is native */ - var reNative = RegExp('^' + - (objectRef.valueOf + '') - .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - .replace(/valueOf|for [^\]]+/g, '.+?') + '$' - ); - - /** - * Used to match ES6 template delimiters - * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6 - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to ensure capturing order of template delimiters */ - var reNoMatch = /($^)/; - - /** Used to match HTML characters */ - var reUnescapedHtml = /[&<>"']/g; - - /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; - - /** Used to fix the JScript [[DontEnum]] bug */ - var shadowed = [ - 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', - 'toLocaleString', 'toString', 'valueOf' - ]; - - /** Used to make template sourceURLs easier to identify */ - var templateCounter = 0; - - /** Native method shortcuts */ - var ceil = Math.ceil, - concat = arrayRef.concat, - floor = Math.floor, - getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectRef.hasOwnProperty, - push = arrayRef.push, - toString = objectRef.toString; - - /* Native method shortcuts for methods with the same name as other `lodash` methods */ - var nativeBind = reNative.test(nativeBind = slice.bind) && nativeBind, - nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, - nativeIsFinite = window.isFinite, - nativeIsNaN = window.isNaN, - nativeKeys = reNative.test(nativeKeys = Object.keys) && nativeKeys, - nativeMax = Math.max, - nativeMin = Math.min, - nativeRandom = Math.random; - - /** `Object#toString` result shortcuts */ - var argsClass = '[object Arguments]', - arrayClass = '[object Array]', - boolClass = '[object Boolean]', - dateClass = '[object Date]', - funcClass = '[object Function]', - numberClass = '[object Number]', - objectClass = '[object Object]', - regexpClass = '[object RegExp]', - stringClass = '[object String]'; - - /** Detect various environments */ - var isIeOpera = !!window.attachEvent, - isV8 = nativeBind && !/\n|true/.test(nativeBind + isIeOpera); - - /* Detect if `Function#bind` exists and is inferred to be fast (all but V8) */ - var isBindFast = nativeBind && !isV8; - - /* Detect if `Object.keys` exists and is inferred to be fast (IE, Opera, V8) */ - var isKeysFast = nativeKeys && (isIeOpera || isV8); - - /** - * Detect the JScript [[DontEnum]] bug: - * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are - * made non-enumerable as well. - */ - var hasDontEnumBug; - - /** - * Detect if a `prototype` properties are enumerable by default: - * - * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 - * (if the prototype or a property on the prototype has been set) - * incorrectly sets a function's `prototype` property [[Enumerable]] - * value to `true`. - */ - var hasEnumPrototype; - - /** Detect if own properties are iterated after inherited properties (IE < 9) */ - var iteratesOwnLast; - - /** - * Detect if `Array#shift` and `Array#splice` augment array-like objects - * incorrectly: - * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()` - * and `splice()` functions that fail to remove the last element, `value[0]`, - * of array-like objects even though the `length` property is set to `0`. - * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()` - * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9. - */ - var hasObjectSpliceBug = (hasObjectSpliceBug = { '0': 1, 'length': 1 }, - arrayRef.splice.call(hasObjectSpliceBug, 0, 1), hasObjectSpliceBug[0]); - - /** Detect if `arguments` object indexes are non-enumerable (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1) */ - var nonEnumArgs = true; - - (function() { - var props = []; - function ctor() { this.x = 1; } - ctor.prototype = { 'valueOf': 1, 'y': 1 }; - for (var prop in new ctor) { props.push(prop); } - for (prop in arguments) { nonEnumArgs = !prop; } - - hasDontEnumBug = !/valueOf/.test(props); - hasEnumPrototype = ctor.propertyIsEnumerable('prototype'); - iteratesOwnLast = props[0] != 'x'; - }(1)); - - /** Detect if `arguments` objects are `Object` objects (all but Opera < 10.5) */ - var argsAreObjects = arguments.constructor == Object; - - /** Detect if `arguments` objects [[Class]] is unresolvable (Firefox < 4, IE < 9) */ - var noArgsClass = !isArguments(arguments); - - /** - * Detect lack of support for accessing string characters by index: - * - * IE < 8 can't access characters by index and IE 8 can only access - * characters by index on string literals. - */ - var noCharByIndex = ('x'[0] + Object('x')[0]) != 'xx'; - - /** - * Detect if a DOM node's [[Class]] is unresolvable (IE < 9) - * and that the JS engine won't error when attempting to coerce an object to - * a string without a `toString` function. - */ - try { - var noNodeClass = toString.call(document) == objectClass && !({ 'toString': 0 } + ''); - } catch(e) { } - - /** Used to identify object classifications that `_.clone` supports */ - var cloneableClasses = {}; - cloneableClasses[funcClass] = false; - cloneableClasses[argsClass] = cloneableClasses[arrayClass] = - cloneableClasses[boolClass] = cloneableClasses[dateClass] = - cloneableClasses[numberClass] = cloneableClasses[objectClass] = - cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; - - /** Used to lookup a built-in constructor by [[Class]] */ - var ctorByClass = {}; - ctorByClass[arrayClass] = Array; - ctorByClass[boolClass] = Boolean; - ctorByClass[dateClass] = Date; - ctorByClass[objectClass] = Object; - ctorByClass[numberClass] = Number; - ctorByClass[regexpClass] = RegExp; - ctorByClass[stringClass] = String; - - /** Used to determine if values are of the language type Object */ - var objectTypes = { - 'boolean': false, - 'function': true, - 'object': true, - 'number': false, - 'string': false, - 'undefined': false - }; - - /** Used to escape characters for inclusion in compiled string literals */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object, that wraps the given `value`, to enable method - * chaining. - * - * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: - * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, - * and `unshift` - * - * The chainable wrapper functions are: - * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, - * `concat`, `countBy`, `debounce`, `defaults`, `defer`, `delay`, `difference`, - * `filter`, `flatten`, `forEach`, `forIn`, `forOwn`, `functions`, `groupBy`, - * `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `max`, `memoize`, - * `merge`, `min`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, - * `pick`, `pluck`, `push`, `range`, `reject`, `rest`, `reverse`, `shuffle`, - * `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, - * `union`, `uniq`, `unshift`, `values`, `where`, `without`, `wrap`, and `zip` - * - * The non-chainable wrapper functions are: - * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, `identity`, - * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, - * `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, - * `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, - * `mixin`, `noConflict`, `pop`, `random`, `reduce`, `reduceRight`, `result`, - * `shift`, `size`, `some`, `sortedIndex`, `template`, `unescape`, and `uniqueId` - * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * passed, otherwise they return unwrapped values. - * - * @name _ - * @constructor - * @category Chaining - * @param {Mixed} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - */ - function lodash(value) { - // exit early if already wrapped, even if wrapped by a different `lodash` constructor - if (value && typeof value == 'object' && value.__wrapped__) { - return value; - } - // allow invoking `lodash` without the `new` operator - if (!(this instanceof lodash)) { - return new lodash(value); - } - this.__wrapped__ = value; - } - - /** - * By default, the template delimiters used by Lo-Dash are similar to those in - * embedded Ruby (ERB). Change the following template settings to use alternative - * delimiters. - * - * @static - * @memberOf _ - * @type Object - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'escape': /<%-([\s\S]+?)%>/g, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'evaluate': /<%([\s\S]+?)%>/g, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type String - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type Object - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type Function - */ - '_': lodash - } - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The template used to create iterator functions. - * - * @private - * @param {Obect} data The data object used to populate the text. - * @returns {String} Returns the interpolated text. - */ - var iteratorTemplate = function(obj) { - - var __p = 'var index, iterable = ' + - (obj.firstArg ) + - ', result = iterable;\nif (!iterable) return result;\n' + - (obj.top ) + - ';\n'; - if (obj.arrays) { - __p += 'var length = iterable.length; index = -1;\nif (' + - (obj.arrays ) + - ') { '; - if (obj.noCharByIndex) { - __p += '\n if (isString(iterable)) {\n iterable = iterable.split(\'\')\n } '; - } ; - __p += '\n while (++index < length) {\n ' + - (obj.loop ) + - '\n }\n}\nelse { '; - } else if (obj.nonEnumArgs) { - __p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' + - (obj.loop ) + - '\n }\n } else { '; - } ; - - if (obj.hasEnumPrototype) { - __p += '\n var skipProto = typeof iterable == \'function\';\n '; - } ; - - if (obj.isKeysFast && obj.useHas) { - __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? nativeKeys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n '; - if (obj.hasEnumPrototype) { - __p += 'if (!(skipProto && index == \'prototype\')) {\n '; - } ; - __p += - (obj.loop ) + - ''; - if (obj.hasEnumPrototype) { - __p += '}\n'; - } ; - __p += ' } '; - } else { - __p += '\n for (index in iterable) {'; - if (obj.hasEnumPrototype || obj.useHas) { - __p += '\n if ('; - if (obj.hasEnumPrototype) { - __p += '!(skipProto && index == \'prototype\')'; - } if (obj.hasEnumPrototype && obj.useHas) { - __p += ' && '; - } if (obj.useHas) { - __p += 'hasOwnProperty.call(iterable, index)'; - } ; - __p += ') { '; - } ; - __p += - (obj.loop ) + - '; '; - if (obj.hasEnumPrototype || obj.useHas) { - __p += '\n }'; - } ; - __p += '\n } '; - } ; - - if (obj.hasDontEnumBug) { - __p += '\n\n var ctor = iterable.constructor;\n '; - for (var k = 0; k < 7; k++) { - __p += '\n index = \'' + - (obj.shadowed[k] ) + - '\';\n if ('; - if (obj.shadowed[k] == 'constructor') { - __p += '!(ctor && ctor.prototype === iterable) && '; - } ; - __p += 'hasOwnProperty.call(iterable, index)) {\n ' + - (obj.loop ) + - '\n } '; - } ; - - } ; - - if (obj.arrays || obj.nonEnumArgs) { - __p += '\n}'; - } ; - __p += - (obj.bottom ) + - ';\nreturn result'; - - - return __p - }; - - /** Reusable iterator options for `assign` and `defaults` */ - var defaultsIteratorOptions = { - 'args': 'object, source, guard', - 'top': - 'var args = arguments,\n' + - ' argsIndex = 0,\n' + - " argsLength = typeof guard == 'number' ? 2 : args.length;\n" + - 'while (++argsIndex < argsLength) {\n' + - ' iterable = args[argsIndex];\n' + - ' if (iterable && objectTypes[typeof iterable]) {', - 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", - 'bottom': ' }\n}' - }; - - /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */ - var eachIteratorOptions = { - 'args': 'collection, callback, thisArg', - 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : createCallback(callback, thisArg)", - 'arrays': "typeof length == 'number'", - 'loop': 'if (callback(iterable[index], index, collection) === false) return result' - }; - - /** Reusable iterator options for `forIn` and `forOwn` */ - var forOwnIteratorOptions = { - 'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top, - 'arrays': false - }; - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. - * - * @private - * @param {Array} array The array to search. - * @param {Mixed} value The value to search for. - * @param {Number} [fromIndex=0] The index to search from. - * @param {Number} [largeSize=30] The length at which an array is considered large. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. - */ - function cachedContains(array, fromIndex, largeSize) { - fromIndex || (fromIndex = 0); - - var length = array.length, - isLarge = (length - fromIndex) >= (largeSize || largeArraySize); - - if (isLarge) { - var cache = {}, - index = fromIndex - 1; - - while (++index < length) { - // manually coerce `value` to a string because `hasOwnProperty`, in some - // older versions of Firefox, coerces objects incorrectly - var key = array[index] + ''; - (hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = [])).push(array[index]); - } - } - return function(value) { - if (isLarge) { - var key = value + ''; - return hasOwnProperty.call(cache, key) && indexOf(cache[key], value) > -1; - } - return indexOf(array, value, fromIndex) > -1; - } - } - - /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. - * - * @private - * @param {String} value The character to inspect. - * @returns {Number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` values, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {Number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ai = a.index, - bi = b.index; - - a = a.criteria; - b = b.criteria; - - // ensure a stable sort in V8 and other engines - // http://code.google.com/p/v8/issues/detail?id=90 - if (a !== b) { - if (a > b || typeof a == 'undefined') { - return 1; - } - if (a < b || typeof b == 'undefined') { - return -1; - } - } - return ai < bi ? -1 : 1; - } - - /** - * Creates a function that, when called, invokes `func` with the `this` binding - * of `thisArg` and prepends any `partialArgs` to the arguments passed to the - * bound function. - * - * @private - * @param {Function|String} func The function to bind or the method name. - * @param {Mixed} [thisArg] The `this` binding of `func`. - * @param {Array} partialArgs An array of arguments to be partially applied. - * @param {Object} [rightIndicator] Used to indicate partially applying arguments from the right. - * @returns {Function} Returns the new bound function. - */ - function createBound(func, thisArg, partialArgs, rightIndicator) { - var isFunc = isFunction(func), - isPartial = !partialArgs, - key = thisArg; - - // juggle arguments - if (isPartial) { - partialArgs = thisArg; - } - if (!isFunc) { - thisArg = func; - } - - function bound() { - // `Function#bind` spec - // http://es5.github.com/#x15.3.4.5 - var args = arguments, - thisBinding = isPartial ? this : thisArg; - - if (!isFunc) { - func = thisArg[key]; - } - if (partialArgs.length) { - args = args.length - ? (args = slice(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args)) - : partialArgs; - } - if (this instanceof bound) { - // ensure `new bound` is an instance of `bound` and `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; - - // mimic the constructor's `return` behavior - // http://es5.github.com/#x13.2.2 - var result = func.apply(thisBinding, args); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisBinding, args); - } - return bound; - } - - /** - * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name, the created callback will return the property value for a given element. - * If `func` is an object, the created callback will return `true` for elements - * that contain the equivalent object properties, otherwise it will return `false`. - * - * @private - * @param {Mixed} [func=identity] The value to convert to a callback. - * @param {Mixed} [thisArg] The `this` binding of the created callback. - * @param {Number} [argCount=3] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - */ - function createCallback(func, thisArg, argCount) { - if (func == null) { - return identity; - } - var type = typeof func; - if (type != 'function') { - if (type != 'object') { - return function(object) { - return object[func]; - }; - } - var props = keys(func); - return function(object) { - var length = props.length, - result = false; - while (length--) { - if (!(result = isEqual(object[props[length]], func[props[length]], indicatorObject))) { - break; - } - } - return result; - }; - } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, object) { - return func.call(thisArg, accumulator, value, index, object); - }; - } - return function(value, index, object) { - return func.call(thisArg, value, index, object); - }; - } - return func; - } - - /** - * Creates compiled iteration functions. - * - * @private - * @param {Object} [options1, options2, ...] The compile options object(s). - * arrays - A string of code to determine if the iterable is an array or array-like. - * useHas - A boolean to specify using `hasOwnProperty` checks in the object loop. - * args - A string of comma separated arguments the iteration function will accept. - * top - A string of code to execute before the iteration branches. - * loop - A string of code to execute in the object loop. - * bottom - A string of code to execute after the iteration branches. - * - * @returns {Function} Returns the compiled function. - */ - function createIterator() { - var data = { - // support properties - 'hasDontEnumBug': hasDontEnumBug, - 'hasEnumPrototype': hasEnumPrototype, - 'isKeysFast': isKeysFast, - 'nonEnumArgs': nonEnumArgs, - 'noCharByIndex': noCharByIndex, - 'shadowed': shadowed, - - // iterator options - 'arrays': 'isArray(iterable)', - 'bottom': '', - 'loop': '', - 'top': '', - 'useHas': true - }; - - // merge options into a template data object - for (var object, index = 0; object = arguments[index]; index++) { - for (var key in object) { - data[key] = object[key]; - } - } - var args = data.args; - data.firstArg = /^[^,]+/.exec(args)[0]; - - // create the function factory - var factory = Function( - 'createCallback, hasOwnProperty, isArguments, isArray, isString, ' + - 'objectTypes, nativeKeys', - 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' - ); - // return the compiled function - return factory( - createCallback, hasOwnProperty, isArguments, isArray, isString, - objectTypes, nativeKeys - ); - } - - /** - * A function compiled to iterate `arguments` objects, arrays, objects, and - * strings consistenly across environments, executing the `callback` for each - * element in the `collection`. The `callback` is bound to `thisArg` and invoked - * with three arguments; (value, index|key, collection). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @private - * @type Function - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|String} Returns `collection`. - */ - var each = createIterator(eachIteratorOptions); - - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {String} match The matched character to escape. - * @returns {String} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - - /** - * Used by `escape` to convert characters to HTML entities. - * - * @private - * @param {String} match The matched character to escape. - * @returns {String} Returns the escaped character. - */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; - } - - /** - * Checks if `value` is a DOM node in IE < 9. - * - * @private - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`. - */ - function isNode(value) { - // IE < 9 presents DOM nodes as `Object` objects except they have `toString` - // methods that are `typeof` "string" and still can coerce nodes to strings - return typeof value.toString != 'function' && typeof (value + '') == 'string'; - } - - /** - * A no-operation function. - * - * @private - */ - function noop() { - // no operation performed - } - - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used, instead of `Array#slice`, to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|String} collection The collection to slice. - * @param {Number} start The start index. - * @param {Number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - - /** - * Used by `unescape` to convert HTML entities to characters. - * - * @private - * @param {String} match The matched character to unescape. - * @returns {String} Returns the unescaped character. - */ - function unescapeHtmlChar(match) { - return htmlUnescapes[match]; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Checks if `value` is an `arguments` object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`. - * @example - * - * (function() { return _.isArguments(arguments); })(1, 2, 3); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - function isArguments(value) { - return toString.call(value) == argsClass; - } - // fallback for browsers that can't detect `arguments` objects by [[Class]] - if (noArgsClass) { - isArguments = function(value) { - return value ? hasOwnProperty.call(value, 'callee') : false; - }; - } - - /** - * Iterates over `object`'s own and inherited enumerable properties, executing - * the `callback` for each property. The `callback` is bound to `thisArg` and - * invoked with three arguments; (value, key, object). Callbacks may exit iteration - * early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Dog(name) { - * this.name = name; - * } - * - * Dog.prototype.bark = function() { - * alert('Woof, woof!'); - * }; - * - * _.forIn(new Dog('Dagny'), function(value, key) { - * alert(key); - * }); - * // => alerts 'name' and 'bark' (order is not guaranteed) - */ - var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, { - 'useHas': false - }); - - /** - * Iterates over an object's own enumerable properties, executing the `callback` - * for each property. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, key, object). Callbacks may exit iteration early by explicitly - * returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * alert(key); - * }); - * // => alerts '0', '1', and 'length' (order is not guaranteed) - */ - var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions); - - /** - * Checks if `value` is an array. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an array, else `false`. - * @example - * - * (function() { return _.isArray(arguments); })(); - * // => false - * - * _.isArray([1, 2, 3]); - * // => true - */ - var isArray = nativeIsArray || function(value) { - // `instanceof` may cause a memory leak in IE 7 if `value` is a host object - // http://ajaxian.com/archives/working-aroung-the-instanceof-memory-leak - return (argsAreObjects && value instanceof Array) || toString.call(value) == arrayClass; - }; - - /** - * Creates an array composed of the own enumerable property names of `object`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns a new array of property names. - * @example - * - * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); - * // => ['one', 'two', 'three'] (order is not guaranteed) - */ - var keys = !nativeKeys ? shimKeys : function(object) { - if (!isObject(object)) { - return []; - } - if ((hasEnumPrototype && typeof object == 'function') || - (nonEnumArgs && object.length && isArguments(object))) { - return shimKeys(object); - } - return nativeKeys(object); - }; - - /** - * A fallback implementation of `isPlainObject` that checks if a given `value` - * is an object created by the `Object` constructor, assuming objects created - * by the `Object` constructor have no inherited enumerable properties and that - * there are no `Object.prototype` extensions. - * - * @private - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. - */ - function shimIsPlainObject(value) { - // avoid non-objects and false positives for `arguments` objects - var result = false; - if (!(value && typeof value == 'object') || isArguments(value)) { - return result; - } - // check that the constructor is `Object` (i.e. `Object instanceof Object`) - var ctor = value.constructor; - if ((!isFunction(ctor) && (!noNodeClass || !isNode(value))) || ctor instanceof ctor) { - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - if (iteratesOwnLast) { - forIn(value, function(value, key, object) { - result = !hasOwnProperty.call(object, key); - return false; - }); - return result === false; - } - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - forIn(value, function(value, key) { - result = key; - }); - return result === false || hasOwnProperty.call(value, result); - } - return result; - } - - /** - * A fallback implementation of `Object.keys` that produces an array of the - * given object's own enumerable property names. - * - * @private - * @param {Object} object The object to inspect. - * @returns {Array} Returns a new array of property names. - */ - function shimKeys(object) { - var result = []; - forOwn(object, function(value, key) { - result.push(key); - }); - return result; - } - - /** - * Used to convert characters to HTML entities: - * - * Though the `>` character is escaped for symmetry, characters like `>` and `/` - * don't require escaping in HTML and have no special meaning unless they're part - * of a tag or an unquoted attribute value. - * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact") - */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to convert HTML entities to characters */ - var htmlUnescapes = invert(htmlEscapes); - - /*--------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources will overwrite propery assignments of previous - * sources. If a `callback` function is passed, it will be executed to produce - * the assigned values. The `callback` is bound to `thisArg` and invoked with - * two arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @type Function - * @alias extend - * @category Objects - * @param {Object} object The destination object. - * @param {Object} [source1, source2, ...] The source objects. - * @param {Function} [callback] The function to customize assigning values. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * _.assign({ 'name': 'moe' }, { 'age': 40 }); - * // => { 'name': 'moe', 'age': 40 } - * - * var defaults = _.partialRight(_.assign, function(a, b) { - * return typeof a == 'undefined' ? b : a; - * }); - * - * var food = { 'name': 'apple' }; - * defaults(food, { 'name': 'banana', 'type': 'fruit' }); - * // => { 'name': 'apple', 'type': 'fruit' } - */ - var assign = createIterator(defaultsIteratorOptions, { - 'top': - defaultsIteratorOptions.top.replace(';', - ';\n' + - "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" + - ' var callback = createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' + - "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" + - ' callback = args[--argsLength];\n' + - '}' - ), - 'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]' - }); - - /** - * Creates a clone of `value`. If `deep` is `true`, nested objects will also - * be cloned, otherwise they will be assigned by reference. If a `callback` - * function is passed, it will be executed to produce the cloned values. If - * `callback` returns `undefined`, cloning will be handled by the method instead. - * The `callback` is bound to `thisArg` and invoked with one argument; (value). - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to clone. - * @param {Boolean} [deep=false] A flag to indicate a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @param- {Array} [stackA=[]] Internally used to track traversed source objects. - * @param- {Array} [stackB=[]] Internally used to associate clones with source counterparts. - * @returns {Mixed} Returns the cloned `value`. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * var shallow = _.clone(stooges); - * shallow[0] === stooges[0]; - * // => true - * - * var deep = _.clone(stooges, true); - * deep[0] === stooges[0]; - * // => false - * - * _.mixin({ - * 'clone': _.partialRight(_.clone, function(value) { - * return _.isElement(value) ? value.cloneNode(false) : undefined; - * }) - * }); - * - * var clone = _.clone(document.body); - * clone.childNodes.length; - * // => 0 - */ - function clone(value, deep, callback, thisArg, stackA, stackB) { - var result = value; - - // allows working with "Collections" methods without using their `callback` - // argument, `index|key`, for this method's `callback` - if (typeof deep == 'function') { - thisArg = callback; - callback = deep; - deep = false; - } - if (typeof callback == 'function') { - callback = typeof thisArg == 'undefined' ? callback : createCallback(callback, thisArg, 1); - result = callback(result); - - var done = typeof result != 'undefined'; - if (!done) { - result = value; - } - } - // inspect [[Class]] - var isObj = isObject(result); - if (isObj) { - var className = toString.call(result); - if (!cloneableClasses[className] || (noNodeClass && isNode(result))) { - return result; - } - var isArr = isArray(result); - } - // shallow clone - if (!isObj || !deep) { - return isObj && !done - ? (isArr ? slice(result) : assign({}, result)) - : result; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return done ? result : new ctor(+result); - - case numberClass: - case stringClass: - return done ? result : new ctor(result); - - case regexpClass: - return done ? result : ctor(result.source, reFlags.exec(result)); - } - // check for circular references and return corresponding clone - stackA || (stackA = []); - stackB || (stackB = []); - - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; - } - } - // init cloned object - if (!done) { - result = isArr ? ctor(result.length) : {}; - - // add array properties assigned by `RegExp#exec` - if (isArr) { - if (hasOwnProperty.call(value, 'index')) { - result.index = value.index; - } - if (hasOwnProperty.call(value, 'input')) { - result.input = value.input; - } - } - } - // add the source value to the stack of traversed objects - // and associate it with its clone - stackA.push(value); - stackB.push(result); - - // recursively populate clone (susceptible to call stack limits) - (isArr ? forEach : forOwn)(done ? result : value, function(objValue, key) { - result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); - }); - - return result; - } - - /** - * Creates a deep clone of `value`. If a `callback` function is passed, it will - * be executed to produce the cloned values. If `callback` returns the value it - * was passed, cloning will be handled by the method instead. The `callback` is - * bound to `thisArg` and invoked with one argument; (value). - * - * Note: This function is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the deep cloned `value`. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * var deep = _.cloneDeep(stooges); - * deep[0] === stooges[0]; - * // => false - * - * var view = { - * 'label': 'docs', - * 'node': element - * }; - * - * var clone = _.cloneDeep(view, function(value) { - * return _.isElement(value) ? value.cloneNode(true) : value; - * }); - * - * clone.node == view.node; - * // => false - */ - function cloneDeep(value, callback, thisArg) { - return clone(value, true, callback, thisArg); - } - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object for all destination properties that resolve to `undefined`. Once a - * property is set, additional defaults of the same property will be ignored. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The destination object. - * @param {Object} [source1, source2, ...] The source objects. - * @param- {Object} [guard] Internally used to allow working with `_.reduce` - * without using its callback's `key` and `object` arguments as sources. - * @returns {Object} Returns the destination object. - * @example - * - * var food = { 'name': 'apple' }; - * _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); - * // => { 'name': 'apple', 'type': 'fruit' } - */ - var defaults = createIterator(defaultsIteratorOptions); - - /** - * Creates a sorted array of all enumerable properties, own and inherited, - * of `object` that have function values. - * - * @static - * @memberOf _ - * @alias methods - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns a new array of property names that have function values. - * @example - * - * _.functions(_); - * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] - */ - function functions(object) { - var result = []; - forIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); - } - - /** - * Checks if the specified object `property` exists and is a direct property, - * instead of an inherited property. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to check. - * @param {String} property The property to check for. - * @returns {Boolean} Returns `true` if key is a direct property, else `false`. - * @example - * - * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); - * // => true - */ - function has(object, property) { - return object ? hasOwnProperty.call(object, property) : false; - } - - /** - * Creates an object composed of the inverted keys and values of the given `object`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to invert. - * @returns {Object} Returns the created inverted object. - * @example - * - * _.invert({ 'first': 'moe', 'second': 'larry' }); - * // => { 'moe': 'first', 'larry': 'second' } (order is not guaranteed) - */ - function invert(object) { - var index = -1, - props = keys(object), - length = props.length, - result = {}; - - while (++index < length) { - var key = props[index]; - result[object[key]] = key; - } - return result; - } - - /** - * Checks if `value` is a boolean value. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`. - * @example - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || toString.call(value) == boolClass; - } - - /** - * Checks if `value` is a date. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a date, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - */ - function isDate(value) { - return value instanceof Date || toString.call(value) == dateClass; - } - - /** - * Checks if `value` is a DOM element. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - */ - function isElement(value) { - return value ? value.nodeType === 1 : false; - } - - /** - * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a - * length of `0` and objects with no own enumerable properties are considered - * "empty". - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object|String} value The value to inspect. - * @returns {Boolean} Returns `true`, if the `value` is empty, else `false`. - * @example - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({}); - * // => true - * - * _.isEmpty(''); - * // => true - */ - function isEmpty(value) { - var result = true; - if (!value) { - return result; - } - var className = toString.call(value), - length = value.length; - - if ((className == arrayClass || className == stringClass || - className == argsClass || (noArgsClass && isArguments(value))) || - (className == objectClass && typeof length == 'number' && isFunction(value.splice))) { - return !length; - } - forOwn(value, function() { - return (result = false); - }); - return result; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If `callback` is passed, it will be executed to - * compare values. If `callback` returns `undefined`, comparisons will be handled - * by the method instead. The `callback` is bound to `thisArg` and invoked with - * two arguments; (a, b). - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} a The value to compare. - * @param {Mixed} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @param- {Object} [stackA=[]] Internally used track traversed `a` objects. - * @param- {Object} [stackB=[]] Internally used track traversed `b` objects. - * @returns {Boolean} Returns `true`, if the values are equvalent, else `false`. - * @example - * - * var moe = { 'name': 'moe', 'age': 40 }; - * var copy = { 'name': 'moe', 'age': 40 }; - * - * moe == copy; - * // => false - * - * _.isEqual(moe, copy); - * // => true - * - * var words = ['hello', 'goodbye']; - * var otherWords = ['hi', 'goodbye']; - * - * _.isEqual(words, otherWords, function(a, b) { - * var reGreet = /^(?:hello|hi)$/i, - * aGreet = _.isString(a) && reGreet.test(a), - * bGreet = _.isString(b) && reGreet.test(b); - * - * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; - * }); - * // => true - */ - function isEqual(a, b, callback, thisArg, stackA, stackB) { - // used to indicate that when comparing objects, `a` has at least the properties of `b` - var whereIndicator = callback === indicatorObject; - if (callback && !whereIndicator) { - callback = typeof thisArg == 'undefined' ? callback : createCallback(callback, thisArg, 2); - var result = callback(a, b); - if (typeof result != 'undefined') { - return !!result; - } - } - // exit early for identical values - if (a === b) { - // treat `+0` vs. `-0` as not equal - return a !== 0 || (1 / a == 1 / b); - } - var type = typeof a, - otherType = typeof b; - - // exit early for unlike primitive values - if (a === a && - (!a || (type != 'function' && type != 'object')) && - (!b || (otherType != 'function' && otherType != 'object'))) { - return false; - } - // exit early for `null` and `undefined`, avoiding ES3's Function#call behavior - // http://es5.github.com/#x15.3.4.4 - if (a == null || b == null) { - return a === b; - } - // compare [[Class]] names - var className = toString.call(a), - otherClass = toString.call(b); - - if (className == argsClass) { - className = objectClass; - } - if (otherClass == argsClass) { - otherClass = objectClass; - } - if (className != otherClass) { - return false; - } - switch (className) { - case boolClass: - case dateClass: - // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0`, treating invalid dates coerced to `NaN` as not equal - return +a == +b; - - case numberClass: - // treat `NaN` vs. `NaN` as equal - return a != +a - ? b != +b - // but treat `+0` vs. `-0` as not equal - : (a == 0 ? (1 / a == 1 / b) : a == +b); - - case regexpClass: - case stringClass: - // coerce regexes to strings (http://es5.github.com/#x15.10.6.4) - // treat string primitives and their corresponding object instances as equal - return a == b + ''; - } - var isArr = className == arrayClass; - if (!isArr) { - // unwrap any `lodash` wrapped values - if (a.__wrapped__ || b.__wrapped__) { - return isEqual(a.__wrapped__ || a, b.__wrapped__ || b, callback, thisArg, stackA, stackB); - } - // exit for functions and DOM nodes - if (className != objectClass || (noNodeClass && (isNode(a) || isNode(b)))) { - return false; - } - // in older versions of Opera, `arguments` objects have `Array` constructors - var ctorA = !argsAreObjects && isArguments(a) ? Object : a.constructor, - ctorB = !argsAreObjects && isArguments(b) ? Object : b.constructor; - - // non `Object` object instances with different constructors are not equal - if (ctorA != ctorB && !( - isFunction(ctorA) && ctorA instanceof ctorA && - isFunction(ctorB) && ctorB instanceof ctorB - )) { - return false; - } - } - // assume cyclic structures are equal - // the algorithm for detecting cyclic structures is adapted from ES 5.1 - // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3) - stackA || (stackA = []); - stackB || (stackB = []); - - var length = stackA.length; - while (length--) { - if (stackA[length] == a) { - return stackB[length] == b; - } - } - var size = 0; - result = true; - - // add `a` and `b` to the stack of traversed objects - stackA.push(a); - stackB.push(b); - - // recursively compare objects and arrays (susceptible to call stack limits) - if (isArr) { - length = a.length; - size = b.length; - - // compare lengths to determine if a deep comparison is necessary - result = size == a.length; - if (!result && !whereIndicator) { - return result; - } - // deep compare the contents, ignoring non-numeric properties - while (size--) { - var index = length, - value = b[size]; - - if (whereIndicator) { - while (index--) { - if ((result = isEqual(a[index], value, callback, thisArg, stackA, stackB))) { - break; - } - } - } else if (!(result = isEqual(a[size], value, callback, thisArg, stackA, stackB))) { - break; - } - } - return result; - } - // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` - // which, in this case, is more costly - forIn(b, function(value, key, b) { - if (hasOwnProperty.call(b, key)) { - // count the number of properties. - size++; - // deep compare each property value. - return (result = hasOwnProperty.call(a, key) && isEqual(a[key], value, callback, thisArg, stackA, stackB)); - } - }); - - if (result && !whereIndicator) { - // ensure both objects have the same number of properties - forIn(a, function(value, key, a) { - if (hasOwnProperty.call(a, key)) { - // `size` will be `-1` if `a` has more properties than `b` - return (result = --size > -1); - } - }); - } - return result; - } - - /** - * Checks if `value` is, or can be coerced to, a finite number. - * - * Note: This is not the same as native `isFinite`, which will return true for - * booleans and empty strings. See http://es5.github.com/#x15.1.2.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is finite, else `false`. - * @example - * - * _.isFinite(-101); - * // => true - * - * _.isFinite('10'); - * // => true - * - * _.isFinite(true); - * // => false - * - * _.isFinite(''); - * // => false - * - * _.isFinite(Infinity); - * // => false - */ - function isFinite(value) { - return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); - } - - /** - * Checks if `value` is a function. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - */ - function isFunction(value) { - return typeof value == 'function'; - } - // fallback for older versions of Chrome and Safari - if (isFunction(/x/)) { - isFunction = function(value) { - return value instanceof Function || toString.call(value) == funcClass; - }; - } - - /** - * Checks if `value` is the language type of Object. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ - function isObject(value) { - // check if the value is the ECMAScript language type of Object - // http://es5.github.com/#x8 - // and avoid a V8 bug - // http://code.google.com/p/v8/issues/detail?id=2291 - return value ? objectTypes[typeof value] : false; - } - - /** - * Checks if `value` is `NaN`. - * - * Note: This is not the same as native `isNaN`, which will return `true` for - * `undefined` and other values. See http://es5.github.com/#x15.1.2.4. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) - return isNumber(value) && value != +value - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(undefined); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is a number. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a number, else `false`. - * @example - * - * _.isNumber(8.4 * 5); - * // => true - */ - function isNumber(value) { - return typeof value == 'number' || toString.call(value) == numberClass; - } - - /** - * Checks if a given `value` is an object created by the `Object` constructor. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. - * @example - * - * function Stooge(name, age) { - * this.name = name; - * this.age = age; - * } - * - * _.isPlainObject(new Stooge('moe', 40)); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'name': 'moe', 'age': 40 }); - * // => true - */ - var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && typeof value == 'object')) { - return false; - } - var valueOf = value.valueOf, - objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? value == objProto || (getPrototypeOf(value) == objProto && !isArguments(value)) - : shimIsPlainObject(value); - }; - - /** - * Checks if `value` is a regular expression. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`. - * @example - * - * _.isRegExp(/moe/); - * // => true - */ - function isRegExp(value) { - return value instanceof RegExp || toString.call(value) == regexpClass; - } - - /** - * Checks if `value` is a string. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a string, else `false`. - * @example - * - * _.isString('moe'); - * // => true - */ - function isString(value) { - return typeof value == 'string' || toString.call(value) == stringClass; - } - - /** - * Checks if `value` is `undefined`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - */ - function isUndefined(value) { - return typeof value == 'undefined'; - } - - /** - * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined`, into the destination object. Subsequent sources - * will overwrite propery assignments of previous sources. If a `callback` function - * is passed, it will be executed to produce the merged values of the destination - * and source properties. If `callback` returns `undefined`, merging will be - * handled by the method instead. The `callback` is bound to `thisArg` and - * invoked with two arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The destination object. - * @param {Object} [source1, source2, ...] The source objects. - * @param {Function} [callback] The function to customize merging properties. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @param- {Object} [deepIndicator] Internally used to indicate that `stackA` - * and `stackB` are arrays of traversed objects instead of source objects. - * @param- {Array} [stackA=[]] Internally used to track traversed source objects. - * @param- {Array} [stackB=[]] Internally used to associate values with their - * source counterparts. - * @returns {Object} Returns the destination object. - * @example - * - * var names = { - * 'stooges': [ - * { 'name': 'moe' }, - * { 'name': 'larry' } - * ] - * }; - * - * var ages = { - * 'stooges': [ - * { 'age': 40 }, - * { 'age': 50 } - * ] - * }; - * - * _.merge(names, ages); - * // => { 'stooges': [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] } - * - * var food = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var otherFood = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.merge(food, otherFood, function(a, b) { - * return _.isArray(a) ? a.concat(b) : undefined; - * }); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } - */ - function merge(object, source, deepIndicator) { - var args = arguments, - index = 0, - length = 2; - - if (!isObject(object)) { - return object; - } - if (deepIndicator === indicatorObject) { - var callback = args[3], - stackA = args[4], - stackB = args[5]; - } else { - stackA = []; - stackB = []; - - // allows working with `_.reduce` and `_.reduceRight` without - // using their `callback` arguments, `index|key` and `collection` - if (typeof deepIndicator != 'number') { - length = args.length; - } - if (length > 3 && typeof args[length - 2] == 'function') { - callback = createCallback(args[--length - 1], args[length--], 2); - } else if (length > 2 && typeof args[length - 1] == 'function') { - callback = args[--length]; - } - } - while (++index < length) { - (isArray(args[index]) ? forEach : forOwn)(args[index], function(source, key) { - var found, - isArr, - result = source, - value = object[key]; - - if (source && ((isArr = isArray(source)) || isPlainObject(source))) { - // avoid merging previously merged cyclic sources - var stackLength = stackA.length; - while (stackLength--) { - if ((found = stackA[stackLength] == source)) { - value = stackB[stackLength]; - break; - } - } - if (!found) { - value = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); - - if (callback) { - result = callback(value, source); - if (typeof result != 'undefined') { - value = result; - } - } - // add `source` and associated `value` to the stack of traversed objects - stackA.push(source); - stackB.push(value); - - // recursively merge objects and arrays (susceptible to call stack limits) - if (!callback) { - value = merge(value, source, indicatorObject, callback, stackA, stackB); - } - } - } - else { - if (callback) { - result = callback(value, source); - if (typeof result == 'undefined') { - result = source; - } - } - if (typeof result != 'undefined') { - value = result; - } - } - object[key] = value; - }); - } - return object; - } - - /** - * Creates a shallow clone of `object` excluding the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a `callback` function is passed, it will be executed - * for each property in the `object`, omitting the properties `callback` - * returns truthy for. The `callback` is bound to `thisArg` and invoked - * with three arguments; (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|String} callback|[prop1, prop2, ...] The properties to omit - * or the function called per iteration. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object without the omitted properties. - * @example - * - * _.omit({ 'name': 'moe', 'age': 40 }, 'age'); - * // => { 'name': 'moe' } - * - * _.omit({ 'name': 'moe', 'age': 40 }, function(value) { - * return typeof value == 'number'; - * }); - * // => { 'name': 'moe' } - */ - function omit(object, callback, thisArg) { - var isFunc = typeof callback == 'function', - result = {}; - - if (isFunc) { - callback = createCallback(callback, thisArg); - } else { - var props = concat.apply(arrayRef, arguments); - } - forIn(object, function(value, key, object) { - if (isFunc - ? !callback(value, key, object) - : indexOf(props, key, 1) < 0 - ) { - result[key] = value; - } - }); - return result; - } - - /** - * Creates a two dimensional array of the given object's key-value pairs, - * i.e. `[[key1, value1], [key2, value2]]`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns new array of key-value pairs. - * @example - * - * _.pairs({ 'moe': 30, 'larry': 40 }); - * // => [['moe', 30], ['larry', 40]] (order is not guaranteed) - */ - function pairs(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; - } - return result; - } - - /** - * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of property - * names. If `callback` is passed, it will be executed for each property in the - * `object`, picking the properties `callback` returns truthy for. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Array|Function|String} callback|[prop1, prop2, ...] The function called - * per iteration or properties to pick, either as individual arguments or arrays. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object composed of the picked properties. - * @example - * - * _.pick({ 'name': 'moe', '_userid': 'moe1' }, 'name'); - * // => { 'name': 'moe' } - * - * _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { - * return key.charAt(0) != '_'; - * }); - * // => { 'name': 'moe' } - */ - function pick(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var index = 0, - props = concat.apply(arrayRef, arguments), - length = isObject(object) ? props.length : 0; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - } else { - callback = createCallback(callback, thisArg); - forIn(object, function(value, key, object) { - if (callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * Creates an array composed of the own enumerable property values of `object`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns a new array of property values. - * @example - * - * _.values({ 'one': 1, 'two': 2, 'three': 3 }); - * // => [1, 2, 3] - */ - function values(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - result[index] = object[props[index]]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array of elements from the specified indexes, or keys, of the - * `collection`. Indexes may be specified as individual arguments or as arrays - * of indexes. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Array|Number|String} [index1, index2, ...] The indexes of - * `collection` to retrieve, either as individual arguments or arrays. - * @returns {Array} Returns a new array of elements corresponding to the - * provided indexes. - * @example - * - * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); - * // => ['a', 'c', 'e'] - * - * _.at(['moe', 'larry', 'curly'], 0, 2); - * // => ['moe', 'curly'] - */ - function at(collection) { - var index = -1, - props = concat.apply(arrayRef, slice(arguments, 1)), - length = props.length, - result = Array(length); - - if (noCharByIndex && isString(collection)) { - collection = collection.split(''); - } - while(++index < length) { - result[index] = collection[props[index]]; - } - return result; - } - - /** - * Checks if a given `target` element is present in a `collection` using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. - * - * @static - * @memberOf _ - * @alias include - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Mixed} target The value to check for. - * @param {Number} [fromIndex=0] The index to search from. - * @returns {Boolean} Returns `true` if the `target` element is found, else `false`. - * @example - * - * _.contains([1, 2, 3], 1); - * // => true - * - * _.contains([1, 2, 3], 1, 2); - * // => false - * - * _.contains({ 'name': 'moe', 'age': 40 }, 'moe'); - * // => true - * - * _.contains('curly', 'ur'); - * // => true - */ - function contains(collection, target, fromIndex) { - var index = -1, - length = collection ? collection.length : 0, - result = false; - - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (typeof length == 'number') { - result = (isString(collection) - ? collection.indexOf(target, fromIndex) - : indexOf(collection, target, fromIndex) - ) > -1; - } else { - each(collection, function(value) { - if (++index >= fromIndex) { - return !(result = value === target); - } - }); - } - return result; - } - - /** - * Creates an object composed of keys returned from running each element of the - * `collection` through the given `callback`. The corresponding value of each key - * is the number of times the key was returned by the `callback`. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': 1, '6': 2 } - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': 1, '6': 2 } - * - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - function countBy(collection, callback, thisArg) { - var result = {}; - callback = createCallback(callback, thisArg); - - forEach(collection, function(value, key, collection) { - key = callback(value, key, collection) + ''; - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); - }); - return result; - } - - /** - * Checks if the `callback` returns a truthy value for **all** elements of a - * `collection`. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias all - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Boolean} Returns `true` if all elements pass the callback check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes'], Boolean); - * // => false - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.every(stooges, 'age'); - * // => true - * - * // using "_.where" callback shorthand - * _.every(stooges, { 'age': 50 }); - * // => false - */ - function every(collection, callback, thisArg) { - var result = true; - callback = createCallback(callback, thisArg); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (!(result = !!callback(collection[index], index, collection))) { - break; - } - } - } else { - each(collection, function(value, index, collection) { - return (result = !!callback(value, index, collection)); - }); - } - return result; - } - - /** - * Examines each element in a `collection`, returning an array of all elements - * the `callback` returns truthy for. The `callback` is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias select - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that passed the callback check. - * @example - * - * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [2, 4, 6] - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.filter(food, 'organic'); - * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }] - * - * // using "_.where" callback shorthand - * _.filter(food, { 'type': 'fruit' }); - * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }] - */ - function filter(collection, callback, thisArg) { - var result = []; - callback = createCallback(callback, thisArg); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - } - } - } else { - each(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result.push(value); - } - }); - } - return result; - } - - /** - * Examines each element in a `collection`, returning the first that the `callback` - * returns truthy for. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias detect - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the element that passed the callback check, - * else `undefined`. - * @example - * - * var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => 2 - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'banana', 'organic': true, 'type': 'fruit' }, - * { 'name': 'beet', 'organic': false, 'type': 'vegetable' }, - * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * var veggie = _.find(food, { 'type': 'vegetable' }); - * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' } - * - * // using "_.pluck" callback shorthand - * var healthy = _.find(food, 'organic'); - * // => { 'name': 'banana', 'organic': true, 'type': 'fruit' } - */ - function find(collection, callback, thisArg) { - var result; - callback = createCallback(callback, thisArg); - - forEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - - /** - * Iterates over a `collection`, executing the `callback` for each element in - * the `collection`. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). Callbacks may exit iteration early - * by explicitly returning `false`. - * - * @static - * @memberOf _ - * @alias each - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|String} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEach(alert).join(','); - * // => alerts each number and returns '1,2,3' - * - * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); - * // => alerts each number value (order is not guaranteed) - */ - function forEach(collection, callback, thisArg) { - if (callback && typeof thisArg == 'undefined' && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (callback(collection[index], index, collection) === false) { - break; - } - } - } else { - each(collection, callback, thisArg); - } - return collection; - } - - /** - * Creates an object composed of keys returned from running each element of the - * `collection` through the `callback`. The corresponding value of each key is - * an array of elements passed to `callback` that returned the key. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false` - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * // using "_.pluck" callback shorthand - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - function groupBy(collection, callback, thisArg) { - var result = {}; - callback = createCallback(callback, thisArg); - - forEach(collection, function(value, key, collection) { - key = callback(value, key, collection) + ''; - (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value); - }); - return result; - } - - /** - * Invokes the method named by `methodName` on each element in the `collection`, - * returning an array of the results of each invoked method. Additional arguments - * will be passed to each invoked method. If `methodName` is a function, it will - * be invoked for, and `this` bound to, each element in the `collection`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|String} methodName The name of the method to invoke or - * the function invoked per iteration. - * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the method with. - * @returns {Array} Returns a new array of the results of each invoked method. - * @example - * - * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invoke([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - function invoke(collection, methodName) { - var args = slice(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); - }); - return result; - } - - /** - * Creates an array of values by running each element in the `collection` - * through the `callback`. The `callback` is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias collect - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of the results of each `callback` execution. - * @example - * - * _.map([1, 2, 3], function(num) { return num * 3; }); - * // => [3, 6, 9] - * - * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); - * // => [3, 6, 9] (order is not guaranteed) - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(stooges, 'name'); - * // => ['moe', 'larry'] - */ - function map(collection, callback, thisArg) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - callback = createCallback(callback, thisArg); - if (isArray(collection)) { - while (++index < length) { - result[index] = callback(collection[index], index, collection); - } - } else { - each(collection, function(value, key, collection) { - result[++index] = callback(value, key, collection); - }); - } - return result; - } - - /** - * Retrieves the maximum value of an `array`. If `callback` is passed, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the maximum value. - * @example - * - * _.max([4, 2, 8, 6]); - * // => 8 - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * _.max(stooges, function(stooge) { return stooge.age; }); - * // => { 'name': 'larry', 'age': 50 }; - * - * // using "_.pluck" callback shorthand - * _.max(stooges, 'age'); - * // => { 'name': 'larry', 'age': 50 }; - */ - function max(collection, callback, thisArg) { - var computed = -Infinity, - result = computed; - - if (!callback && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value > result) { - result = value; - } - } - } else { - callback = !callback && isString(collection) - ? charAtCallback - : createCallback(callback, thisArg); - - each(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current > computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the minimum value of an `array`. If `callback` is passed, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the minimum value. - * @example - * - * _.min([4, 2, 8, 6]); - * // => 2 - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * _.min(stooges, function(stooge) { return stooge.age; }); - * // => { 'name': 'moe', 'age': 40 }; - * - * // using "_.pluck" callback shorthand - * _.min(stooges, 'age'); - * // => { 'name': 'moe', 'age': 40 }; - */ - function min(collection, callback, thisArg) { - var computed = Infinity, - result = computed; - - if (!callback && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value < result) { - result = value; - } - } - } else { - callback = !callback && isString(collection) - ? charAtCallback - : createCallback(callback, thisArg); - - each(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current < computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the value of a specified property from all elements in the `collection`. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {String} property The property to pluck. - * @returns {Array} Returns a new array of property values. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * _.pluck(stooges, 'name'); - * // => ['moe', 'larry'] - */ - var pluck = map; - - /** - * Reduces a `collection` to a value that is the accumulated result of running - * each element in the `collection` through the `callback`, where each successive - * `callback` execution consumes the return value of the previous execution. - * If `accumulator` is not passed, the first element of the `collection` will be - * used as the initial `accumulator` value. The `callback` is bound to `thisArg` - * and invoked with four arguments; (accumulator, value, index|key, collection). - * - * @static - * @memberOf _ - * @alias foldl, inject - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {Mixed} [accumulator] Initial value of the accumulator. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the accumulated value. - * @example - * - * var sum = _.reduce([1, 2, 3], function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * return result; - * }, {}); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function reduce(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = createCallback(callback, thisArg, 4); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - if (noaccum) { - accumulator = collection[++index]; - } - while (++index < length) { - accumulator = callback(accumulator, collection[index], index, collection); - } - } else { - each(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection) - }); - } - return accumulator; - } - - /** - * This method is similar to `_.reduce`, except that it iterates over a - * `collection` from right to left. - * - * @static - * @memberOf _ - * @alias foldr - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {Mixed} [accumulator] Initial value of the accumulator. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the accumulated value. - * @example - * - * var list = [[0, 1], [2, 3], [4, 5]]; - * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, callback, accumulator, thisArg) { - var iterable = collection, - length = collection ? collection.length : 0, - noaccum = arguments.length < 3; - - if (typeof length != 'number') { - var props = keys(collection); - length = props.length; - } else if (noCharByIndex && isString(collection)) { - iterable = collection.split(''); - } - callback = createCallback(callback, thisArg, 4); - forEach(collection, function(value, index, collection) { - index = props ? props[--length] : --length; - accumulator = noaccum - ? (noaccum = false, iterable[index]) - : callback(accumulator, iterable[index], index, collection); - }); - return accumulator; - } - - /** - * The opposite of `_.filter`, this method returns the elements of a - * `collection` that `callback` does **not** return truthy for. - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that did **not** pass the - * callback check. - * @example - * - * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [1, 3, 5] - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.reject(food, 'organic'); - * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }] - * - * // using "_.where" callback shorthand - * _.reject(food, { 'type': 'fruit' }); - * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }] - */ - function reject(collection, callback, thisArg) { - callback = createCallback(callback, thisArg); - return filter(collection, function(value, index, collection) { - return !callback(value, index, collection); - }); - } - - /** - * Creates an array of shuffled `array` values, using a version of the - * Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to shuffle. - * @returns {Array} Returns a new shuffled collection. - * @example - * - * _.shuffle([1, 2, 3, 4, 5, 6]); - * // => [4, 1, 6, 3, 5, 2] - */ - function shuffle(collection) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - var rand = floor(nativeRandom() * (++index + 1)); - result[index] = result[rand]; - result[rand] = value; - }); - return result; - } - - /** - * Gets the size of the `collection` by returning `collection.length` for arrays - * and array-like objects or the number of own enumerable properties for objects. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to inspect. - * @returns {Number} Returns `collection.length` or number of own enumerable properties. - * @example - * - * _.size([1, 2]); - * // => 2 - * - * _.size({ 'one': 1, 'two': 2, 'three': 3 }); - * // => 3 - * - * _.size('curly'); - * // => 5 - */ - function size(collection) { - var length = collection ? collection.length : 0; - return typeof length == 'number' ? length : keys(collection).length; - } - - /** - * Checks if the `callback` returns a truthy value for **any** element of a - * `collection`. The function returns as soon as it finds passing value, and - * does not iterate over the entire `collection`. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias any - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Boolean} Returns `true` if any element passes the callback check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var food = [ - * { 'name': 'apple', 'organic': false, 'type': 'fruit' }, - * { 'name': 'carrot', 'organic': true, 'type': 'vegetable' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.some(food, 'organic'); - * // => true - * - * // using "_.where" callback shorthand - * _.some(food, { 'type': 'meat' }); - * // => false - */ - function some(collection, callback, thisArg) { - var result; - callback = createCallback(callback, thisArg); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if ((result = callback(collection[index], index, collection))) { - break; - } - } - } else { - each(collection, function(value, index, collection) { - return !(result = callback(value, index, collection)); - }); - } - return !!result; - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in the `collection` through the `callback`. This method - * performs a stable sort, that is, it will preserve the original sort order of - * equal elements. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of sorted elements. - * @example - * - * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); - * // => [3, 1, 2] - * - * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); - * // => [3, 1, 2] - * - * // using "_.pluck" callback shorthand - * _.sortBy(['banana', 'strawberry', 'apple'], 'length'); - * // => ['apple', 'banana', 'strawberry'] - */ - function sortBy(collection, callback, thisArg) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - callback = createCallback(callback, thisArg); - forEach(collection, function(value, key, collection) { - result[++index] = { - 'criteria': callback(value, key, collection), - 'index': index, - 'value': value - }; - }); - - length = result.length; - result.sort(compareAscending); - while (length--) { - result[length] = result[length].value; - } - return result; - } - - /** - * Converts the `collection` to an array. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to convert. - * @returns {Array} Returns the new converted array. - * @example - * - * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); - * // => [2, 3, 4] - */ - function toArray(collection) { - if (collection && typeof collection.length == 'number') { - return noCharByIndex && isString(collection) - ? collection.split('') - : slice(collection); - } - return values(collection); - } - - /** - * Examines each element in a `collection`, returning an array of all elements - * that have the given `properties`. When checking `properties`, this method - * performs a deep comparison between values to determine if they are equivalent - * to each other. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|String} collection The collection to iterate over. - * @param {Object} properties The object of property values to filter by. - * @returns {Array} Returns a new array of elements that have the given `properties`. - * @example - * - * var stooges = [ - * { 'name': 'moe', 'age': 40 }, - * { 'name': 'larry', 'age': 50 } - * ]; - * - * _.where(stooges, { 'age': 40 }); - * // => [{ 'name': 'moe', 'age': 40 }] - */ - var where = filter; - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array with all falsey values of `array` removed. The values - * `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to compact. - * @returns {Array} Returns a new filtered array. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result.push(value); - } - } - return result; - } - - /** - * Creates an array of `array` elements not present in the other arrays - * using strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @param {Array} [array1, array2, ...] Arrays to check. - * @returns {Array} Returns a new array of `array` elements not present in the - * other arrays. - * @example - * - * _.difference([1, 2, 3, 4, 5], [5, 2, 10]); - * // => [1, 3, 4] - */ - function difference(array) { - var index = -1, - length = array ? array.length : 0, - flattened = concat.apply(arrayRef, arguments), - contains = cachedContains(flattened, length), - result = []; - - while (++index < length) { - var value = array[index]; - if (!contains(value)) { - result.push(value); - } - } - return result; - } - - /** - * Gets the first element of the `array`. If a number `n` is passed, the first - * `n` elements of the `array` are returned. If a `callback` function is passed, - * the first elements the `callback` returns truthy for are returned. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, index, array). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias head, take - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|Number|String} [callback|n] The function called - * per element or the number of elements to return. If a property name or - * object is passed, it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the first element(s) of `array`. - * @example - * - * _.first([1, 2, 3]); - * // => 1 - * - * _.first([1, 2, 3], 2); - * // => [1, 2] - * - * _.first([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [1, 2] - * - * var food = [ - * { 'name': 'banana', 'organic': true }, - * { 'name': 'beet', 'organic': false }, - * ]; - * - * // using "_.pluck" callback shorthand - * _.first(food, 'organic'); - * // => [{ 'name': 'banana', 'organic': true }] - * - * var food = [ - * { 'name': 'apple', 'type': 'fruit' }, - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.first(food, { 'type': 'fruit' }); - * // => [{ 'name': 'apple', 'type': 'fruit' }, { 'name': 'banana', 'type': 'fruit' }] - */ - function first(array, callback, thisArg) { - if (array) { - var n = 0, - length = array.length; - - if (typeof callback != 'number' && callback != null) { - var index = -1; - callback = createCallback(callback, thisArg); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array[0]; - } - } - return slice(array, 0, nativeMin(nativeMax(0, n), length)); - } - } - - /** - * Flattens a nested array (the nesting can be to any depth). If `shallow` is - * truthy, `array` will only be flattened a single level. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to compact. - * @param {Boolean} shallow A flag to indicate only flattening a single level. - * @returns {Array} Returns a new flattened array. - * @example - * - * _.flatten([1, [2], [3, [[4]]]]); - * // => [1, 2, 3, 4]; - * - * _.flatten([1, [2], [3, [[4]]]], true); - * // => [1, 2, 3, [[4]]]; - */ - function flatten(array, shallow) { - var index = -1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - - // recursively flatten arrays (susceptible to call stack limits) - if (isArray(value)) { - push.apply(result, shallow ? value : flatten(value)); - } else { - result.push(value); - } - } - return result; - } - - /** - * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the `array` is already - * sorted, passing `true` for `fromIndex` will run a faster binary search. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Mixed} value The value to search for. - * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to - * perform a binary search on a sorted `array`. - * @returns {Number} Returns the index of the matched value or `-1`. - * @example - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2); - * // => 1 - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 4 - * - * _.indexOf([1, 1, 2, 2, 3, 3], 2, true); - * // => 2 - */ - function indexOf(array, value, fromIndex) { - var index = -1, - length = array ? array.length : 0; - - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0) - 1; - } else if (fromIndex) { - index = sortedIndex(array, value); - return array[index] === value ? index : -1; - } - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Gets all but the last element of `array`. If a number `n` is passed, the - * last `n` elements are excluded from the result. If a `callback` function - * is passed, the last elements the `callback` returns truthy for are excluded - * from the result. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|Number|String} [callback|n=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is passed, it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - * - * _.initial([1, 2, 3], 2); - * // => [1] - * - * _.initial([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [1] - * - * var food = [ - * { 'name': 'beet', 'organic': false }, - * { 'name': 'carrot', 'organic': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.initial(food, 'organic'); - * // => [{ 'name': 'beet', 'organic': false }] - * - * var food = [ - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' }, - * { 'name': 'carrot', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.initial(food, { 'type': 'vegetable' }); - * // => [{ 'name': 'banana', 'type': 'fruit' }] - */ - function initial(array, callback, thisArg) { - if (!array) { - return []; - } - var n = 0, - length = array.length; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = createCallback(callback, thisArg); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : callback || n; - } - return slice(array, 0, nativeMin(nativeMax(0, length - n), length)); - } - - /** - * Computes the intersection of all the passed-in arrays using strict equality - * for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} [array1, array2, ...] Arrays to process. - * @returns {Array} Returns a new array of unique elements that are present - * in **all** of the arrays. - * @example - * - * _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); - * // => [1, 2] - */ - function intersection(array) { - var args = arguments, - argsLength = args.length, - cache = { '0': {} }, - index = -1, - length = array ? array.length : 0, - isLarge = length >= 100, - result = [], - seen = result; - - outer: - while (++index < length) { - var value = array[index]; - if (isLarge) { - var key = value + ''; - var inited = hasOwnProperty.call(cache[0], key) - ? !(seen = cache[0][key]) - : (seen = cache[0][key] = []); - } - if (inited || indexOf(seen, value) < 0) { - if (isLarge) { - seen.push(value); - } - var argsIndex = argsLength; - while (--argsIndex) { - if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex], 0, 100)))(value)) { - continue outer; - } - } - result.push(value); - } - } - return result; - } - - /** - * Gets the last element of the `array`. If a number `n` is passed, the last - * `n` elements of the `array` are returned. If a `callback` function is passed, - * the last elements the `callback` returns truthy for are returned. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, index, array). - * - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|Number|String} [callback|n] The function called - * per element or the number of elements to return. If a property name or - * object is passed, it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Mixed} Returns the last element(s) of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - * - * _.last([1, 2, 3], 2); - * // => [2, 3] - * - * _.last([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [2, 3] - * - * var food = [ - * { 'name': 'beet', 'organic': false }, - * { 'name': 'carrot', 'organic': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.last(food, 'organic'); - * // => [{ 'name': 'carrot', 'organic': true }] - * - * var food = [ - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' }, - * { 'name': 'carrot', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.last(food, { 'type': 'vegetable' }); - * // => [{ 'name': 'beet', 'type': 'vegetable' }, { 'name': 'carrot', 'type': 'vegetable' }] - */ - function last(array, callback, thisArg) { - if (array) { - var n = 0, - length = array.length; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = createCallback(callback, thisArg); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array[length - 1]; - } - } - return slice(array, nativeMax(0, length - n)); - } - } - - /** - * Gets the index at which the last occurrence of `value` is found using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Mixed} value The value to search for. - * @param {Number} [fromIndex=array.length-1] The index to search from. - * @returns {Number} Returns the index of the matched value or `-1`. - * @example - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); - * // => 4 - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var index = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Creates an object composed from arrays of `keys` and `values`. Pass either - * a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or - * two arrays, one of `keys` and one of corresponding `values`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} keys The array of keys. - * @param {Array} [values=[]] The array of values. - * @returns {Object} Returns an object composed of the given keys and - * corresponding values. - * @example - * - * _.object(['moe', 'larry'], [30, 40]); - * // => { 'moe': 30, 'larry': 40 } - */ - function object(keys, values) { - var index = -1, - length = keys ? keys.length : 0, - result = {}; - - while (++index < length) { - var key = keys[index]; - if (values) { - result[key] = values[index]; - } else { - result[key[0]] = key[1]; - } - } - return result; - } - - /** - * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Number} [start=0] The start of the range. - * @param {Number} end The end of the range. - * @param {Number} [step=1] The value to increment or descrement by. - * @returns {Array} Returns a new range array. - * @example - * - * _.range(10); - * // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - * - * _.range(1, 11); - * // => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] - * - * _.range(0, 30, 5); - * // => [0, 5, 10, 15, 20, 25] - * - * _.range(0, -10, -1); - * // => [0, -1, -2, -3, -4, -5, -6, -7, -8, -9] - * - * _.range(0); - * // => [] - */ - function range(start, end, step) { - start = +start || 0; - step = +step || 1; - - if (end == null) { - end = start; - start = 0; - } - // use `Array(length)` so V8 will avoid the slower "dictionary" mode - // http://youtu.be/XAqIpGU8ZZk#t=17m25s - var index = -1, - length = nativeMax(0, ceil((end - start) / step)), - result = Array(length); - - while (++index < length) { - result[index] = start; - start += step; - } - return result; - } - - /** - * The opposite of `_.initial`, this method gets all but the first value of `array`. - * If a number `n` is passed, the first `n` values are excluded from the result. - * If a `callback` function is passed, the first elements the `callback` returns - * truthy for are excluded from the result. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index, array). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias drop, tail - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|Number|String} [callback|n=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is passed, it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.rest([1, 2, 3]); - * // => [2, 3] - * - * _.rest([1, 2, 3], 2); - * // => [3] - * - * _.rest([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [3] - * - * var food = [ - * { 'name': 'banana', 'organic': true }, - * { 'name': 'beet', 'organic': false }, - * ]; - * - * // using "_.pluck" callback shorthand - * _.rest(food, 'organic'); - * // => [{ 'name': 'beet', 'organic': false }] - * - * var food = [ - * { 'name': 'apple', 'type': 'fruit' }, - * { 'name': 'banana', 'type': 'fruit' }, - * { 'name': 'beet', 'type': 'vegetable' } - * ]; - * - * // using "_.where" callback shorthand - * _.rest(food, { 'type': 'fruit' }); - * // => [{ 'name': 'beet', 'type': 'vegetable' }] - */ - function rest(array, callback, thisArg) { - if (typeof callback != 'number' && callback != null) { - var n = 0, - index = -1, - length = array ? array.length : 0; - - callback = createCallback(callback, thisArg); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); - } - return slice(array, n); - } - - /** - * Uses a binary search to determine the smallest index at which the `value` - * should be inserted into `array` in order to maintain the sort order of the - * sorted `array`. If `callback` is passed, it will be executed for `value` and - * each element in `array` to compute their sort ranking. The `callback` is - * bound to `thisArg` and invoked with one argument; (value). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to iterate over. - * @param {Mixed} value The value to evaluate. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Number} Returns the index at which the value should be inserted - * into `array`. - * @example - * - * _.sortedIndex([20, 30, 50], 40); - * // => 2 - * - * // using "_.pluck" callback shorthand - * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - * // => 2 - * - * var dict = { - * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - * }; - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return dict.wordToNumber[word]; - * }); - * // => 2 - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return this.wordToNumber[word]; - * }, dict); - * // => 2 - */ - function sortedIndex(array, value, callback, thisArg) { - var low = 0, - high = array ? array.length : low; - - // explicitly reference `identity` for better inlining in Firefox - callback = callback ? createCallback(callback, thisArg, 1) : identity; - value = callback(value); - - while (low < high) { - var mid = (low + high) >>> 1; - callback(array[mid]) < value - ? low = mid + 1 - : high = mid; - } - return low; - } - - /** - * Computes the union of the passed-in arrays using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} [array1, array2, ...] Arrays to process. - * @returns {Array} Returns a new array of unique values, in order, that are - * present in one or more of the arrays. - * @example - * - * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); - * // => [1, 2, 3, 101, 10] - */ - function union() { - return uniq(concat.apply(arrayRef, arguments)); - } - - /** - * Creates a duplicate-value-free version of the `array` using strict equality - * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` - * for `isSorted` will run a faster algorithm. If `callback` is passed, each - * element of `array` is passed through a callback` before uniqueness is computed. - * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). - * - * If a property name is passed for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is passed for `callback`, the created "_.where" style callback - * will return `true` for elements that have the propeties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias unique - * @category Arrays - * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. - * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is passed, it will be used to create - * a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a duplicate-value-free array. - * @example - * - * _.uniq([1, 2, 1, 3, 1]); - * // => [1, 2, 3] - * - * _.uniq([1, 1, 2, 2, 3], true); - * // => [1, 2, 3] - * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return Math.floor(num); }); - * // => [1, 2, 3] - * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2, 3] - * - * // using "_.pluck" callback shorthand - * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniq(array, isSorted, callback, thisArg) { - var index = -1, - length = array ? array.length : 0, - result = [], - seen = result; - - // juggle arguments - if (typeof isSorted == 'function') { - thisArg = callback; - callback = isSorted; - isSorted = false; - } - // init value cache for large arrays - var isLarge = !isSorted && length >= 75; - if (isLarge) { - var cache = {}; - } - if (callback) { - seen = []; - callback = createCallback(callback, thisArg); - } - while (++index < length) { - var value = array[index], - computed = callback ? callback(value, index, array) : value; - - if (isLarge) { - var key = computed + ''; - var inited = hasOwnProperty.call(cache, key) - ? !(seen = cache[key]) - : (seen = cache[key] = []); - } - if (isSorted - ? !index || seen[seen.length - 1] !== computed - : inited || indexOf(seen, computed) < 0 - ) { - if (callback || isLarge) { - seen.push(computed); - } - result.push(value); - } - } - return result; - } - - /** - * Creates an array with all occurrences of the passed values removed using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to filter. - * @param {Mixed} [value1, value2, ...] Values to remove. - * @returns {Array} Returns a new filtered array. - * @example - * - * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); - * // => [2, 3, 4] - */ - function without(array) { - var index = -1, - length = array ? array.length : 0, - contains = cachedContains(arguments, 1), - result = []; - - while (++index < length) { - var value = array[index]; - if (!contains(value)) { - result.push(value); - } - } - return result; - } - - /** - * Groups the elements of each array at their corresponding indexes. Useful for - * separate data sources that are coordinated through matching array indexes. - * For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix - * in a similar fashion. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} [array1, array2, ...] Arrays to process. - * @returns {Array} Returns a new array of grouped elements. - * @example - * - * _.zip(['moe', 'larry'], [30, 40], [true, false]); - * // => [['moe', 30, true], ['larry', 40, false]] - */ - function zip(array) { - var index = -1, - length = array ? max(pluck(arguments, 'length')) : 0, - result = Array(length); - - while (++index < length) { - result[index] = pluck(arguments, index); - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that is restricted to executing `func` only after it is - * called `n` times. The `func` is executed with the `this` binding of the - * created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Number} n The number of times the function must be called before - * it is executed. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var renderNotes = _.after(notes.length, render); - * _.forEach(notes, function(note) { - * note.asyncSave({ 'success': renderNotes }); - * }); - * // `renderNotes` is run once, after all notes have saved - */ - function after(n, func) { - if (n < 1) { - return func(); - } - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that, when called, invokes `func` with the `this` - * binding of `thisArg` and prepends any additional `bind` arguments to those - * passed to the bound function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to bind. - * @param {Mixed} [thisArg] The `this` binding of `func`. - * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var func = function(greeting) { - * return greeting + ' ' + this.name; - * }; - * - * func = _.bind(func, { 'name': 'moe' }, 'hi'); - * func(); - * // => 'hi moe' - */ - function bind(func, thisArg) { - // use `Function#bind` if it exists and is fast - // (in V8 `Function#bind` is slower except when partially applied) - return isBindFast || (nativeBind && arguments.length > 2) - ? nativeBind.call.apply(nativeBind, arguments) - : createBound(func, thisArg, slice(arguments, 2)); - } - - /** - * Binds methods on `object` to `object`, overwriting the existing method. - * Method names may be specified as individual arguments or as arrays of method - * names. If no method names are provided, all the function properties of `object` - * will be bound. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object to bind and assign the bound methods to. - * @param {String} [methodName1, methodName2, ...] Method names on the object to bind. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'onClick': function() { alert('clicked ' + this.label); } - * }; - * - * _.bindAll(view); - * jQuery('#docs').on('click', view.onClick); - * // => alerts 'clicked docs', when the button is clicked - */ - function bindAll(object) { - var funcs = concat.apply(arrayRef, arguments), - index = funcs.length > 1 ? 0 : (funcs = functions(object), -1), - length = funcs.length; - - while (++index < length) { - var key = funcs[index]; - object[key] = bind(object[key], object); - } - return object; - } - - /** - * Creates a function that, when called, invokes the method at `object[key]` - * and prepends any additional `bindKey` arguments to those passed to the bound - * function. This method differs from `_.bind` by allowing bound functions to - * reference methods that will be redefined or don't yet exist. - * See http://michaux.ca/articles/lazy-function-definition-pattern. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object the method belongs to. - * @param {String} key The key of the method. - * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'name': 'moe', - * 'greet': function(greeting) { - * return greeting + ' ' + this.name; - * } - * }; - * - * var func = _.bindKey(object, 'greet', 'hi'); - * func(); - * // => 'hi moe' - * - * object.greet = function(greeting) { - * return greeting + ', ' + this.name + '!'; - * }; - * - * func(); - * // => 'hi, moe!' - */ - function bindKey(object, key) { - return createBound(object, key, slice(arguments, 2)); - } - - /** - * Creates a function that is the composition of the passed functions, - * where each function consumes the return value of the function that follows. - * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. - * Each function is executed with the `this` binding of the composed function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} [func1, func2, ...] Functions to compose. - * @returns {Function} Returns the new composed function. - * @example - * - * var greet = function(name) { return 'hi ' + name; }; - * var exclaim = function(statement) { return statement + '!'; }; - * var welcome = _.compose(exclaim, greet); - * welcome('moe'); - * // => 'hi moe!' - */ - function compose() { - var funcs = arguments; - return function() { - var args = arguments, - length = funcs.length; - - while (length--) { - args = [funcs[length].apply(this, args)]; - } - return args[0]; - }; - } - - /** - * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. Pass - * `true` for `immediate` to cause debounce to invoke `func` on the leading, - * instead of the trailing, edge of the `wait` timeout. Subsequent calls to - * the debounced function will return the result of the last `func` call. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to debounce. - * @param {Number} wait The number of milliseconds to delay. - * @param {Boolean} immediate A flag to indicate execution is on the leading - * edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * var lazyLayout = _.debounce(calculateLayout, 300); - * jQuery(window).on('resize', lazyLayout); - */ - function debounce(func, wait, immediate) { - var args, - result, - thisArg, - timeoutId; - - function delayed() { - timeoutId = null; - if (!immediate) { - result = func.apply(thisArg, args); - } - } - return function() { - var isImmediate = immediate && !timeoutId; - args = arguments; - thisArg = this; - - clearTimeout(timeoutId); - timeoutId = setTimeout(delayed, wait); - - if (isImmediate) { - result = func.apply(thisArg, args); - } - return result; - }; - } - - /** - * Executes the `func` function after `wait` milliseconds. Additional arguments - * will be passed to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to delay. - * @param {Number} wait The number of milliseconds to delay execution. - * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the function with. - * @returns {Number} Returns the `setTimeout` timeout id. - * @example - * - * var log = _.bind(console.log, console); - * _.delay(log, 1000, 'logged later'); - * // => 'logged later' (Appears after one second.) - */ - function delay(func, wait) { - var args = slice(arguments, 2); - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * Defers executing the `func` function until the current call stack has cleared. - * Additional arguments will be passed to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to defer. - * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the function with. - * @returns {Number} Returns the `setTimeout` timeout id. - * @example - * - * _.defer(function() { alert('deferred'); }); - * // returns from the function before `alert` is called - */ - function defer(func) { - var args = slice(arguments, 1); - return setTimeout(function() { func.apply(undefined, args); }, 1); - } - // use `setImmediate` if it's available in Node.js - if (isV8 && freeModule && typeof setImmediate == 'function') { - defer = bind(setImmediate, window); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * passed, it will be used to determine the cache key for storing the result - * based on the arguments passed to the memoized function. By default, the first - * argument passed to the memoized function is used as the cache key. The `func` - * is executed with the `this` binding of the memoized function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] A function used to resolve the cache key. - * @returns {Function} Returns the new memoizing function. - * @example - * - * var fibonacci = _.memoize(function(n) { - * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); - * }); - */ - function memoize(func, resolver) { - var cache = {}; - return function() { - var key = (resolver ? resolver.apply(this, arguments) : arguments[0]) + ''; - return hasOwnProperty.call(cache, key) - ? cache[key] - : (cache[key] = func.apply(this, arguments)); - }; - } - - /** - * Creates a function that is restricted to execute `func` once. Repeat calls to - * the function will return the value of the first call. The `func` is executed - * with the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // `initialize` executes `createApplication` once - */ - function once(func) { - var ran, - result; - - return function() { - if (ran) { - return result; - } - ran = true; - result = func.apply(this, arguments); - - // clear the `func` variable so the function may be garbage collected - func = null; - return result; - }; - } - - /** - * Creates a function that, when called, invokes `func` with any additional - * `partial` arguments prepended to those passed to the new function. This - * method is similar to `_.bind`, except it does **not** alter the `this` binding. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var greet = function(greeting, name) { return greeting + ' ' + name; }; - * var hi = _.partial(greet, 'hi'); - * hi('moe'); - * // => 'hi moe' - */ - function partial(func) { - return createBound(func, slice(arguments, 1)); - } - - /** - * This method is similar to `_.partial`, except that `partial` arguments are - * appended to those passed to the new function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var defaultsDeep = _.partialRight(_.merge, _.defaults); - * - * var options = { - * 'variable': 'data', - * 'imports': { 'jq': $ } - * }; - * - * defaultsDeep(options, _.templateSettings); - * - * options.variable - * // => 'data' - * - * options.imports - * // => { '_': _, 'jq': $ } - */ - function partialRight(func) { - return createBound(func, slice(arguments, 1), null, indicatorObject); - } - - /** - * Creates a function that, when executed, will only call the `func` - * function at most once per every `wait` milliseconds. If the throttled - * function is invoked more than once during the `wait` timeout, `func` will - * also be called on the trailing edge of the timeout. Subsequent calls to the - * throttled function will return the result of the last `func` call. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to throttle. - * @param {Number} wait The number of milliseconds to throttle executions to. - * @returns {Function} Returns the new throttled function. - * @example - * - * var throttled = _.throttle(updatePosition, 100); - * jQuery(window).on('scroll', throttled); - */ - function throttle(func, wait) { - var args, - result, - thisArg, - timeoutId, - lastCalled = 0; - - function trailingCall() { - lastCalled = new Date; - timeoutId = null; - result = func.apply(thisArg, args); - } - return function() { - var now = new Date, - remaining = wait - (now - lastCalled); - - args = arguments; - thisArg = this; - - if (remaining <= 0) { - clearTimeout(timeoutId); - timeoutId = null; - lastCalled = now; - result = func.apply(thisArg, args); - } - else if (!timeoutId) { - timeoutId = setTimeout(trailingCall, remaining); - } - return result; - }; - } - - /** - * Creates a function that passes `value` to the `wrapper` function as its - * first argument. Additional arguments passed to the function are appended - * to those passed to the `wrapper` function. The `wrapper` is executed with - * the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Mixed} value The value to wrap. - * @param {Function} wrapper The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var hello = function(name) { return 'hello ' + name; }; - * hello = _.wrap(hello, function(func) { - * return 'before, ' + func('moe') + ', after'; - * }); - * hello(); - * // => 'before, hello moe, after' - */ - function wrap(value, wrapper) { - return function() { - var args = [value]; - push.apply(args, arguments); - return wrapper.apply(this, args); - }; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their - * corresponding HTML entities. - * - * @static - * @memberOf _ - * @category Utilities - * @param {String} string The string to escape. - * @returns {String} Returns the escaped string. - * @example - * - * _.escape('Moe, Larry & Curly'); - * // => 'Moe, Larry & Curly' - */ - function escape(string) { - return string == null ? '' : (string + '').replace(reUnescapedHtml, escapeHtmlChar); - } - - /** - * This function returns the first argument passed to it. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Mixed} value Any value. - * @returns {Mixed} Returns `value`. - * @example - * - * var moe = { 'name': 'moe' }; - * moe === _.identity(moe); - * // => true - */ - function identity(value) { - return value; - } - - /** - * Adds functions properties of `object` to the `lodash` function and chainable - * wrapper. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} object The object of function properties to add to `lodash`. - * @example - * - * _.mixin({ - * 'capitalize': function(string) { - * return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); - * } - * }); - * - * _.capitalize('moe'); - * // => 'Moe' - * - * _('moe').capitalize(); - * // => 'Moe' - */ - function mixin(object) { - forEach(functions(object), function(methodName) { - var func = lodash[methodName] = object[methodName]; - - lodash.prototype[methodName] = function() { - var args = [this.__wrapped__]; - push.apply(args, arguments); - return new lodash(func.apply(lodash, args)); - }; - }); - } - - /** - * Reverts the '_' variable to its previous value and returns a reference to - * the `lodash` function. - * - * @static - * @memberOf _ - * @category Utilities - * @returns {Function} Returns the `lodash` function. - * @example - * - * var lodash = _.noConflict(); - */ - function noConflict() { - window._ = oldDash; - return this; - } - - /** - * Produces a random number between `min` and `max` (inclusive). If only one - * argument is passed, a number between `0` and the given number will be returned. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Number} [min=0] The minimum possible value. - * @param {Number} [max=1] The maximum possible value. - * @returns {Number} Returns a random number. - * @example - * - * _.random(0, 5); - * // => a number between 0 and 5 - * - * _.random(5); - * // => also a number between 0 and 5 - */ - function random(min, max) { - if (min == null && max == null) { - max = 1; - } - min = +min || 0; - if (max == null) { - max = min; - min = 0; - } - return min + floor(nativeRandom() * ((+max || 0) - min + 1)); - } - - /** - * Resolves the value of `property` on `object`. If `property` is a function, - * it will be invoked and its result returned, else the property value is - * returned. If `object` is falsey, then `null` is returned. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} object The object to inspect. - * @param {String} property The property to get the value of. - * @returns {Mixed} Returns the resolved value. - * @example - * - * var object = { - * 'cheese': 'crumpets', - * 'stuff': function() { - * return 'nonsense'; - * } - * }; - * - * _.result(object, 'cheese'); - * // => 'crumpets' - * - * _.result(object, 'stuff'); - * // => 'nonsense' - */ - function result(object, property) { - var value = object ? object[property] : undefined; - return isFunction(value) ? object[property]() : value; - } - - /** - * A micro-templating method that handles arbitrary delimiters, preserves - * whitespace, and correctly escapes quotes within interpolated code. - * - * Note: In the development build, `_.template` utilizes sourceURLs for easier - * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - * - * Note: Lo-Dash may be used in Chrome extensions by either creating a `lodash csp` - * build and using precompiled templates, or loading Lo-Dash in a sandbox. - * - * For more information on precompiling templates see: - * http://lodash.com/#custom-builds - * - * For more information on Chrome extension sandboxes see: - * http://developer.chrome.com/stable/extensions/sandboxingEval.html - * - * @static - * @memberOf _ - * @category Utilities - * @param {String} text The template text. - * @param {Obect} data The data object used to populate the text. - * @param {Object} options The options object. - * escape - The "escape" delimiter regexp. - * evaluate - The "evaluate" delimiter regexp. - * interpolate - The "interpolate" delimiter regexp. - * sourceURL - The sourceURL of the template's compiled source. - * variable - The data object variable name. - * - * @returns {Function|String} Returns a compiled function when no `data` object - * is given, else it returns the interpolated text. - * @example - * - * // using a compiled template - * var compiled = _.template('hello <%= name %>'); - * compiled({ 'name': 'moe' }); - * // => 'hello moe' - * - * var list = '<% _.forEach(people, function(name) { %>
  • <%= name %>
  • <% }); %>'; - * _.template(list, { 'people': ['moe', 'larry'] }); - * // => '
  • moe
  • larry
  • ' - * - * // using the "escape" delimiter to escape HTML in data property values - * _.template('<%- value %>', { 'value': ' - - - -## Documentation - -### Collections - -* [forEach](#forEach) -* [map](#map) -* [filter](#filter) -* [reject](#reject) -* [reduce](#reduce) -* [detect](#detect) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) - -### Flow Control - -* [series](#series) -* [parallel](#parallel) -* [whilst](#whilst) -* [until](#until) -* [waterfall](#waterfall) -* [queue](#queue) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) - -### Utils - -* [memoize](#memoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - -
    -### forEach(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the forEach function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // assuming openFiles is an array of file names and saveFile is a function - // to save the modified contents of that file: - - async.forEach(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error - }); - ---------------------------------------- - - -### forEachSeries(arr, iterator, callback) - -The same as forEach only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as filter, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then its probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback which accepts an optional error as its first argument, and the state - of the reduction as the second. If an error is passed to the callback, the - reduction is stopped and the main callback is immediately called with the - error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - - async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); - }, function(err, result){ - // result is now equal to the last value of memo, which is 6 - }); - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - - async.detect(['file1','file2','file3'], path.exists, function(result){ - // result now equals the first file in the list that exists - }); - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a value to use as the sort criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - - async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); - }, function(err, results){ - // results is now the original array of files sorted by - // modified date - }); - - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - - async.some(['file1','file2','file3'], path.exists, function(result){ - // if result is true then at least one of the files exists - }); - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - - async.every(['file1','file2','file3'], path.exists, function(result){ - // if result is true then every file exists - }); - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - - async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories - }); - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Flow Control - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - }, - ], - // optional callback - function(err, results){ - // results is now equal to ['one', 'two'] - }); - - - // an example using an object instead of an array - async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed a - callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - }, - ], - // optional callback - function(err, results){ - // in this case, the results array will equal ['two','one'] - // because the functions were run in parallel and the second - // function had a shorter timeout before calling the callback. - }); - - - // an example using an object instead of an array - async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback which must be called once it has completed with an optional - error as the first argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - - var count = 0; - - async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } - }); - - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. -* callback(err) - An optional callback to run once all the functions have - completed. This function gets passed any error that may have occurred. - -__Example__ - - async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } - ]); - - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - - // create a queue object with concurrency 2 - - var q = async.queue(function (task, callback) { - console.log('hello ' + task.name). - callback(); - }, 2); - - - // assign a callback - q.drain = function() { - console.log('all items have been processed'); - } - - // add some items to the queue - - q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); - }); - q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); - }); - - ---------------------------------------- - - -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass and error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - syntax is easier to understand by looking at the example. -* callback(err) - An optional callback which is called when all the tasks have - been completed. The callback may receive an error as an argument. - -__Example__ - - async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }], - email_link: ['write_file', function(callback){ - // once the file is written let's email a link to it... - }] - }); - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - - async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } - ], - function(results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - email_link: ['write_file', function(callback){ - // once the file is written let's email a link to it... - } - ]); - }); - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. Its also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. - -__Example__ - - var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } - ]); - - node> var iterator2 = iterator(); - 'one' - node> var iterator3 = iterator2(); - 'two' - node> iterator3(); - 'three' - node> var nextfn = iterator2.next(); - node> nextfn(); - 'three' - - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other flow control functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - - // using apply - - async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), - ]); - - - // the same process without using apply - - async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - }, - ]); - -It's possible to pass any number of additional arguments when calling the -continuation: - - node> var fn = async.apply(sys.puts, 'one'); - node> fn('two', 'three'); - one - two - three - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), -which means other higher priority events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - - var call_order = []; - async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two] - }); - call_order.push('one') - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - - var slow_fn = function (name, callback) { - // do something - callback(null, result); - }; - var fn = async.memoize(slow_fn); - - // fn can now be used as if it were slow_fn - fn('some name', function () { - // callback - }); - - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); - }; - - node> async.log(hello, 'world'); - 'hello world' - - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); - }; - - node> async.dir(hello, 'world'); - {hello: 'world'} - - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip deleted file mode 100644 index e1c3294..0000000 Binary files a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css deleted file mode 100644 index 274434a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css +++ /dev/null @@ -1,70 +0,0 @@ -/*! - * Styles taken from qunit.css - */ - -h1#nodeunit-header, h1.nodeunit-header { - padding: 15px; - font-size: large; - background-color: #06b; - color: white; - font-family: 'trebuchet ms', verdana, arial; - margin: 0; -} - -h1#nodeunit-header a { - color: white; -} - -h2#nodeunit-banner { - height: 2em; - border-bottom: 1px solid white; - background-color: #eee; - margin: 0; - font-family: 'trebuchet ms', verdana, arial; -} -h2#nodeunit-banner.pass { - background-color: green; -} -h2#nodeunit-banner.fail { - background-color: red; -} - -h2#nodeunit-userAgent, h2.nodeunit-userAgent { - padding: 10px; - background-color: #eee; - color: black; - margin: 0; - font-size: small; - font-weight: normal; - font-family: 'trebuchet ms', verdana, arial; - font-size: 10pt; -} - -div#nodeunit-testrunner-toolbar { - background: #eee; - border-top: 1px solid black; - padding: 10px; - font-family: 'trebuchet ms', verdana, arial; - margin: 0; - font-size: 10pt; -} - -ol#nodeunit-tests { - font-family: 'trebuchet ms', verdana, arial; - font-size: 10pt; -} -ol#nodeunit-tests li strong { - cursor:pointer; -} -ol#nodeunit-tests .pass { - color: green; -} -ol#nodeunit-tests .fail { - color: red; -} - -p#nodeunit-testresult { - margin-left: 1em; - font-size: 10pt; - font-family: 'trebuchet ms', verdana, arial; -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js deleted file mode 100644 index 5957184..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js +++ /dev/null @@ -1,1966 +0,0 @@ -/*! - * Nodeunit - * https://github.com/caolan/nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * json2.js - * http://www.JSON.org/json2.js - * Public Domain. - * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - */ -nodeunit = (function(){ -/* - http://www.JSON.org/json2.js - 2010-11-17 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, strict: false, regexp: false */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -if (!this.JSON) { - this.JSON = {}; -} - -(function () { - "use strict"; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function (key) { - - return isFinite(this.valueOf()) ? - this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' : null; - }; - - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function (key) { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? - '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? c : - '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : - '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 ? '[]' : - gap ? '[\n' + gap + - partial.join(',\n' + gap) + '\n' + - mind + ']' : - '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - k = rep[i]; - if (typeof k === 'string') { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 ? '{}' : - gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + - mind + '}' : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ -.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') -.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') -.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' ? - walk({'': j}, '') : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); -var assert = this.assert = {}; -var types = {}; -var core = {}; -var nodeunit = {}; -var reporter = {}; -/*global setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root = this, - previous_async = root.async; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - else { - root.async = async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _forEach(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _forEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - var _indexOf = function (arr, item) { - if (arr.indexOf) { - return arr.indexOf(item); - } - for (var i = 0; i < arr.length; i += 1) { - if (arr[i] === item) { - return i; - } - } - return -1; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - async.nextTick = function (fn) { - if (typeof process === 'undefined' || !(process.nextTick)) { - setTimeout(fn, 0); - } - else { - process.nextTick(fn); - } - }; - - async.forEach = function (arr, iterator, callback) { - if (!arr.length) { - return callback(); - } - var completed = 0; - _forEach(arr, function (x) { - iterator(x, function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - } - }); - }); - }; - - async.forEachSeries = function (arr, iterator, callback) { - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEach].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.forEachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var completed = []; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners, function (fn) { - fn(); - }); - }; - - addListener(function () { - if (completed.length === keys.length) { - callback(null); - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - completed.push(k); - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && _indexOf(completed, x) !== -1); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - if (!tasks.length) { - return callback(); - } - callback = callback || function () {}; - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args || null); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args || null); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var tasks = []; - var q = { - concurrency: concurrency, - push: function (data, callback) { - tasks.push({data: data, callback: callback}); - async.nextTick(q.process); - }, - process: function () { - if (workers < q.concurrency && tasks.length) { - var task = tasks.splice(0, 1)[0]; - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - q.process(); - }); - } - }, - length: function () { - return tasks.length; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - -}()); -(function(exports){ -/** - * This file is based on the node.js assert module, but with some small - * changes for browser-compatibility - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - */ - - -/** - * Added for browser compatibility - */ - -var _keys = function(obj){ - if(Object.keys) return Object.keys(obj); - var keys = []; - for(var k in obj){ - if(obj.hasOwnProperty(k)) keys.push(k); - } - return keys; -}; - - - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// 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 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 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. - - -var pSlice = Array.prototype.slice; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = exports; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({message: message, actual: actual, expected: expected}) - -assert.AssertionError = function AssertionError (options) { - this.name = "AssertionError"; - this.message = options.message; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } -}; -// code from util.inherits in node -assert.AssertionError.super_ = Error; - - -// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call -// TODO: test what effect this may have -var ctor = function () { this.constructor = assert.AssertionError; }; -ctor.prototype = Error.prototype; -assert.AssertionError.prototype = new ctor(); - - -assert.AssertionError.prototype.toString = function() { - if (this.message) { - return [this.name+":", this.message].join(' '); - } else { - return [ this.name+":" - , JSON.stringify(this.expected ) - , this.operator - , JSON.stringify(this.actual) - ].join(" "); - } -}; - -// assert.AssertionError instanceof Error - -assert.AssertionError.__proto__ = Error.prototype; - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -assert.ok = function ok(value, message) { - if (!!!value) fail(value, true, message, "==", assert.ok); -}; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, "==", assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, "!=", assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, "deepEqual", assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == "object", - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical "prototype" property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isUndefinedOrNull (value) { - return value === null || value === undefined; -} - -function isArguments (object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv (a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - // an identical "prototype" property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try{ - var ka = _keys(a), - kb = _keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key] )) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, "===", assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as determined by !==. -// assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, "!==", assert.notStrictEqual); - } -}; - -function _throws (shouldThrow, block, err, message) { - var exception = null, - threw = false, - typematters = true; - - message = message || ""; - - //handle optional arguments - if (arguments.length == 3) { - if (typeof(err) == "string") { - message = err; - typematters = false; - } - } else if (arguments.length == 2) { - typematters = false; - } - - try { - block(); - } catch (e) { - threw = true; - exception = e; - } - - if (shouldThrow && !threw) { - fail( "Missing expected exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if (!shouldThrow && threw && typematters && exception instanceof err) { - fail( "Got unwanted exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if ((shouldThrow && threw && typematters && !(exception instanceof err)) || - (!shouldThrow && threw)) { - throw exception; - } -}; - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function (err) { if (err) {throw err;}}; -})(assert); -(function(exports){ -/*! - * Nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -/** - * Module dependencies - */ - - - -/** - * Creates assertion objects representing the result of an assert call. - * Accepts an object or AssertionError as its argument. - * - * @param {object} obj - * @api public - */ - -exports.assertion = function (obj) { - return { - method: obj.method || '', - message: obj.message || (obj.error && obj.error.message) || '', - error: obj.error, - passed: function () { - return !this.error; - }, - failed: function () { - return Boolean(this.error); - } - }; -}; - -/** - * Creates an assertion list object representing a group of assertions. - * Accepts an array of assertion objects. - * - * @param {Array} arr - * @param {Number} duration - * @api public - */ - -exports.assertionList = function (arr, duration) { - var that = arr || []; - that.failures = function () { - var failures = 0; - for (var i=0; i(' + - '' + assertions.failures() + ', ' + - '' + assertions.passes() + ', ' + - assertions.length + - ')'; - test.className = assertions.failures() ? 'fail': 'pass'; - test.appendChild(strong); - - var aList = document.createElement('ol'); - aList.style.display = 'none'; - test.onclick = function () { - var d = aList.style.display; - aList.style.display = (d == 'none') ? 'block': 'none'; - }; - for (var i=0; i' + (a.error.stack || a.error) + ''; - li.className = 'fail'; - } - else { - li.innerHTML = a.message || a.method || 'no message'; - li.className = 'pass'; - } - aList.appendChild(li); - } - test.appendChild(aList); - tests.appendChild(test); - }, - done: function (assertions) { - var end = new Date().getTime(); - var duration = end - start; - - var failures = assertions.failures(); - banner.className = failures ? 'fail': 'pass'; - - result.innerHTML = 'Tests completed in ' + duration + - ' milliseconds.
    ' + - assertions.passes() + ' assertions of ' + - '' + assertions.length + ' passed, ' + - assertions.failures() + ' failed.'; - } - }); -}; -})(reporter); -nodeunit = core; -nodeunit.assert = assert; -nodeunit.reporter = reporter; -nodeunit.run = reporter.run; -return nodeunit; })(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js deleted file mode 100644 index f89741e..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js +++ /dev/null @@ -1 +0,0 @@ -/*global setTimeout: false, console: false */(function(){var a={};var b=this,c=b.async;typeof module!=="undefined"&&module.exports?module.exports=a:b.async=a,a.noConflict=function(){b.async=c;return a};var d=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;cd?1:0};d(null,e(b.sort(c),function(a){return a.value}))})},a.auto=function(a,b){b=b||function(){};var c=g(a);if(!c.length)return b(null);var e=[];var i=[];var j=function(a){i.unshift(a)};var k=function(a){for(var b=0;b b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var completed = []; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners, function (fn) { - fn(); - }); - }; - - addListener(function () { - if (completed.length === keys.length) { - callback(null); - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - completed.push(k); - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && _indexOf(completed, x) !== -1); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - if (!tasks.length) { - return callback(); - } - callback = callback || function () {}; - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var tasks = []; - var q = { - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - tasks.push({data: data, callback: callback}); - if(q.saturated && tasks.length == concurrency) q.saturated(); - async.nextTick(q.process); - }, - process: function () { - if (workers < q.concurrency && tasks.length) { - var task = tasks.splice(0, 1)[0]; - if(q.empty && tasks.length == 0) q.empty(); - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if(q.drain && tasks.length + workers == 0) q.drain(); - q.process(); - }); - } - }, - length: function () { - return tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - hasher = hasher || function (x) { - return x; - }; - return function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else { - fn.apply(null, args.concat([function () { - memo[key] = arguments; - callback.apply(null, arguments); - }])); - } - }; - }; - -}()); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg deleted file mode 100644 index 457a967..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -var options = { - indent: 4, - onevar: false -}; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/package.json b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/package.json deleted file mode 100644 index e5646d7..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./index", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.1.9", - "repository": { - "type": "git", - "url": "git://github.com/caolan/async.git" - }, - "bugs": { - "url": "http://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/caolan/async/raw/master/LICENSE" - } - ], - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "_id": "async@0.1.9", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.24", - "_nodeVersion": "v0.8.1", - "_defaultsLoaded": true, - "dist": { - "shasum": "fd9b6aca66495fd0f7e97f86e71c7706ca9ae754" - }, - "_from": "async@0.1.9" -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/.swp b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/.swp deleted file mode 100644 index ece9b6b..0000000 Binary files a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/.swp and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js deleted file mode 100644 index 8c2cebd..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js +++ /dev/null @@ -1,1367 +0,0 @@ -var async = require('../lib/async'); - - -exports['auto'] = function(test){ - var callOrder = []; - var testdata = [{test: 'test'}]; - async.auto({ - task1: ['task2', function(callback){ - setTimeout(function(){ - callOrder.push('task1'); - callback(); - }, 25); - }], - task2: function(callback){ - setTimeout(function(){ - callOrder.push('task2'); - callback(); - }, 50); - }, - task3: ['task2', function(callback){ - callOrder.push('task3'); - callback(); - }], - task4: ['task1', 'task2', function(callback){ - callOrder.push('task4'); - callback(); - }] - }, - function(err){ - test.same(callOrder, ['task2','task3','task1','task4']); - test.done(); - }); -}; - -exports['auto empty object'] = function(test){ - async.auto({}, function(err){ - test.done(); - }); -}; - -exports['auto error'] = function(test){ - test.expect(1); - async.auto({ - task1: function(callback){ - callback('testerror'); - }, - task2: ['task1', function(callback){ - test.ok(false, 'task2 should not be called'); - callback(); - }], - task3: function(callback){ - callback('testerror2'); - } - }, - function(err){ - test.equals(err, 'testerror'); - }); - setTimeout(test.done, 100); -}; - -exports['auto no callback'] = function(test){ - async.auto({ - task1: function(callback){callback();}, - task2: ['task1', function(callback){callback(); test.done();}] - }); -}; - -exports['waterfall'] = function(test){ - test.expect(6); - var call_order = []; - async.waterfall([ - function(callback){ - call_order.push('fn1'); - setTimeout(function(){callback(null, 'one', 'two');}, 0); - }, - function(arg1, arg2, callback){ - call_order.push('fn2'); - test.equals(arg1, 'one'); - test.equals(arg2, 'two'); - setTimeout(function(){callback(null, arg1, arg2, 'three');}, 25); - }, - function(arg1, arg2, arg3, callback){ - call_order.push('fn3'); - test.equals(arg1, 'one'); - test.equals(arg2, 'two'); - test.equals(arg3, 'three'); - callback(null, 'four'); - }, - function(arg4, callback){ - call_order.push('fn4'); - test.same(call_order, ['fn1','fn2','fn3','fn4']); - callback(null, 'test'); - } - ], function(err){ - test.done(); - }); -}; - -exports['waterfall empty array'] = function(test){ - async.waterfall([], function(err){ - test.done(); - }); -}; - -exports['waterfall no callback'] = function(test){ - async.waterfall([ - function(callback){callback();}, - function(callback){callback(); test.done();} - ]); -}; - -exports['waterfall async'] = function(test){ - var call_order = []; - async.waterfall([ - function(callback){ - call_order.push(1); - callback(); - call_order.push(2); - }, - function(callback){ - call_order.push(3); - callback(); - }, - function(){ - test.same(call_order, [1,2,3]); - test.done(); - } - ]); -}; - -exports['waterfall error'] = function(test){ - test.expect(1); - async.waterfall([ - function(callback){ - callback('error'); - }, - function(callback){ - test.ok(false, 'next function should not be called'); - callback(); - } - ], function(err){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['waterfall multiple callback calls'] = function(test){ - var call_order = []; - var arr = [ - function(callback){ - call_order.push(1); - // call the callback twice. this should call function 2 twice - callback(null, 'one', 'two'); - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - call_order.push(2); - callback(null, arg1, arg2, 'three'); - }, - function(arg1, arg2, arg3, callback){ - call_order.push(3); - callback(null, 'four'); - }, - function(arg4){ - call_order.push(4); - arr[3] = function(){ - call_order.push(4); - test.same(call_order, [1,2,2,3,3,4,4]); - test.done(); - }; - } - ]; - async.waterfall(arr); -}; - - -exports['parallel'] = function(test){ - var call_order = []; - async.parallel([ - function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 25); - }, - function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 50); - }, - function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 15); - } - ], - function(err, results){ - test.equals(err, null); - test.same(call_order, [3,1,2]); - test.same(results, [1,2,[3,3]]); - test.done(); - }); -}; - -exports['parallel empty array'] = function(test){ - async.parallel([], function(err, results){ - test.equals(err, null); - test.same(results, []); - test.done(); - }); -}; - -exports['parallel error'] = function(test){ - async.parallel([ - function(callback){ - callback('error', 1); - }, - function(callback){ - callback('error2', 2); - } - ], - function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 100); -}; - -exports['parallel no callback'] = function(test){ - async.parallel([ - function(callback){callback();}, - function(callback){callback(); test.done();}, - ]); -}; - -exports['parallel object'] = function(test){ - var call_order = []; - async.parallel({ - one: function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 25); - }, - two: function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 50); - }, - three: function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 15); - } - }, - function(err, results){ - test.equals(err, null); - test.same(call_order, [3,1,2]); - test.same(results, { - one: 1, - two: 2, - three: [3,3] - }); - test.done(); - }); -}; - -exports['series'] = function(test){ - var call_order = []; - async.series([ - function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 25); - }, - function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 50); - }, - function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 15); - } - ], - function(err, results){ - test.equals(err, null); - test.same(results, [1,2,[3,3]]); - test.same(call_order, [1,2,3]); - test.done(); - }); -}; - -exports['series empty array'] = function(test){ - async.series([], function(err, results){ - test.equals(err, null); - test.same(results, []); - test.done(); - }); -}; - -exports['series error'] = function(test){ - test.expect(1); - async.series([ - function(callback){ - callback('error', 1); - }, - function(callback){ - test.ok(false, 'should not be called'); - callback('error2', 2); - } - ], - function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 100); -}; - -exports['series no callback'] = function(test){ - async.series([ - function(callback){callback();}, - function(callback){callback(); test.done();}, - ]); -}; - -exports['series object'] = function(test){ - var call_order = []; - async.series({ - one: function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 25); - }, - two: function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 50); - }, - three: function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 15); - } - }, - function(err, results){ - test.equals(err, null); - test.same(results, { - one: 1, - two: 2, - three: [3,3] - }); - test.same(call_order, [1,2,3]); - test.done(); - }); -}; - -exports['iterator'] = function(test){ - var call_order = []; - var iterator = async.iterator([ - function(){call_order.push(1);}, - function(arg1){ - test.equals(arg1, 'arg1'); - call_order.push(2); - }, - function(arg1, arg2){ - test.equals(arg1, 'arg1'); - test.equals(arg2, 'arg2'); - call_order.push(3); - } - ]); - iterator(); - test.same(call_order, [1]); - var iterator2 = iterator(); - test.same(call_order, [1,1]); - var iterator3 = iterator2('arg1'); - test.same(call_order, [1,1,2]); - var iterator4 = iterator3('arg1', 'arg2'); - test.same(call_order, [1,1,2,3]); - test.equals(iterator4, undefined); - test.done(); -}; - -exports['iterator empty array'] = function(test){ - var iterator = async.iterator([]); - test.equals(iterator(), undefined); - test.equals(iterator.next(), undefined); - test.done(); -}; - -exports['iterator.next'] = function(test){ - var call_order = []; - var iterator = async.iterator([ - function(){call_order.push(1);}, - function(arg1){ - test.equals(arg1, 'arg1'); - call_order.push(2); - }, - function(arg1, arg2){ - test.equals(arg1, 'arg1'); - test.equals(arg2, 'arg2'); - call_order.push(3); - } - ]); - var fn = iterator.next(); - var iterator2 = fn('arg1'); - test.same(call_order, [2]); - iterator2('arg1','arg2'); - test.same(call_order, [2,3]); - test.equals(iterator2.next(), undefined); - test.done(); -}; - -exports['forEach'] = function(test){ - var args = []; - async.forEach([1,3,2], function(x, callback){ - setTimeout(function(){ - args.push(x); - callback(); - }, x*25); - }, function(err){ - test.same(args, [1,2,3]); - test.done(); - }); -}; - -exports['forEach empty array'] = function(test){ - test.expect(1); - async.forEach([], function(x, callback){ - test.ok(false, 'iterator should not be called'); - callback(); - }, function(err){ - test.ok(true, 'should call callback'); - }); - setTimeout(test.done, 25); -}; - -exports['forEach error'] = function(test){ - test.expect(1); - async.forEach([1,2,3], function(x, callback){ - callback('error'); - }, function(err){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['forEachSeries'] = function(test){ - var args = []; - async.forEachSeries([1,3,2], function(x, callback){ - setTimeout(function(){ - args.push(x); - callback(); - }, x*25); - }, function(err){ - test.same(args, [1,3,2]); - test.done(); - }); -}; - -exports['forEachSeries empty array'] = function(test){ - test.expect(1); - async.forEachSeries([], function(x, callback){ - test.ok(false, 'iterator should not be called'); - callback(); - }, function(err){ - test.ok(true, 'should call callback'); - }); - setTimeout(test.done, 25); -}; - -exports['forEachSeries error'] = function(test){ - test.expect(2); - var call_order = []; - async.forEachSeries([1,2,3], function(x, callback){ - call_order.push(x); - callback('error'); - }, function(err){ - test.same(call_order, [1]); - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['map'] = function(test){ - var call_order = []; - async.map([1,3,2], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(null, x*2); - }, x*25); - }, function(err, results){ - test.same(call_order, [1,2,3]); - test.same(results, [2,6,4]); - test.done(); - }); -}; - -exports['map original untouched'] = function(test){ - var a = [1,2,3]; - async.map(a, function(x, callback){ - callback(null, x*2); - }, function(err, results){ - test.same(results, [2,4,6]); - test.same(a, [1,2,3]); - test.done(); - }); -}; - -exports['map error'] = function(test){ - test.expect(1); - async.map([1,2,3], function(x, callback){ - callback('error'); - }, function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['mapSeries'] = function(test){ - var call_order = []; - async.mapSeries([1,3,2], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(null, x*2); - }, x*25); - }, function(err, results){ - test.same(call_order, [1,3,2]); - test.same(results, [2,6,4]); - test.done(); - }); -}; - -exports['mapSeries error'] = function(test){ - test.expect(1); - async.mapSeries([1,2,3], function(x, callback){ - callback('error'); - }, function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['reduce'] = function(test){ - var call_order = []; - async.reduce([1,2,3], 0, function(a, x, callback){ - call_order.push(x); - callback(null, a + x); - }, function(err, result){ - test.equals(result, 6); - test.same(call_order, [1,2,3]); - test.done(); - }); -}; - -exports['reduce async with non-reference memo'] = function(test){ - async.reduce([1,3,2], 0, function(a, x, callback){ - setTimeout(function(){callback(null, a + x)}, Math.random()*100); - }, function(err, result){ - test.equals(result, 6); - test.done(); - }); -}; - -exports['reduce error'] = function(test){ - test.expect(1); - async.reduce([1,2,3], 0, function(a, x, callback){ - callback('error'); - }, function(err, result){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['inject alias'] = function(test){ - test.equals(async.inject, async.reduce); - test.done(); -}; - -exports['foldl alias'] = function(test){ - test.equals(async.foldl, async.reduce); - test.done(); -}; - -exports['reduceRight'] = function(test){ - var call_order = []; - var a = [1,2,3]; - async.reduceRight(a, 0, function(a, x, callback){ - call_order.push(x); - callback(null, a + x); - }, function(err, result){ - test.equals(result, 6); - test.same(call_order, [3,2,1]); - test.same(a, [1,2,3]); - test.done(); - }); -}; - -exports['foldr alias'] = function(test){ - test.equals(async.foldr, async.reduceRight); - test.done(); -}; - -exports['filter'] = function(test){ - async.filter([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [3,1]); - test.done(); - }); -}; - -exports['filter original untouched'] = function(test){ - var a = [3,1,2]; - async.filter(a, function(x, callback){ - callback(x % 2); - }, function(results){ - test.same(results, [3,1]); - test.same(a, [3,1,2]); - test.done(); - }); -}; - -exports['filterSeries'] = function(test){ - async.filterSeries([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [3,1]); - test.done(); - }); -}; - -exports['select alias'] = function(test){ - test.equals(async.select, async.filter); - test.done(); -}; - -exports['selectSeries alias'] = function(test){ - test.equals(async.selectSeries, async.filterSeries); - test.done(); -}; - -exports['reject'] = function(test){ - async.reject([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [2]); - test.done(); - }); -}; - -exports['reject original untouched'] = function(test){ - var a = [3,1,2]; - async.reject(a, function(x, callback){ - callback(x % 2); - }, function(results){ - test.same(results, [2]); - test.same(a, [3,1,2]); - test.done(); - }); -}; - -exports['rejectSeries'] = function(test){ - async.rejectSeries([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [2]); - test.done(); - }); -}; - -exports['some true'] = function(test){ - async.some([3,1,2], function(x, callback){ - setTimeout(function(){callback(x === 1);}, 0); - }, function(result){ - test.equals(result, true); - test.done(); - }); -}; - -exports['some false'] = function(test){ - async.some([3,1,2], function(x, callback){ - setTimeout(function(){callback(x === 10);}, 0); - }, function(result){ - test.equals(result, false); - test.done(); - }); -}; - -exports['some early return'] = function(test){ - var call_order = []; - async.some([1,2,3], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x === 1); - }, x*25); - }, function(result){ - call_order.push('callback'); - }); - setTimeout(function(){ - test.same(call_order, [1,'callback',2,3]); - test.done(); - }, 100); -}; - -exports['any alias'] = function(test){ - test.equals(async.any, async.some); - test.done(); -}; - -exports['every true'] = function(test){ - async.every([1,2,3], function(x, callback){ - setTimeout(function(){callback(true);}, 0); - }, function(result){ - test.equals(result, true); - test.done(); - }); -}; - -exports['every false'] = function(test){ - async.every([1,2,3], function(x, callback){ - setTimeout(function(){callback(x % 2);}, 0); - }, function(result){ - test.equals(result, false); - test.done(); - }); -}; - -exports['every early return'] = function(test){ - var call_order = []; - async.every([1,2,3], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x === 1); - }, x*25); - }, function(result){ - call_order.push('callback'); - }); - setTimeout(function(){ - test.same(call_order, [1,2,'callback',3]); - test.done(); - }, 100); -}; - -exports['all alias'] = function(test){ - test.equals(async.all, async.every); - test.done(); -}; - -exports['detect'] = function(test){ - var call_order = []; - async.detect([3,2,1], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x == 2); - }, x*25); - }, function(result){ - call_order.push('callback'); - test.equals(result, 2); - }); - setTimeout(function(){ - test.same(call_order, [1,2,'callback',3]); - test.done(); - }, 100); -}; - -exports['detectSeries'] = function(test){ - var call_order = []; - async.detectSeries([3,2,1], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x == 2); - }, x*25); - }, function(result){ - call_order.push('callback'); - test.equals(result, 2); - }); - setTimeout(function(){ - test.same(call_order, [3,2,'callback']); - test.done(); - }, 200); -}; - -exports['sortBy'] = function(test){ - async.sortBy([{a:1},{a:15},{a:6}], function(x, callback){ - setTimeout(function(){callback(null, x.a);}, 0); - }, function(err, result){ - test.same(result, [{a:1},{a:6},{a:15}]); - test.done(); - }); -}; - -exports['apply'] = function(test){ - test.expect(6); - var fn = function(){ - test.same(Array.prototype.slice.call(arguments), [1,2,3,4]) - }; - async.apply(fn, 1, 2, 3, 4)(); - async.apply(fn, 1, 2, 3)(4); - async.apply(fn, 1, 2)(3, 4); - async.apply(fn, 1)(2, 3, 4); - async.apply(fn)(1, 2, 3, 4); - test.equals( - async.apply(function(name){return 'hello ' + name}, 'world')(), - 'hello world' - ); - test.done(); -}; - - -// generates tests for console functions such as async.log -var console_fn_tests = function(name){ - - if (typeof console !== 'undefined') { - exports[name] = function(test){ - test.expect(5); - var fn = function(arg1, callback){ - test.equals(arg1, 'one'); - setTimeout(function(){callback(null, 'test');}, 0); - }; - var fn_err = function(arg1, callback){ - test.equals(arg1, 'one'); - setTimeout(function(){callback('error');}, 0); - }; - var _console_fn = console[name]; - var _error = console.error; - console[name] = function(val){ - test.equals(val, 'test'); - test.equals(arguments.length, 1); - console.error = function(val){ - test.equals(val, 'error'); - console[name] = _console_fn; - console.error = _error; - test.done(); - }; - async[name](fn_err, 'one'); - }; - async[name](fn, 'one'); - }; - - exports[name + ' with multiple result params'] = function(test){ - var fn = function(callback){callback(null,'one','two','three');}; - var _console_fn = console[name]; - var called_with = []; - console[name] = function(x){ - called_with.push(x); - }; - async[name](fn); - test.same(called_with, ['one','two','three']); - console[name] = _console_fn; - test.done(); - }; - } - - // browser-only test - exports[name + ' without console.' + name] = function(test){ - if (typeof window !== 'undefined') { - var _console = window.console; - window.console = undefined; - var fn = function(callback){callback(null, 'val');}; - var fn_err = function(callback){callback('error');}; - async[name](fn); - async[name](fn_err); - window.console = _console; - } - test.done(); - }; - -}; - -console_fn_tests('log'); -console_fn_tests('dir'); -/*console_fn_tests('info'); -console_fn_tests('warn'); -console_fn_tests('error');*/ - -exports['nextTick'] = function(test){ - var call_order = []; - async.nextTick(function(){call_order.push('two');}); - call_order.push('one'); - setTimeout(function(){ - test.same(call_order, ['one','two']); - test.done(); - }, 50); -}; - -exports['nextTick in the browser'] = function(test){ - if (typeof process !== 'undefined') { - // skip this test in node - return test.done(); - } - test.expect(1); - - var call_order = []; - async.nextTick(function(){call_order.push('two');}); - - call_order.push('one'); - setTimeout(function(){ - if (typeof process !== 'undefined') { - process.nextTick = _nextTick; - } - test.same(call_order, ['one','two']); - }, 50); - setTimeout(test.done, 100); -}; - -exports['noConflict - node only'] = function(test){ - if (typeof process !== 'undefined') { - // node only test - test.expect(3); - var fs = require('fs'); - var filename = __dirname + '/../lib/async.js'; - fs.readFile(filename, function(err, content){ - if(err) return test.done(); - var Script = process.binding('evals').Script; - - var s = new Script(content, filename); - var s2 = new Script( - content + 'this.async2 = this.async.noConflict();', - filename - ); - - var sandbox1 = {async: 'oldvalue'}; - s.runInNewContext(sandbox1); - test.ok(sandbox1.async); - - var sandbox2 = {async: 'oldvalue'}; - s2.runInNewContext(sandbox2); - test.equals(sandbox2.async, 'oldvalue'); - test.ok(sandbox2.async2); - - test.done(); - }); - } - else test.done(); -}; - -exports['concat'] = function(test){ - var call_order = []; - var iterator = function (x, cb) { - setTimeout(function(){ - call_order.push(x); - var r = []; - while (x > 0) { - r.push(x); - x--; - } - cb(null, r); - }, x*25); - }; - async.concat([1,3,2], iterator, function(err, results){ - test.same(results, [1,2,1,3,2,1]); - test.same(call_order, [1,2,3]); - test.ok(!err); - test.done(); - }); -}; - -exports['concat error'] = function(test){ - var iterator = function (x, cb) { - cb(new Error('test error')); - }; - async.concat([1,2,3], iterator, function(err, results){ - test.ok(err); - test.done(); - }); -}; - -exports['concatSeries'] = function(test){ - var call_order = []; - var iterator = function (x, cb) { - setTimeout(function(){ - call_order.push(x); - var r = []; - while (x > 0) { - r.push(x); - x--; - } - cb(null, r); - }, x*25); - }; - async.concatSeries([1,3,2], iterator, function(err, results){ - test.same(results, [1,3,2,1,2,1]); - test.same(call_order, [1,3,2]); - test.ok(!err); - test.done(); - }); -}; - -exports['until'] = function (test) { - var call_order = []; - - var count = 0; - async.until( - function () { - call_order.push(['test', count]); - return (count == 5); - }, - function (cb) { - call_order.push(['iterator', count]); - count++; - cb(); - }, - function (err) { - test.same(call_order, [ - ['test', 0], - ['iterator', 0], ['test', 1], - ['iterator', 1], ['test', 2], - ['iterator', 2], ['test', 3], - ['iterator', 3], ['test', 4], - ['iterator', 4], ['test', 5], - ]); - test.equals(count, 5); - test.done(); - } - ); -}; - -exports['whilst'] = function (test) { - var call_order = []; - - var count = 0; - async.whilst( - function () { - call_order.push(['test', count]); - return (count < 5); - }, - function (cb) { - call_order.push(['iterator', count]); - count++; - cb(); - }, - function (err) { - test.same(call_order, [ - ['test', 0], - ['iterator', 0], ['test', 1], - ['iterator', 1], ['test', 2], - ['iterator', 2], ['test', 3], - ['iterator', 3], ['test', 4], - ['iterator', 4], ['test', 5], - ]); - test.equals(count, 5); - test.done(); - } - ); -}; - -exports['queue'] = function (test) { - var call_order = [], - delays = [40,20,60,20]; - - // worker1: --1-4 - // worker2: -2---3 - // order of completion: 2,1,4,3 - - var q = async.queue(function (task, callback) { - setTimeout(function () { - call_order.push('process ' + task); - callback('error', 'arg'); - }, delays.splice(0,1)[0]); - }, 2); - - q.push(1, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 1); - call_order.push('callback ' + 1); - }); - q.push(2, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 2); - call_order.push('callback ' + 2); - }); - q.push(3, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 0); - call_order.push('callback ' + 3); - }); - q.push(4, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 0); - call_order.push('callback ' + 4); - }); - test.equal(q.length(), 4); - test.equal(q.concurrency, 2); - - setTimeout(function () { - test.same(call_order, [ - 'process 2', 'callback 2', - 'process 1', 'callback 1', - 'process 4', 'callback 4', - 'process 3', 'callback 3' - ]); - test.equal(q.concurrency, 2); - test.equal(q.length(), 0); - test.done(); - }, 200); -}; - -exports['queue changing concurrency'] = function (test) { - var call_order = [], - delays = [40,20,60,20]; - - // worker1: --1-2---3-4 - // order of completion: 1,2,3,4 - - var q = async.queue(function (task, callback) { - setTimeout(function () { - call_order.push('process ' + task); - callback('error', 'arg'); - }, delays.splice(0,1)[0]); - }, 2); - - q.push(1, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 3); - call_order.push('callback ' + 1); - }); - q.push(2, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 2); - call_order.push('callback ' + 2); - }); - q.push(3, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 1); - call_order.push('callback ' + 3); - }); - q.push(4, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 0); - call_order.push('callback ' + 4); - }); - test.equal(q.length(), 4); - test.equal(q.concurrency, 2); - q.concurrency = 1; - - setTimeout(function () { - test.same(call_order, [ - 'process 1', 'callback 1', - 'process 2', 'callback 2', - 'process 3', 'callback 3', - 'process 4', 'callback 4' - ]); - test.equal(q.concurrency, 1); - test.equal(q.length(), 0); - test.done(); - }, 250); -}; - -exports['queue push without callback'] = function (test) { - var call_order = [], - delays = [40,20,60,20]; - - // worker1: --1-4 - // worker2: -2---3 - // order of completion: 2,1,4,3 - - var q = async.queue(function (task, callback) { - setTimeout(function () { - call_order.push('process ' + task); - callback('error', 'arg'); - }, delays.splice(0,1)[0]); - }, 2); - - q.push(1); - q.push(2); - q.push(3); - q.push(4); - - setTimeout(function () { - test.same(call_order, [ - 'process 2', - 'process 1', - 'process 4', - 'process 3' - ]); - test.done(); - }, 200); -}; - -exports['memoize'] = function (test) { - test.expect(4); - var call_order = []; - - var fn = function (arg1, arg2, callback) { - call_order.push(['fn', arg1, arg2]); - callback(null, arg1 + arg2); - }; - - var fn2 = async.memoize(fn); - fn2(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn2(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn2(2, 2, function (err, result) { - test.equal(result, 4); - }); - - test.same(call_order, [['fn',1,2], ['fn',2,2]]); - test.done(); -}; - -exports['memoize error'] = function (test) { - test.expect(1); - var testerr = new Error('test'); - var fn = function (arg1, arg2, callback) { - callback(testerr, arg1 + arg2); - }; - async.memoize(fn)(1, 2, function (err, result) { - test.equal(err, testerr); - }); - test.done(); -}; - -exports['memoize custom hash function'] = function (test) { - test.expect(2); - var testerr = new Error('test'); - - var fn = function (arg1, arg2, callback) { - callback(testerr, arg1 + arg2); - }; - var fn2 = async.memoize(fn, function () { - return 'custom hash'; - }); - fn2(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn2(2, 2, function (err, result) { - test.equal(result, 3); - }); - test.done(); -}; - -// Issue 10 on github: https://github.com/caolan/async/issues#issue/10 -exports['falsy return values in series'] = function (test) { - function taskFalse(callback) { - async.nextTick(function() { - callback(null, false); - }); - }; - function taskUndefined(callback) { - async.nextTick(function() { - callback(null, undefined); - }); - }; - function taskEmpty(callback) { - async.nextTick(function() { - callback(null); - }); - }; - function taskNull(callback) { - async.nextTick(function() { - callback(null, null); - }); - }; - async.series( - [taskFalse, taskUndefined, taskEmpty, taskNull], - function(err, results) { - test.same(results, [false, undefined, undefined, null]); - test.strictEqual(results[0], false); - test.strictEqual(results[1], undefined); - test.strictEqual(results[2], undefined); - test.strictEqual(results[3], null); - test.done(); - } - ); -}; - -// Issue 10 on github: https://github.com/caolan/async/issues#issue/10 -exports['falsy return values in parallel'] = function (test) { - function taskFalse(callback) { - async.nextTick(function() { - callback(null, false); - }); - }; - function taskUndefined(callback) { - async.nextTick(function() { - callback(null, undefined); - }); - }; - function taskEmpty(callback) { - async.nextTick(function() { - callback(null); - }); - }; - function taskNull(callback) { - async.nextTick(function() { - callback(null, null); - }); - }; - async.parallel( - [taskFalse, taskUndefined, taskEmpty, taskNull], - function(err, results) { - test.same(results, [false, undefined, undefined, null]); - test.strictEqual(results[0], false); - test.strictEqual(results[1], undefined); - test.strictEqual(results[2], undefined); - test.strictEqual(results[3], null); - test.done(); - } - ); -}; - -exports['queue events'] = function(test) { - var calls = []; - var q = async.queue(function(task, cb) { - // nop - calls.push('process ' + task); - cb(); - }, 3); - - q.saturated = function() { - test.ok(q.length() == 3, 'queue should be saturated now'); - calls.push('saturated'); - }; - q.empty = function() { - test.ok(q.length() == 0, 'queue should be empty now'); - calls.push('empty'); - }; - q.drain = function() { - test.ok( - q.length() == 0 && q.running() == 0, - 'queue should be empty now and no more workers should be running' - ); - calls.push('drain'); - test.same(calls, [ - 'saturated', - 'process foo', - 'foo cb', - 'process bar', - 'bar cb', - 'process zoo', - 'zoo cb', - 'process poo', - 'poo cb', - 'empty', - 'process moo', - 'moo cb', - 'drain', - ]); - test.done(); - }; - q.push('foo', function () {calls.push('foo cb');}); - q.push('bar', function () {calls.push('bar cb');}); - q.push('zoo', function () {calls.push('zoo cb');}); - q.push('poo', function () {calls.push('poo cb');}); - q.push('moo', function () {calls.push('moo cb');}); -}; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/test.html b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/test.html deleted file mode 100644 index 2450e2d..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/async/test/test.html +++ /dev/null @@ -1,24 +0,0 @@ - - - Async.js Test Suite - - - - - - - - -

    Async.js Test Suite

    - - - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore deleted file mode 100644 index aba34f0..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -*.un~ -/node_modules -/test/tmp diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/License b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/License deleted file mode 100644 index 4804b7a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Debuggable Limited - -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 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/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile deleted file mode 100644 index b4ff85a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -.PHONY: test - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md deleted file mode 100644 index 1a9999e..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md +++ /dev/null @@ -1,132 +0,0 @@ -# combined-stream - -A stream that emits multiple other streams one after another. - -## Installation - -``` bash -npm install combined-stream -``` - -## Usage - -Here is a simple example that shows how you can use combined-stream to combine -two files into one: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create(); -combinedStream.append(fs.createReadStream('file1.txt')); -combinedStream.append(fs.createReadStream('file2.txt')); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -While the example above works great, it will pause all source streams until -they are needed. If you don't want that to happen, you can set `pauseStreams` -to `false`: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create({pauseStreams: false}); -combinedStream.append(fs.createReadStream('file1.txt')); -combinedStream.append(fs.createReadStream('file2.txt')); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -However, what if you don't have all the source streams yet, or you don't want -to allocate the resources (file descriptors, memory, etc.) for them right away? -Well, in that case you can simply provide a callback that supplies the stream -by calling a `next()` function: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create(); -combinedStream.append(function(next) { - next(fs.createReadStream('file1.txt')); -}); -combinedStream.append(function(next) { - next(fs.createReadStream('file2.txt')); -}); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -## API - -### CombinedStream.create([options]) - -Returns a new combined stream object. Available options are: - -* `maxDataSize` -* `pauseStreams` - -The effect of those options is described below. - -### combinedStream.pauseStreams = true - -Whether to apply back pressure to the underlaying streams. If set to `false`, -the underlaying streams will never be paused. If set to `true`, the -underlaying streams will be paused right after being appended, as well as when -`delayedStream.pipe()` wants to throttle. - -### combinedStream.maxDataSize = 2 * 1024 * 1024 - -The maximum amount of bytes (or characters) to buffer for all source streams. -If this value is exceeded, `combinedStream` emits an `'error'` event. - -### combinedStream.dataSize = 0 - -The amount of bytes (or characters) currently buffered by `combinedStream`. - -### combinedStream.append(stream) - -Appends the given `stream` to the combinedStream object. If `pauseStreams` is -set to `true, this stream will also be paused right away. - -`streams` can also be a function that takes one parameter called `next`. `next` -is a function that must be invoked in order to provide the `next` stream, see -example above. - -Regardless of how the `stream` is appended, combined-stream always attaches an -`'error'` listener to it, so you don't have to do that manually. - -Special case: `stream` can also be a String or Buffer. - -### combinedStream.write(data) - -You should not call this, `combinedStream` takes care of piping the appended -streams into itself for you. - -### combinedStream.resume() - -Causes `combinedStream` to start drain the streams it manages. The function is -idempotent, and also emits a `'resume'` event each time which usually goes to -the stream that is currently being drained. - -### combinedStream.pause(); - -If `combinedStream.pauseStreams` is set to `false`, this does nothing. -Otherwise a `'pause'` event is emitted, this goes to the stream that is -currently being drained, so you can use it to apply back pressure. - -### combinedStream.end(); - -Sets `combinedStream.writable` to false, emits an `'end'` event, and removes -all streams from the queue. - -### combinedStream.destroy(); - -Same as `combinedStream.end()`, except it emits a `'close'` event instead of -`'end'`. - -## License - -combined-stream is licensed under the MIT license. diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js deleted file mode 100644 index 03754e6..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +++ /dev/null @@ -1,183 +0,0 @@ -var util = require('util'); -var Stream = require('stream').Stream; -var DelayedStream = require('delayed-stream'); - -module.exports = CombinedStream; -function CombinedStream() { - this.writable = false; - this.readable = true; - this.dataSize = 0; - this.maxDataSize = 2 * 1024 * 1024; - this.pauseStreams = true; - - this._released = false; - this._streams = []; - this._currentStream = null; -} -util.inherits(CombinedStream, Stream); - -CombinedStream.create = function(options) { - var combinedStream = new this(); - - options = options || {}; - for (var option in options) { - combinedStream[option] = options[option]; - } - - return combinedStream; -}; - -CombinedStream.isStreamLike = function(stream) { - return (typeof stream !== 'function') - && (typeof stream !== 'string') - && (!Buffer.isBuffer(stream)); -}; - -CombinedStream.prototype.append = function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); - - if (isStreamLike) { - if (!(stream instanceof DelayedStream)) { - stream.on('data', this._checkDataSize.bind(this)); - - stream = DelayedStream.create(stream, { - maxDataSize: Infinity, - pauseStream: this.pauseStreams, - }); - } - - this._handleErrors(stream); - - if (this.pauseStreams) { - stream.pause(); - } - } - - this._streams.push(stream); - return this; -}; - -CombinedStream.prototype.pipe = function(dest, options) { - Stream.prototype.pipe.call(this, dest, options); - this.resume(); -}; - -CombinedStream.prototype._getNext = function() { - this._currentStream = null; - var stream = this._streams.shift(); - - - if (!stream) { - this.end(); - return; - } - - if (typeof stream !== 'function') { - this._pipeNext(stream); - return; - } - - var getStream = stream; - getStream(function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('data', this._checkDataSize.bind(this)); - this._handleErrors(stream); - } - - this._pipeNext(stream); - }.bind(this)); -}; - -CombinedStream.prototype._pipeNext = function(stream) { - this._currentStream = stream; - - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('end', this._getNext.bind(this)) - stream.pipe(this, {end: false}); - return; - } - - var value = stream; - this.write(value); - this._getNext(); -}; - -CombinedStream.prototype._handleErrors = function(stream) { - var self = this; - stream.on('error', function(err) { - self._emitError(err); - }); -}; - -CombinedStream.prototype.write = function(data) { - this.emit('data', data); -}; - -CombinedStream.prototype.pause = function() { - if (!this.pauseStreams) { - return; - } - - this.emit('pause'); -}; - -CombinedStream.prototype.resume = function() { - if (!this._released) { - this._released = true; - this.writable = true; - this._getNext(); - } - - this.emit('resume'); -}; - -CombinedStream.prototype.end = function() { - this._reset(); - this.emit('end'); -}; - -CombinedStream.prototype.destroy = function() { - this._reset(); - this.emit('close'); -}; - -CombinedStream.prototype._reset = function() { - this.writable = false; - this._streams = []; - this._currentStream = null; -}; - -CombinedStream.prototype._checkDataSize = function() { - this._updateDataSize(); - if (this.dataSize <= this.maxDataSize) { - return; - } - - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' - this._emitError(new Error(message)); -}; - -CombinedStream.prototype._updateDataSize = function() { - this.dataSize = 0; - - var self = this; - this._streams.forEach(function(stream) { - if (!stream.dataSize) { - return; - } - - self.dataSize += stream.dataSize; - }); - - if (this._currentStream && this._currentStream.dataSize) { - this.dataSize += this._currentStream.dataSize; - } -}; - -CombinedStream.prototype._emitError = function(err) { - this._reset(); - this.emit('error', err); -}; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore deleted file mode 100644 index 2fedb26..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -*.un~ -/node_modules/* diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License deleted file mode 100644 index 4804b7a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Debuggable Limited - -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 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/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile deleted file mode 100644 index b4ff85a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -.PHONY: test - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md deleted file mode 100644 index 5cb5b35..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +++ /dev/null @@ -1,154 +0,0 @@ -# delayed-stream - -Buffers events from a stream until you are ready to handle them. - -## Installation - -``` bash -npm install delayed-stream -``` - -## Usage - -The following example shows how to write a http echo server that delays its -response by 1000 ms. - -``` javascript -var DelayedStream = require('delayed-stream'); -var http = require('http'); - -http.createServer(function(req, res) { - var delayed = DelayedStream.create(req); - - setTimeout(function() { - res.writeHead(200); - delayed.pipe(res); - }, 1000); -}); -``` - -If you are not using `Stream#pipe`, you can also manually release the buffered -events by calling `delayedStream.resume()`: - -``` javascript -var delayed = DelayedStream.create(req); - -setTimeout(function() { - // Emit all buffered events and resume underlaying source - delayed.resume(); -}, 1000); -``` - -## Implementation - -In order to use this meta stream properly, here are a few things you should -know about the implementation. - -### Event Buffering / Proxying - -All events of the `source` stream are hijacked by overwriting the `source.emit` -method. Until node implements a catch-all event listener, this is the only way. - -However, delayed-stream still continues to emit all events it captures on the -`source`, regardless of whether you have released the delayed stream yet or -not. - -Upon creation, delayed-stream captures all `source` events and stores them in -an internal event buffer. Once `delayedStream.release()` is called, all -buffered events are emitted on the `delayedStream`, and the event buffer is -cleared. After that, delayed-stream merely acts as a proxy for the underlaying -source. - -### Error handling - -Error events on `source` are buffered / proxied just like any other events. -However, `delayedStream.create` attaches a no-op `'error'` listener to the -`source`. This way you only have to handle errors on the `delayedStream` -object, rather than in two places. - -### Buffer limits - -delayed-stream provides a `maxDataSize` property that can be used to limit -the amount of data being buffered. In order to protect you from bad `source` -streams that don't react to `source.pause()`, this feature is enabled by -default. - -## API - -### DelayedStream.create(source, [options]) - -Returns a new `delayedStream`. Available options are: - -* `pauseStream` -* `maxDataSize` - -The description for those properties can be found below. - -### delayedStream.source - -The `source` stream managed by this object. This is useful if you are -passing your `delayedStream` around, and you still want to access properties -on the `source` object. - -### delayedStream.pauseStream = true - -Whether to pause the underlaying `source` when calling -`DelayedStream.create()`. Modifying this property afterwards has no effect. - -### delayedStream.maxDataSize = 1024 * 1024 - -The amount of data to buffer before emitting an `error`. - -If the underlaying source is emitting `Buffer` objects, the `maxDataSize` -refers to bytes. - -If the underlaying source is emitting JavaScript strings, the size refers to -characters. - -If you know what you are doing, you can set this property to `Infinity` to -disable this feature. You can also modify this property during runtime. - -### delayedStream.maxDataSize = 1024 * 1024 - -The amount of data to buffer before emitting an `error`. - -If the underlaying source is emitting `Buffer` objects, the `maxDataSize` -refers to bytes. - -If the underlaying source is emitting JavaScript strings, the size refers to -characters. - -If you know what you are doing, you can set this property to `Infinity` to -disable this feature. - -### delayedStream.dataSize = 0 - -The amount of data buffered so far. - -### delayedStream.readable - -An ECMA5 getter that returns the value of `source.readable`. - -### delayedStream.resume() - -If the `delayedStream` has not been released so far, `delayedStream.release()` -is called. - -In either case, `source.resume()` is called. - -### delayedStream.pause() - -Calls `source.pause()`. - -### delayedStream.pipe(dest) - -Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. - -### delayedStream.release() - -Emits and clears all events that have been buffered up so far. This does not -resume the underlaying source, use `delayedStream.resume()` instead. - -## License - -delayed-stream is licensed under the MIT license. diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js deleted file mode 100644 index 7c10d48..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +++ /dev/null @@ -1,99 +0,0 @@ -var Stream = require('stream').Stream; -var util = require('util'); - -module.exports = DelayedStream; -function DelayedStream() { - this.source = null; - this.dataSize = 0; - this.maxDataSize = 1024 * 1024; - this.pauseStream = true; - - this._maxDataSizeExceeded = false; - this._released = false; - this._bufferedEvents = []; -} -util.inherits(DelayedStream, Stream); - -DelayedStream.create = function(source, options) { - var delayedStream = new this(); - - options = options || {}; - for (var option in options) { - delayedStream[option] = options[option]; - } - - delayedStream.source = source; - - var realEmit = source.emit; - source.emit = function() { - delayedStream._handleEmit(arguments); - return realEmit.apply(source, arguments); - }; - - source.on('error', function() {}); - if (delayedStream.pauseStream) { - source.pause(); - } - - return delayedStream; -}; - -DelayedStream.prototype.__defineGetter__('readable', function() { - return this.source.readable; -}); - -DelayedStream.prototype.resume = function() { - if (!this._released) { - this.release(); - } - - this.source.resume(); -}; - -DelayedStream.prototype.pause = function() { - this.source.pause(); -}; - -DelayedStream.prototype.release = function() { - this._released = true; - - this._bufferedEvents.forEach(function(args) { - this.emit.apply(this, args); - }.bind(this)); - this._bufferedEvents = []; -}; - -DelayedStream.prototype.pipe = function() { - var r = Stream.prototype.pipe.apply(this, arguments); - this.resume(); - return r; -}; - -DelayedStream.prototype._handleEmit = function(args) { - if (this._released) { - this.emit.apply(this, args); - return; - } - - if (args[0] === 'data') { - this.dataSize += args[1].length; - this._checkIfMaxDataSizeExceeded(); - } - - this._bufferedEvents.push(args); -}; - -DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { - if (this._maxDataSizeExceeded) { - return; - } - - if (this.dataSize <= this.maxDataSize) { - return; - } - - this._maxDataSizeExceeded = true; - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' - this.emit('error', new Error(message)); -}; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json deleted file mode 100644 index d394b92..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "name": "delayed-stream", - "description": "Buffers events from a stream until you are ready to handle them.", - "version": "0.0.5", - "homepage": "https://github.com/felixge/node-delayed-stream", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-delayed-stream.git" - }, - "main": "./lib/delayed_stream", - "engines": { - "node": ">=0.4.0" - }, - "dependencies": {}, - "devDependencies": { - "fake": "0.2.0", - "far": "0.0.1" - }, - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "_id": "delayed-stream@0.0.5", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.24", - "_nodeVersion": "v0.8.1", - "_defaultsLoaded": true, - "dist": { - "shasum": "56f46a53506f656e1a549c63d8794c6cf8b6e1fc" - }, - "_from": "delayed-stream@0.0.5" -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js deleted file mode 100644 index 4d71b8a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js +++ /dev/null @@ -1,6 +0,0 @@ -var common = module.exports; - -common.DelayedStream = require('..'); -common.assert = require('assert'); -common.fake = require('fake'); -common.PORT = 49252; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js deleted file mode 100644 index 9ecad5b..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +++ /dev/null @@ -1,38 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var DelayedStream = common.DelayedStream; -var http = require('http'); - -var UPLOAD = new Buffer(10 * 1024 * 1024); - -var server = http.createServer(function(req, res) { - var delayed = DelayedStream.create(req, {maxDataSize: UPLOAD.length}); - - setTimeout(function() { - res.writeHead(200); - delayed.pipe(res); - }, 10); -}); -server.listen(common.PORT, function() { - var request = http.request({ - method: 'POST', - port: common.PORT, - }); - - request.write(UPLOAD); - request.end(); - - request.on('response', function(res) { - var received = 0; - res - .on('data', function(chunk) { - received += chunk.length; - }) - .on('end', function() { - assert.equal(received, UPLOAD.length); - server.close(); - }); - }); -}); - - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js deleted file mode 100644 index 6f417f3..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js +++ /dev/null @@ -1,21 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var fake = common.fake.create(); -var DelayedStream = common.DelayedStream; -var Stream = require('stream').Stream; - -(function testAutoPause() { - var source = new Stream(); - - fake.expect(source, 'pause', 1); - var delayedStream = DelayedStream.create(source); - fake.verify(); -})(); - -(function testDisableAutoPause() { - var source = new Stream(); - fake.expect(source, 'pause', 0); - - var delayedStream = DelayedStream.create(source, {pauseStream: false}); - fake.verify(); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js deleted file mode 100644 index b50c397..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js +++ /dev/null @@ -1,14 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var fake = common.fake.create(); -var DelayedStream = common.DelayedStream; -var Stream = require('stream').Stream; - -(function testDelayEventsUntilResume() { - var source = new Stream(); - var delayedStream = DelayedStream.create(source, {pauseStream: false}); - - fake.expect(source, 'pause'); - delayedStream.pause(); - fake.verify(); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js deleted file mode 100644 index fc4047e..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js +++ /dev/null @@ -1,48 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var fake = common.fake.create(); -var DelayedStream = common.DelayedStream; -var Stream = require('stream').Stream; - -(function testDelayEventsUntilResume() { - var source = new Stream(); - var delayedStream = DelayedStream.create(source, {pauseStream: false}); - - // delayedStream must not emit until we resume - fake.expect(delayedStream, 'emit', 0); - - // but our original source must emit - var params = []; - source.on('foo', function(param) { - params.push(param); - }); - - source.emit('foo', 1); - source.emit('foo', 2); - - // Make sure delayedStream did not emit, and source did - assert.deepEqual(params, [1, 2]); - fake.verify(); - - // After resume, delayedStream must playback all events - fake - .stub(delayedStream, 'emit') - .times(Infinity) - .withArg(1, 'newListener'); - fake.expect(delayedStream, 'emit', ['foo', 1]); - fake.expect(delayedStream, 'emit', ['foo', 2]); - fake.expect(source, 'resume'); - - delayedStream.resume(); - fake.verify(); - - // Calling resume again will delegate to source - fake.expect(source, 'resume'); - delayedStream.resume(); - fake.verify(); - - // Emitting more events directly leads to them being emitted - fake.expect(delayedStream, 'emit', ['foo', 3]); - source.emit('foo', 3); - fake.verify(); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js deleted file mode 100644 index a9d35e7..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js +++ /dev/null @@ -1,15 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var fake = common.fake.create(); -var DelayedStream = common.DelayedStream; -var Stream = require('stream').Stream; - -(function testHandleSourceErrors() { - var source = new Stream(); - var delayedStream = DelayedStream.create(source, {pauseStream: false}); - - // We deal with this by attaching a no-op listener to 'error' on the source - // when creating a new DelayedStream. This way error events on the source - // won't throw. - source.emit('error', new Error('something went wrong')); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js deleted file mode 100644 index 7638a2b..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js +++ /dev/null @@ -1,18 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var fake = common.fake.create(); -var DelayedStream = common.DelayedStream; -var Stream = require('stream').Stream; - -(function testMaxDataSize() { - var source = new Stream(); - var delayedStream = DelayedStream.create(source, {maxDataSize: 1024, pauseStream: false}); - - source.emit('data', new Buffer(1024)); - - fake - .expect(delayedStream, 'emit') - .withArg(1, 'error'); - source.emit('data', new Buffer(1)); - fake.verify(); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js deleted file mode 100644 index 7d312ab..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js +++ /dev/null @@ -1,13 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var fake = common.fake.create(); -var DelayedStream = common.DelayedStream; -var Stream = require('stream').Stream; - -(function testPipeReleases() { - var source = new Stream(); - var delayedStream = DelayedStream.create(source, {pauseStream: false}); - - fake.expect(delayedStream, 'resume'); - delayedStream.pipe(new Stream()); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js deleted file mode 100644 index d436163..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js +++ /dev/null @@ -1,13 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var fake = common.fake.create(); -var DelayedStream = common.DelayedStream; -var Stream = require('stream').Stream; - -(function testProxyReadableProperty() { - var source = new Stream(); - var delayedStream = DelayedStream.create(source, {pauseStream: false}); - - source.readable = fake.value('source.readable'); - assert.strictEqual(delayedStream.readable, source.readable); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js deleted file mode 100755 index 0bb8e82..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var far = require('far').create(); - -far.add(__dirname); -far.include(/test-.*\.js$/); - -far.execute(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json deleted file mode 100644 index 7bb0fcf..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "name": "combined-stream", - "description": "A stream that emits multiple other streams one after another.", - "version": "0.0.3", - "homepage": "https://github.com/felixge/node-combined-stream", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-combined-stream.git" - }, - "main": "./lib/combined_stream", - "engines": { - "node": "*" - }, - "dependencies": { - "delayed-stream": "0.0.5" - }, - "devDependencies": { - "far": "0.0.1" - }, - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "_id": "combined-stream@0.0.3", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.24", - "_nodeVersion": "v0.8.1", - "_defaultsLoaded": true, - "dist": { - "shasum": "c41c9899277b587901bb6ce4bf458b94693afafa" - }, - "_from": "combined-stream@0.0.3" -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js deleted file mode 100644 index aa9ab3a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js +++ /dev/null @@ -1,12 +0,0 @@ -var common = module.exports; - -var path = require('path'); -var root = path.join(__dirname, '..'); - -common.dir = { - fixture: root + '/test/fixture', - tmp: root + '/test/tmp', -}; - -common.CombinedStream = require(root); -common.assert = require('assert'); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt deleted file mode 100644 index 50e0218..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt +++ /dev/null @@ -1,256 +0,0 @@ -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 -10101010101010101010101010101010101010101010101010101010101010101010101010101010 -01010101010101010101010101010101010101010101010101010101010101010101010101010101 diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt deleted file mode 100644 index da1d821..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt +++ /dev/null @@ -1,256 +0,0 @@ -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 -20202020202020202020202020202020202020202020202020202020202020202020202020202020 -02020202020202020202020202020202020202020202020202020202020202020202020202020202 diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js deleted file mode 100644 index 44ecaba..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js +++ /dev/null @@ -1,27 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var CombinedStream = common.CombinedStream; -var fs = require('fs'); - -var FILE1 = common.dir.fixture + '/file1.txt'; -var FILE2 = common.dir.fixture + '/file2.txt'; -var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); - -(function testDelayedStreams() { - var combinedStream = CombinedStream.create(); - combinedStream.append(function(next) { - next(fs.createReadStream(FILE1)); - }); - combinedStream.append(function(next) { - next(fs.createReadStream(FILE2)); - }); - - var tmpFile = common.dir.tmp + '/combined.txt'; - var dest = fs.createWriteStream(tmpFile); - combinedStream.pipe(dest); - - dest.on('end', function() { - var written = fs.readFileSync(tmpFile, 'utf8'); - assert.strictEqual(written, EXPECTED); - }); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js deleted file mode 100644 index e3fbd18..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js +++ /dev/null @@ -1,34 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var CombinedStream = common.CombinedStream; - -(function testDataSizeGetter() { - var combinedStream = CombinedStream.create(); - - assert.strictEqual(combinedStream.dataSize, 0); - - // Test one stream - combinedStream._streams.push({dataSize: 10}); - combinedStream._updateDataSize(); - assert.strictEqual(combinedStream.dataSize, 10); - - // Test two streams - combinedStream._streams.push({dataSize: 23}); - combinedStream._updateDataSize(); - assert.strictEqual(combinedStream.dataSize, 33); - - // Test currentStream - combinedStream._currentStream = {dataSize: 20}; - combinedStream._updateDataSize(); - assert.strictEqual(combinedStream.dataSize, 53); - - // Test currentStream without dataSize - combinedStream._currentStream = {}; - combinedStream._updateDataSize(); - assert.strictEqual(combinedStream.dataSize, 33); - - // Test stream function - combinedStream._streams.push(function() {}); - combinedStream._updateDataSize(); - assert.strictEqual(combinedStream.dataSize, 33); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js deleted file mode 100644 index c678575..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js +++ /dev/null @@ -1,38 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var CombinedStream = common.CombinedStream; -var fs = require('fs'); - -var FILE1 = common.dir.fixture + '/file1.txt'; -var BUFFER = new Buffer('Bacon is delicious'); -var FILE2 = common.dir.fixture + '/file2.txt'; -var STRING = 'The € kicks the $\'s ass!'; - -var EXPECTED = - fs.readFileSync(FILE1) - + BUFFER - + fs.readFileSync(FILE2) - + STRING; -var GOT; - -(function testDelayedStreams() { - var combinedStream = CombinedStream.create(); - combinedStream.append(fs.createReadStream(FILE1)); - combinedStream.append(BUFFER); - combinedStream.append(fs.createReadStream(FILE2)); - combinedStream.append(function(next) { - next(STRING); - }); - - var tmpFile = common.dir.tmp + '/combined-file1-buffer-file2-string.txt'; - var dest = fs.createWriteStream(tmpFile); - combinedStream.pipe(dest); - - dest.on('close', function() { - GOT = fs.readFileSync(tmpFile, 'utf8'); - }); -})(); - -process.on('exit', function() { - assert.strictEqual(GOT, EXPECTED); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js deleted file mode 100644 index 263cfdf..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js +++ /dev/null @@ -1,35 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var CombinedStream = common.CombinedStream; -var fs = require('fs'); - -var FILE1 = common.dir.fixture + '/file1.txt'; -var FILE2 = common.dir.fixture + '/file2.txt'; -var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); -var GOT; - -(function testDelayedStreams() { - var combinedStream = CombinedStream.create(); - combinedStream.append(fs.createReadStream(FILE1)); - combinedStream.append(fs.createReadStream(FILE2)); - - var stream1 = combinedStream._streams[0]; - var stream2 = combinedStream._streams[1]; - - stream1.on('end', function() { - assert.equal(stream2.dataSize, 0); - }); - - var tmpFile = common.dir.tmp + '/combined.txt'; - var dest = fs.createWriteStream(tmpFile); - combinedStream.pipe(dest); - - dest.on('close', function() { - GOT = fs.readFileSync(tmpFile, 'utf8'); - }); -})(); - -process.on('exit', function() { - console.error(GOT.length, EXPECTED.length); - assert.strictEqual(GOT, EXPECTED); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js deleted file mode 100644 index 25f47a4..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js +++ /dev/null @@ -1,24 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var CombinedStream = common.CombinedStream; -var fs = require('fs'); - -var FILE1 = common.dir.fixture + '/file1.txt'; -var FILE2 = common.dir.fixture + '/file2.txt'; -var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); - -(function testDelayedStreams() { - var combinedStream = CombinedStream.create({pauseStreams: false, maxDataSize: 20736}); - combinedStream.append(fs.createReadStream(FILE1)); - combinedStream.append(fs.createReadStream(FILE2)); - - var gotErr = null; - combinedStream.on('error', function(err) { - gotErr = err; - }); - - process.on('exit', function() { - assert.ok(gotErr); - assert.ok(gotErr.message.match(/bytes/)); - }); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js deleted file mode 100644 index 30a3a6f..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js +++ /dev/null @@ -1,30 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var CombinedStream = common.CombinedStream; -var fs = require('fs'); - -var FILE1 = common.dir.fixture + '/file1.txt'; -var FILE2 = common.dir.fixture + '/file2.txt'; -var EXPECTED = fs.readFileSync(FILE1) + fs.readFileSync(FILE2); - -(function testDelayedStreams() { - var combinedStream = CombinedStream.create({pauseStreams: false}); - combinedStream.append(fs.createReadStream(FILE1)); - combinedStream.append(fs.createReadStream(FILE2)); - - var stream1 = combinedStream._streams[0]; - var stream2 = combinedStream._streams[1]; - - stream1.on('end', function() { - assert.ok(stream2.dataSize > 0); - }); - - var tmpFile = common.dir.tmp + '/combined.txt'; - var dest = fs.createWriteStream(tmpFile); - combinedStream.pipe(dest); - - dest.on('end', function() { - var written = fs.readFileSync(tmpFile, 'utf8'); - assert.strictEqual(written, EXPECTED); - }); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js deleted file mode 100755 index 0bb8e82..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var far = require('far').create(); - -far.add(__dirname); -far.include(/test-.*\.js$/); - -far.execute(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/package.json b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/package.json deleted file mode 100644 index 1948a5e..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "name": "form-data", - "description": "A module to create readable `\"multipart/form-data\"` streams. Can be used to submit forms and file uploads to other web applications.", - "version": "0.0.3", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-form-data.git" - }, - "main": "./lib/form_data", - "engines": { - "node": "*" - }, - "dependencies": { - "combined-stream": "0.0.3", - "mime": "~1.2.2", - "async": "~0.1.9" - }, - "devDependencies": { - "fake": "0.2.1", - "far": "0.0.1", - "formidable": "1.0.2", - "request": "~2.9.203" - }, - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "_id": "form-data@0.0.3", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.24", - "_nodeVersion": "v0.8.1", - "_defaultsLoaded": true, - "dist": { - "shasum": "6eea17b45790b42d779a1d581d1b3600fe0c7c0d" - }, - "_from": "form-data" -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/common.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/common.js deleted file mode 100644 index 8a26482..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/common.js +++ /dev/null @@ -1,14 +0,0 @@ -var common = module.exports; -var path = require('path'); - -var rootDir = path.join(__dirname, '..'); -common.dir = { - lib: rootDir + '/lib', - fixture: rootDir + '/test/fixture', - tmp: rootDir + '/test/tmp', -}; - -common.assert = require('assert'); -common.fake = require('fake'); - -common.port = 8432; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/fixture/bacon.txt b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/fixture/bacon.txt deleted file mode 100644 index 9804bbd..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/fixture/bacon.txt +++ /dev/null @@ -1 +0,0 @@ -Bacon is delicious. diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg deleted file mode 100644 index 7cea4dd..0000000 Binary files a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js deleted file mode 100644 index 44d3b4d..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js +++ /dev/null @@ -1,93 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var FormData = require(common.dir.lib + '/form_data'); -var fake = require('fake').create(); -var fs = require('fs'); - -(function testEmptyForm() { - var form = new FormData(); - var callback = fake.callback(arguments.callee.name + '-getLength'); - var calls = fake.expectAnytime(callback, [null, 0]).calls; - - form.getLength(callback); - - // Make sure our response is async - assert.strictEqual(calls.length, 0); -})(); - -(function testUtf8String() { - var FIELD = 'my_field'; - var VALUE = 'May the € be with you'; - - var form = new FormData(); - form.append(FIELD, VALUE); - var callback = fake.callback(arguments.callee.name + '-getLength'); - - var expectedLength = - form._overheadLength + - Buffer.byteLength(VALUE) + - form._lastBoundary().length; - - fake.expectAnytime(callback, [null, expectedLength]); - form.getLength(callback); -})(); - -(function testBuffer() { - var FIELD = 'my_field'; - var VALUE = new Buffer(23); - - var form = new FormData(); - form.append(FIELD, VALUE); - var callback = fake.callback(arguments.callee.name + '-getLength'); - - var expectedLength = - form._overheadLength + - VALUE.length + - form._lastBoundary().length; - - fake.expectAnytime(callback, [null, expectedLength]); - form.getLength(callback); -})(); - - -(function testStringFileBufferFile() { - var fields = [ - { - name: 'my_field', - value: 'Test 123', - }, - { - name: 'my_image', - value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg'), - }, - { - name: 'my_buffer', - value: new Buffer('123'), - }, - { - name: 'my_txt', - value: fs.createReadStream(common.dir.fixture + '/bacon.txt'), - }, - ]; - - var form = new FormData(); - var expectedLength = 0; - - fields.forEach(function(field) { - form.append(field.name, field.value); - if (field.value.path) { - var stat = fs.statSync(field.value.path); - expectedLength += stat.size; - } else { - expectedLength += field.value.length; - } - }); - - expectedLength += form._overheadLength + form._lastBoundary().length; - - var callback = fake.callback(arguments.callee.name + '-getLength'); - fake.expectAnytime(callback, [null, expectedLength]); - form.getLength(callback); -})(); - - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js deleted file mode 100644 index 6dc2fb2..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js +++ /dev/null @@ -1,18 +0,0 @@ -var common = require('../common'); -var assert = common.assert; - -var FormData = require(common.dir.lib + '/form_data'); - -(function testOneBoundaryPerForm() { - var form = new FormData(); - var boundary = form.getBoundary(); - - assert.equal(boundary, form.getBoundary()); - assert.equal(boundary.length, 50); -})(); - -(function testUniqueBoundaryPerForm() { - var formA = new FormData(); - var formB = new FormData(); - assert.notEqual(formA.getBoundary(), formB.getBoundary()); -})(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-http-response.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-http-response.js deleted file mode 100644 index 8e183fe..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-http-response.js +++ /dev/null @@ -1,121 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var http = require('http'); -var path = require('path'); -var mime = require('mime'); -var request = require('request'); -var parseUrl = require('url').parse; -var fs = require('fs'); -var FormData = require(common.dir.lib + '/form_data'); -var IncomingForm = require('formidable').IncomingForm; - -var remoteFile = 'http://nodejs.org/images/logo.png'; - -var FIELDS; -var server; - -var parsedUrl = parseUrl(remoteFile) - , options = { - method: 'get', - port: parsedUrl.port || 80, - path: parsedUrl.pathname, - host: parsedUrl.hostname - } - ; - -http.request(options, function(res) { - - FIELDS = [ - {name: 'my_field', value: 'my_value'}, - {name: 'my_buffer', value: new Buffer([1, 2, 3])}, - {name: 'remote_file', value: res } - ]; - - var form = new FormData(); - FIELDS.forEach(function(field) { - form.append(field.name, field.value); - }); - - server.listen(common.port, function() { - - form.submit('http://localhost:' + common.port + '/', function(err, res) { - - if (err) { - throw err; - } - - assert.strictEqual(res.statusCode, 200); - server.close(); - }); - - }); - - -}).end(); - -server = http.createServer(function(req, res) { - - // formidable is broken so let's do it manual way - // - // var form = new IncomingForm(); - // form.uploadDir = common.dir.tmp; - // form.parse(req); - // form - // .on('field', function(name, value) { - // var field = FIELDS.shift(); - // assert.strictEqual(name, field.name); - // assert.strictEqual(value, field.value+''); - // }) - // .on('file', function(name, file) { - // var field = FIELDS.shift(); - // assert.strictEqual(name, field.name); - // assert.strictEqual(file.name, path.basename(field.value.path)); - // // mime.lookup file.NAME == 'my_file' ? - // assert.strictEqual(file.type, mime.lookup(file.name)); - // }) - // .on('end', function() { - // res.writeHead(200); - // res.end('done'); - // }); - - // temp workaround - var data = ''; - req.setEncoding('utf8'); - - req.on('data', function(d) { - data += d; - }); - - req.on('end', function() { - - // check for the fields' traces - - // 1st field : my_field - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 2nd field : my_buffer - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 3rd field : remote_file - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf('; filename="'+path.basename(remoteFile)+'"') != -1 ); - // check for http://nodejs.org/images/logo.png traces - assert.ok( data.indexOf('ImageReady') != -1 ); - assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); - - res.writeHead(200); - res.end('done'); - - }); - -}); - - -process.on('exit', function() { - assert.strictEqual(FIELDS.length, 0); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-pipe.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-pipe.js deleted file mode 100644 index acc39df..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-pipe.js +++ /dev/null @@ -1,111 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var http = require('http'); -var path = require('path'); -var mime = require('mime'); -var request = require('request'); -var fs = require('fs'); -var FormData = require(common.dir.lib + '/form_data'); -var IncomingForm = require('formidable').IncomingForm; - -var remoteFile = 'http://nodejs.org/images/logo.png'; - -var FIELDS = [ - {name: 'my_field', value: 'my_value'}, - {name: 'my_buffer', value: new Buffer([1, 2, 3])}, - {name: 'my_file', value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg')}, - {name: 'remote_file', value: request(remoteFile) } -]; - -var server = http.createServer(function(req, res) { - - // formidable is broken so let's do it manual way - // - // var form = new IncomingForm(); - // form.uploadDir = common.dir.tmp; - // form.parse(req); - // form - // .on('field', function(name, value) { - // var field = FIELDS.shift(); - // assert.strictEqual(name, field.name); - // assert.strictEqual(value, field.value+''); - // }) - // .on('file', function(name, file) { - // var field = FIELDS.shift(); - // assert.strictEqual(name, field.name); - // assert.strictEqual(file.name, path.basename(field.value.path)); - // assert.strictEqual(file.type, mime.lookup(file.name)); - // }) - // .on('end', function() { - // res.writeHead(200); - // res.end('done'); - // }); - - // temp workaround - var data = ''; - req.setEncoding('utf8'); - - req.on('data', function(d) { - data += d; - }); - - req.on('end', function() { - // check for the fields' traces - - // 1st field : my_field - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 2nd field : my_buffer - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 3rd field : my_file - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); - // check for unicycle.jpg traces - assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 ); - assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 ); - - // 4th field : remote_file - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); - // check for http://nodejs.org/images/logo.png traces - assert.ok( data.indexOf('ImageReady') != -1 ); - assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); - - res.writeHead(200); - res.end('done'); - - }); - - -}); - -server.listen(common.port, function() { - var form = new FormData(); - FIELDS.forEach(function(field) { - form.append(field.name, field.value); - }); - - var request = http.request({ - method: 'post', - port: common.port, - path: '/upload', - headers: form.getHeaders() - }); - - form.pipe(request); - - request.on('response', function(res) { - server.close(); - }); -}); - -process.on('exit', function() { - assert.strictEqual(FIELDS.length, 0); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-submit.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-submit.js deleted file mode 100644 index c40e88f..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/integration/test-submit.js +++ /dev/null @@ -1,107 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var http = require('http'); -var path = require('path'); -var mime = require('mime'); -var request = require('request'); -var fs = require('fs'); -var FormData = require(common.dir.lib + '/form_data'); -var IncomingForm = require('formidable').IncomingForm; - -var remoteFile = 'http://nodejs.org/images/logo.png'; - -var FIELDS = [ - {name: 'my_field', value: 'my_value'}, - {name: 'my_buffer', value: new Buffer([1, 2, 3])}, - {name: 'my_file', value: fs.createReadStream(common.dir.fixture + '/unicycle.jpg') }, - {name: 'remote_file', value: request(remoteFile) } -]; - -var server = http.createServer(function(req, res) { - - // formidable is broken so let's do it manual way - // - // var form = new IncomingForm(); - // form.uploadDir = common.dir.tmp; - // form.parse(req); - // form - // .on('field', function(name, value) { - // var field = FIELDS.shift(); - // assert.strictEqual(name, field.name); - // assert.strictEqual(value, field.value+''); - // }) - // .on('file', function(name, file) { - // var field = FIELDS.shift(); - // assert.strictEqual(name, field.name); - // assert.strictEqual(file.name, path.basename(field.value.path)); - // // mime.lookup file.NAME == 'my_file' ? - // assert.strictEqual(file.type, mime.lookup(file.name)); - // }) - // .on('end', function() { - // res.writeHead(200); - // res.end('done'); - // }); - - // temp workaround - var data = ''; - req.setEncoding('utf8'); - req.on('data', function(d) { - data += d; - }); - req.on('end', function() { - // check for the fields' traces - - // 1st field : my_field - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 2nd field : my_buffer - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 3rd field : my_file - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); - // check for unicycle.jpg traces - assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 ); - assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 ); - - // 4th field : remote_file - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); - // check for http://nodejs.org/images/logo.png traces - assert.ok( data.indexOf('ImageReady') != -1 ); - assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); - - res.writeHead(200); - res.end('done'); - - }); - -}); - -server.listen(common.port, function() { - var form = new FormData(); - FIELDS.forEach(function(field) { - form.append(field.name, field.value); - }); - - form.submit('http://localhost:' + common.port + '/', function(err, res) { - - if (err) { - throw err; - } - - assert.strictEqual(res.statusCode, 200); - server.close(); - }); - -}); - -process.on('exit', function() { - assert.strictEqual(FIELDS.length, 0); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/run.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/run.js deleted file mode 100755 index 0bb8e82..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/form-data/test/run.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var far = require('far').create(); - -far.add(__dirname); -far.include(/test-.*\.js$/); - -far.execute(); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/LICENSE b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/LICENSE deleted file mode 100644 index 451fc45..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Benjamin Thomas, Robert Kieffer - -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 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/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/README.md b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/README.md deleted file mode 100644 index b90552a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# mime - -Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community. - -## Install - -Install with [npm](http://github.com/isaacs/npm): - - npm install mime - -## API - Queries - -### mime.lookup(path) -Get the mime type associated with a file. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g. - - var mime = require('mime'); - - mime.lookup('/path/to/file.txt'); // => 'text/plain' - mime.lookup('file.txt'); // => 'text/plain' - mime.lookup('.TXT'); // => 'text/plain' - mime.lookup('htm'); // => 'text/html' - -### mime.extension(type) -Get the default extension for `type` - - mime.extension('text/html'); // => 'html' - mime.extension('application/octet-stream'); // => 'bin' - -### mime.charsets.lookup() - -Map mime-type to charset - - mime.charsets.lookup('text/plain'); // => 'UTF-8' - -(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) - -## API - Defining Custom Types - -The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types). - -### mime.define() - -Add custom mime/extension mappings - - mime.define({ - 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], - 'application/x-my-type': ['x-mt', 'x-mtt'], - // etc ... - }); - - mime.lookup('x-sft'); // => 'text/x-some-format' - -The first entry in the extensions array is returned by `mime.extension()`. E.g. - - mime.extension('text/x-some-format'); // => 'x-sf' - -### mime.load(filepath) - -Load mappings from an Apache ".types" format file - - mime.load('./my_project.types'); - -The .types file format is simple - See the `types` dir for examples. diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/mime.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/mime.js deleted file mode 100644 index 1e00585..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/mime.js +++ /dev/null @@ -1,104 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -function Mime() { - // Map of extension -> mime type - this.types = Object.create(null); - - // Map of mime type -> extension - this.extensions = Object.create(null); -} - -/** - * Define mimetype -> extension mappings. Each key is a mime-type that maps - * to an array of extensions associated with the type. The first extension is - * used as the default extension for the type. - * - * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); - * - * @param map (Object) type definitions - */ -Mime.prototype.define = function (map) { - for (var type in map) { - var exts = map[type]; - - for (var i = 0; i < exts.length; i++) { - this.types[exts[i]] = type; - } - - // Default extension is the first one we encounter - if (!this.extensions[type]) { - this.extensions[type] = exts[0]; - } - } -}; - -/** - * Load an Apache2-style ".types" file - * - * This may be called multiple times (it's expected). Where files declare - * overlapping types/extensions, the last file wins. - * - * @param file (String) path of file to load. - */ -Mime.prototype.load = function(file) { - // Read file and split into lines - var map = {}, - content = fs.readFileSync(file, 'ascii'), - lines = content.split(/[\r\n]+/); - - lines.forEach(function(line) { - // Clean up whitespace/comments, and split into fields - var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); - map[fields.shift()] = fields; - }); - - this.define(map); -}; - -/** - * Lookup a mime type based on extension - */ -Mime.prototype.lookup = function(path, fallback) { - var ext = path.replace(/.*[\.\/]/, '').toLowerCase(); - - return this.types[ext] || fallback || this.default_type; -}; - -/** - * Return file extension associated with a mime type - */ -Mime.prototype.extension = function(mimeType) { - return this.extensions[mimeType]; -}; - -// Default instance -var mime = new Mime(); - -// Load local copy of -// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -mime.load(path.join(__dirname, 'types/mime.types')); - -// Load additional types from node.js community -mime.load(path.join(__dirname, 'types/node.types')); - -// Default type -mime.default_type = mime.lookup('bin'); - -// -// Additional API specific to the default instance -// - -mime.Mime = Mime; - -/** - * Lookup a charset based on mime type. - */ -mime.charsets = { - lookup: function(mimeType, fallback) { - // Assume text types are utf8 - return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; - } -} - -module.exports = mime; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/package.json b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/package.json deleted file mode 100644 index 06e2ee5..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "author": { - "name": "Robert Kieffer", - "email": "robert@broofa.com", - "url": "http://github.com/broofa" - }, - "contributors": [ - { - "name": "Benjamin Thomas", - "email": "benjamin@benjaminthomas.org", - "url": "http://github.com/bentomas" - } - ], - "dependencies": {}, - "description": "A comprehensive library for mime-type mapping", - "devDependencies": {}, - "keywords": [ - "util", - "mime" - ], - "main": "mime.js", - "name": "mime", - "repository": { - "url": "git://github.com/broofa/node-mime.git", - "type": "git" - }, - "version": "1.2.7", - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "_id": "mime@1.2.7", - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.24", - "_nodeVersion": "v0.8.1", - "_defaultsLoaded": true, - "_from": "mime" -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/test.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/test.js deleted file mode 100644 index cbad034..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/test.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Usage: node test.js - */ - -var mime = require('./mime'); -var assert = require('assert'); - -function eq(a, b) { - console.log('Test: ' + a + ' === ' + b); - assert.strictEqual.apply(null, arguments); -} - -console.log(Object.keys(mime.extensions).length + ' types'); -console.log(Object.keys(mime.types).length + ' extensions\n'); - -// -// Test mime lookups -// - -eq('text/plain', mime.lookup('text.txt')); -eq('text/plain', mime.lookup('.text.txt')); -eq('text/plain', mime.lookup('.txt')); -eq('text/plain', mime.lookup('txt')); -eq('application/octet-stream', mime.lookup('text.nope')); -eq('fallback', mime.lookup('text.fallback', 'fallback')); -eq('application/octet-stream', mime.lookup('constructor')); -eq('text/plain', mime.lookup('TEXT.TXT')); -eq('text/event-stream', mime.lookup('text/event-stream')); -eq('application/x-web-app-manifest+json', mime.lookup('text.webapp')); - -// -// Test extensions -// - -eq('txt', mime.extension(mime.types.text)); -eq('html', mime.extension(mime.types.htm)); -eq('bin', mime.extension('application/octet-stream')); -eq(undefined, mime.extension('constructor')); - -// -// Test node types -// - -eq('application/octet-stream', mime.lookup('file.buffer')); -eq('audio/mp4', mime.lookup('file.m4a')); - -// -// Test charsets -// - -eq('UTF-8', mime.charsets.lookup('text/plain')); -eq(undefined, mime.charsets.lookup(mime.types.js)); -eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); - -console.log('\nOK'); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/types/mime.types b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/types/mime.types deleted file mode 100644 index b90b165..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/types/mime.types +++ /dev/null @@ -1,1588 +0,0 @@ -# This file maps Internet media types to unique file extension(s). -# Although created for httpd, this file is used by many software systems -# and has been placed in the public domain for unlimited redisribution. -# -# The table below contains both registered and (common) unregistered types. -# A type that has no unique extension can be ignored -- they are listed -# here to guide configurations toward known types and to make it easier to -# identify "new" types. File extensions are also commonly used to indicate -# content languages and encodings, so choose them carefully. -# -# Internet media types should be registered as described in RFC 4288. -# The registry is at . -# -# MIME type (lowercased) Extensions -# ============================================ ========== -# application/1d-interleaved-parityfec -# application/3gpp-ims+xml -# application/activemessage -application/andrew-inset ez -# application/applefile -application/applixware aw -application/atom+xml atom -application/atomcat+xml atomcat -# application/atomicmail -application/atomsvc+xml atomsvc -# application/auth-policy+xml -# application/batch-smtp -# application/beep+xml -# application/calendar+xml -# application/cals-1840 -# application/ccmp+xml -application/ccxml+xml ccxml -application/cdmi-capability cdmia -application/cdmi-container cdmic -application/cdmi-domain cdmid -application/cdmi-object cdmio -application/cdmi-queue cdmiq -# application/cea-2018+xml -# application/cellml+xml -# application/cfw -# application/cnrp+xml -# application/commonground -# application/conference-info+xml -# application/cpl+xml -# application/csta+xml -# application/cstadata+xml -application/cu-seeme cu -# application/cybercash -application/davmount+xml davmount -# application/dca-rft -# application/dec-dx -# application/dialog-info+xml -# application/dicom -# application/dns -application/docbook+xml dbk -# application/dskpp+xml -application/dssc+der dssc -application/dssc+xml xdssc -# application/dvcs -application/ecmascript ecma -# application/edi-consent -# application/edi-x12 -# application/edifact -application/emma+xml emma -# application/epp+xml -application/epub+zip epub -# application/eshop -# application/example -application/exi exi -# application/fastinfoset -# application/fastsoap -# application/fits -application/font-tdpfr pfr -# application/framework-attributes+xml -application/gml+xml gml -application/gpx+xml gpx -application/gxf gxf -# application/h224 -# application/held+xml -# application/http -application/hyperstudio stk -# application/ibe-key-request+xml -# application/ibe-pkg-reply+xml -# application/ibe-pp-data -# application/iges -# application/im-iscomposing+xml -# application/index -# application/index.cmd -# application/index.obj -# application/index.response -# application/index.vnd -application/inkml+xml ink inkml -# application/iotp -application/ipfix ipfix -# application/ipp -# application/isup -application/java-archive jar -application/java-serialized-object ser -application/java-vm class -application/javascript js -application/json json -application/jsonml+json jsonml -# application/kpml-request+xml -# application/kpml-response+xml -application/lost+xml lostxml -application/mac-binhex40 hqx -application/mac-compactpro cpt -# application/macwriteii -application/mads+xml mads -application/marc mrc -application/marcxml+xml mrcx -application/mathematica ma nb mb -# application/mathml-content+xml -# application/mathml-presentation+xml -application/mathml+xml mathml -# application/mbms-associated-procedure-description+xml -# application/mbms-deregister+xml -# application/mbms-envelope+xml -# application/mbms-msk+xml -# application/mbms-msk-response+xml -# application/mbms-protection-description+xml -# application/mbms-reception-report+xml -# application/mbms-register+xml -# application/mbms-register-response+xml -# application/mbms-user-service-description+xml -application/mbox mbox -# application/media_control+xml -application/mediaservercontrol+xml mscml -application/metalink+xml metalink -application/metalink4+xml meta4 -application/mets+xml mets -# application/mikey -application/mods+xml mods -# application/moss-keys -# application/moss-signature -# application/mosskey-data -# application/mosskey-request -application/mp21 m21 mp21 -application/mp4 mp4s -# application/mpeg4-generic -# application/mpeg4-iod -# application/mpeg4-iod-xmt -# application/msc-ivr+xml -# application/msc-mixer+xml -application/msword doc dot -application/mxf mxf -# application/nasdata -# application/news-checkgroups -# application/news-groupinfo -# application/news-transmission -# application/nss -# application/ocsp-request -# application/ocsp-response -application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy -application/oda oda -application/oebps-package+xml opf -application/ogg ogx -application/omdoc+xml omdoc -application/onenote onetoc onetoc2 onetmp onepkg -application/oxps oxps -# application/parityfec -application/patch-ops-error+xml xer -application/pdf pdf -application/pgp-encrypted pgp -# application/pgp-keys -application/pgp-signature asc sig -application/pics-rules prf -# application/pidf+xml -# application/pidf-diff+xml -application/pkcs10 p10 -application/pkcs7-mime p7m p7c -application/pkcs7-signature p7s -application/pkcs8 p8 -application/pkix-attr-cert ac -application/pkix-cert cer -application/pkix-crl crl -application/pkix-pkipath pkipath -application/pkixcmp pki -application/pls+xml pls -# application/poc-settings+xml -application/postscript ai eps ps -# application/prs.alvestrand.titrax-sheet -application/prs.cww cww -# application/prs.nprend -# application/prs.plucker -# application/prs.rdf-xml-crypt -# application/prs.xsf+xml -application/pskc+xml pskcxml -# application/qsig -application/rdf+xml rdf -application/reginfo+xml rif -application/relax-ng-compact-syntax rnc -# application/remote-printing -application/resource-lists+xml rl -application/resource-lists-diff+xml rld -# application/riscos -# application/rlmi+xml -application/rls-services+xml rs -application/rpki-ghostbusters gbr -application/rpki-manifest mft -application/rpki-roa roa -# application/rpki-updown -application/rsd+xml rsd -application/rss+xml rss -application/rtf rtf -# application/rtx -# application/samlassertion+xml -# application/samlmetadata+xml -application/sbml+xml sbml -application/scvp-cv-request scq -application/scvp-cv-response scs -application/scvp-vp-request spq -application/scvp-vp-response spp -application/sdp sdp -# application/set-payment -application/set-payment-initiation setpay -# application/set-registration -application/set-registration-initiation setreg -# application/sgml -# application/sgml-open-catalog -application/shf+xml shf -# application/sieve -# application/simple-filter+xml -# application/simple-message-summary -# application/simplesymbolcontainer -# application/slate -# application/smil -application/smil+xml smi smil -# application/soap+fastinfoset -# application/soap+xml -application/sparql-query rq -application/sparql-results+xml srx -# application/spirits-event+xml -application/srgs gram -application/srgs+xml grxml -application/sru+xml sru -application/ssdl+xml ssdl -application/ssml+xml ssml -# application/tamp-apex-update -# application/tamp-apex-update-confirm -# application/tamp-community-update -# application/tamp-community-update-confirm -# application/tamp-error -# application/tamp-sequence-adjust -# application/tamp-sequence-adjust-confirm -# application/tamp-status-query -# application/tamp-status-response -# application/tamp-update -# application/tamp-update-confirm -application/tei+xml tei teicorpus -application/thraud+xml tfi -# application/timestamp-query -# application/timestamp-reply -application/timestamped-data tsd -# application/tve-trigger -# application/ulpfec -# application/vcard+xml -# application/vemmi -# application/vividence.scriptfile -# application/vnd.3gpp.bsf+xml -application/vnd.3gpp.pic-bw-large plb -application/vnd.3gpp.pic-bw-small psb -application/vnd.3gpp.pic-bw-var pvb -# application/vnd.3gpp.sms -# application/vnd.3gpp2.bcmcsinfo+xml -# application/vnd.3gpp2.sms -application/vnd.3gpp2.tcap tcap -application/vnd.3m.post-it-notes pwn -application/vnd.accpac.simply.aso aso -application/vnd.accpac.simply.imp imp -application/vnd.acucobol acu -application/vnd.acucorp atc acutc -application/vnd.adobe.air-application-installer-package+zip air -application/vnd.adobe.formscentral.fcdt fcdt -application/vnd.adobe.fxp fxp fxpl -# application/vnd.adobe.partial-upload -application/vnd.adobe.xdp+xml xdp -application/vnd.adobe.xfdf xfdf -# application/vnd.aether.imp -# application/vnd.ah-barcode -application/vnd.ahead.space ahead -application/vnd.airzip.filesecure.azf azf -application/vnd.airzip.filesecure.azs azs -application/vnd.amazon.ebook azw -application/vnd.americandynamics.acc acc -application/vnd.amiga.ami ami -# application/vnd.amundsen.maze+xml -application/vnd.android.package-archive apk -application/vnd.anser-web-certificate-issue-initiation cii -application/vnd.anser-web-funds-transfer-initiation fti -application/vnd.antix.game-component atx -application/vnd.apple.installer+xml mpkg -application/vnd.apple.mpegurl m3u8 -# application/vnd.arastra.swi -application/vnd.aristanetworks.swi swi -application/vnd.astraea-software.iota iota -application/vnd.audiograph aep -# application/vnd.autopackage -# application/vnd.avistar+xml -application/vnd.blueice.multipass mpm -# application/vnd.bluetooth.ep.oob -application/vnd.bmi bmi -application/vnd.businessobjects rep -# application/vnd.cab-jscript -# application/vnd.canon-cpdl -# application/vnd.canon-lips -# application/vnd.cendio.thinlinc.clientconf -application/vnd.chemdraw+xml cdxml -application/vnd.chipnuts.karaoke-mmd mmd -application/vnd.cinderella cdy -# application/vnd.cirpack.isdn-ext -application/vnd.claymore cla -application/vnd.cloanto.rp9 rp9 -application/vnd.clonk.c4group c4g c4d c4f c4p c4u -application/vnd.cluetrust.cartomobile-config c11amc -application/vnd.cluetrust.cartomobile-config-pkg c11amz -# application/vnd.collection+json -# application/vnd.commerce-battelle -application/vnd.commonspace csp -application/vnd.contact.cmsg cdbcmsg -application/vnd.cosmocaller cmc -application/vnd.crick.clicker clkx -application/vnd.crick.clicker.keyboard clkk -application/vnd.crick.clicker.palette clkp -application/vnd.crick.clicker.template clkt -application/vnd.crick.clicker.wordbank clkw -application/vnd.criticaltools.wbs+xml wbs -application/vnd.ctc-posml pml -# application/vnd.ctct.ws+xml -# application/vnd.cups-pdf -# application/vnd.cups-postscript -application/vnd.cups-ppd ppd -# application/vnd.cups-raster -# application/vnd.cups-raw -# application/vnd.curl -application/vnd.curl.car car -application/vnd.curl.pcurl pcurl -# application/vnd.cybank -application/vnd.dart dart -application/vnd.data-vision.rdz rdz -application/vnd.dece.data uvf uvvf uvd uvvd -application/vnd.dece.ttml+xml uvt uvvt -application/vnd.dece.unspecified uvx uvvx -application/vnd.dece.zip uvz uvvz -application/vnd.denovo.fcselayout-link fe_launch -# application/vnd.dir-bi.plate-dl-nosuffix -application/vnd.dna dna -application/vnd.dolby.mlp mlp -# application/vnd.dolby.mobile.1 -# application/vnd.dolby.mobile.2 -application/vnd.dpgraph dpg -application/vnd.dreamfactory dfac -application/vnd.ds-keypoint kpxx -application/vnd.dvb.ait ait -# application/vnd.dvb.dvbj -# application/vnd.dvb.esgcontainer -# application/vnd.dvb.ipdcdftnotifaccess -# application/vnd.dvb.ipdcesgaccess -# application/vnd.dvb.ipdcesgaccess2 -# application/vnd.dvb.ipdcesgpdd -# application/vnd.dvb.ipdcroaming -# application/vnd.dvb.iptv.alfec-base -# application/vnd.dvb.iptv.alfec-enhancement -# application/vnd.dvb.notif-aggregate-root+xml -# application/vnd.dvb.notif-container+xml -# application/vnd.dvb.notif-generic+xml -# application/vnd.dvb.notif-ia-msglist+xml -# application/vnd.dvb.notif-ia-registration-request+xml -# application/vnd.dvb.notif-ia-registration-response+xml -# application/vnd.dvb.notif-init+xml -# application/vnd.dvb.pfr -application/vnd.dvb.service svc -# application/vnd.dxr -application/vnd.dynageo geo -# application/vnd.easykaraoke.cdgdownload -# application/vnd.ecdis-update -application/vnd.ecowin.chart mag -# application/vnd.ecowin.filerequest -# application/vnd.ecowin.fileupdate -# application/vnd.ecowin.series -# application/vnd.ecowin.seriesrequest -# application/vnd.ecowin.seriesupdate -# application/vnd.emclient.accessrequest+xml -application/vnd.enliven nml -# application/vnd.eprints.data+xml -application/vnd.epson.esf esf -application/vnd.epson.msf msf -application/vnd.epson.quickanime qam -application/vnd.epson.salt slt -application/vnd.epson.ssf ssf -# application/vnd.ericsson.quickcall -application/vnd.eszigno3+xml es3 et3 -# application/vnd.etsi.aoc+xml -# application/vnd.etsi.cug+xml -# application/vnd.etsi.iptvcommand+xml -# application/vnd.etsi.iptvdiscovery+xml -# application/vnd.etsi.iptvprofile+xml -# application/vnd.etsi.iptvsad-bc+xml -# application/vnd.etsi.iptvsad-cod+xml -# application/vnd.etsi.iptvsad-npvr+xml -# application/vnd.etsi.iptvservice+xml -# application/vnd.etsi.iptvsync+xml -# application/vnd.etsi.iptvueprofile+xml -# application/vnd.etsi.mcid+xml -# application/vnd.etsi.overload-control-policy-dataset+xml -# application/vnd.etsi.sci+xml -# application/vnd.etsi.simservs+xml -# application/vnd.etsi.tsl+xml -# application/vnd.etsi.tsl.der -# application/vnd.eudora.data -application/vnd.ezpix-album ez2 -application/vnd.ezpix-package ez3 -# application/vnd.f-secure.mobile -application/vnd.fdf fdf -application/vnd.fdsn.mseed mseed -application/vnd.fdsn.seed seed dataless -# application/vnd.ffsns -# application/vnd.fints -application/vnd.flographit gph -application/vnd.fluxtime.clip ftc -# application/vnd.font-fontforge-sfd -application/vnd.framemaker fm frame maker book -application/vnd.frogans.fnc fnc -application/vnd.frogans.ltf ltf -application/vnd.fsc.weblaunch fsc -application/vnd.fujitsu.oasys oas -application/vnd.fujitsu.oasys2 oa2 -application/vnd.fujitsu.oasys3 oa3 -application/vnd.fujitsu.oasysgp fg5 -application/vnd.fujitsu.oasysprs bh2 -# application/vnd.fujixerox.art-ex -# application/vnd.fujixerox.art4 -# application/vnd.fujixerox.hbpl -application/vnd.fujixerox.ddd ddd -application/vnd.fujixerox.docuworks xdw -application/vnd.fujixerox.docuworks.binder xbd -# application/vnd.fut-misnet -application/vnd.fuzzysheet fzs -application/vnd.genomatix.tuxedo txd -# application/vnd.geocube+xml -application/vnd.geogebra.file ggb -application/vnd.geogebra.tool ggt -application/vnd.geometry-explorer gex gre -application/vnd.geonext gxt -application/vnd.geoplan g2w -application/vnd.geospace g3w -# application/vnd.globalplatform.card-content-mgt -# application/vnd.globalplatform.card-content-mgt-response -application/vnd.gmx gmx -application/vnd.google-earth.kml+xml kml -application/vnd.google-earth.kmz kmz -application/vnd.grafeq gqf gqs -# application/vnd.gridmp -application/vnd.groove-account gac -application/vnd.groove-help ghf -application/vnd.groove-identity-message gim -application/vnd.groove-injector grv -application/vnd.groove-tool-message gtm -application/vnd.groove-tool-template tpl -application/vnd.groove-vcard vcg -# application/vnd.hal+json -application/vnd.hal+xml hal -application/vnd.handheld-entertainment+xml zmm -application/vnd.hbci hbci -# application/vnd.hcl-bireports -application/vnd.hhe.lesson-player les -application/vnd.hp-hpgl hpgl -application/vnd.hp-hpid hpid -application/vnd.hp-hps hps -application/vnd.hp-jlyt jlt -application/vnd.hp-pcl pcl -application/vnd.hp-pclxl pclxl -# application/vnd.httphone -application/vnd.hydrostatix.sof-data sfd-hdstx -# application/vnd.hzn-3d-crossword -# application/vnd.ibm.afplinedata -# application/vnd.ibm.electronic-media -application/vnd.ibm.minipay mpy -application/vnd.ibm.modcap afp listafp list3820 -application/vnd.ibm.rights-management irm -application/vnd.ibm.secure-container sc -application/vnd.iccprofile icc icm -application/vnd.igloader igl -application/vnd.immervision-ivp ivp -application/vnd.immervision-ivu ivu -# application/vnd.informedcontrol.rms+xml -# application/vnd.informix-visionary -# application/vnd.infotech.project -# application/vnd.infotech.project+xml -# application/vnd.innopath.wamp.notification -application/vnd.insors.igm igm -application/vnd.intercon.formnet xpw xpx -application/vnd.intergeo i2g -# application/vnd.intertrust.digibox -# application/vnd.intertrust.nncp -application/vnd.intu.qbo qbo -application/vnd.intu.qfx qfx -# application/vnd.iptc.g2.conceptitem+xml -# application/vnd.iptc.g2.knowledgeitem+xml -# application/vnd.iptc.g2.newsitem+xml -# application/vnd.iptc.g2.newsmessage+xml -# application/vnd.iptc.g2.packageitem+xml -# application/vnd.iptc.g2.planningitem+xml -application/vnd.ipunplugged.rcprofile rcprofile -application/vnd.irepository.package+xml irp -application/vnd.is-xpr xpr -application/vnd.isac.fcs fcs -application/vnd.jam jam -# application/vnd.japannet-directory-service -# application/vnd.japannet-jpnstore-wakeup -# application/vnd.japannet-payment-wakeup -# application/vnd.japannet-registration -# application/vnd.japannet-registration-wakeup -# application/vnd.japannet-setstore-wakeup -# application/vnd.japannet-verification -# application/vnd.japannet-verification-wakeup -application/vnd.jcp.javame.midlet-rms rms -application/vnd.jisp jisp -application/vnd.joost.joda-archive joda -application/vnd.kahootz ktz ktr -application/vnd.kde.karbon karbon -application/vnd.kde.kchart chrt -application/vnd.kde.kformula kfo -application/vnd.kde.kivio flw -application/vnd.kde.kontour kon -application/vnd.kde.kpresenter kpr kpt -application/vnd.kde.kspread ksp -application/vnd.kde.kword kwd kwt -application/vnd.kenameaapp htke -application/vnd.kidspiration kia -application/vnd.kinar kne knp -application/vnd.koan skp skd skt skm -application/vnd.kodak-descriptor sse -application/vnd.las.las+xml lasxml -# application/vnd.liberty-request+xml -application/vnd.llamagraphics.life-balance.desktop lbd -application/vnd.llamagraphics.life-balance.exchange+xml lbe -application/vnd.lotus-1-2-3 123 -application/vnd.lotus-approach apr -application/vnd.lotus-freelance pre -application/vnd.lotus-notes nsf -application/vnd.lotus-organizer org -application/vnd.lotus-screencam scm -application/vnd.lotus-wordpro lwp -application/vnd.macports.portpkg portpkg -# application/vnd.marlin.drm.actiontoken+xml -# application/vnd.marlin.drm.conftoken+xml -# application/vnd.marlin.drm.license+xml -# application/vnd.marlin.drm.mdcf -application/vnd.mcd mcd -application/vnd.medcalcdata mc1 -application/vnd.mediastation.cdkey cdkey -# application/vnd.meridian-slingshot -application/vnd.mfer mwf -application/vnd.mfmp mfm -application/vnd.micrografx.flo flo -application/vnd.micrografx.igx igx -application/vnd.mif mif -# application/vnd.minisoft-hp3000-save -# application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf daf -application/vnd.mobius.dis dis -application/vnd.mobius.mbk mbk -application/vnd.mobius.mqy mqy -application/vnd.mobius.msl msl -application/vnd.mobius.plc plc -application/vnd.mobius.txf txf -application/vnd.mophun.application mpn -application/vnd.mophun.certificate mpc -# application/vnd.motorola.flexsuite -# application/vnd.motorola.flexsuite.adsi -# application/vnd.motorola.flexsuite.fis -# application/vnd.motorola.flexsuite.gotap -# application/vnd.motorola.flexsuite.kmr -# application/vnd.motorola.flexsuite.ttc -# application/vnd.motorola.flexsuite.wem -# application/vnd.motorola.iprm -application/vnd.mozilla.xul+xml xul -application/vnd.ms-artgalry cil -# application/vnd.ms-asf -application/vnd.ms-cab-compressed cab -# application/vnd.ms-color.iccprofile -application/vnd.ms-excel xls xlm xla xlc xlt xlw -application/vnd.ms-excel.addin.macroenabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb -application/vnd.ms-excel.sheet.macroenabled.12 xlsm -application/vnd.ms-excel.template.macroenabled.12 xltm -application/vnd.ms-fontobject eot -application/vnd.ms-htmlhelp chm -application/vnd.ms-ims ims -application/vnd.ms-lrm lrm -# application/vnd.ms-office.activex+xml -application/vnd.ms-officetheme thmx -# application/vnd.ms-opentype -# application/vnd.ms-package.obfuscated-opentype -application/vnd.ms-pki.seccat cat -application/vnd.ms-pki.stl stl -# application/vnd.ms-playready.initiator+xml -application/vnd.ms-powerpoint ppt pps pot -application/vnd.ms-powerpoint.addin.macroenabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm -application/vnd.ms-powerpoint.slide.macroenabled.12 sldm -application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm -application/vnd.ms-powerpoint.template.macroenabled.12 potm -# application/vnd.ms-printing.printticket+xml -application/vnd.ms-project mpp mpt -# application/vnd.ms-tnef -# application/vnd.ms-wmdrm.lic-chlg-req -# application/vnd.ms-wmdrm.lic-resp -# application/vnd.ms-wmdrm.meter-chlg-req -# application/vnd.ms-wmdrm.meter-resp -application/vnd.ms-word.document.macroenabled.12 docm -application/vnd.ms-word.template.macroenabled.12 dotm -application/vnd.ms-works wps wks wcm wdb -application/vnd.ms-wpl wpl -application/vnd.ms-xpsdocument xps -application/vnd.mseq mseq -# application/vnd.msign -# application/vnd.multiad.creator -# application/vnd.multiad.creator.cif -# application/vnd.music-niff -application/vnd.musician mus -application/vnd.muvee.style msty -application/vnd.mynfc taglet -# application/vnd.ncd.control -# application/vnd.ncd.reference -# application/vnd.nervana -# application/vnd.netfpx -application/vnd.neurolanguage.nlu nlu -application/vnd.nitf ntf nitf -application/vnd.noblenet-directory nnd -application/vnd.noblenet-sealer nns -application/vnd.noblenet-web nnw -# application/vnd.nokia.catalogs -# application/vnd.nokia.conml+wbxml -# application/vnd.nokia.conml+xml -# application/vnd.nokia.isds-radio-presets -# application/vnd.nokia.iptv.config+xml -# application/vnd.nokia.landmark+wbxml -# application/vnd.nokia.landmark+xml -# application/vnd.nokia.landmarkcollection+xml -# application/vnd.nokia.n-gage.ac+xml -application/vnd.nokia.n-gage.data ngdat -application/vnd.nokia.n-gage.symbian.install n-gage -# application/vnd.nokia.ncd -# application/vnd.nokia.pcd+wbxml -# application/vnd.nokia.pcd+xml -application/vnd.nokia.radio-preset rpst -application/vnd.nokia.radio-presets rpss -application/vnd.novadigm.edm edm -application/vnd.novadigm.edx edx -application/vnd.novadigm.ext ext -# application/vnd.ntt-local.file-transfer -# application/vnd.ntt-local.sip-ta_remote -# application/vnd.ntt-local.sip-ta_tcp_stream -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template odft -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -# application/vnd.obn -# application/vnd.oftn.l10n+json -# application/vnd.oipf.contentaccessdownload+xml -# application/vnd.oipf.contentaccessstreaming+xml -# application/vnd.oipf.cspg-hexbinary -# application/vnd.oipf.dae.svg+xml -# application/vnd.oipf.dae.xhtml+xml -# application/vnd.oipf.mippvcontrolmessage+xml -# application/vnd.oipf.pae.gem -# application/vnd.oipf.spdiscovery+xml -# application/vnd.oipf.spdlist+xml -# application/vnd.oipf.ueprofile+xml -# application/vnd.oipf.userprofile+xml -application/vnd.olpc-sugar xo -# application/vnd.oma-scws-config -# application/vnd.oma-scws-http-request -# application/vnd.oma-scws-http-response -# application/vnd.oma.bcast.associated-procedure-parameter+xml -# application/vnd.oma.bcast.drm-trigger+xml -# application/vnd.oma.bcast.imd+xml -# application/vnd.oma.bcast.ltkm -# application/vnd.oma.bcast.notification+xml -# application/vnd.oma.bcast.provisioningtrigger -# application/vnd.oma.bcast.sgboot -# application/vnd.oma.bcast.sgdd+xml -# application/vnd.oma.bcast.sgdu -# application/vnd.oma.bcast.simple-symbol-container -# application/vnd.oma.bcast.smartcard-trigger+xml -# application/vnd.oma.bcast.sprov+xml -# application/vnd.oma.bcast.stkm -# application/vnd.oma.cab-address-book+xml -# application/vnd.oma.cab-feature-handler+xml -# application/vnd.oma.cab-pcc+xml -# application/vnd.oma.cab-user-prefs+xml -# application/vnd.oma.dcd -# application/vnd.oma.dcdc -application/vnd.oma.dd2+xml dd2 -# application/vnd.oma.drm.risd+xml -# application/vnd.oma.group-usage-list+xml -# application/vnd.oma.pal+xml -# application/vnd.oma.poc.detailed-progress-report+xml -# application/vnd.oma.poc.final-report+xml -# application/vnd.oma.poc.groups+xml -# application/vnd.oma.poc.invocation-descriptor+xml -# application/vnd.oma.poc.optimized-progress-report+xml -# application/vnd.oma.push -# application/vnd.oma.scidm.messages+xml -# application/vnd.oma.xcap-directory+xml -# application/vnd.omads-email+xml -# application/vnd.omads-file+xml -# application/vnd.omads-folder+xml -# application/vnd.omaloc-supl-init -application/vnd.openofficeorg.extension oxt -# application/vnd.openxmlformats-officedocument.custom-properties+xml -# application/vnd.openxmlformats-officedocument.customxmlproperties+xml -# application/vnd.openxmlformats-officedocument.drawing+xml -# application/vnd.openxmlformats-officedocument.drawingml.chart+xml -# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml -# application/vnd.openxmlformats-officedocument.extended-properties+xml -# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml -# application/vnd.openxmlformats-officedocument.presentationml.comments+xml -# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml -application/vnd.openxmlformats-officedocument.presentationml.slide sldx -# application/vnd.openxmlformats-officedocument.presentationml.slide+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml -# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml -# application/vnd.openxmlformats-officedocument.presentationml.tags+xml -application/vnd.openxmlformats-officedocument.presentationml.template potx -# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml -# application/vnd.openxmlformats-officedocument.theme+xml -# application/vnd.openxmlformats-officedocument.themeoverride+xml -# application/vnd.openxmlformats-officedocument.vmldrawing -# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml -# application/vnd.openxmlformats-package.core-properties+xml -# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml -# application/vnd.openxmlformats-package.relationships+xml -# application/vnd.quobject-quoxdocument -# application/vnd.osa.netdeploy -application/vnd.osgeo.mapguide.package mgp -# application/vnd.osgi.bundle -application/vnd.osgi.dp dp -application/vnd.osgi.subsystem esa -# application/vnd.otps.ct-kip+xml -application/vnd.palm pdb pqa oprc -# application/vnd.paos.xml -application/vnd.pawaafile paw -application/vnd.pg.format str -application/vnd.pg.osasli ei6 -# application/vnd.piaccess.application-licence -application/vnd.picsel efif -application/vnd.pmi.widget wg -# application/vnd.poc.group-advertisement+xml -application/vnd.pocketlearn plf -application/vnd.powerbuilder6 pbd -# application/vnd.powerbuilder6-s -# application/vnd.powerbuilder7 -# application/vnd.powerbuilder7-s -# application/vnd.powerbuilder75 -# application/vnd.powerbuilder75-s -# application/vnd.preminet -application/vnd.previewsystems.box box -application/vnd.proteus.magazine mgz -application/vnd.publishare-delta-tree qps -application/vnd.pvi.ptid1 ptid -# application/vnd.pwg-multiplexed -# application/vnd.pwg-xhtml-print+xml -# application/vnd.qualcomm.brew-app-res -application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb -# application/vnd.radisys.moml+xml -# application/vnd.radisys.msml+xml -# application/vnd.radisys.msml-audit+xml -# application/vnd.radisys.msml-audit-conf+xml -# application/vnd.radisys.msml-audit-conn+xml -# application/vnd.radisys.msml-audit-dialog+xml -# application/vnd.radisys.msml-audit-stream+xml -# application/vnd.radisys.msml-conf+xml -# application/vnd.radisys.msml-dialog+xml -# application/vnd.radisys.msml-dialog-base+xml -# application/vnd.radisys.msml-dialog-fax-detect+xml -# application/vnd.radisys.msml-dialog-fax-sendrecv+xml -# application/vnd.radisys.msml-dialog-group+xml -# application/vnd.radisys.msml-dialog-speech+xml -# application/vnd.radisys.msml-dialog-transform+xml -# application/vnd.rainstor.data -# application/vnd.rapid -application/vnd.realvnc.bed bed -application/vnd.recordare.musicxml mxl -application/vnd.recordare.musicxml+xml musicxml -# application/vnd.renlearn.rlprint -application/vnd.rig.cryptonote cryptonote -application/vnd.rim.cod cod -application/vnd.rn-realmedia rm -application/vnd.rn-realmedia-vbr rmvb -application/vnd.route66.link66+xml link66 -# application/vnd.rs-274x -# application/vnd.ruckus.download -# application/vnd.s3sms -application/vnd.sailingtracker.track st -# application/vnd.sbm.cid -# application/vnd.sbm.mid2 -# application/vnd.scribus -# application/vnd.sealed.3df -# application/vnd.sealed.csf -# application/vnd.sealed.doc -# application/vnd.sealed.eml -# application/vnd.sealed.mht -# application/vnd.sealed.net -# application/vnd.sealed.ppt -# application/vnd.sealed.tiff -# application/vnd.sealed.xls -# application/vnd.sealedmedia.softseal.html -# application/vnd.sealedmedia.softseal.pdf -application/vnd.seemail see -application/vnd.sema sema -application/vnd.semd semd -application/vnd.semf semf -application/vnd.shana.informed.formdata ifm -application/vnd.shana.informed.formtemplate itp -application/vnd.shana.informed.interchange iif -application/vnd.shana.informed.package ipk -application/vnd.simtech-mindmapper twd twds -application/vnd.smaf mmf -# application/vnd.smart.notebook -application/vnd.smart.teacher teacher -# application/vnd.software602.filler.form+xml -# application/vnd.software602.filler.form-xml-zip -application/vnd.solent.sdkm+xml sdkm sdkd -application/vnd.spotfire.dxp dxp -application/vnd.spotfire.sfs sfs -# application/vnd.sss-cod -# application/vnd.sss-dtf -# application/vnd.sss-ntf -application/vnd.stardivision.calc sdc -application/vnd.stardivision.draw sda -application/vnd.stardivision.impress sdd -application/vnd.stardivision.math smf -application/vnd.stardivision.writer sdw vor -application/vnd.stardivision.writer-global sgl -application/vnd.stepmania.package smzip -application/vnd.stepmania.stepchart sm -# application/vnd.street-stream -application/vnd.sun.xml.calc sxc -application/vnd.sun.xml.calc.template stc -application/vnd.sun.xml.draw sxd -application/vnd.sun.xml.draw.template std -application/vnd.sun.xml.impress sxi -application/vnd.sun.xml.impress.template sti -application/vnd.sun.xml.math sxm -application/vnd.sun.xml.writer sxw -application/vnd.sun.xml.writer.global sxg -application/vnd.sun.xml.writer.template stw -# application/vnd.sun.wadl+xml -application/vnd.sus-calendar sus susp -application/vnd.svd svd -# application/vnd.swiftview-ics -application/vnd.symbian.install sis sisx -application/vnd.syncml+xml xsm -application/vnd.syncml.dm+wbxml bdm -application/vnd.syncml.dm+xml xdm -# application/vnd.syncml.dm.notification -# application/vnd.syncml.ds.notification -application/vnd.tao.intent-module-archive tao -application/vnd.tcpdump.pcap pcap cap dmp -application/vnd.tmobile-livetv tmo -application/vnd.trid.tpt tpt -application/vnd.triscape.mxs mxs -application/vnd.trueapp tra -# application/vnd.truedoc -# application/vnd.ubisoft.webplayer -application/vnd.ufdl ufd ufdl -application/vnd.uiq.theme utz -application/vnd.umajin umj -application/vnd.unity unityweb -application/vnd.uoml+xml uoml -# application/vnd.uplanet.alert -# application/vnd.uplanet.alert-wbxml -# application/vnd.uplanet.bearer-choice -# application/vnd.uplanet.bearer-choice-wbxml -# application/vnd.uplanet.cacheop -# application/vnd.uplanet.cacheop-wbxml -# application/vnd.uplanet.channel -# application/vnd.uplanet.channel-wbxml -# application/vnd.uplanet.list -# application/vnd.uplanet.list-wbxml -# application/vnd.uplanet.listcmd -# application/vnd.uplanet.listcmd-wbxml -# application/vnd.uplanet.signal -application/vnd.vcx vcx -# application/vnd.vd-study -# application/vnd.vectorworks -# application/vnd.verimatrix.vcas -# application/vnd.vidsoft.vidconference -application/vnd.visio vsd vst vss vsw -application/vnd.visionary vis -# application/vnd.vividence.scriptfile -application/vnd.vsf vsf -# application/vnd.wap.sic -# application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo wtb -# application/vnd.wfa.wsc -# application/vnd.wmc -# application/vnd.wmf.bootstrap -# application/vnd.wolfram.mathematica -# application/vnd.wolfram.mathematica.package -application/vnd.wolfram.player nbp -application/vnd.wordperfect wpd -application/vnd.wqd wqd -# application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf stf -# application/vnd.wv.csp+wbxml -# application/vnd.wv.csp+xml -# application/vnd.wv.ssp+xml -application/vnd.xara xar -application/vnd.xfdl xfdl -# application/vnd.xfdl.webform -# application/vnd.xmi+xml -# application/vnd.xmpie.cpkg -# application/vnd.xmpie.dpkg -# application/vnd.xmpie.plan -# application/vnd.xmpie.ppkg -# application/vnd.xmpie.xlim -application/vnd.yamaha.hv-dic hvd -application/vnd.yamaha.hv-script hvs -application/vnd.yamaha.hv-voice hvp -application/vnd.yamaha.openscoreformat osf -application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg -# application/vnd.yamaha.remote-setup -application/vnd.yamaha.smaf-audio saf -application/vnd.yamaha.smaf-phrase spf -# application/vnd.yamaha.through-ngn -# application/vnd.yamaha.tunnel-udpencap -application/vnd.yellowriver-custom-menu cmp -application/vnd.zul zir zirz -application/vnd.zzazz.deck+xml zaz -application/voicexml+xml vxml -# application/vq-rtcpxr -# application/watcherinfo+xml -# application/whoispp-query -# application/whoispp-response -application/widget wgt -application/winhlp hlp -# application/wita -# application/wordperfect5.1 -application/wsdl+xml wsdl -application/wspolicy+xml wspolicy -application/x-7z-compressed 7z -application/x-abiword abw -application/x-ace-compressed ace -# application/x-amf -application/x-apple-diskimage dmg -application/x-authorware-bin aab x32 u32 vox -application/x-authorware-map aam -application/x-authorware-seg aas -application/x-bcpio bcpio -application/x-bittorrent torrent -application/x-blorb blb blorb -application/x-bzip bz -application/x-bzip2 bz2 boz -application/x-cbr cbr cba cbt cbz cb7 -application/x-cdlink vcd -application/x-cfs-compressed cfs -application/x-chat chat -application/x-chess-pgn pgn -application/x-conference nsc -# application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-debian-package deb udeb -application/x-dgc-compressed dgc -application/x-director dir dcr dxr cst cct cxt w3d fgd swa -application/x-doom wad -application/x-dtbncx+xml ncx -application/x-dtbook+xml dtb -application/x-dtbresource+xml res -application/x-dvi dvi -application/x-envoy evy -application/x-eva eva -application/x-font-bdf bdf -# application/x-font-dos -# application/x-font-framemaker -application/x-font-ghostscript gsf -# application/x-font-libgrx -application/x-font-linux-psf psf -application/x-font-otf otf -application/x-font-pcf pcf -application/x-font-snf snf -# application/x-font-speedo -# application/x-font-sunos-news -application/x-font-ttf ttf ttc -application/x-font-type1 pfa pfb pfm afm -application/x-font-woff woff -# application/x-font-vfont -application/x-freearc arc -application/x-futuresplash spl -application/x-gca-compressed gca -application/x-glulx ulx -application/x-gnumeric gnumeric -application/x-gramps-xml gramps -application/x-gtar gtar -# application/x-gzip -application/x-hdf hdf -application/x-install-instructions install -application/x-iso9660-image iso -application/x-java-jnlp-file jnlp -application/x-latex latex -application/x-lzh-compressed lzh lha -application/x-mie mie -application/x-mobipocket-ebook prc mobi -application/x-ms-application application -application/x-ms-shortcut lnk -application/x-ms-wmd wmd -application/x-ms-wmz wmz -application/x-ms-xbap xbap -application/x-msaccess mdb -application/x-msbinder obd -application/x-mscardfile crd -application/x-msclip clp -application/x-msdownload exe dll com bat msi -application/x-msmediaview mvb m13 m14 -application/x-msmetafile wmf wmz emf emz -application/x-msmoney mny -application/x-mspublisher pub -application/x-msschedule scd -application/x-msterminal trm -application/x-mswrite wri -application/x-netcdf nc cdf -application/x-nzb nzb -application/x-pkcs12 p12 pfx -application/x-pkcs7-certificates p7b spc -application/x-pkcs7-certreqresp p7r -application/x-rar-compressed rar -application/x-research-info-systems ris -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-silverlight-app xap -application/x-sql sql -application/x-stuffit sit -application/x-stuffitx sitx -application/x-subrip srt -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-t3vm-image t3 -application/x-tads gam -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-tex-tfm tfm -application/x-texinfo texinfo texi -application/x-tgif obj -application/x-ustar ustar -application/x-wais-source src -application/x-x509-ca-cert der crt -application/x-xfig fig -application/x-xliff+xml xlf -application/x-xpinstall xpi -application/x-xz xz -application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 -# application/x400-bp -application/xaml+xml xaml -# application/xcap-att+xml -# application/xcap-caps+xml -application/xcap-diff+xml xdf -# application/xcap-el+xml -# application/xcap-error+xml -# application/xcap-ns+xml -# application/xcon-conference-info-diff+xml -# application/xcon-conference-info+xml -application/xenc+xml xenc -application/xhtml+xml xhtml xht -# application/xhtml-voice+xml -application/xml xml xsl -application/xml-dtd dtd -# application/xml-external-parsed-entity -# application/xmpp+xml -application/xop+xml xop -application/xproc+xml xpl -application/xslt+xml xslt -application/xspf+xml xspf -application/xv+xml mxml xhvml xvml xvm -application/yang yang -application/yin+xml yin -application/zip zip -# audio/1d-interleaved-parityfec -# audio/32kadpcm -# audio/3gpp -# audio/3gpp2 -# audio/ac3 -audio/adpcm adp -# audio/amr -# audio/amr-wb -# audio/amr-wb+ -# audio/asc -# audio/atrac-advanced-lossless -# audio/atrac-x -# audio/atrac3 -audio/basic au snd -# audio/bv16 -# audio/bv32 -# audio/clearmode -# audio/cn -# audio/dat12 -# audio/dls -# audio/dsr-es201108 -# audio/dsr-es202050 -# audio/dsr-es202211 -# audio/dsr-es202212 -# audio/dv -# audio/dvi4 -# audio/eac3 -# audio/evrc -# audio/evrc-qcp -# audio/evrc0 -# audio/evrc1 -# audio/evrcb -# audio/evrcb0 -# audio/evrcb1 -# audio/evrcwb -# audio/evrcwb0 -# audio/evrcwb1 -# audio/example -# audio/fwdred -# audio/g719 -# audio/g722 -# audio/g7221 -# audio/g723 -# audio/g726-16 -# audio/g726-24 -# audio/g726-32 -# audio/g726-40 -# audio/g728 -# audio/g729 -# audio/g7291 -# audio/g729d -# audio/g729e -# audio/gsm -# audio/gsm-efr -# audio/gsm-hr-08 -# audio/ilbc -# audio/ip-mr_v2.5 -# audio/isac -# audio/l16 -# audio/l20 -# audio/l24 -# audio/l8 -# audio/lpc -audio/midi mid midi kar rmi -# audio/mobile-xmf -audio/mp4 mp4a -# audio/mp4a-latm -# audio/mpa -# audio/mpa-robust -audio/mpeg mpga mp2 mp2a mp3 m2a m3a -# audio/mpeg4-generic -# audio/musepack -audio/ogg oga ogg spx -# audio/opus -# audio/parityfec -# audio/pcma -# audio/pcma-wb -# audio/pcmu-wb -# audio/pcmu -# audio/prs.sid -# audio/qcelp -# audio/red -# audio/rtp-enc-aescm128 -# audio/rtp-midi -# audio/rtx -audio/s3m s3m -audio/silk sil -# audio/smv -# audio/smv0 -# audio/smv-qcp -# audio/sp-midi -# audio/speex -# audio/t140c -# audio/t38 -# audio/telephone-event -# audio/tone -# audio/uemclip -# audio/ulpfec -# audio/vdvi -# audio/vmr-wb -# audio/vnd.3gpp.iufp -# audio/vnd.4sb -# audio/vnd.audiokoz -# audio/vnd.celp -# audio/vnd.cisco.nse -# audio/vnd.cmles.radio-events -# audio/vnd.cns.anp1 -# audio/vnd.cns.inf1 -audio/vnd.dece.audio uva uvva -audio/vnd.digital-winds eol -# audio/vnd.dlna.adts -# audio/vnd.dolby.heaac.1 -# audio/vnd.dolby.heaac.2 -# audio/vnd.dolby.mlp -# audio/vnd.dolby.mps -# audio/vnd.dolby.pl2 -# audio/vnd.dolby.pl2x -# audio/vnd.dolby.pl2z -# audio/vnd.dolby.pulse.1 -audio/vnd.dra dra -audio/vnd.dts dts -audio/vnd.dts.hd dtshd -# audio/vnd.dvb.file -# audio/vnd.everad.plj -# audio/vnd.hns.audio -audio/vnd.lucent.voice lvp -audio/vnd.ms-playready.media.pya pya -# audio/vnd.nokia.mobile-xmf -# audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 ecelp4800 -audio/vnd.nuera.ecelp7470 ecelp7470 -audio/vnd.nuera.ecelp9600 ecelp9600 -# audio/vnd.octel.sbc -# audio/vnd.qcelp -# audio/vnd.rhetorex.32kadpcm -audio/vnd.rip rip -# audio/vnd.sealedmedia.softseal.mpeg -# audio/vnd.vmx.cvsd -# audio/vorbis -# audio/vorbis-config -audio/webm weba -audio/x-aac aac -audio/x-aiff aif aiff aifc -audio/x-caf caf -audio/x-flac flac -audio/x-matroska mka -audio/x-mpegurl m3u -audio/x-ms-wax wax -audio/x-ms-wma wma -audio/x-pn-realaudio ram ra -audio/x-pn-realaudio-plugin rmp -# audio/x-tta -audio/x-wav wav -audio/xm xm -chemical/x-cdx cdx -chemical/x-cif cif -chemical/x-cmdf cmdf -chemical/x-cml cml -chemical/x-csml csml -# chemical/x-pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -# image/example -# image/fits -image/g3fax g3 -image/gif gif -image/ief ief -# image/jp2 -image/jpeg jpeg jpg jpe -# image/jpm -# image/jpx -image/ktx ktx -# image/naplps -image/png png -image/prs.btif btif -# image/prs.pti -image/sgi sgi -image/svg+xml svg svgz -# image/t38 -image/tiff tiff tif -# image/tiff-fx -image/vnd.adobe.photoshop psd -# image/vnd.cns.inf2 -image/vnd.dece.graphic uvi uvvi uvg uvvg -image/vnd.dvb.subtitle sub -image/vnd.djvu djvu djv -image/vnd.dwg dwg -image/vnd.dxf dxf -image/vnd.fastbidsheet fbs -image/vnd.fpx fpx -image/vnd.fst fst -image/vnd.fujixerox.edmics-mmr mmr -image/vnd.fujixerox.edmics-rlc rlc -# image/vnd.globalgraphics.pgb -# image/vnd.microsoft.icon -# image/vnd.mix -image/vnd.ms-modi mdi -image/vnd.ms-photo wdp -image/vnd.net-fpx npx -# image/vnd.radiance -# image/vnd.sealed.png -# image/vnd.sealedmedia.softseal.gif -# image/vnd.sealedmedia.softseal.jpg -# image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff xif -image/webp webp -image/x-3ds 3ds -image/x-cmu-raster ras -image/x-cmx cmx -image/x-freehand fh fhc fh4 fh5 fh7 -image/x-icon ico -image/x-mrsid-image sid -image/x-pcx pcx -image/x-pict pic pct -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-tga tga -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -# message/cpim -# message/delivery-status -# message/disposition-notification -# message/example -# message/external-body -# message/feedback-report -# message/global -# message/global-delivery-status -# message/global-disposition-notification -# message/global-headers -# message/http -# message/imdn+xml -# message/news -# message/partial -message/rfc822 eml mime -# message/s-http -# message/sip -# message/sipfrag -# message/tracking-status -# message/vnd.si.simp -# model/example -model/iges igs iges -model/mesh msh mesh silo -model/vnd.collada+xml dae -model/vnd.dwf dwf -# model/vnd.flatland.3dml -model/vnd.gdl gdl -# model/vnd.gs-gdl -# model/vnd.gs.gdl -model/vnd.gtw gtw -# model/vnd.moml+xml -model/vnd.mts mts -# model/vnd.parasolid.transmit.binary -# model/vnd.parasolid.transmit.text -model/vnd.vtu vtu -model/vrml wrl vrml -model/x3d+binary x3db x3dbz -model/x3d+vrml x3dv x3dvz -model/x3d+xml x3d x3dz -# multipart/alternative -# multipart/appledouble -# multipart/byteranges -# multipart/digest -# multipart/encrypted -# multipart/example -# multipart/form-data -# multipart/header-set -# multipart/mixed -# multipart/parallel -# multipart/related -# multipart/report -# multipart/signed -# multipart/voice-message -# text/1d-interleaved-parityfec -text/cache-manifest appcache -text/calendar ics ifb -text/css css -text/csv csv -# text/directory -# text/dns -# text/ecmascript -# text/enriched -# text/example -# text/fwdred -text/html html htm -# text/javascript -text/n3 n3 -# text/parityfec -text/plain txt text conf def list log in -# text/prs.fallenstein.rst -text/prs.lines.tag dsc -# text/vnd.radisys.msml-basic-layout -# text/red -# text/rfc822-headers -text/richtext rtx -# text/rtf -# text/rtp-enc-aescm128 -# text/rtx -text/sgml sgml sgm -# text/t140 -text/tab-separated-values tsv -text/troff t tr roff man me ms -text/turtle ttl -# text/ulpfec -text/uri-list uri uris urls -text/vcard vcard -# text/vnd.abc -text/vnd.curl curl -text/vnd.curl.dcurl dcurl -text/vnd.curl.scurl scurl -text/vnd.curl.mcurl mcurl -# text/vnd.dmclientscript -text/vnd.dvb.subtitle sub -# text/vnd.esmertec.theme-descriptor -text/vnd.fly fly -text/vnd.fmi.flexstor flx -text/vnd.graphviz gv -text/vnd.in3d.3dml 3dml -text/vnd.in3d.spot spot -# text/vnd.iptc.newsml -# text/vnd.iptc.nitf -# text/vnd.latex-z -# text/vnd.motorola.reflex -# text/vnd.ms-mediapackage -# text/vnd.net2phone.commcenter.command -# text/vnd.si.uricatalogue -text/vnd.sun.j2me.app-descriptor jad -# text/vnd.trolltech.linguist -# text/vnd.wap.si -# text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-asm s asm -text/x-c c cc cxx cpp h hh dic -text/x-fortran f for f77 f90 -text/x-java-source java -text/x-opml opml -text/x-pascal p pas -text/x-nfo nfo -text/x-setext etx -text/x-sfv sfv -text/x-uuencode uu -text/x-vcalendar vcs -text/x-vcard vcf -# text/xml -# text/xml-external-parsed-entity -# video/1d-interleaved-parityfec -video/3gpp 3gp -# video/3gpp-tt -video/3gpp2 3g2 -# video/bmpeg -# video/bt656 -# video/celb -# video/dv -# video/example -video/h261 h261 -video/h263 h263 -# video/h263-1998 -# video/h263-2000 -video/h264 h264 -# video/h264-rcdo -# video/h264-svc -video/jpeg jpgv -# video/jpeg2000 -video/jpm jpm jpgm -video/mj2 mj2 mjp2 -# video/mp1s -# video/mp2p -# video/mp2t -video/mp4 mp4 mp4v mpg4 -# video/mp4v-es -video/mpeg mpeg mpg mpe m1v m2v -# video/mpeg4-generic -# video/mpv -# video/nv -video/ogg ogv -# video/parityfec -# video/pointer -video/quicktime qt mov -# video/raw -# video/rtp-enc-aescm128 -# video/rtx -# video/smpte292m -# video/ulpfec -# video/vc1 -# video/vnd.cctv -video/vnd.dece.hd uvh uvvh -video/vnd.dece.mobile uvm uvvm -# video/vnd.dece.mp4 -video/vnd.dece.pd uvp uvvp -video/vnd.dece.sd uvs uvvs -video/vnd.dece.video uvv uvvv -# video/vnd.directv.mpeg -# video/vnd.directv.mpeg-tts -# video/vnd.dlna.mpeg-tts -video/vnd.dvb.file dvb -video/vnd.fvt fvt -# video/vnd.hns.video -# video/vnd.iptvforum.1dparityfec-1010 -# video/vnd.iptvforum.1dparityfec-2005 -# video/vnd.iptvforum.2dparityfec-1010 -# video/vnd.iptvforum.2dparityfec-2005 -# video/vnd.iptvforum.ttsavc -# video/vnd.iptvforum.ttsmpeg2 -# video/vnd.motorola.video -# video/vnd.motorola.videop -video/vnd.mpegurl mxu m4u -video/vnd.ms-playready.media.pyv pyv -# video/vnd.nokia.interleaved-multimedia -# video/vnd.nokia.videovoip -# video/vnd.objectvideo -# video/vnd.sealed.mpeg1 -# video/vnd.sealed.mpeg4 -# video/vnd.sealed.swf -# video/vnd.sealedmedia.softseal.mov -video/vnd.uvvu.mp4 uvu uvvu -video/vnd.vivo viv -video/webm webm -video/x-f4v f4v -video/x-fli fli -video/x-flv flv -video/x-m4v m4v -video/x-matroska mkv mk3d mks -video/x-mng mng -video/x-ms-asf asf asx -video/x-ms-vob vob -video/x-ms-wm wm -video/x-ms-wmv wmv -video/x-ms-wmx wmx -video/x-ms-wvx wvx -video/x-msvideo avi -video/x-sgi-movie movie -video/x-smv smv -x-conference/x-cooltalk ice diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/types/node.types b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/types/node.types deleted file mode 100644 index 9097334..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/node_modules/mime/types/node.types +++ /dev/null @@ -1,59 +0,0 @@ -# What: Google Chrome Extension -# Why: To allow apps to (work) be served with the right content type header. -# http://codereview.chromium.org/2830017 -# Added by: niftylettuce -application/x-chrome-extension crx - -# What: OTF Message Silencer -# Why: To silence the "Resource interpreted as font but transferred with MIME -# type font/otf" message that occurs in Google Chrome -# Added by: niftylettuce -font/opentype otf - -# What: HTC support -# Why: To properly render .htc files such as CSS3PIE -# Added by: niftylettuce -text/x-component htc - -# What: HTML5 application cache manifest -# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps -# per https://developer.mozilla.org/en/offline_resources_in_firefox -# Added by: louisremi -text/cache-manifest appcache manifest - -# What: node binary buffer format -# Why: semi-standard extension w/in the node community -# Added by: tootallnate -application/octet-stream buffer - -# What: The "protected" MP-4 formats used by iTunes. -# Why: Required for streaming music to browsers (?) -# Added by: broofa -application/mp4 m4p -audio/mp4 m4a - -# What: Music playlist format (http://en.wikipedia.org/wiki/M3U) -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -application/x-mpegURL m3u8 - -# What: Video format, Part of RFC1890 -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -video/MP2T ts - -# What: The FLAC lossless codec format -# Why: Streaming and serving FLAC audio -# Added by: jacobrask -audio/flac flac - -# What: EventSource mime type -# Why: mime type of Server-Sent Events stream -# http://www.w3.org/TR/eventsource/#text-event-stream -# Added by: francois2metz -text/event-stream event-stream - -# What: Mozilla App manifest mime type -# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests -# Added by: ednapiranha -application/x-web-app-manifest+json webapp diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/oauth.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/oauth.js deleted file mode 100644 index ebde3fd..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/oauth.js +++ /dev/null @@ -1,34 +0,0 @@ -var crypto = require('crypto') - , qs = require('querystring') - ; - -function sha1 (key, body) { - return crypto.createHmac('sha1', key).update(body).digest('base64') -} - -function rfc3986 (str) { - return encodeURIComponent(str) - .replace(/!/g,'%21') - .replace(/\*/g,'%2A') - .replace(/\(/g,'%28') - .replace(/\)/g,'%29') - .replace(/'/g,'%27') - ; -} - -function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { - // adapted from https://dev.twitter.com/docs/auth/oauth - var base = - (httpMethod || 'GET') + "&" + - encodeURIComponent( base_uri ) + "&" + - Object.keys(params).sort().map(function (i) { - // big WTF here with the escape + encoding but it's what twitter wants - return escape(rfc3986(i)) + "%3D" + escape(rfc3986(params[i])) - }).join("%26") - var key = encodeURIComponent(consumer_secret) + '&' - if (token_secret) key += encodeURIComponent(token_secret) - return sha1(key, base) -} - -exports.hmacsign = hmacsign -exports.rfc3986 = rfc3986 \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/package.json b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/package.json deleted file mode 100644 index 3b04856..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "request", - "description": "Simplified HTTP request client.", - "tags": [ - "http", - "simple", - "util", - "utility" - ], - "version": "2.11.4", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/mikeal/request.git" - }, - "bugs": { - "url": "http://github.com/mikeal/request/issues" - }, - "engines": [ - "node >= 0.3.6" - ], - "main": "./main", - "dependencies": { - "form-data": "~0.0.3", - "mime": "~1.2.7" - }, - "bundleDependencies": [ - "form-data", - "mime" - ], - "scripts": { - "test": "node tests/run.js" - }, - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "_id": "request@2.11.4", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.24", - "_nodeVersion": "v0.8.1", - "_defaultsLoaded": true, - "dist": { - "shasum": "6347d7d44e52dc588108cc1ce5cee975fc8926de", - "tarball": "http://registry.npmjs.org/request/-/request-2.11.4.tgz" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - } - ], - "directories": {}, - "_shasum": "6347d7d44e52dc588108cc1ce5cee975fc8926de", - "_from": "request@2.11.4", - "_resolved": "https://registry.npmjs.org/request/-/request-2.11.4.tgz" -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/googledoodle.png b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c5..0000000 Binary files a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/run.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/run.js deleted file mode 100644 index 538a65c..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/run.js +++ /dev/null @@ -1,45 +0,0 @@ -var spawn = require('child_process').spawn - , exitCode = 0 - ; - -var tests = [ - 'test-body.js' - , 'test-cookie.js' - , 'test-cookiejar.js' - , 'test-defaults.js' - , 'test-errors.js' - , 'test-form.js' - , 'test-follow-all-303.js' - , 'test-follow-all.js' - , 'test-headers.js' - , 'test-httpModule.js' - , 'test-https.js' - , 'test-https-strict.js' - , 'test-oauth.js' - , 'test-params.js' - , 'test-pipes.js' - , 'test-pool.js' - , 'test-protocol-changing-redirect.js' - , 'test-proxy.js' - , 'test-piped-redirect.js' - , 'test-qs.js' - , 'test-redirect.js' - , 'test-timeout.js' - , 'test-toJSON.js' - , 'test-tunnel.js' -] - -var next = function () { - if (tests.length === 0) process.exit(exitCode); - - var file = tests.shift() - console.log(file) - var proc = spawn('node', [ 'tests/' + file ]) - proc.stdout.pipe(process.stdout) - proc.stderr.pipe(process.stderr) - proc.on('exit', function (code) { - exitCode += code || 0 - next() - }) -} -next() diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/server.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/server.js deleted file mode 100644 index 5b7cb51..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/server.js +++ /dev/null @@ -1,86 +0,0 @@ -var fs = require('fs') - , http = require('http') - , path = require('path') - , https = require('https') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'http://localhost:'+port - return s; -} - -exports.createSSLServer = function(port, opts) { - port = port || 16767 - - var options = { 'key' : path.join(__dirname, 'ssl', 'test.key') - , 'cert': path.join(__dirname, 'ssl', 'test.crt') - } - if (opts) { - for (var i in opts) options[i] = opts[i] - } - - for (var i in options) { - options[i] = fs.readFileSync(options[i]) - } - - var s = https.createServer(options, function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'https://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (req.headers['content-type'] && req.headers['content-type'].indexOf('boundary=') >= 0) { - var boundary = req.headers['content-type'].split('boundary=')[1]; - text = text.replace(/__BOUNDARY__/g, boundary); - } - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} -exports.createChunkResponse = function (chunks, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - chunks.forEach(function (chunk) { - resp.write(chunk) - }) - resp.end() - } - return l; -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/squid.conf b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/squid.conf deleted file mode 100644 index 0d4a3b6..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/squid.conf +++ /dev/null @@ -1,77 +0,0 @@ -# -# Recommended minimum configuration: -# -acl manager proto cache_object -acl localhost src 127.0.0.1/32 ::1 -acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 - -# Example rule allowing access from your local networks. -# Adapt to list your (internal) IP networks from where browsing -# should be allowed -acl localnet src 10.0.0.0/8 # RFC1918 possible internal network -acl localnet src 172.16.0.0/12 # RFC1918 possible internal network -acl localnet src 192.168.0.0/16 # RFC1918 possible internal network -acl localnet src fc00::/7 # RFC 4193 local private network range -acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines - -acl SSL_ports port 443 -acl Safe_ports port 80 # http -acl Safe_ports port 21 # ftp -acl Safe_ports port 443 # https -acl Safe_ports port 70 # gopher -acl Safe_ports port 210 # wais -acl Safe_ports port 1025-65535 # unregistered ports -acl Safe_ports port 280 # http-mgmt -acl Safe_ports port 488 # gss-http -acl Safe_ports port 591 # filemaker -acl Safe_ports port 777 # multiling http -acl CONNECT method CONNECT - -# -# Recommended minimum Access Permission configuration: -# -# Only allow cachemgr access from localhost -http_access allow manager localhost -http_access deny manager - -# Deny requests to certain unsafe ports -http_access deny !Safe_ports - -# Deny CONNECT to other than secure SSL ports -#http_access deny CONNECT !SSL_ports - -# We strongly recommend the following be uncommented to protect innocent -# web applications running on the proxy server who think the only -# one who can access services on "localhost" is a local user -#http_access deny to_localhost - -# -# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS -# - -# Example rule allowing access from your local networks. -# Adapt localnet in the ACL section to list your (internal) IP networks -# from where browsing should be allowed -http_access allow localnet -http_access allow localhost - -# And finally deny all other access to this proxy -http_access deny all - -# Squid normally listens to port 3128 -http_port 3128 - -# We recommend you to use at least the following line. -hierarchy_stoplist cgi-bin ? - -# Uncomment and adjust the following to add a disk cache directory. -#cache_dir ufs /usr/local/var/cache 100 16 256 - -# Leave coredumps in the first cache dir -coredump_dir /usr/local/var/cache - -# Add any of your own refresh_pattern entries above these. -refresh_pattern ^ftp: 1440 20% 10080 -refresh_pattern ^gopher: 1440 0% 1440 -refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 -refresh_pattern . 0 20% 4320 diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.cnf b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.cnf deleted file mode 100644 index 425a889..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.cnf +++ /dev/null @@ -1,20 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no -output_password = password - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = request Certificate Authority -CN = requestCA -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.crl b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.crl deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.crt b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.crt deleted file mode 100644 index b4524e4..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.crt +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl -YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4 -5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ -5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD -xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB -ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm -D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo -88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj ------END CERTIFICATE----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.csr b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.csr deleted file mode 100644 index e48c56e..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.csr +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD -ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG -SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0 -deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br -44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB -AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3 -DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj -bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia -SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X ------END CERTIFICATE REQUEST----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.key b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.key deleted file mode 100644 index a53e7f7..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.key +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C8B5887048377F02 - -nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q -nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+ -GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH -gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38 -VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3 -/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb -4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U -gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR -Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh -FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf -dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC -uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb -EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.srl b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.srl deleted file mode 100644 index 17128db..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/ca.srl +++ /dev/null @@ -1 +0,0 @@ -ADF62016AA40C9C3 diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.cnf b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.cnf deleted file mode 100644 index cd1fd1e..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = testing -CN = testing.request.mikealrogers.com -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.crt b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.crt deleted file mode 100644 index efe96ce..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx -dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr -ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM -20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh -DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj -7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB -kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC -yapjN3RxZbInGhWR+jA= ------END CERTIFICATE----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.csr b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.csr deleted file mode 100644 index a8e7595..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.csr +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp -MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq -hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB -BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU -ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw -7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A -HidVJ/3u ------END CERTIFICATE REQUEST----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.js deleted file mode 100644 index 05e21c1..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.js +++ /dev/null @@ -1,28 +0,0 @@ -var fs = require("fs") -var https = require("https") -var options = { key: fs.readFileSync("./server.key") - , cert: fs.readFileSync("./server.crt") } - -var server = https.createServer(options, function (req, res) { - res.writeHead(200) - res.end() - server.close() -}) -server.listen(1337) - -var ca = fs.readFileSync("./ca.crt") -var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca }) - -https.request({ host: "localhost" - , method: "HEAD" - , port: 1337 - , headers: { host: "testing.request.mikealrogers.com" } - , agent: agent - , ca: [ ca ] - , path: "/" }, function (res) { - if (res.client.authorized) { - console.log("node test: OK") - } else { - throw new Error(res.client.authorizationError) - } -}).end() diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.key b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.key deleted file mode 100644 index 72d8698..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/ca/server.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB -iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW -gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0 -JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ -rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ -0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw== ------END RSA PRIVATE KEY----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/npm-ca.crt b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/npm-ca.crt deleted file mode 100644 index fde2fe9..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/npm-ca.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x -IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w -bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y -MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV -BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj -YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA -aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE -OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz -Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl -y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC -l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv -yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl -ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op ------END CERTIFICATE----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/test.crt b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/test.crt deleted file mode 100644 index b357f86..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/test.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU -SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo -ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx -MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV -BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz -dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto -wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj -eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV -l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4 -L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE -c7U8F6MWLQ== ------END CERTIFICATE----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/test.key b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/test.key deleted file mode 100644 index b85810d..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/ssl/test.key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt -NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE -mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB -AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt -Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ -fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb -rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6 -V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF -+WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb -G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf -Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ -fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w -kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-body.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-body.js deleted file mode 100644 index a624397..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,117 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetEncoding : - { resp : server.createGetResponse(new Buffer('efa3bfcea9e29883', 'hex')) - , encoding: 'hex' - , expectBody: "efa3bfcea9e29883" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--__BOUNDARY__\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__\r\n\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - , testPutMultipartPreambleCRLF : - { resp: server.createPostValidator( - '\r\n--__BOUNDARY__\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__\r\n\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__--' - ) - , method: "PUT" - , preambleCRLF: true - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-cookie.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-cookie.js deleted file mode 100644 index 6c6a7a7..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-cookie.js +++ /dev/null @@ -1,29 +0,0 @@ -var Cookie = require('../vendor/cookie') - , assert = require('assert'); - -var str = 'Sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; Path=/; httpOnly; Expires=Sat, 04 Dec 2010 23:27:28 GMT'; -var cookie = new Cookie(str); - -// test .toString() -assert.equal(cookie.toString(), str); - -// test .path -assert.equal(cookie.path, '/'); - -// test .httpOnly -assert.equal(cookie.httpOnly, true); - -// test .name -assert.equal(cookie.name, 'Sid'); - -// test .value -assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="'); - -// test .expires -assert.equal(cookie.expires instanceof Date, true); - -// test .path default -var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); -assert.equal(cookie.path, '/bar'); - -console.log('All tests passed'); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-cookiejar.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-cookiejar.js deleted file mode 100644 index 76fcd71..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-cookiejar.js +++ /dev/null @@ -1,90 +0,0 @@ -var Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , assert = require('assert'); - -function expires(ms) { - return new Date(Date.now() + ms).toUTCString(); -} - -// test .get() expiration -(function() { - var jar = new Jar; - var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); - jar.add(cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 0); - }, 1000); - }, 5); -})(); - -// test .get() path support -(function() { - var jar = new Jar; - var a = new Cookie('sid=1234; path=/'); - var b = new Cookie('sid=1111; path=/foo/bar'); - var c = new Cookie('sid=2222; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - - // should remove the duplicates - assert.equal(jar.cookies.length, 2); - - // same name, same path, latter prevails - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], c); - - // same name, diff path, path specifity prevails, latter prevails - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], a); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=3333; path=/foo/bar'); - var c = new Cookie('pid=3333; path=/foo/bar'); - var d = new Cookie('sid=2222; path=/foo/'); - var e = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - jar.add(d); - jar.add(e); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 2); - assert.equal(cookies[0], b); - assert.equal(cookies[1], c); - - var cookies = jar.get({ url: 'http://foo.com/foo/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], d); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], e); -})(); - -setTimeout(function() { - console.log('All tests passed'); -}, 1200); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-defaults.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-defaults.js deleted file mode 100644 index 479abf2..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-defaults.js +++ /dev/null @@ -1,99 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -s.listen(s.port, function () { - var counter = 0; - s.on('/get', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'GET') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end('TESTING!'); - }); - - // test get(string, function) - request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){ - if (e) throw e; - assert.deepEqual("TESTING!", b); - counter += 1; - }); - - s.on('/post', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.headers['content-type'], 'application/json'); - assert.equal(req.method, 'POST') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test post(string, object, function) - request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/del', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'DELETE') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test .del(string, function) - request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/head', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'HEAD') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end(); - }); - - // test head.(object, function) - request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){ - if (e) throw e; - counter += 1; - }); - - s.on('/get_custom', function(req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.headers.x, 'y'); - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end(); - }); - - // test custom request handler function - var defaultRequest = request.defaults({ - headers:{foo:"bar"} - , body: 'TESTING!' - }, function(uri, options, callback) { - var params = request.initParams(uri, options, callback); - options = params.options; - options.headers.x = 'y'; - - return request(params.uri, params.options, params.callback); - }); - - var msg = 'defaults test failed. head request should throw earlier'; - assert.throws(function() { - defaultRequest.head(s.url + '/get_custom', function(e, r, b) { - throw new Error(msg); - }); - counter+=1; - }, msg); - - defaultRequest.get(s.url + '/get_custom', function(e, r, b) { - if(e) throw e; - counter += 1; - console.log(counter.toString() + " tests passed."); - s.close(); - }); -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-errors.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-errors.js deleted file mode 100644 index 1986a59..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,37 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -try { - request(local, {multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-follow-all-303.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-follow-all-303.js deleted file mode 100644 index 3f2162d..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-follow-all-303.js +++ /dev/null @@ -1,30 +0,0 @@ -var request = require('../main'); -var http = require('http'); -var requests = 0; -var assert = require('assert'); - -var server = http.createServer(function (req, res) { - console.error(req.method, req.url); - requests ++; - - if (req.method === 'POST') { - console.error('send 303'); - res.setHeader('location', req.url); - res.statusCode = 303; - res.end('try again, i guess\n'); - } else { - console.error('send 200') - res.end('ok: ' + requests); - } -}); -server.listen(6767); - -request.post({ url: 'http://localhost:6767/foo', - followAllRedirects: true, - form: { foo: 'bar' } }, function (er, req, body) { - if (er) throw er; - assert.equal(body, 'ok: 2'); - assert.equal(requests, 2); - console.error('ok - ' + process.version); - server.close(); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-follow-all.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-follow-all.js deleted file mode 100644 index b78745b..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-follow-all.js +++ /dev/null @@ -1,35 +0,0 @@ -var request = require('../main'); -var http = require('http'); -var requests = 0; -var assert = require('assert'); - -var server = http.createServer(function (req, res) { - requests ++; - - // redirect everything 3 times, no matter what. - var c = req.headers.cookie; - - if (!c) c = 0; - else c = +c.split('=')[1] || 0; - - if (c > 3) { - res.end('ok: '+requests); - return; - } - - res.setHeader('set-cookie', 'c=' + (c + 1)); - res.setHeader('location', req.url); - res.statusCode = 302; - res.end('try again, i guess\n'); -}); -server.listen(6767); - -request.post({ url: 'http://localhost:6767/foo', - followAllRedirects: true, - form: { foo: 'bar' } }, function (er, req, body) { - if (er) throw er; - assert.equal(body, 'ok: 5'); - assert.equal(requests, 5); - console.error('ok - ' + process.version); - server.close(); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-form.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-form.js deleted file mode 100644 index aeefd31..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-form.js +++ /dev/null @@ -1,79 +0,0 @@ -var assert = require('assert') -var http = require('http'); -var path = require('path'); -var mime = require('mime'); -var request = require('../main.js'); -var fs = require('fs'); - -var remoteFile = 'http://nodejs.org/images/logo.png'; - -var FIELDS = [ - {name: 'my_field', value: 'my_value'}, - {name: 'my_buffer', value: new Buffer([1, 2, 3])}, - {name: 'my_file', value: fs.createReadStream(__dirname + '/unicycle.jpg')}, - {name: 'remote_file', value: request(remoteFile) } -]; - -var server = http.createServer(function(req, res) { - - // temp workaround - var data = ''; - req.setEncoding('utf8'); - - req.on('data', function(d) { - data += d; - }); - - req.on('end', function() { - // check for the fields' traces - - // 1st field : my_field - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 2nd field : my_buffer - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf(field.value) != -1 ); - - // 3rd field : my_file - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); - // check for unicycle.jpg traces - assert.ok( data.indexOf('2005:06:21 01:44:12') != -1 ); - assert.ok( data.indexOf('Content-Type: '+mime.lookup(field.value.path) ) != -1 ); - - // 4th field : remote_file - var field = FIELDS.shift(); - assert.ok( data.indexOf('form-data; name="'+field.name+'"') != -1 ); - assert.ok( data.indexOf('; filename="'+path.basename(field.value.path)+'"') != -1 ); - // check for http://nodejs.org/images/logo.png traces - assert.ok( data.indexOf('ImageReady') != -1 ); - assert.ok( data.indexOf('Content-Type: '+mime.lookup(remoteFile) ) != -1 ); - - res.writeHead(200); - res.end('done'); - - }); - - -}); - -server.listen(8080, function() { - - var req = request.post('http://localhost:8080/upload', function () { - server.close(); - }) - var form = req.form() - - FIELDS.forEach(function(field) { - form.append(field.name, field.value); - }); - -}); - -process.on('exit', function() { - assert.strictEqual(FIELDS.length, 0); -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-headers.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-headers.js deleted file mode 100644 index 31fe3f4..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-headers.js +++ /dev/null @@ -1,52 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , s = server.createServer() - -s.listen(s.port, function () { - var serverUri = 'http://localhost:' + s.port - , numTests = 0 - , numOutstandingTests = 0 - - function createTest(requestObj, serverAssertFn) { - var testNumber = numTests; - numTests += 1; - numOutstandingTests += 1; - s.on('/' + testNumber, function (req, res) { - serverAssertFn(req, res); - res.writeHead(200); - res.end(); - }); - requestObj.url = serverUri + '/' + testNumber - request(requestObj, function (err, res, body) { - assert.ok(!err) - assert.equal(res.statusCode, 200) - numOutstandingTests -= 1 - if (numOutstandingTests === 0) { - console.log(numTests + ' tests passed.') - s.close() - } - }) - } - - // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified - createTest({headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar') - }) - - // Issue #125: headers.cookie + cookie jar - var jar = new Jar() - jar.add(new Cookie('quux=baz')); - createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar; quux=baz') - }) - - // There should be no cookie header when neither headers.cookie nor a cookie jar is specified - createTest({}, function (req, res) { - assert.ok(!req.headers.cookie) - }) -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-httpModule.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-httpModule.js deleted file mode 100644 index 1866de2..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-httpModule.js +++ /dev/null @@ -1,94 +0,0 @@ -var http = require('http') - , https = require('https') - , server = require('./server') - , assert = require('assert') - , request = require('../main.js') - - -var faux_requests_made = {'http':0, 'https':0} -function wrap_request(name, module) { - // Just like the http or https module, but note when a request is made. - var wrapped = {} - Object.keys(module).forEach(function(key) { - var value = module[key]; - - if(key != 'request') - wrapped[key] = value; - else - wrapped[key] = function(options, callback) { - faux_requests_made[name] += 1 - return value.apply(this, arguments) - } - }) - - return wrapped; -} - - -var faux_http = wrap_request('http', http) - , faux_https = wrap_request('https', https) - , plain_server = server.createServer() - , https_server = server.createSSLServer() - - -plain_server.listen(plain_server.port, function() { - plain_server.on('/plain', function (req, res) { - res.writeHead(200) - res.end('plain') - }) - plain_server.on('/to_https', function (req, res) { - res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'}) - res.end() - }) - - https_server.listen(https_server.port, function() { - https_server.on('/https', function (req, res) { - res.writeHead(200) - res.end('https') - }) - https_server.on('/to_plain', function (req, res) { - res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'}) - res.end() - }) - - run_tests() - run_tests({}) - run_tests({'http:':faux_http}) - run_tests({'https:':faux_https}) - run_tests({'http:':faux_http, 'https:':faux_https}) - }) -}) - -function run_tests(httpModules) { - var to_https = 'http://localhost:'+plain_server.port+'/to_https' - var to_plain = 'https://localhost:'+https_server.port+'/to_plain' - - request(to_https, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to SSL worked') - assert.equal(body, 'https', 'Received HTTPS server body') - done() - }) - - request(to_plain, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to plaintext server worked') - assert.equal(body, 'plain', 'Received HTTPS server body') - done() - }) -} - - -var passed = 0; -function done() { - passed += 1 - var expected = 10 - - if(passed == expected) { - plain_server.close() - https_server.close() - - assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately') - assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately') - - console.log((expected+2) + ' tests passed.') - } -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-https-strict.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-https-strict.js deleted file mode 100644 index 470b68d..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-https-strict.js +++ /dev/null @@ -1,97 +0,0 @@ -// a test where we validate the siguature of the keys -// otherwise exactly the same as the ssl test - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key') - , cert: path.resolve(__dirname, 'ssl/ca/server.crt') } - , s = server.createSSLServer(null, opts) - , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt') - , ca = fs.readFileSync(caFile) - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--__BOUNDARY__\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__\r\n\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - test.strictSSL = true - test.ca = ca - test.headers = { host: 'testing.request.mikealrogers.com' } - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-https.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-https.js deleted file mode 100644 index 58e7db9..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-https.js +++ /dev/null @@ -1,86 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - -var s = server.createSSLServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--__BOUNDARY__\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__\r\n\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-oauth.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-oauth.js deleted file mode 100644 index 72ca923..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-oauth.js +++ /dev/null @@ -1,117 +0,0 @@ -var hmacsign = require('../oauth').hmacsign - , assert = require('assert') - , qs = require('querystring') - , request = require('../main') - ; - -function getsignature (r) { - var sign - r.headers.Authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { - if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) - }) - return decodeURIComponent(sign) -} - -// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth - -var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', - { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_timestamp: '1272323042' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") - -console.log(reqsign) -console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') -assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') - -var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', - { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , oauth_timestamp: '1272323047' - , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") - -console.log(accsign) -console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') -assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') - -var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', - { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" - , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , oauth_signature_method: "HMAC-SHA1" - , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , oauth_timestamp: "1272325550" - , oauth_version: "1.0" - , status: 'setting up my twitter ç§ã®ã•ãˆãšã‚Šã‚’設定ã™ã‚‹' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") - -console.log(upsign) -console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') -assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') - - -var rsign = request.post( - { url: 'https://api.twitter.com/oauth/request_token' - , oauth: - { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , timestamp: '1272323042' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - } - }) - -setTimeout(function () { - console.log(getsignature(rsign)) - assert.equal(reqsign, getsignature(rsign)) -}) - -var raccsign = request.post( - { url: 'https://api.twitter.com/oauth/access_token' - , oauth: - { consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , signature_method: 'HMAC-SHA1' - , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , timestamp: '1272323047' - , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" - } - }) - -setTimeout(function () { - console.log(getsignature(raccsign)) - assert.equal(accsign, getsignature(raccsign)) -}, 1) - -var rupsign = request.post( - { url: 'http://api.twitter.com/1/statuses/update.json' - , oauth: - { consumer_key: "GDdmIQH6jhtmLUypg82g" - , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , signature_method: "HMAC-SHA1" - , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , timestamp: "1272325550" - , version: "1.0" - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" - } - , form: {status: 'setting up my twitter ç§ã®ã•ãˆãšã‚Šã‚’設定ã™ã‚‹'} - }) -setTimeout(function () { - console.log(getsignature(rupsign)) - assert.equal(upsign, getsignature(rupsign)) -}, 1) - - - - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-params.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-params.js deleted file mode 100644 index 5ddb311..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-params.js +++ /dev/null @@ -1,92 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--__BOUNDARY__\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__\r\n\r\n' + - 'Oh hi.' + - '\r\n--__BOUNDARY__--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - //test.uri = s.url + '/' + i - request(s.url + '/' + i, test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-piped-redirect.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-piped-redirect.js deleted file mode 100644 index 25bf35d..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-piped-redirect.js +++ /dev/null @@ -1,52 +0,0 @@ -var http = require('http') - , assert = require('assert') - , request = require('../main.js') - ; - -var portOne = 8968 - , portTwo = 8969 - ; - - -// server one -var s1 = http.createServer(function (req, resp) -{ - if (req.url == '/original') - { - resp.writeHeader(302, {'location': '/redirected'}) - resp.end() - } - else if (req.url == '/redirected') - { - resp.writeHeader(200, {'content-type': 'text/plain'}) - resp.write('OK') - resp.end() - } - -}).listen(portOne); - - -// server two -var s2 = http.createServer(function (req, resp) -{ - - var x = request('http://localhost:'+portOne+'/original') - req.pipe(x) - x.pipe(resp) - -}).listen(portTwo, function() -{ - - var r = request('http://localhost:'+portTwo+'/original', function (err, res, body) { - - assert.equal(body, 'OK') - - s1.close() - s2.close() - - }); - - // it hangs, so wait a second :) - r.timeout = 1000; - -}); diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-pipes.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-pipes.js deleted file mode 100644 index 0f7afb8..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,202 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var s = server.createServer(3453); - -function ValidationStream(str) { - this.str = str - this.buf = '' - this.on('data', function (data) { - this.buf += data - }) - this.on('end', function () { - assert.equal(this.str, this.buf) - }) - this.writable = true -} -util.inherits(ValidationStream, stream.Stream) -ValidationStream.prototype.write = function (chunk) { - this.emit('data', chunk) -} -ValidationStream.prototype.end = function (chunk) { - if (chunk) emit('data', chunk) - this.emit('end') -} - -s.listen(s.port, function () { - counter = 0; - - var check = function () { - counter = counter - 1 - if (counter === 0) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - } - - // Test pipeing to a request object - s.once('/push', server.createPostValidator("mydata")); - - var mydata = new stream.Stream(); - mydata.readable = true - - counter++ - var r1 = request.put({url:'http://localhost:3453/push'}, function () { - check(); - }) - mydata.pipe(r1) - - mydata.emit('data', 'mydata'); - mydata.emit('end'); - - - // Test pipeing from a request object. - s.once('/pull', server.createGetResponse("mypulldata")); - - var mypulldata = new stream.Stream(); - mypulldata.writable = true - - counter++ - request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - - var d = ''; - - mypulldata.write = function (chunk) { - d += chunk; - } - mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - check(); - }; - - - s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - check(); - }) - } - }) - s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'application/javascript'); - check(); - } - }) - s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) - }) - s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) - }) - s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) - }) - - counter++ - fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - - counter++ - request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - - counter++ - request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - check(); - }) - - var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - - counter++ - request.get('http://localhost:3453/doodle').pipe(doodleWrite) - - doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - check() - }) - - process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) - }) - - counter++ - request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - check() - }) - - s.on('/afterresponse', function (req, resp) { - resp.write('d') - resp.end() - }) - - counter++ - var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { - var v = new ValidationStream('d') - afterresp.pipe(v) - v.on('end', check) - }) - - s.on('/forward1', function (req, resp) { - resp.writeHead(302, {location:'/forward2'}) - resp.end() - }) - s.on('/forward2', function (req, resp) { - resp.writeHead('200', {'content-type':'image/png'}) - resp.write('d') - resp.end() - }) - - counter++ - var validateForward = new ValidationStream('d') - validateForward.on('end', check) - request.get('http://localhost:3453/forward1').pipe(validateForward) - - // Test pipe options - s.once('/opts', server.createGetResponse('opts response')); - - var optsStream = new stream.Stream(); - optsStream.writable = true - - var optsData = ''; - optsStream.write = function (buf) { - optsData += buf; - if (optsData === 'opts response') { - setTimeout(check, 10); - } - } - - optsStream.end = function () { - assert.fail('end called') - }; - - counter++ - request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false }) -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-pool.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-pool.js deleted file mode 100644 index 1e7d578..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-pool.js +++ /dev/null @@ -1,16 +0,0 @@ -var request = require('../main') - , http = require('http') - , assert = require('assert') - ; - -var s = http.createServer(function (req, resp) { - resp.statusCode = 200; - resp.end('asdf'); -}).listen(8080, function () { - request({'url': 'http://localhost:8080', 'pool': false}, function (e, resp) { - var agent = resp.request.agent; - assert.strictEqual(typeof agent, 'boolean'); - assert.strictEqual(agent, false); - s.close(); - }); -}); \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-protocol-changing-redirect.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-protocol-changing-redirect.js deleted file mode 100644 index f74e196..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-protocol-changing-redirect.js +++ /dev/null @@ -1,60 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - - -var s = server.createServer() -var ss = server.createSSLServer() -var sUrl = 'http://localhost:' + s.port -var ssUrl = 'https://localhost:' + ss.port - -s.listen(s.port, bouncy(s, ssUrl)) -ss.listen(ss.port, bouncy(ss, sUrl)) - -var hits = {} -var expect = {} -var pending = 0 -function bouncy (s, server) { return function () { - - var redirs = { a: 'b' - , b: 'c' - , c: 'd' - , d: 'e' - , e: 'f' - , f: 'g' - , g: 'h' - , h: 'end' } - - var perm = true - Object.keys(redirs).forEach(function (p) { - var t = redirs[p] - - // switch type each time - var type = perm ? 301 : 302 - perm = !perm - s.on('/' + p, function (req, res) { - res.writeHead(type, { location: server + '/' + t }) - res.end() - }) - }) - - s.on('/end', function (req, res) { - var h = req.headers['x-test-key'] - hits[h] = true - pending -- - if (pending === 0) done() - }) -}} - -for (var i = 0; i < 5; i ++) { - pending ++ - var val = 'test_' + i - expect[val] = true - request({ url: (i % 2 ? sUrl : ssUrl) + '/a' - , headers: { 'x-test-key': val } }) -} - -function done () { - assert.deepEqual(hits, expect) - process.exit(0) -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-proxy.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-proxy.js deleted file mode 100644 index 647157c..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-proxy.js +++ /dev/null @@ -1,39 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var port = 6768 - , called = false - , proxiedHost = 'google.com' - ; - -var s = server.createServer(port) -s.listen(port, function () { - s.on('http://google.com/', function (req, res) { - called = true - assert.equal(req.headers.host, proxiedHost) - res.writeHeader(200) - res.end() - }) - request ({ - url: 'http://'+proxiedHost, - proxy: 'http://localhost:'+port - /* - //should behave as if these arguments where passed: - url: 'http://localhost:'+port, - headers: {host: proxiedHost} - //*/ - }, function (err, res, body) { - s.close() - }) -}) - -process.on('exit', function () { - assert.ok(called, 'the request must be made to the proxy server') -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-qs.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-qs.js deleted file mode 100644 index 1aac22b..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-qs.js +++ /dev/null @@ -1,28 +0,0 @@ -var request = request = require('../main.js') - , assert = require('assert') - ; - - -// Test adding a querystring -var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req1.path) -}, 1) - -// Test replacing a querystring value -var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req2.path) -}, 1) - -// Test appending a querystring value to the ones present in the uri -var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?x=y&q=search', req3.path) -}, 1) - -// Test leaving a querystring alone -var req4 = request.get({ uri: 'http://www.google.com?x=y'}) -setTimeout(function() { - assert.equal('/?x=y', req4.path) -}, 1) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-redirect.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-redirect.js deleted file mode 100644 index b84844a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-redirect.js +++ /dev/null @@ -1,154 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - -var s = server.createServer() - -s.listen(s.port, function () { - var server = 'http://localhost:' + s.port; - var hits = {} - var passed = 0; - - bouncer(301, 'temp') - bouncer(302, 'perm') - bouncer(302, 'nope') - - function bouncer(code, label) { - var landing = label+'_landing'; - - s.on('/'+label, function (req, res) { - hits[label] = true; - res.writeHead(code, { - 'location':server + '/'+landing, - 'set-cookie': 'ham=eggs' - }) - res.end() - }) - - s.on('/'+landing, function (req, res) { - if (req.method !== 'GET') { // We should only accept GET redirects - console.error("Got a non-GET request to the redirect destination URL"); - res.writeHead(400); - res.end(); - return; - } - // Make sure the cookie doesn't get included twice, see #139: - // Make sure cookies are set properly after redirect - assert.equal(req.headers.cookie, 'foo=bar; quux=baz; ham=eggs'); - hits[landing] = true; - res.writeHead(200) - res.end(landing) - }) - } - - // Permanent bounce - var jar = new Jar() - jar.add(new Cookie('quux=baz')) - request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.perm, 'Original request is to /perm') - assert.ok(hits.perm_landing, 'Forward to permanent landing URL') - assert.equal(body, 'perm_landing', 'Got permanent landing content') - passed += 1 - done() - }) - - // Temporary bounce - request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - done() - }) - - // Prevent bouncing. - request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 302) throw new Error('Status is not 302: '+res.statusCode) - assert.ok(hits.nope, 'Original request to /nope') - assert.ok(!hits.nope_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 302, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should not follow post redirects by default - request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when post') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should follow post redirects when followAllRedirects true - request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - done() - }) - - request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should not follow delete redirects by default - request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode < 301) throw new Error('Status is not a redirect.') - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should not follow delete redirects even if followRedirect is set to true - request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should follow delete redirects when followAllRedirects true - request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - done() - }) - - var reqs_done = 0; - function done() { - reqs_done += 1; - if(reqs_done == 9) { - console.log(passed + ' tests passed.') - s.close() - } - } -}) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-s3.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-s3.js deleted file mode 100644 index 5f59c4a..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-s3.js +++ /dev/null @@ -1,13 +0,0 @@ -var request = require('../main') - -var r = request.get('https://log.curlybracecast.com.s3.amazonaws.com/', - { aws: - { key: 'AKIAI6KIQRRVMGK3WK5Q' - , secret: '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' - , bucket: 'log.curlybracecast.com' - } - }, function (e, resp, body) { - console.log(r.headers) - console.log(body) - } -) \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-timeout.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 673f8ad..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,87 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -s.listen(s.port, function () { - // Request that waits for 200ms - s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); - }); - - // Scenario that should timeout - var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 - } - - - request(shouldTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - - // Scenario that shouldn't timeout - var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 - } - - request(shouldntTimeout, function (err, resp, body) { - assert.equal(err, null); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with no timeout set, so shouldn't timeout - var noTimeout = { - url: s.url + "/timeout" - } - - request(noTimeout, function (err, resp, body) { - assert.equal(err); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with a negative timeout value, should be treated a zero or the minimum delay - var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 - } - - request(negativeTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - // Scenario with a float timeout value, should be rounded by setTimeout anyway - var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 - } - - request(floatTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } - } -}) - diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-toJSON.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-toJSON.js deleted file mode 100644 index b7c67ef..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-toJSON.js +++ /dev/null @@ -1,14 +0,0 @@ -var request = require('../main') - , http = require('http') - , assert = require('assert') - ; - -var s = http.createServer(function (req, resp) { - resp.statusCode = 200 - resp.end('asdf') -}).listen(8080, function () { - var r = request('http://localhost:8080', function (e, resp) { - assert.equal(JSON.parse(JSON.stringify(r)).response.statusCode, 200) - s.close() - }) -}) \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-tunnel.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-tunnel.js deleted file mode 100644 index 51e2126..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/test-tunnel.js +++ /dev/null @@ -1,63 +0,0 @@ -// test that we can tunnel a https request over an http proxy -// keeping all the CA and whatnot intact. -// -// Note: this requires that squid is installed. -// If the proxy fails to start, we'll just log a warning and assume success. - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt') - , ca = fs.readFileSync(caFile) - , child_process = require('child_process') - , sqConf = path.resolve(__dirname, 'squid.conf') - , sqArgs = ['-f', sqConf, '-N', '-d', '5'] - , proxy = 'http://localhost:3128' - , hadError = null - -var squid = child_process.spawn('squid', sqArgs); -var ready = false - -squid.stderr.on('data', function (c) { - console.error('SQUIDERR ' + c.toString().trim().split('\n') - .join('\nSQUIDERR ')) - ready = c.toString().match(/ready to serve requests/i) -}) - -squid.stdout.on('data', function (c) { - console.error('SQUIDOUT ' + c.toString().trim().split('\n') - .join('\nSQUIDOUT ')) -}) - -squid.on('exit', function (c) { - console.error('squid: exit '+c) - if (c && !ready) { - console.error('squid must be installed to run this test.') - console.error('skipping this test. please install squid and run again if you need to test tunneling.') - c = null - hadError = null - process.exit(0) - return - } - - if (c) { - hadError = hadError || new Error('Squid exited with '+c) - } - if (hadError) throw hadError -}) - -setTimeout(function F () { - if (!ready) return setTimeout(F, 100) - request({ uri: 'https://registry.npmjs.org/' - , proxy: 'http://localhost:3128' - , strictSSL: true - , ca: ca - , json: true }, function (er, body) { - hadError = er - console.log(er || typeof body) - if (!er) console.log("ok") - squid.kill('SIGKILL') - }) -}, 100) diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/unicycle.jpg b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/unicycle.jpg deleted file mode 100644 index 7cea4dd..0000000 Binary files a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tests/unicycle.jpg and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tunnel.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tunnel.js deleted file mode 100644 index 469c130..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/tunnel.js +++ /dev/null @@ -1,230 +0,0 @@ -'use strict'; - -var net = require('net'); -var tls = require('tls'); -var http = require('http'); -var https = require('https'); -var events = require('events'); -var assert = require('assert'); -var util = require('util'); - - -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - return agent; -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - return agent; -} - - -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); - -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) { - var self = this; - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: host, port: port, request: req}); - return; - } - - // If we are under maxSockets create a new one. - self.createSocket({host: host, port: port, request: req}, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); - - function onFree() { - self.emit('free', socket, host, port); - } - - function onCloseOrRemove(err) { - self.removeSocket(); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); - - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false - }); - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } - - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - - if (res.statusCode === 200) { - assert.equal(head.length, 0); - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - cb(socket); - } else { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - var error = new Error('tunneling socket could not be established, ' + - 'sutatusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } - } - - function onError(cause) { - connectReq.removeAllListeners(); - - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); - - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; - -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, { - servername: options.host, - socket: socket - })); - cb(secureSocket); - }); -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } - } - return target; -} - - -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); - } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/uuid.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/uuid.js deleted file mode 100644 index 1d83bd5..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = function () { - var s = [], itoh = '0123456789ABCDEF'; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - - return s.join(''); -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/vendor/cookie/index.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/vendor/cookie/index.js deleted file mode 100644 index ff44b3e..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/vendor/cookie/index.js +++ /dev/null @@ -1,65 +0,0 @@ -/*! - * Tobi - Cookie - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url'); - -/** - * Initialize a new `Cookie` with the given cookie `str` and `req`. - * - * @param {String} str - * @param {IncomingRequest} req - * @api private - */ - -var Cookie = exports = module.exports = function Cookie(str, req) { - this.str = str; - - // Map the key/val pairs - str.split(/ *; */).reduce(function(obj, pair){ - var p = pair.indexOf('='); - var key = p > 0 ? pair.substring(0, p).trim() : pair.trim(); - var lowerCasedKey = key.toLowerCase(); - var value = p > 0 ? pair.substring(p + 1).trim() : true; - - if (!obj.name) { - // First key is the name - obj.name = key; - obj.value = value; - } - else if (lowerCasedKey === 'httponly') { - obj.httpOnly = value; - } - else { - obj[lowerCasedKey] = value; - } - return obj; - }, this); - - // Expires - this.expires = this.expires - ? new Date(this.expires) - : Infinity; - - // Default or trim path - this.path = this.path - ? this.path.trim(): req - ? url.parse(req.url).pathname: '/'; -}; - -/** - * Return the original cookie string. - * - * @return {String} - * @api public - */ - -Cookie.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/vendor/cookie/jar.js b/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/vendor/cookie/jar.js deleted file mode 100644 index 34920e0..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/node_modules/request/vendor/cookie/jar.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! -* Tobi - CookieJar -* Copyright(c) 2010 LearnBoost -* MIT Licensed -*/ - -/** -* Module dependencies. -*/ - -var url = require('url'); - -/** -* Initialize a new `CookieJar`. -* -* @api private -*/ - -var CookieJar = exports = module.exports = function CookieJar() { - this.cookies = []; -}; - -/** -* Add the given `cookie` to the jar. -* -* @param {Cookie} cookie -* @api private -*/ - -CookieJar.prototype.add = function(cookie){ - this.cookies = this.cookies.filter(function(c){ - // Avoid duplication (same path, same name) - return !(c.name == cookie.name && c.path == cookie.path); - }); - this.cookies.push(cookie); -}; - -/** -* Get cookies for the given `req`. -* -* @param {IncomingRequest} req -* @return {Array} -* @api private -*/ - -CookieJar.prototype.get = function(req){ - var path = url.parse(req.url).pathname - , now = new Date - , specificity = {}; - return this.cookies.filter(function(cookie){ - if (0 == path.indexOf(cookie.path) && now < cookie.expires - && cookie.path.length > (specificity[cookie.name] || 0)) - return specificity[cookie.name] = cookie.path.length; - }); -}; - -/** -* Return Cookie string for the given `req`. -* -* @param {IncomingRequest} req -* @return {String} -* @api private -*/ - -CookieJar.prototype.cookieString = function(req){ - var cookies = this.get(req); - if (cookies.length) { - return cookies.map(function(cookie){ - return cookie.name + '=' + cookie.value; - }).join('; '); - } -}; diff --git a/node_modules/browser-sync/node_modules/localtunnel/package.json b/node_modules/browser-sync/node_modules/localtunnel/package.json deleted file mode 100644 index c9b2d86..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "author": { - "name": "Roman Shtylman", - "email": "shtylman@gmail.com" - }, - "name": "localtunnel", - "description": "expose localhost to the world", - "version": "1.5.0", - "repository": { - "type": "git", - "url": "git://github.com/shtylman/localtunnel.git" - }, - "dependencies": { - "request": "2.11.4", - "optimist": "0.3.4", - "debug": "0.7.4" - }, - "devDependencies": { - "mocha": "~1.17.0" - }, - "scripts": { - "test": "mocha --ui qunit --reporter list --timeout 10000 -- test/index.js" - }, - "bin": { - "lt": "./bin/client" - }, - "main": "./client.js", - "gitHead": "a6845ec63bd4f485f3c45c4272eb38733448ee05", - "bugs": { - "url": "https://github.com/shtylman/localtunnel/issues" - }, - "homepage": "https://github.com/shtylman/localtunnel", - "_id": "localtunnel@1.5.0", - "_shasum": "5be949779325e9f3273021a3f38d2e7a8dcd7c4f", - "_from": "localtunnel@^1.3.0", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "shtylman", - "email": "shtylman@gmail.com" - }, - "maintainers": [ - { - "name": "shtylman", - "email": "shtylman@gmail.com" - } - ], - "dist": { - "shasum": "5be949779325e9f3273021a3f38d2e7a8dcd7c4f", - "tarball": "http://registry.npmjs.org/localtunnel/-/localtunnel-1.5.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/localtunnel/-/localtunnel-1.5.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/localtunnel/test/index.js b/node_modules/browser-sync/node_modules/localtunnel/test/index.js deleted file mode 100644 index bec0d42..0000000 --- a/node_modules/browser-sync/node_modules/localtunnel/test/index.js +++ /dev/null @@ -1,188 +0,0 @@ -var http = require('http'); -var https = require('https'); -var url = require('url'); -var assert = require('assert'); - -var localtunnel = require('../'); - -test('setup local http server', function(done) { - var server = http.createServer(); - server.on('request', function(req, res) { - res.write(req.headers.host); - res.end(); - }); - server.listen(function() { - var port = server.address().port; - - test._fake_port = port; - console.log('local http on:', port); - done(); - }); -}); - -test('setup localtunnel client', function(done) { - localtunnel(test._fake_port, function(err, tunnel) { - assert.ifError(err); - assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url)); - test._fake_url = tunnel.url; - done(); - }); -}); - -test('query localtunnel server w/ ident', function(done) { - var uri = test._fake_url; - var parsed = url.parse(uri); - - var opt = { - host: parsed.host, - port: 443, - headers: { - host: parsed.hostname - }, - path: '/' - }; - - var req = https.request(opt, function(res) { - res.setEncoding('utf8'); - var body = ''; - - res.on('data', function(chunk) { - body += chunk; - }); - - res.on('end', function() { - assert(/.*[.]localtunnel[.]me/.test(body), body); - done(); - }); - }); - - req.end(); -}); - -test('request specific domain', function(done) { - localtunnel(test._fake_port, { subdomain: 'abcd' }, function(err, tunnel) { - assert.ifError(err); - assert.ok(new RegExp('^https:\/\/abcd.localtunnel.me' + '$').test(tunnel.url)); - tunnel.close(); - done(); - }); -}); - -suite('--local-host localhost'); - -test('setup localtunnel client', function(done) { - var opt = { - local_host: 'localhost' - }; - localtunnel(test._fake_port, opt, function(err, tunnel) { - assert.ifError(err); - assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url)); - test._fake_url = tunnel.url; - done(); - }); -}); - -test('override Host header with local-host', function(done) { - var uri = test._fake_url; - var parsed = url.parse(uri); - - var opt = { - host: parsed.host, - port: 443, - headers: { - host: parsed.hostname - }, - path: '/' - }; - - var req = https.request(opt, function(res) { - res.setEncoding('utf8'); - var body = ''; - - res.on('data', function(chunk) { - body += chunk; - }); - - res.on('end', function() { - assert.equal(body, 'localhost'); - done(); - }); - }); - - req.end(); -}); - -suite('--local-host 127.0.0.1'); - -test('setup localtunnel client', function(done) { - var opt = { - local_host: '127.0.0.1' - }; - localtunnel(test._fake_port, opt, function(err, tunnel) { - assert.ifError(err); - assert.ok(new RegExp('^https:\/\/.*localtunnel.me' + '$').test(tunnel.url)); - test._fake_url = tunnel.url; - done(); - }); -}); - -test('override Host header with local-host', function(done) { - var uri = test._fake_url; - var parsed = url.parse(uri); - - var opt = { - host: parsed.host, - port: 443, - headers: { - host: parsed.hostname - }, - path: '/' - }; - - var req = https.request(opt, function(res) { - res.setEncoding('utf8'); - var body = ''; - - res.on('data', function(chunk) { - body += chunk; - }); - - res.on('end', function() { - assert.equal(body, '127.0.0.1'); - done(); - }); - }); - - req.end(); -}); - -test('send chunked request', function(done) { - var uri = test._fake_url; - var parsed = url.parse(uri); - - var opt = { - host: parsed.host, - port: 443, - headers: { - host: parsed.hostname, - 'Transfer-Encoding': 'chunked' - }, - path: '/' - }; - - var req = https.request(opt, function(res) { - res.setEncoding('utf8'); - var body = ''; - - res.on('data', function(chunk) { - body += chunk; - }); - - res.on('end', function() { - assert.equal(body, '127.0.0.1'); - done(); - }); - }); - - req.end(require('crypto').randomBytes(1024 * 8).toString('base64')); -}); diff --git a/node_modules/browser-sync/node_modules/lodash/LICENSE.txt b/node_modules/browser-sync/node_modules/lodash/LICENSE.txt deleted file mode 100644 index 49869bb..0000000 --- a/node_modules/browser-sync/node_modules/lodash/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright 2012-2013 The Dojo Foundation -Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -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 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. \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/lodash/README.md b/node_modules/browser-sync/node_modules/lodash/README.md deleted file mode 100644 index 6f9598e..0000000 --- a/node_modules/browser-sync/node_modules/lodash/README.md +++ /dev/null @@ -1,163 +0,0 @@ -# Lo-Dash v2.4.1 -A utility library delivering consistency, [customization](http://lodash.com/custom-builds), [performance](http://lodash.com/benchmarks), & [extras](http://lodash.com/#features). - -## Download - -Check out our [wiki]([https://github.com/lodash/lodash/wiki/build-differences]) for details over the differences between builds. - -* Modern builds perfect for newer browsers/environments:
    -[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.js) & -[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.min.js) - -* Compatibility builds for older environment support too:
    -[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.compat.js) & -[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.compat.min.js) - -* Underscore builds to use as a drop-in replacement:
    -[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.underscore.js) & -[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.underscore.min.js) - -CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash). For smaller file sizes, create [custom builds](http://lodash.com/custom-builds) with only the features needed. - -Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-es6](https://github.com/lodash/lodash-es6), [lodash-node](https://npmjs.org/package/lodash-node), & [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method. - -## Dive in - -There’s plenty of **[documentation](http://lodash.com/docs)**, [unit tests](http://lodash.com/tests), & [benchmarks](http://lodash.com/benchmarks).
    -Check out
    DevDocs as a fast, organized, & searchable interface for our documentation. - -The full changelog for this release is available on our [wiki](https://github.com/lodash/lodash/wiki/Changelog).
    -A list of upcoming features is available on our [roadmap](https://github.com/lodash/lodash/wiki/Roadmap). - -## Features *not* in Underscore - - * AMD loader support ([curl](https://github.com/cujojs/curl), [dojo](http://dojotoolkit.org/), [requirejs](http://requirejs.org/), etc.) - * [_(…)](http://lodash.com/docs#_) supports intuitive chaining - * [_.at](http://lodash.com/docs#at) for cherry-picking collection values - * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazyâ€*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods - * [_.clone](http://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects - * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays & objects - * [_.constant](http://lodash.com/docs#constant) & [_.property](http://lodash.com/docs#property) function generators for composing functions - * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` - * [_.create](http://lodash.com/docs#create) for easier object inheritance - * [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins - * [_.curry](http://lodash.com/docs#curry) for creating [curried](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) functions - * [_.debounce](http://lodash.com/docs#debounce) & [_.throttle](http://lodash.com/docs#throttle) accept additional `options` for more control - * [_.findIndex](http://lodash.com/docs#findIndex) & [_.findKey](http://lodash.com/docs#findKey) for finding indexes & keys - * [_.forEach](http://lodash.com/docs#forEach) is chainable & supports exiting early - * [_.forIn](http://lodash.com/docs#forIn) for iterating own & inherited properties - * [_.forOwn](http://lodash.com/docs#forOwn) for iterating own properties - * [_.isPlainObject](http://lodash.com/docs#isPlainObject) for checking if values are created by `Object` - * [_.mapValues](http://lodash.com/docs#mapValues) for [mapping](http://lodash.com/docs#map) values to an object - * [_.memoize](http://lodash.com/docs#memoize) exposes the `cache` of memoized functions - * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend) - * [_.noop](http://lodash.com/docs#noop) for function placeholders - * [_.now](http://lodash.com/docs#now) as a cross-browser `Date.now` alternative - * [_.parseInt](http://lodash.com/docs#parseInt) for consistent behavior - * [_.pull](http://lodash.com/docs#pull) & [_.remove](http://lodash.com/docs#remove) for mutating arrays - * [_.random](http://lodash.com/docs#random) supports returning floating-point numbers - * [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking - * [_.sortBy](http://lodash.com/docs#sortBy) supports sorting by multiple properties - * [_.support](http://lodash.com/docs#support) for flagging environment features - * [_.template](http://lodash.com/docs#template) supports [*“importsâ€*](http://lodash.com/docs#templateSettings_imports) options & [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals) - * [_.transform](http://lodash.com/docs#transform) as a powerful alternative to [_.reduce](http://lodash.com/docs#reduce) for transforming objects - * [_.where](http://lodash.com/docs#where) supports deep object comparisons - * [_.xor](http://lodash.com/docs#xor) as a companion to [_.difference](http://lodash.com/docs#difference), [_.intersection](http://lodash.com/docs#intersection), & [_.union](http://lodash.com/docs#union) - * [_.zip](http://lodash.com/docs#zip) is capable of unzipping values - * [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick), & - [more](http://lodash.com/docs "_.assign, _.clone, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept callbacks - * [_.contains](http://lodash.com/docs#contains), [_.toArray](http://lodash.com/docs#toArray), & - [more](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.forEachRight, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.where") accept strings - * [_.filter](http://lodash.com/docs#filter), [_.map](http://lodash.com/docs#map), & - [more](http://lodash.com/docs "_.countBy, _.every, _.find, _.findKey, _.findLast, _.findLastIndex, _.findLastKey, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluckâ€* & *“_.whereâ€* shorthands - * [_.findLast](http://lodash.com/docs#findLast), [_.findLastIndex](http://lodash.com/docs#findLastIndex), & - [more](http://lodash.com/docs "_.findLastKey, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods - -## Resources - - * Podcasts - - [JavaScript Jabber](http://javascriptjabber.com/079-jsj-lo-dash-with-john-david-dalton/) - - * Posts - - [Say “Hello†to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/) - - [Custom builds in Lo-Dash 2.0](http://kitcambridge.be/blog/custom-builds-in-lo-dash-2-dot-0/) - - * Videos - - [Introduction](https://vimeo.com/44154599) - - [Origins](https://vimeo.com/44154600) - - [Optimizations & builds](https://vimeo.com/44154601) - - [Native method use](https://vimeo.com/48576012) - - [Testing](https://vimeo.com/45865290) - - [CascadiaJS ’12](http://www.youtube.com/watch?v=dpPy4f_SeEk) - - A list of other community created podcasts, posts, & videos is available on our [wiki](https://github.com/lodash/lodash/wiki/Resources). - -## Support - -Tested in Chrome 5~31, Firefox 2~25, IE 6-11, Opera 9.25~17, Safari 3-7, Node.js 0.6.21~0.10.22, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, & Rhino 1.7RC5.
    -Automated browser test results [are available](https://saucelabs.com/u/lodash) as well as [Travis CI](https://travis-ci.org/) builds for [lodash](https://travis-ci.org/lodash/lodash/), [lodash-cli](https://travis-ci.org/lodash/lodash-cli/), [lodash-amd](https://travis-ci.org/lodash/lodash-amd/), [lodash-node](https://travis-ci.org/lodash/lodash-node/), & [grunt-lodash](https://travis-ci.org/lodash/grunt-lodash). - -Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
    -[![Sauce Labs](http://lodash.com/_img/sauce.png)](https://saucelabs.com/ "Sauce Labs: Selenium Testing & More") - -## Installation & usage - -In browsers: - -```html - -``` - -Using [`npm`](http://npmjs.org/): - -```bash -npm i --save lodash - -{sudo} npm i -g lodash -npm ln lodash -``` - -In [Node.js](http://nodejs.org/) & [Ringo](http://ringojs.org/): - -```js -var _ = require('lodash'); -// or as Underscore -var _ = require('lodash/dist/lodash.underscore'); -``` - -**Notes:** - * Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL - * If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('lodash.js'); -``` - -In an AMD loader: - -```js -require({ - 'packages': [ - { 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' } - ] -}, -['lodash'], function(_) { - console.log(_.VERSION); -}); -``` - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/blainebublitz](http://gravatar.com/avatar/ac1c67fd906c9fecd823ce302283b4c1?s=70)](https://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | -|---|---|---| -| [Blaine Bublitz](http://www.iceddev.com/) | [Kit Cambridge](http://kitcambridge.be/) | [Mathias Bynens](http://mathiasbynens.be/) | - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lodash/lodash/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/node_modules/browser-sync/node_modules/lodash/dist/lodash.compat.js b/node_modules/browser-sync/node_modules/lodash/dist/lodash.compat.js deleted file mode 100644 index 23798ba..0000000 --- a/node_modules/browser-sync/node_modules/lodash/dist/lodash.compat.js +++ /dev/null @@ -1,7157 +0,0 @@ -/** - * @license - * Lo-Dash 2.4.1 (Custom Build) - * Build: `lodash -o ./dist/lodash.compat.js` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.5.2 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre ES5 environments */ - var undefined; - - /** Used to pool arrays and objects used internally */ - var arrayPool = [], - objectPool = []; - - /** Used to generate unique IDs */ - var idCounter = 0; - - /** Used internally to indicate various things */ - var indicatorObject = {}; - - /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ - var keyPrefix = +new Date + ''; - - /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 75; - - /** Used as the max size of the `arrayPool` and `objectPool` */ - var maxPoolSize = 40; - - /** Used to detect and test whitespace */ - var whitespace = ( - // whitespace - ' \t\x0B\f\xA0\ufeff' + - - // line terminators - '\n\r\u2028\u2029' + - - // unicode category "Zs" space separators - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' - ); - - /** Used to match empty string literals in compiled template source */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** - * Used to match ES6 template delimiters - * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match regexp flags from their coerced string values */ - var reFlags = /\w*$/; - - /** Used to detected named functions */ - var reFuncName = /^\s*function[ \n\r\t]+\w/; - - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match leading whitespace and zeros to be removed */ - var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); - - /** Used to ensure capturing order of template delimiters */ - var reNoMatch = /($^)/; - - /** Used to detect functions containing a `this` reference */ - var reThis = /\bthis\b/; - - /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; - - /** Used to assign default `context` object properties */ - var contextProps = [ - 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', - 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', - 'parseInt', 'setTimeout' - ]; - - /** Used to fix the JScript [[DontEnum]] bug */ - var shadowedProps = [ - 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', - 'toLocaleString', 'toString', 'valueOf' - ]; - - /** Used to make template sourceURLs easier to identify */ - var templateCounter = 0; - - /** `Object#toString` result shortcuts */ - var argsClass = '[object Arguments]', - arrayClass = '[object Array]', - boolClass = '[object Boolean]', - dateClass = '[object Date]', - errorClass = '[object Error]', - funcClass = '[object Function]', - numberClass = '[object Number]', - objectClass = '[object Object]', - regexpClass = '[object RegExp]', - stringClass = '[object String]'; - - /** Used to identify object classifications that `_.clone` supports */ - var cloneableClasses = {}; - cloneableClasses[funcClass] = false; - cloneableClasses[argsClass] = cloneableClasses[arrayClass] = - cloneableClasses[boolClass] = cloneableClasses[dateClass] = - cloneableClasses[numberClass] = cloneableClasses[objectClass] = - cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; - - /** Used as an internal `_.debounce` options object */ - var debounceOptions = { - 'leading': false, - 'maxWait': 0, - 'trailing': false - }; - - /** Used as the property descriptor for `__bindData__` */ - var descriptor = { - 'configurable': false, - 'enumerable': false, - 'value': null, - 'writable': false - }; - - /** Used as the data object for `iteratorTemplate` */ - var iteratorData = { - 'args': '', - 'array': null, - 'bottom': '', - 'firstArg': '', - 'init': '', - 'keys': null, - 'loop': '', - 'shadowedProps': null, - 'support': null, - 'top': '', - 'useHas': false - }; - - /** Used to determine if values are of the language type Object */ - var objectTypes = { - 'boolean': false, - 'function': true, - 'object': true, - 'number': false, - 'string': false, - 'undefined': false - }; - - /** Used to escape characters for inclusion in compiled string literals */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Used as a reference to the global object */ - var root = (objectTypes[typeof window] && window) || this; - - /** Detect free variable `exports` */ - var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; - - /** Detect free variable `module` */ - var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports` */ - var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; - - /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ - var freeGlobal = objectTypes[typeof global] && global; - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * An implementation of `_.contains` for cache objects that mimics the return - * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. - * - * @private - * @param {Object} cache The cache object to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns `0` if `value` is found, else `-1`. - */ - function cacheIndexOf(cache, value) { - var type = typeof value; - cache = cache.cache; - - if (type == 'boolean' || value == null) { - return cache[value] ? 0 : -1; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = (cache = cache[type]) && cache[key]; - - return type == 'object' - ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) - : (cache ? 0 : -1); - } - - /** - * Adds a given value to the corresponding cache object. - * - * @private - * @param {*} value The value to add to the cache. - */ - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - (typeCache[key] || (typeCache[key] = [])).push(value); - } else { - typeCache[key] = true; - } - } - } - - /** - * Used by `_.max` and `_.min` as the default callback when a given - * collection is a string value. - * - * @private - * @param {string} value The character to inspect. - * @returns {number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` elements, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ac = a.criteria, - bc = b.criteria, - index = -1, - length = ac.length; - - while (++index < length) { - var value = ac[index], - other = bc[index]; - - if (value !== other) { - if (value > other || typeof value == 'undefined') { - return 1; - } - if (value < other || typeof other == 'undefined') { - return -1; - } - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to return the same value for - // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247 - // - // This also ensures a stable sort in V8 and other engines. - // See http://code.google.com/p/v8/issues/detail?id=90 - return a.index - b.index; - } - - /** - * Creates a cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [array=[]] The array to search. - * @returns {null|Object} Returns the cache object or `null` if caching should not be used. - */ - function createCache(array) { - var index = -1, - length = array.length, - first = array[0], - mid = array[(length / 2) | 0], - last = array[length - 1]; - - if (first && typeof first == 'object' && - mid && typeof mid == 'object' && last && typeof last == 'object') { - return false; - } - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return result; - } - - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - - /** - * Gets an array from the array pool or creates a new one if the pool is empty. - * - * @private - * @returns {Array} The array from the pool. - */ - function getArray() { - return arrayPool.pop() || []; - } - - /** - * Gets an object from the object pool or creates a new one if the pool is empty. - * - * @private - * @returns {Object} The object from the pool. - */ - function getObject() { - return objectPool.pop() || { - 'array': null, - 'cache': null, - 'criteria': null, - 'false': false, - 'index': 0, - 'null': false, - 'number': null, - 'object': null, - 'push': null, - 'string': null, - 'true': false, - 'undefined': false, - 'value': null - }; - } - - /** - * Checks if `value` is a DOM node in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM node, else `false`. - */ - function isNode(value) { - // IE < 9 presents DOM nodes as `Object` objects except they have `toString` - // methods that are `typeof` "string" and still can coerce nodes to strings - return typeof value.toString != 'function' && typeof (value + '') == 'string'; - } - - /** - * Releases the given array back to the array pool. - * - * @private - * @param {Array} [array] The array to release. - */ - function releaseArray(array) { - array.length = 0; - if (arrayPool.length < maxPoolSize) { - arrayPool.push(array); - } - } - - /** - * Releases the given object back to the object pool. - * - * @private - * @param {Object} [object] The object to release. - */ - function releaseObject(object) { - var cache = object.cache; - if (cache) { - releaseObject(cache); - } - object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; - if (objectPool.length < maxPoolSize) { - objectPool.push(object); - } - } - - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used instead of `Array#slice` to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|string} collection The collection to slice. - * @param {number} start The start index. - * @param {number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new `lodash` function using the given context object. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} [context=root] The context object. - * @returns {Function} Returns the `lodash` function. - */ - function runInContext(context) { - // Avoid issues with some ES3 environments that attempt to use values, named - // after built-in constructors like `Object`, for the creation of literals. - // ES5 clears this up by stating that literals must use built-in constructors. - // See http://es5.github.io/#x11.1.5. - context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; - - /** Native constructor references */ - var Array = context.Array, - Boolean = context.Boolean, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Number = context.Number, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** - * Used for `Array` method references. - * - * Normally `Array.prototype` would suffice, however, using an array literal - * avoids issues in Narwhal. - */ - var arrayRef = []; - - /** Used for native method references */ - var errorProto = Error.prototype, - objectProto = Object.prototype, - stringProto = String.prototype; - - /** Used to restore the original `_` reference in `noConflict` */ - var oldDash = context._; - - /** Used to resolve the internal [[Class]] of values */ - var toString = objectProto.toString; - - /** Used to detect if a method is native */ - var reNative = RegExp('^' + - String(toString) - .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - .replace(/toString| for [^\]]+/g, '.*?') + '$' - ); - - /** Native method shortcuts */ - var ceil = Math.ceil, - clearTimeout = context.clearTimeout, - floor = Math.floor, - fnToString = Function.prototype.toString, - getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectProto.hasOwnProperty, - push = arrayRef.push, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - setTimeout = context.setTimeout, - splice = arrayRef.splice, - unshift = arrayRef.unshift; - - /** Used to set meta data on functions */ - var defineProperty = (function() { - // IE 8 only accepts DOM elements - try { - var o = {}, - func = isNative(func = Object.defineProperty) && func, - result = func(o, o, o) && func; - } catch(e) { } - return result; - }()); - - /* Native method shortcuts for methods with the same name as other `lodash` methods */ - var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, - nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, - nativeIsFinite = context.isFinite, - nativeIsNaN = context.isNaN, - nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, - nativeMax = Math.max, - nativeMin = Math.min, - nativeParseInt = context.parseInt, - nativeRandom = Math.random; - - /** Used to lookup a built-in constructor by [[Class]] */ - var ctorByClass = {}; - ctorByClass[arrayClass] = Array; - ctorByClass[boolClass] = Boolean; - ctorByClass[dateClass] = Date; - ctorByClass[funcClass] = Function; - ctorByClass[objectClass] = Object; - ctorByClass[numberClass] = Number; - ctorByClass[regexpClass] = RegExp; - ctorByClass[stringClass] = String; - - /** Used to avoid iterating non-enumerable properties in IE < 9 */ - var nonEnumProps = {}; - nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; - nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; - nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; - nonEnumProps[objectClass] = { 'constructor': true }; - - (function() { - var length = shadowedProps.length; - while (length--) { - var key = shadowedProps[length]; - for (var className in nonEnumProps) { - if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], key)) { - nonEnumProps[className][key] = false; - } - } - } - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps the given value to enable intuitive - * method chaining. - * - * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: - * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, - * and `unshift` - * - * Chaining is supported in custom builds as long as the `value` method is - * implicitly or explicitly included in the build. - * - * The chainable wrapper functions are: - * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, - * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, - * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, - * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, - * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, - * and `zip` - * - * The non-chainable wrapper functions are: - * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, - * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, - * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, - * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, - * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` - * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. - * - * Explicit chaining can be enabled by using the `_.chain` method. - * - * @name _ - * @constructor - * @category Chaining - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - * @example - * - * var wrapped = _([1, 2, 3]); - * - * // returns an unwrapped value - * wrapped.reduce(function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * // returns a wrapped value - * var squares = wrapped.map(function(num) { - * return num * num; - * }); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor - return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__')) - ? value - : new lodashWrapper(value); - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} chainAll A flag to enable chaining for all methods - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value, chainAll) { - this.__chain__ = !!chainAll; - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * An object used to flag environments features. - * - * @static - * @memberOf _ - * @type Object - */ - var support = lodash.support = {}; - - (function() { - var ctor = function() { this.x = 1; }, - object = { '0': 1, 'length': 1 }, - props = []; - - ctor.prototype = { 'valueOf': 1, 'y': 1 }; - for (var key in new ctor) { props.push(key); } - for (key in arguments) { } - - /** - * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.argsClass = toString.call(arguments) == argsClass; - - /** - * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5). - * - * @memberOf _.support - * @type boolean - */ - support.argsObject = arguments.constructor == Object && !(arguments instanceof Array); - - /** - * Detect if `name` or `message` properties of `Error.prototype` are - * enumerable by default. (IE < 9, Safari < 5.1) - * - * @memberOf _.support - * @type boolean - */ - support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); - - /** - * Detect if `prototype` properties are enumerable by default. - * - * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 - * (if the prototype or a property on the prototype has been set) - * incorrectly sets a function's `prototype` property [[Enumerable]] - * value to `true`. - * - * @memberOf _.support - * @type boolean - */ - support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); - - /** - * Detect if functions can be decompiled by `Function#toString` - * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). - * - * @memberOf _.support - * @type boolean - */ - support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext); - - /** - * Detect if `Function#name` is supported (all but IE). - * - * @memberOf _.support - * @type boolean - */ - support.funcNames = typeof Function.name == 'string'; - - /** - * Detect if `arguments` object indexes are non-enumerable - * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumArgs = key != 0; - - /** - * Detect if properties shadowing those on `Object.prototype` are non-enumerable. - * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are - * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumShadows = !/valueOf/.test(props); - - /** - * Detect if own properties are iterated after inherited properties (all but IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.ownLast = props[0] != 'x'; - - /** - * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. - * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()` - * and `splice()` functions that fail to remove the last element, `value[0]`, - * of array-like objects even though the `length` property is set to `0`. - * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()` - * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9. - * - * @memberOf _.support - * @type boolean - */ - support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); - - /** - * Detect lack of support for accessing string characters by index. - * - * IE < 8 can't access characters by index and IE 8 can only access - * characters by index on string literals. - * - * @memberOf _.support - * @type boolean - */ - support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx'; - - /** - * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9) - * and that the JS engine errors when attempting to coerce an object to - * a string without a `toString` function. - * - * @memberOf _.support - * @type boolean - */ - try { - support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); - } catch(e) { - support.nodeClass = true; - } - }(1)); - - /** - * By default, the template delimiters used by Lo-Dash are similar to those in - * embedded Ruby (ERB). Change the following template settings to use alternative - * delimiters. - * - * @static - * @memberOf _ - * @type Object - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'escape': /<%-([\s\S]+?)%>/g, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'evaluate': /<%([\s\S]+?)%>/g, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type string - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type Object - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type Function - */ - '_': lodash - } - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The template used to create iterator functions. - * - * @private - * @param {Object} data The data object used to populate the text. - * @returns {string} Returns the interpolated text. - */ - var iteratorTemplate = function(obj) { - - var __p = 'var index, iterable = ' + - (obj.firstArg) + - ', result = ' + - (obj.init) + - ';\nif (!iterable) return result;\n' + - (obj.top) + - ';'; - if (obj.array) { - __p += '\nvar length = iterable.length; index = -1;\nif (' + - (obj.array) + - ') { '; - if (support.unindexedChars) { - __p += '\n if (isString(iterable)) {\n iterable = iterable.split(\'\')\n } '; - } - __p += '\n while (++index < length) {\n ' + - (obj.loop) + - ';\n }\n}\nelse { '; - } else if (support.nonEnumArgs) { - __p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' + - (obj.loop) + - ';\n }\n } else { '; - } - - if (support.enumPrototypes) { - __p += '\n var skipProto = typeof iterable == \'function\';\n '; - } - - if (support.enumErrorProps) { - __p += '\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n '; - } - - var conditions = []; if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); } if (support.enumErrorProps) { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); } - - if (obj.useHas && obj.keys) { - __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; - if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - } else { - __p += '\n for (index in iterable) {\n'; - if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); } if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - if (support.nonEnumShadows) { - __p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n '; - for (k = 0; k < 7; k++) { - __p += '\n index = \'' + - (obj.shadowedProps[k]) + - '\';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))'; - if (!obj.useHas) { - __p += ' || (!nonEnum[index] && iterable[index] !== objectProto[index])'; - } - __p += ') {\n ' + - (obj.loop) + - ';\n } '; - } - __p += '\n } '; - } - - } - - if (obj.array || support.nonEnumArgs) { - __p += '\n}'; - } - __p += - (obj.bottom) + - ';\nreturn result'; - - return __p - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.bind` that creates the bound function and - * sets its meta data. - * - * @private - * @param {Array} bindData The bind data array. - * @returns {Function} Returns the new bound function. - */ - function baseBind(bindData) { - var func = bindData[0], - partialArgs = bindData[2], - thisArg = bindData[4]; - - function bound() { - // `Function#bind` spec - // http://es5.github.io/#x15.3.4.5 - if (partialArgs) { - // avoid `arguments` object deoptimizations by using `slice` instead - // of `Array.prototype.slice.call` and not assigning `arguments` to a - // variable as a ternary expression - var args = slice(partialArgs); - push.apply(args, arguments); - } - // mimic the constructor's `return` behavior - // http://es5.github.io/#x13.2.2 - if (this instanceof bound) { - // ensure `new bound` is an instance of `func` - var thisBinding = baseCreate(func.prototype), - result = func.apply(thisBinding, args || arguments); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisArg, args || arguments); - } - setBindData(bound, bindData); - return bound; - } - - /** - * The base implementation of `_.clone` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates clones with source counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, isDeep, callback, stackA, stackB) { - if (callback) { - var result = callback(value); - if (typeof result != 'undefined') { - return result; - } - } - // inspect [[Class]] - var isObj = isObject(value); - if (isObj) { - var className = toString.call(value); - if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) { - return value; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return new ctor(+value); - - case numberClass: - case stringClass: - return new ctor(value); - - case regexpClass: - result = ctor(value.source, reFlags.exec(value)); - result.lastIndex = value.lastIndex; - return result; - } - } else { - return value; - } - var isArr = isArray(value); - if (isDeep) { - // check for circular references and return corresponding clone - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; - } - } - result = isArr ? ctor(value.length) : {}; - } - else { - result = isArr ? slice(value) : assign({}, value); - } - // add array properties assigned by `RegExp#exec` - if (isArr) { - if (hasOwnProperty.call(value, 'index')) { - result.index = value.index; - } - if (hasOwnProperty.call(value, 'input')) { - result.input = value.input; - } - } - // exit for shallow clone - if (!isDeep) { - return result; - } - // add the source value to the stack of traversed objects - // and associate it with its clone - stackA.push(value); - stackB.push(result); - - // recursively populate clone (susceptible to call stack limits) - (isArr ? baseEach : forOwn)(value, function(objValue, key) { - result[key] = baseClone(objValue, isDeep, callback, stackA, stackB); - }); - - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ - function baseCreate(prototype, properties) { - return isObject(prototype) ? nativeCreate(prototype) : {}; - } - // fallback for browsers without `Object.create` - if (!nativeCreate) { - baseCreate = (function() { - function Object() {} - return function(prototype) { - if (isObject(prototype)) { - Object.prototype = prototype; - var result = new Object; - Object.prototype = null; - } - return result || context.Object(); - }; - }()); - } - - /** - * The base implementation of `_.createCallback` without support for creating - * "_.pluck" or "_.where" style callbacks. - * - * @private - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - */ - function baseCreateCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - // exit early for no `thisArg` or already bound by `Function#bind` - if (typeof thisArg == 'undefined' || !('prototype' in func)) { - return func; - } - var bindData = func.__bindData__; - if (typeof bindData == 'undefined') { - if (support.funcNames) { - bindData = !func.name; - } - bindData = bindData || !support.funcDecomp; - if (!bindData) { - var source = fnToString.call(func); - if (!support.funcNames) { - bindData = !reFuncName.test(source); - } - if (!bindData) { - // checks if `func` references the `this` keyword and stores the result - bindData = reThis.test(source); - setBindData(func, bindData); - } - } - } - // exit early if there are no `this` references or `func` is bound - if (bindData === false || (bindData !== true && bindData[1] & 1)) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 2: return function(a, b) { - return func.call(thisArg, a, b); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return bind(func, thisArg); - } - - /** - * The base implementation of `createWrapper` that creates the wrapper and - * sets its meta data. - * - * @private - * @param {Array} bindData The bind data array. - * @returns {Function} Returns the new function. - */ - function baseCreateWrapper(bindData) { - var func = bindData[0], - bitmask = bindData[1], - partialArgs = bindData[2], - partialRightArgs = bindData[3], - thisArg = bindData[4], - arity = bindData[5]; - - var isBind = bitmask & 1, - isBindKey = bitmask & 2, - isCurry = bitmask & 4, - isCurryBound = bitmask & 8, - key = func; - - function bound() { - var thisBinding = isBind ? thisArg : this; - if (partialArgs) { - var args = slice(partialArgs); - push.apply(args, arguments); - } - if (partialRightArgs || isCurry) { - args || (args = slice(arguments)); - if (partialRightArgs) { - push.apply(args, partialRightArgs); - } - if (isCurry && args.length < arity) { - bitmask |= 16 & ~32; - return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]); - } - } - args || (args = arguments); - if (isBindKey) { - func = thisBinding[key]; - } - if (this instanceof bound) { - thisBinding = baseCreate(func.prototype); - var result = func.apply(thisBinding, args); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisBinding, args); - } - setBindData(bound, bindData); - return bound; - } - - /** - * The base implementation of `_.difference` that accepts a single array - * of values to exclude. - * - * @private - * @param {Array} array The array to process. - * @param {Array} [values] The array of values to exclude. - * @returns {Array} Returns a new array of filtered values. - */ - function baseDifference(array, values) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - isLarge = length >= largeArraySize && indexOf === baseIndexOf, - result = []; - - if (isLarge) { - var cache = createCache(values); - if (cache) { - indexOf = cacheIndexOf; - values = cache; - } else { - isLarge = false; - } - } - while (++index < length) { - var value = array[index]; - if (indexOf(values, value) < 0) { - result.push(value); - } - } - if (isLarge) { - releaseObject(values); - } - return result; - } - - /** - * The base implementation of `_.flatten` without support for callback - * shorthands or `thisArg` binding. - * - * @private - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects. - * @param {number} [fromIndex=0] The index to start from. - * @returns {Array} Returns a new flattened array. - */ - function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - - if (value && typeof value == 'object' && typeof value.length == 'number' - && (isArray(value) || isArguments(value))) { - // recursively flatten arrays (susceptible to call stack limits) - if (!isShallow) { - value = baseFlatten(value, isShallow, isStrict); - } - var valIndex = -1, - valLength = value.length, - resIndex = result.length; - - result.length += valLength; - while (++valIndex < valLength) { - result[resIndex++] = value[valIndex]; - } - } else if (!isStrict) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.isEqual`, without support for `thisArg` binding, - * that allows partial "_.where" style comparisons. - * - * @private - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. - * @param {Array} [stackA=[]] Tracks traversed `a` objects. - * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { - // used to indicate that when comparing objects, `a` has at least the properties of `b` - if (callback) { - var result = callback(a, b); - if (typeof result != 'undefined') { - return !!result; - } - } - // exit early for identical values - if (a === b) { - // treat `+0` vs. `-0` as not equal - return a !== 0 || (1 / a == 1 / b); - } - var type = typeof a, - otherType = typeof b; - - // exit early for unlike primitive values - if (a === a && - !(a && objectTypes[type]) && - !(b && objectTypes[otherType])) { - return false; - } - // exit early for `null` and `undefined` avoiding ES3's Function#call behavior - // http://es5.github.io/#x15.3.4.4 - if (a == null || b == null) { - return a === b; - } - // compare [[Class]] names - var className = toString.call(a), - otherClass = toString.call(b); - - if (className == argsClass) { - className = objectClass; - } - if (otherClass == argsClass) { - otherClass = objectClass; - } - if (className != otherClass) { - return false; - } - switch (className) { - case boolClass: - case dateClass: - // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal - return +a == +b; - - case numberClass: - // treat `NaN` vs. `NaN` as equal - return (a != +a) - ? b != +b - // but treat `+0` vs. `-0` as not equal - : (a == 0 ? (1 / a == 1 / b) : a == +b); - - case regexpClass: - case stringClass: - // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) - // treat string primitives and their corresponding object instances as equal - return a == String(b); - } - var isArr = className == arrayClass; - if (!isArr) { - // unwrap any `lodash` wrapped values - var aWrapped = hasOwnProperty.call(a, '__wrapped__'), - bWrapped = hasOwnProperty.call(b, '__wrapped__'); - - if (aWrapped || bWrapped) { - return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB); - } - // exit for functions and DOM nodes - if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { - return false; - } - // in older versions of Opera, `arguments` objects have `Array` constructors - var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, - ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; - - // non `Object` object instances with different constructors are not equal - if (ctorA != ctorB && - !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && - ('constructor' in a && 'constructor' in b) - ) { - return false; - } - } - // assume cyclic structures are equal - // the algorithm for detecting cyclic structures is adapted from ES 5.1 - // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == a) { - return stackB[length] == b; - } - } - var size = 0; - result = true; - - // add `a` and `b` to the stack of traversed objects - stackA.push(a); - stackB.push(b); - - // recursively compare objects and arrays (susceptible to call stack limits) - if (isArr) { - // compare lengths to determine if a deep comparison is necessary - length = a.length; - size = b.length; - result = size == length; - - if (result || isWhere) { - // deep compare the contents, ignoring non-numeric properties - while (size--) { - var index = length, - value = b[size]; - - if (isWhere) { - while (index--) { - if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) { - break; - } - } - } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) { - break; - } - } - } - } - else { - // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` - // which, in this case, is more costly - forIn(b, function(value, key, b) { - if (hasOwnProperty.call(b, key)) { - // count the number of properties. - size++; - // deep compare each property value. - return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB)); - } - }); - - if (result && !isWhere) { - // ensure both objects have the same number of properties - forIn(a, function(value, key, a) { - if (hasOwnProperty.call(a, key)) { - // `size` will be `-1` if `a` has more properties than `b` - return (result = --size > -1); - } - }); - } - } - stackA.pop(); - stackB.pop(); - - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.merge` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} [callback] The function to customize merging properties. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates values with source counterparts. - */ - function baseMerge(object, source, callback, stackA, stackB) { - (isArray(source) ? forEach : forOwn)(source, function(source, key) { - var found, - isArr, - result = source, - value = object[key]; - - if (source && ((isArr = isArray(source)) || isPlainObject(source))) { - // avoid merging previously merged cyclic sources - var stackLength = stackA.length; - while (stackLength--) { - if ((found = stackA[stackLength] == source)) { - value = stackB[stackLength]; - break; - } - } - if (!found) { - var isShallow; - if (callback) { - result = callback(value, source); - if ((isShallow = typeof result != 'undefined')) { - value = result; - } - } - if (!isShallow) { - value = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); - } - // add `source` and associated `value` to the stack of traversed objects - stackA.push(source); - stackB.push(value); - - // recursively merge objects and arrays (susceptible to call stack limits) - if (!isShallow) { - baseMerge(value, source, callback, stackA, stackB); - } - } - } - else { - if (callback) { - result = callback(value, source); - if (typeof result == 'undefined') { - result = source; - } - } - if (typeof result != 'undefined') { - value = result; - } - } - object[key] = value; - }); - } - - /** - * The base implementation of `_.random` without argument juggling or support - * for returning floating-point numbers. - * - * @private - * @param {number} min The minimum possible value. - * @param {number} max The maximum possible value. - * @returns {number} Returns a random number. - */ - function baseRandom(min, max) { - return min + floor(nativeRandom() * (max - min + 1)); - } - - /** - * The base implementation of `_.uniq` without support for callback shorthands - * or `thisArg` binding. - * - * @private - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function} [callback] The function called per iteration. - * @returns {Array} Returns a duplicate-value-free array. - */ - function baseUniq(array, isSorted, callback) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - result = []; - - var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf, - seen = (callback || isLarge) ? getArray() : result; - - if (isLarge) { - var cache = createCache(seen); - indexOf = cacheIndexOf; - seen = cache; - } - while (++index < length) { - var value = array[index], - computed = callback ? callback(value, index, array) : value; - - if (isSorted - ? !index || seen[seen.length - 1] !== computed - : indexOf(seen, computed) < 0 - ) { - if (callback || isLarge) { - seen.push(computed); - } - result.push(value); - } - } - if (isLarge) { - releaseArray(seen.array); - releaseObject(seen); - } else if (callback) { - releaseArray(seen); - } - return result; - } - - /** - * Creates a function that aggregates a collection, creating an object composed - * of keys generated from the results of running each element of the collection - * through a callback. The given `setter` function sets the keys and values - * of the composed object. - * - * @private - * @param {Function} setter The setter function. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter) { - return function(collection, callback, thisArg) { - var result = {}; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - setter(result, value, callback(value, index, collection), collection); - } - } else { - baseEach(collection, function(value, key, collection) { - setter(result, value, callback(value, key, collection), collection); - }); - } - return result; - }; - } - - /** - * Creates a function that, when called, either curries or invokes `func` - * with an optional `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to reference. - * @param {number} bitmask The bitmask of method flags to compose. - * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` - * 8 - `_.curry` (bound) - * 16 - `_.partial` - * 32 - `_.partialRight` - * @param {Array} [partialArgs] An array of arguments to prepend to those - * provided to the new function. - * @param {Array} [partialRightArgs] An array of arguments to append to those - * provided to the new function. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new function. - */ - function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) { - var isBind = bitmask & 1, - isBindKey = bitmask & 2, - isCurry = bitmask & 4, - isCurryBound = bitmask & 8, - isPartial = bitmask & 16, - isPartialRight = bitmask & 32; - - if (!isBindKey && !isFunction(func)) { - throw new TypeError; - } - if (isPartial && !partialArgs.length) { - bitmask &= ~16; - isPartial = partialArgs = false; - } - if (isPartialRight && !partialRightArgs.length) { - bitmask &= ~32; - isPartialRight = partialRightArgs = false; - } - var bindData = func && func.__bindData__; - if (bindData && bindData !== true) { - // clone `bindData` - bindData = slice(bindData); - if (bindData[2]) { - bindData[2] = slice(bindData[2]); - } - if (bindData[3]) { - bindData[3] = slice(bindData[3]); - } - // set `thisBinding` is not previously bound - if (isBind && !(bindData[1] & 1)) { - bindData[4] = thisArg; - } - // set if previously bound but not currently (subsequent curried functions) - if (!isBind && bindData[1] & 1) { - bitmask |= 8; - } - // set curried arity if not yet set - if (isCurry && !(bindData[1] & 4)) { - bindData[5] = arity; - } - // append partial left arguments - if (isPartial) { - push.apply(bindData[2] || (bindData[2] = []), partialArgs); - } - // append partial right arguments - if (isPartialRight) { - unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs); - } - // merge flags - bindData[1] |= bitmask; - return createWrapper.apply(null, bindData); - } - // fast path for `_.bind` - var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper; - return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]); - } - - /** - * Creates compiled iteration functions. - * - * @private - * @param {...Object} [options] The compile options object(s). - * @param {string} [options.array] Code to determine if the iterable is an array or array-like. - * @param {boolean} [options.useHas] Specify using `hasOwnProperty` checks in the object loop. - * @param {Function} [options.keys] A reference to `_.keys` for use in own property iteration. - * @param {string} [options.args] A comma separated string of iteration function arguments. - * @param {string} [options.top] Code to execute before the iteration branches. - * @param {string} [options.loop] Code to execute in the object loop. - * @param {string} [options.bottom] Code to execute after the iteration branches. - * @returns {Function} Returns the compiled function. - */ - function createIterator() { - // data properties - iteratorData.shadowedProps = shadowedProps; - - // iterator options - iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = ''; - iteratorData.init = 'iterable'; - iteratorData.useHas = true; - - // merge options into a template data object - for (var object, index = 0; object = arguments[index]; index++) { - for (var key in object) { - iteratorData[key] = object[key]; - } - } - var args = iteratorData.args; - iteratorData.firstArg = /^[^,]+/.exec(args)[0]; - - // create the function factory - var factory = Function( - 'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' + - 'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' + - 'objectTypes, nonEnumProps, stringClass, stringProto, toString', - 'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}' - ); - - // return the compiled function - return factory( - baseCreateCallback, errorClass, errorProto, hasOwnProperty, - indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto, - objectTypes, nonEnumProps, stringClass, stringProto, toString - ); - } - - /** - * Used by `escape` to convert characters to HTML entities. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; - } - - /** - * Gets the appropriate "indexOf" function. If the `_.indexOf` method is - * customized, this method returns the custom method, otherwise it returns - * the `baseIndexOf` function. - * - * @private - * @returns {Function} Returns the "indexOf" function. - */ - function getIndexOf() { - var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; - return result; - } - - /** - * Checks if `value` is a native function. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a native function, else `false`. - */ - function isNative(value) { - return typeof value == 'function' && reNative.test(value); - } - - /** - * Sets `this` binding data on a given function. - * - * @private - * @param {Function} func The function to set data on. - * @param {Array} value The data array to set. - */ - var setBindData = !defineProperty ? noop : function(func, value) { - descriptor.value = value; - defineProperty(func, '__bindData__', descriptor); - }; - - /** - * A fallback implementation of `isPlainObject` which checks if a given value - * is an object created by the `Object` constructor, assuming objects created - * by the `Object` constructor have no inherited enumerable properties and that - * there are no `Object.prototype` extensions. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - */ - function shimIsPlainObject(value) { - var ctor, - result; - - // avoid non Object objects, `arguments` objects, and DOM elements - if (!(value && toString.call(value) == objectClass) || - (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) || - (!support.argsClass && isArguments(value)) || - (!support.nodeClass && isNode(value))) { - return false; - } - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - if (support.ownLast) { - forIn(value, function(value, key, object) { - result = hasOwnProperty.call(object, key); - return false; - }); - return result !== false; - } - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - forIn(value, function(value, key) { - result = key; - }); - return typeof result == 'undefined' || hasOwnProperty.call(value, result); - } - - /** - * Used by `unescape` to convert HTML entities to characters. - * - * @private - * @param {string} match The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - function unescapeHtmlChar(match) { - return htmlUnescapes[match]; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Checks if `value` is an `arguments` object. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`. - * @example - * - * (function() { return _.isArguments(arguments); })(1, 2, 3); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - function isArguments(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == argsClass || false; - } - // fallback for browsers that can't detect `arguments` objects by [[Class]] - if (!support.argsClass) { - isArguments = function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee') || false; - }; - } - - /** - * Checks if `value` is an array. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an array, else `false`. - * @example - * - * (function() { return _.isArray(arguments); })(); - * // => false - * - * _.isArray([1, 2, 3]); - * // => true - */ - var isArray = nativeIsArray || function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == arrayClass || false; - }; - - /** - * A fallback implementation of `Object.keys` which produces an array of the - * given object's own enumerable property names. - * - * @private - * @type Function - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - */ - var shimKeys = createIterator({ - 'args': 'object', - 'init': '[]', - 'top': 'if (!(objectTypes[typeof object])) return result', - 'loop': 'result.push(index)' - }); - - /** - * Creates an array composed of the own enumerable property names of an object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - * @example - * - * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); - * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) - */ - var keys = !nativeKeys ? shimKeys : function(object) { - if (!isObject(object)) { - return []; - } - if ((support.enumPrototypes && typeof object == 'function') || - (support.nonEnumArgs && object.length && isArguments(object))) { - return shimKeys(object); - } - return nativeKeys(object); - }; - - /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */ - var eachIteratorOptions = { - 'args': 'collection, callback, thisArg', - 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)", - 'array': "typeof length == 'number'", - 'keys': keys, - 'loop': 'if (callback(iterable[index], index, collection) === false) return result' - }; - - /** Reusable iterator options for `assign` and `defaults` */ - var defaultsIteratorOptions = { - 'args': 'object, source, guard', - 'top': - 'var args = arguments,\n' + - ' argsIndex = 0,\n' + - " argsLength = typeof guard == 'number' ? 2 : args.length;\n" + - 'while (++argsIndex < argsLength) {\n' + - ' iterable = args[argsIndex];\n' + - ' if (iterable && objectTypes[typeof iterable]) {', - 'keys': keys, - 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", - 'bottom': ' }\n}' - }; - - /** Reusable iterator options for `forIn` and `forOwn` */ - var forOwnIteratorOptions = { - 'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top, - 'array': false - }; - - /** - * Used to convert characters to HTML entities: - * - * Though the `>` character is escaped for symmetry, characters like `>` and `/` - * don't require escaping in HTML and have no special meaning unless they're part - * of a tag or an unquoted attribute value. - * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact") - */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to convert HTML entities to characters */ - var htmlUnescapes = invert(htmlEscapes); - - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'), - reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g'); - - /** - * A function compiled to iterate `arguments` objects, arrays, objects, and - * strings consistenly across environments, executing the callback for each - * element in the collection. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index|key, collection). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @private - * @type Function - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - */ - var baseEach = createIterator(eachIteratorOptions); - - /*--------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources will overwrite property assignments of previous - * sources. If a callback is provided it will be executed to produce the - * assigned values. The callback is bound to `thisArg` and invoked with two - * arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @type Function - * @alias extend - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize assigning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * _.assign({ 'name': 'fred' }, { 'employer': 'slate' }); - * // => { 'name': 'fred', 'employer': 'slate' } - * - * var defaults = _.partialRight(_.assign, function(a, b) { - * return typeof a == 'undefined' ? b : a; - * }); - * - * var object = { 'name': 'barney' }; - * defaults(object, { 'name': 'fred', 'employer': 'slate' }); - * // => { 'name': 'barney', 'employer': 'slate' } - */ - var assign = createIterator(defaultsIteratorOptions, { - 'top': - defaultsIteratorOptions.top.replace(';', - ';\n' + - "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" + - ' var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n' + - "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" + - ' callback = args[--argsLength];\n' + - '}' - ), - 'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]' - }); - - /** - * Creates a clone of `value`. If `isDeep` is `true` nested objects will also - * be cloned, otherwise they will be assigned by reference. If a callback - * is provided it will be executed to produce the cloned values. If the - * callback returns `undefined` cloning will be handled by the method instead. - * The callback is bound to `thisArg` and invoked with one argument; (value). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to clone. - * @param {boolean} [isDeep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the cloned value. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * var shallow = _.clone(characters); - * shallow[0] === characters[0]; - * // => true - * - * var deep = _.clone(characters, true); - * deep[0] === characters[0]; - * // => false - * - * _.mixin({ - * 'clone': _.partialRight(_.clone, function(value) { - * return _.isElement(value) ? value.cloneNode(false) : undefined; - * }) - * }); - * - * var clone = _.clone(document.body); - * clone.childNodes.length; - * // => 0 - */ - function clone(value, isDeep, callback, thisArg) { - // allows working with "Collections" methods without using their `index` - // and `collection` arguments for `isDeep` and `callback` - if (typeof isDeep != 'boolean' && isDeep != null) { - thisArg = callback; - callback = isDeep; - isDeep = false; - } - return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Creates a deep clone of `value`. If a callback is provided it will be - * executed to produce the cloned values. If the callback returns `undefined` - * cloning will be handled by the method instead. The callback is bound to - * `thisArg` and invoked with one argument; (value). - * - * Note: This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the deep cloned value. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * var deep = _.cloneDeep(characters); - * deep[0] === characters[0]; - * // => false - * - * var view = { - * 'label': 'docs', - * 'node': element - * }; - * - * var clone = _.cloneDeep(view, function(value) { - * return _.isElement(value) ? value.cloneNode(true) : undefined; - * }); - * - * clone.node == view.node; - * // => false - */ - function cloneDeep(value, callback, thisArg) { - return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Creates an object that inherits from the given `prototype` object. If a - * `properties` object is provided its own enumerable properties are assigned - * to the created object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties ? assign(result, properties) : result; - } - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object for all destination properties that resolve to `undefined`. Once a - * property is set, additional defaults of the same property will be ignored. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param- {Object} [guard] Allows working with `_.reduce` without using its - * `key` and `object` arguments as sources. - * @returns {Object} Returns the destination object. - * @example - * - * var object = { 'name': 'barney' }; - * _.defaults(object, { 'name': 'fred', 'employer': 'slate' }); - * // => { 'name': 'barney', 'employer': 'slate' } - */ - var defaults = createIterator(defaultsIteratorOptions); - - /** - * This method is like `_.findIndex` except that it returns the key of the - * first element that passes the callback check, instead of the element itself. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * var characters = { - * 'barney': { 'age': 36, 'blocked': false }, - * 'fred': { 'age': 40, 'blocked': true }, - * 'pebbles': { 'age': 1, 'blocked': false } - * }; - * - * _.findKey(characters, function(chr) { - * return chr.age < 40; - * }); - * // => 'barney' (property order is not guaranteed across environments) - * - * // using "_.where" callback shorthand - * _.findKey(characters, { 'age': 1 }); - * // => 'pebbles' - * - * // using "_.pluck" callback shorthand - * _.findKey(characters, 'blocked'); - * // => 'fred' - */ - function findKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwn(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * This method is like `_.findKey` except that it iterates over elements - * of a `collection` in the opposite order. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * var characters = { - * 'barney': { 'age': 36, 'blocked': true }, - * 'fred': { 'age': 40, 'blocked': false }, - * 'pebbles': { 'age': 1, 'blocked': true } - * }; - * - * _.findLastKey(characters, function(chr) { - * return chr.age < 40; - * }); - * // => returns `pebbles`, assuming `_.findKey` returns `barney` - * - * // using "_.where" callback shorthand - * _.findLastKey(characters, { 'age': 40 }); - * // => 'fred' - * - * // using "_.pluck" callback shorthand - * _.findLastKey(characters, 'blocked'); - * // => 'pebbles' - */ - function findLastKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwnRight(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * Iterates over own and inherited enumerable properties of an object, - * executing the callback for each property. The callback is bound to `thisArg` - * and invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * Shape.prototype.move = function(x, y) { - * this.x += x; - * this.y += y; - * }; - * - * _.forIn(new Shape, function(value, key) { - * console.log(key); - * }); - * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments) - */ - var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, { - 'useHas': false - }); - - /** - * This method is like `_.forIn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * Shape.prototype.move = function(x, y) { - * this.x += x; - * this.y += y; - * }; - * - * _.forInRight(new Shape, function(value, key) { - * console.log(key); - * }); - * // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move' - */ - function forInRight(object, callback, thisArg) { - var pairs = []; - - forIn(object, function(value, key) { - pairs.push(key, value); - }); - - var length = pairs.length; - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - if (callback(pairs[length--], pairs[length], object) === false) { - break; - } - } - return object; - } - - /** - * Iterates over own enumerable properties of an object, executing the callback - * for each property. The callback is bound to `thisArg` and invoked with three - * arguments; (value, key, object). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) - */ - var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions); - - /** - * This method is like `_.forOwn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' - */ - function forOwnRight(object, callback, thisArg) { - var props = keys(object), - length = props.length; - - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - var key = props[length]; - if (callback(object[key], key, object) === false) { - break; - } - } - return object; - } - - /** - * Creates a sorted array of property names of all enumerable properties, - * own and inherited, of `object` that have function values. - * - * @static - * @memberOf _ - * @alias methods - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names that have function values. - * @example - * - * _.functions(_); - * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] - */ - function functions(object) { - var result = []; - forIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); - } - - /** - * Checks if the specified property name exists as a direct property of `object`, - * instead of an inherited property. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @param {string} key The name of the property to check. - * @returns {boolean} Returns `true` if key is a direct property, else `false`. - * @example - * - * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); - * // => true - */ - function has(object, key) { - return object ? hasOwnProperty.call(object, key) : false; - } - - /** - * Creates an object composed of the inverted keys and values of the given object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to invert. - * @returns {Object} Returns the created inverted object. - * @example - * - * _.invert({ 'first': 'fred', 'second': 'barney' }); - * // => { 'fred': 'first', 'barney': 'second' } - */ - function invert(object) { - var index = -1, - props = keys(object), - length = props.length, - result = {}; - - while (++index < length) { - var key = props[index]; - result[object[key]] = key; - } - return result; - } - - /** - * Checks if `value` is a boolean value. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`. - * @example - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - value && typeof value == 'object' && toString.call(value) == boolClass || false; - } - - /** - * Checks if `value` is a date. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a date, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - */ - function isDate(value) { - return value && typeof value == 'object' && toString.call(value) == dateClass || false; - } - - /** - * Checks if `value` is a DOM element. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - */ - function isElement(value) { - return value && value.nodeType === 1 || false; - } - - /** - * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a - * length of `0` and objects with no own enumerable properties are considered - * "empty". - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object|string} value The value to inspect. - * @returns {boolean} Returns `true` if the `value` is empty, else `false`. - * @example - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({}); - * // => true - * - * _.isEmpty(''); - * // => true - */ - function isEmpty(value) { - var result = true; - if (!value) { - return result; - } - var className = toString.call(value), - length = value.length; - - if ((className == arrayClass || className == stringClass || - (support.argsClass ? className == argsClass : isArguments(value))) || - (className == objectClass && typeof length == 'number' && isFunction(value.splice))) { - return !length; - } - forOwn(value, function() { - return (result = false); - }); - return result; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If a callback is provided it will be executed - * to compare values. If the callback returns `undefined` comparisons will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (a, b). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'name': 'fred' }; - * var copy = { 'name': 'fred' }; - * - * object == copy; - * // => false - * - * _.isEqual(object, copy); - * // => true - * - * var words = ['hello', 'goodbye']; - * var otherWords = ['hi', 'goodbye']; - * - * _.isEqual(words, otherWords, function(a, b) { - * var reGreet = /^(?:hello|hi)$/i, - * aGreet = _.isString(a) && reGreet.test(a), - * bGreet = _.isString(b) && reGreet.test(b); - * - * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; - * }); - * // => true - */ - function isEqual(a, b, callback, thisArg) { - return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2)); - } - - /** - * Checks if `value` is, or can be coerced to, a finite number. - * - * Note: This is not the same as native `isFinite` which will return true for - * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is finite, else `false`. - * @example - * - * _.isFinite(-101); - * // => true - * - * _.isFinite('10'); - * // => true - * - * _.isFinite(true); - * // => false - * - * _.isFinite(''); - * // => false - * - * _.isFinite(Infinity); - * // => false - */ - function isFinite(value) { - return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); - } - - /** - * Checks if `value` is a function. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - */ - function isFunction(value) { - return typeof value == 'function'; - } - // fallback for older versions of Chrome and Safari - if (isFunction(/x/)) { - isFunction = function(value) { - return typeof value == 'function' && toString.call(value) == funcClass; - }; - } - - /** - * Checks if `value` is the language type of Object. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ - function isObject(value) { - // check if the value is the ECMAScript language type of Object - // http://es5.github.io/#x8 - // and avoid a V8 bug - // http://code.google.com/p/v8/issues/detail?id=2291 - return !!(value && objectTypes[typeof value]); - } - - /** - * Checks if `value` is `NaN`. - * - * Note: This is not the same as native `isNaN` which will return `true` for - * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(undefined); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is a number. - * - * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a number, else `false`. - * @example - * - * _.isNumber(8.4 * 5); - * // => true - */ - function isNumber(value) { - return typeof value == 'number' || - value && typeof value == 'object' && toString.call(value) == numberClass || false; - } - - /** - * Checks if `value` is an object created by the `Object` constructor. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * _.isPlainObject(new Shape); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - */ - var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { - return false; - } - var valueOf = value.valueOf, - objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? (value == objProto || getPrototypeOf(value) == objProto) - : shimIsPlainObject(value); - }; - - /** - * Checks if `value` is a regular expression. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`. - * @example - * - * _.isRegExp(/fred/); - * // => true - */ - function isRegExp(value) { - return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false; - } - - /** - * Checks if `value` is a string. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a string, else `false`. - * @example - * - * _.isString('fred'); - * // => true - */ - function isString(value) { - return typeof value == 'string' || - value && typeof value == 'object' && toString.call(value) == stringClass || false; - } - - /** - * Checks if `value` is `undefined`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - */ - function isUndefined(value) { - return typeof value == 'undefined'; - } - - /** - * Creates an object with the same keys as `object` and values generated by - * running each own enumerable property of `object` through the callback. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new object with values of the results of each `callback` execution. - * @example - * - * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; }); - * // => { 'a': 3, 'b': 6, 'c': 9 } - * - * var characters = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * - * // using "_.pluck" callback shorthand - * _.mapValues(characters, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } - */ - function mapValues(object, callback, thisArg) { - var result = {}; - callback = lodash.createCallback(callback, thisArg, 3); - - forOwn(object, function(value, key, object) { - result[key] = callback(value, key, object); - }); - return result; - } - - /** - * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined` into the destination object. Subsequent sources - * will overwrite property assignments of previous sources. If a callback is - * provided it will be executed to produce the merged values of the destination - * and source properties. If the callback returns `undefined` merging will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize merging properties. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * var names = { - * 'characters': [ - * { 'name': 'barney' }, - * { 'name': 'fred' } - * ] - * }; - * - * var ages = { - * 'characters': [ - * { 'age': 36 }, - * { 'age': 40 } - * ] - * }; - * - * _.merge(names, ages); - * // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] } - * - * var food = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var otherFood = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.merge(food, otherFood, function(a, b) { - * return _.isArray(a) ? a.concat(b) : undefined; - * }); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } - */ - function merge(object) { - var args = arguments, - length = 2; - - if (!isObject(object)) { - return object; - } - // allows working with `_.reduce` and `_.reduceRight` without using - // their `index` and `collection` arguments - if (typeof args[2] != 'number') { - length = args.length; - } - if (length > 3 && typeof args[length - 2] == 'function') { - var callback = baseCreateCallback(args[--length - 1], args[length--], 2); - } else if (length > 2 && typeof args[length - 1] == 'function') { - callback = args[--length]; - } - var sources = slice(arguments, 1, length), - index = -1, - stackA = getArray(), - stackB = getArray(); - - while (++index < length) { - baseMerge(object, sources[index], callback, stackA, stackB); - } - releaseArray(stackA); - releaseArray(stackB); - return object; - } - - /** - * Creates a shallow clone of `object` excluding the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` omitting the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The properties to omit or the - * function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object without the omitted properties. - * @example - * - * _.omit({ 'name': 'fred', 'age': 40 }, 'age'); - * // => { 'name': 'fred' } - * - * _.omit({ 'name': 'fred', 'age': 40 }, function(value) { - * return typeof value == 'number'; - * }); - * // => { 'name': 'fred' } - */ - function omit(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var props = []; - forIn(object, function(value, key) { - props.push(key); - }); - props = baseDifference(props, baseFlatten(arguments, true, false, 1)); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - result[key] = object[key]; - } - } else { - callback = lodash.createCallback(callback, thisArg, 3); - forIn(object, function(value, key, object) { - if (!callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * Creates a two dimensional array of an object's key-value pairs, - * i.e. `[[key1, value1], [key2, value2]]`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns new array of key-value pairs. - * @example - * - * _.pairs({ 'barney': 36, 'fred': 40 }); - * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments) - */ - function pairs(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; - } - return result; - } - - /** - * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` picking the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The function called per - * iteration or property names to pick, specified as individual property - * names or arrays of property names. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object composed of the picked properties. - * @example - * - * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name'); - * // => { 'name': 'fred' } - * - * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) { - * return key.charAt(0) != '_'; - * }); - * // => { 'name': 'fred' } - */ - function pick(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var index = -1, - props = baseFlatten(arguments, true, false, 1), - length = isObject(object) ? props.length : 0; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - } else { - callback = lodash.createCallback(callback, thisArg, 3); - forIn(object, function(value, key, object) { - if (callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * An alternative to `_.reduce` this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable properties through a callback, with each callback execution - * potentially mutating the `accumulator` object. The callback is bound to - * `thisArg` and invoked with four arguments; (accumulator, value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { - * num *= num; - * if (num % 2) { - * return result.push(num) < 3; - * } - * }); - * // => [1, 9, 25] - * - * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * }); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function transform(object, callback, accumulator, thisArg) { - var isArr = isArray(object); - if (accumulator == null) { - if (isArr) { - accumulator = []; - } else { - var ctor = object && object.constructor, - proto = ctor && ctor.prototype; - - accumulator = baseCreate(proto); - } - } - if (callback) { - callback = lodash.createCallback(callback, thisArg, 4); - (isArr ? baseEach : forOwn)(object, function(value, index, object) { - return callback(accumulator, value, index, object); - }); - } - return accumulator; - } - - /** - * Creates an array composed of the own enumerable property values of `object`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property values. - * @example - * - * _.values({ 'one': 1, 'two': 2, 'three': 3 }); - * // => [1, 2, 3] (property order is not guaranteed across environments) - */ - function values(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - result[index] = object[props[index]]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array of elements from the specified indexes, or keys, of the - * `collection`. Indexes may be specified as individual arguments or as arrays - * of indexes. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(number|number[]|string|string[])} [index] The indexes of `collection` - * to retrieve, specified as individual indexes or arrays of indexes. - * @returns {Array} Returns a new array of elements corresponding to the - * provided indexes. - * @example - * - * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); - * // => ['a', 'c', 'e'] - * - * _.at(['fred', 'barney', 'pebbles'], 0, 2); - * // => ['fred', 'pebbles'] - */ - function at(collection) { - var args = arguments, - index = -1, - props = baseFlatten(args, true, false, 1), - length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length, - result = Array(length); - - if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - while(++index < length) { - result[index] = collection[props[index]]; - } - return result; - } - - /** - * Checks if a given value is present in a collection using strict equality - * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the - * offset from the end of the collection. - * - * @static - * @memberOf _ - * @alias include - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {*} target The value to check for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {boolean} Returns `true` if the `target` element is found, else `false`. - * @example - * - * _.contains([1, 2, 3], 1); - * // => true - * - * _.contains([1, 2, 3], 1, 2); - * // => false - * - * _.contains({ 'name': 'fred', 'age': 40 }, 'fred'); - * // => true - * - * _.contains('pebbles', 'eb'); - * // => true - */ - function contains(collection, target, fromIndex) { - var index = -1, - indexOf = getIndexOf(), - length = collection ? collection.length : 0, - result = false; - - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (isArray(collection)) { - result = indexOf(collection, target, fromIndex) > -1; - } else if (typeof length == 'number') { - result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1; - } else { - baseEach(collection, function(value) { - if (++index >= fromIndex) { - return !(result = value === target); - } - }); - } - return result; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through the callback. The corresponding value - * of each key is the number of times the key was returned by the callback. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': 1, '6': 2 } - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': 1, '6': 2 } - * - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); - }); - - /** - * Checks if the given callback returns truey value for **all** elements of - * a collection. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias all - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if all elements passed the callback check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes']); - * // => false - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.every(characters, 'age'); - * // => true - * - * // using "_.where" callback shorthand - * _.every(characters, { 'age': 36 }); - * // => false - */ - function every(collection, callback, thisArg) { - var result = true; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (!(result = !!callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return (result = !!callback(value, index, collection)); - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning an array of all elements - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias select - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that passed the callback check. - * @example - * - * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [2, 4, 6] - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.filter(characters, 'blocked'); - * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] - * - * // using "_.where" callback shorthand - * _.filter(characters, { 'age': 36 }); - * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] - */ - function filter(collection, callback, thisArg) { - var result = []; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - } - } - } else { - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result.push(value); - } - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning the first element that - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias detect, findWhere - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true }, - * { 'name': 'pebbles', 'age': 1, 'blocked': false } - * ]; - * - * _.find(characters, function(chr) { - * return chr.age < 40; - * }); - * // => { 'name': 'barney', 'age': 36, 'blocked': false } - * - * // using "_.where" callback shorthand - * _.find(characters, { 'age': 1 }); - * // => { 'name': 'pebbles', 'age': 1, 'blocked': false } - * - * // using "_.pluck" callback shorthand - * _.find(characters, 'blocked'); - * // => { 'name': 'fred', 'age': 40, 'blocked': true } - */ - function find(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - return value; - } - } - } else { - var result; - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - } - - /** - * This method is like `_.find` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(num) { - * return num % 2 == 1; - * }); - * // => 3 - */ - function findLast(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forEachRight(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - - /** - * Iterates over elements of a collection, executing the callback for each - * element. The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * Note: As with other "Collections" methods, objects with a `length` property - * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` - * may be used for object iteration. - * - * @static - * @memberOf _ - * @alias each - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(','); - * // => logs each number and returns '1,2,3' - * - * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); - * // => logs each number and returns the object (property order is not guaranteed across environments) - */ - function forEach(collection, callback, thisArg) { - if (callback && typeof thisArg == 'undefined' && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (callback(collection[index], index, collection) === false) { - break; - } - } - } else { - baseEach(collection, callback, thisArg); - } - return collection; - } - - /** - * This method is like `_.forEach` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias eachRight - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); - * // => logs each number from right to left and returns '3,2,1' - */ - function forEachRight(collection, callback, thisArg) { - var iterable = collection, - length = collection ? collection.length : 0; - - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (length--) { - if (callback(collection[length], length, collection) === false) { - break; - } - } - } else { - if (typeof length != 'number') { - var props = keys(collection); - length = props.length; - } else if (support.unindexedChars && isString(collection)) { - iterable = collection.split(''); - } - baseEach(collection, function(value, key, collection) { - key = props ? props[--length] : --length; - return callback(iterable[key], key, collection); - }); - } - return collection; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of a collection through the callback. The corresponding value - * of each key is an array of the elements responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false` - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * // using "_.pluck" callback shorthand - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value); - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of the collection through the given callback. The corresponding - * value of each key is the last element responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var keys = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.indexBy(keys, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - */ - var indexBy = createAggregator(function(result, value, key) { - result[key] = value; - }); - - /** - * Invokes the method named by `methodName` on each element in the `collection` - * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function it - * will be invoked for, and `this` bound to, each element in the `collection`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|string} methodName The name of the method to invoke or - * the function invoked per iteration. - * @param {...*} [arg] Arguments to invoke the method with. - * @returns {Array} Returns a new array of the results of each invoked method. - * @example - * - * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invoke([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - function invoke(collection, methodName) { - var args = slice(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); - }); - return result; - } - - /** - * Creates an array of values by running each element in the collection - * through the callback. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias collect - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of the results of each `callback` execution. - * @example - * - * _.map([1, 2, 3], function(num) { return num * 3; }); - * // => [3, 6, 9] - * - * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); - * // => [3, 6, 9] (property order is not guaranteed across environments) - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(characters, 'name'); - * // => ['barney', 'fred'] - */ - function map(collection, callback, thisArg) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - callback = lodash.createCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (++index < length) { - result[index] = callback(collection[index], index, collection); - } - } else { - baseEach(collection, function(value, key, collection) { - result[++index] = callback(value, key, collection); - }); - } - return result; - } - - /** - * Retrieves the maximum value of a collection. If the collection is empty or - * falsey `-Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the maximum value. - * @example - * - * _.max([4, 2, 8, 6]); - * // => 8 - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.max(characters, function(chr) { return chr.age; }); - * // => { 'name': 'fred', 'age': 40 }; - * - * // using "_.pluck" callback shorthand - * _.max(characters, 'age'); - * // => { 'name': 'fred', 'age': 40 }; - */ - function max(collection, callback, thisArg) { - var computed = -Infinity, - result = computed; - - // allows working with functions like `_.map` without using - // their `index` argument as a callback - if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { - callback = null; - } - if (callback == null && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value > result) { - result = value; - } - } - } else { - callback = (callback == null && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current > computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the minimum value of a collection. If the collection is empty or - * falsey `Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the minimum value. - * @example - * - * _.min([4, 2, 8, 6]); - * // => 2 - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.min(characters, function(chr) { return chr.age; }); - * // => { 'name': 'barney', 'age': 36 }; - * - * // using "_.pluck" callback shorthand - * _.min(characters, 'age'); - * // => { 'name': 'barney', 'age': 36 }; - */ - function min(collection, callback, thisArg) { - var computed = Infinity, - result = computed; - - // allows working with functions like `_.map` without using - // their `index` argument as a callback - if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { - callback = null; - } - if (callback == null && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value < result) { - result = value; - } - } - } else { - callback = (callback == null && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current < computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the value of a specified property from all elements in the collection. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {string} property The name of the property to pluck. - * @returns {Array} Returns a new array of property values. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.pluck(characters, 'name'); - * // => ['barney', 'fred'] - */ - var pluck = map; - - /** - * Reduces a collection to a value which is the accumulated result of running - * each element in the collection through the callback, where each successive - * callback execution consumes the return value of the previous execution. If - * `accumulator` is not provided the first element of the collection will be - * used as the initial `accumulator` value. The callback is bound to `thisArg` - * and invoked with four arguments; (accumulator, value, index|key, collection). - * - * @static - * @memberOf _ - * @alias foldl, inject - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var sum = _.reduce([1, 2, 3], function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * return result; - * }, {}); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function reduce(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = lodash.createCallback(callback, thisArg, 4); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - if (noaccum) { - accumulator = collection[++index]; - } - while (++index < length) { - accumulator = callback(accumulator, collection[index], index, collection); - } - } else { - baseEach(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection) - }); - } - return accumulator; - } - - /** - * This method is like `_.reduce` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias foldr - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var list = [[0, 1], [2, 3], [4, 5]]; - * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = lodash.createCallback(callback, thisArg, 4); - forEachRight(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The opposite of `_.filter` this method returns the elements of a - * collection that the callback does **not** return truey for. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that failed the callback check. - * @example - * - * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [1, 3, 5] - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.reject(characters, 'blocked'); - * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] - * - * // using "_.where" callback shorthand - * _.reject(characters, { 'age': 36 }); - * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] - */ - function reject(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - return filter(collection, function(value, index, collection) { - return !callback(value, index, collection); - }); - } - - /** - * Retrieves a random element or `n` random elements from a collection. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to sample. - * @param {number} [n] The number of elements to sample. - * @param- {Object} [guard] Allows working with functions like `_.map` - * without using their `index` arguments as `n`. - * @returns {Array} Returns the random sample(s) of `collection`. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - * - * _.sample([1, 2, 3, 4], 2); - * // => [3, 1] - */ - function sample(collection, n, guard) { - if (collection && typeof collection.length != 'number') { - collection = values(collection); - } else if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - if (n == null || guard) { - return collection ? collection[baseRandom(0, collection.length - 1)] : undefined; - } - var result = shuffle(collection); - result.length = nativeMin(nativeMax(0, n), result.length); - return result; - } - - /** - * Creates an array of shuffled values, using a version of the Fisher-Yates - * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to shuffle. - * @returns {Array} Returns a new shuffled collection. - * @example - * - * _.shuffle([1, 2, 3, 4, 5, 6]); - * // => [4, 1, 6, 3, 5, 2] - */ - function shuffle(collection) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - var rand = baseRandom(0, ++index); - result[index] = result[rand]; - result[rand] = value; - }); - return result; - } - - /** - * Gets the size of the `collection` by returning `collection.length` for arrays - * and array-like objects or the number of own enumerable properties for objects. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns `collection.length` or number of own enumerable properties. - * @example - * - * _.size([1, 2]); - * // => 2 - * - * _.size({ 'one': 1, 'two': 2, 'three': 3 }); - * // => 3 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - var length = collection ? collection.length : 0; - return typeof length == 'number' ? length : keys(collection).length; - } - - /** - * Checks if the callback returns a truey value for **any** element of a - * collection. The function returns as soon as it finds a passing value and - * does not iterate over the entire collection. The callback is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias any - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if any element passed the callback check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.some(characters, 'blocked'); - * // => true - * - * // using "_.where" callback shorthand - * _.some(characters, { 'age': 1 }); - * // => false - */ - function some(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if ((result = callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return !(result = callback(value, index, collection)); - }); - } - return !!result; - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through the callback. This method - * performs a stable sort, that is, it will preserve the original sort order - * of equal elements. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an array of property names is provided for `callback` the collection - * will be sorted by each property value. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of sorted elements. - * @example - * - * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); - * // => [3, 1, 2] - * - * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); - * // => [3, 1, 2] - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 }, - * { 'name': 'barney', 'age': 26 }, - * { 'name': 'fred', 'age': 30 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(_.sortBy(characters, 'age'), _.values); - * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]] - * - * // sorting by multiple properties - * _.map(_.sortBy(characters, ['name', 'age']), _.values); - * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] - */ - function sortBy(collection, callback, thisArg) { - var index = -1, - isArr = isArray(callback), - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - if (!isArr) { - callback = lodash.createCallback(callback, thisArg, 3); - } - forEach(collection, function(value, key, collection) { - var object = result[++index] = getObject(); - if (isArr) { - object.criteria = map(callback, function(key) { return value[key]; }); - } else { - (object.criteria = getArray())[0] = callback(value, key, collection); - } - object.index = index; - object.value = value; - }); - - length = result.length; - result.sort(compareAscending); - while (length--) { - var object = result[length]; - result[length] = object.value; - if (!isArr) { - releaseArray(object.criteria); - } - releaseObject(object); - } - return result; - } - - /** - * Converts the `collection` to an array. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to convert. - * @returns {Array} Returns the new converted array. - * @example - * - * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); - * // => [2, 3, 4] - */ - function toArray(collection) { - if (collection && typeof collection.length == 'number') { - return (support.unindexedChars && isString(collection)) - ? collection.split('') - : slice(collection); - } - return values(collection); - } - - /** - * Performs a deep comparison of each element in a `collection` to the given - * `properties` object, returning an array of all elements that have equivalent - * property values. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Object} props The object of property values to filter by. - * @returns {Array} Returns a new array of elements that have the given properties. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }, - * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } - * ]; - * - * _.where(characters, { 'age': 36 }); - * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }] - * - * _.where(characters, { 'pets': ['dino'] }); - * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }] - */ - var where = filter; - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are all falsey. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to compact. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result.push(value); - } - } - return result; - } - - /** - * Creates an array excluding all values of the provided arrays using strict - * equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @param {...Array} [values] The arrays of values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.difference([1, 2, 3, 4, 5], [5, 2, 10]); - * // => [1, 3, 4] - */ - function difference(array) { - return baseDifference(array, baseFlatten(arguments, true, true, 1)); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element that passes the callback check, instead of the element itself. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true }, - * { 'name': 'pebbles', 'age': 1, 'blocked': false } - * ]; - * - * _.findIndex(characters, function(chr) { - * return chr.age < 20; - * }); - * // => 2 - * - * // using "_.where" callback shorthand - * _.findIndex(characters, { 'age': 36 }); - * // => 0 - * - * // using "_.pluck" callback shorthand - * _.findIndex(characters, 'blocked'); - * // => 1 - */ - function findIndex(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - if (callback(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of a `collection` from right to left. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': true }, - * { 'name': 'fred', 'age': 40, 'blocked': false }, - * { 'name': 'pebbles', 'age': 1, 'blocked': true } - * ]; - * - * _.findLastIndex(characters, function(chr) { - * return chr.age > 30; - * }); - * // => 1 - * - * // using "_.where" callback shorthand - * _.findLastIndex(characters, { 'age': 36 }); - * // => 0 - * - * // using "_.pluck" callback shorthand - * _.findLastIndex(characters, 'blocked'); - * // => 2 - */ - function findLastIndex(array, callback, thisArg) { - var length = array ? array.length : 0; - callback = lodash.createCallback(callback, thisArg, 3); - while (length--) { - if (callback(array[length], length, array)) { - return length; - } - } - return -1; - } - - /** - * Gets the first element or first `n` elements of an array. If a callback - * is provided elements at the beginning of the array are returned as long - * as the callback returns truey. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias head, take - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the first element(s) of `array`. - * @example - * - * _.first([1, 2, 3]); - * // => 1 - * - * _.first([1, 2, 3], 2); - * // => [1, 2] - * - * _.first([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [1, 2] - * - * var characters = [ - * { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.first(characters, 'blocked'); - * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }] - * - * // using "_.where" callback shorthand - * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name'); - * // => ['barney', 'fred'] - */ - function first(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = -1; - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[0] : undefined; - } - } - return slice(array, 0, nativeMin(nativeMax(0, n), length)); - } - - /** - * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truey, the array will only be flattened a single level. If a callback - * is provided each element of the array is passed through the callback before - * flattening. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new flattened array. - * @example - * - * _.flatten([1, [2], [3, [[4]]]]); - * // => [1, 2, 3, 4]; - * - * _.flatten([1, [2], [3, [[4]]]], true); - * // => [1, 2, 3, [[4]]]; - * - * var characters = [ - * { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] }, - * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } - * ]; - * - * // using "_.pluck" callback shorthand - * _.flatten(characters, 'pets'); - * // => ['hoppy', 'baby puss', 'dino'] - */ - function flatten(array, isShallow, callback, thisArg) { - // juggle arguments - if (typeof isShallow != 'boolean' && isShallow != null) { - thisArg = callback; - callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow; - isShallow = false; - } - if (callback != null) { - array = map(array, callback, thisArg); - } - return baseFlatten(array, isShallow); - } - - /** - * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the array is already sorted - * providing `true` for `fromIndex` will run a faster binary search. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {boolean|number} [fromIndex=0] The index to search from or `true` - * to perform a binary search on a sorted array. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2); - * // => 1 - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 4 - * - * _.indexOf([1, 1, 2, 2, 3, 3], 2, true); - * // => 2 - */ - function indexOf(array, value, fromIndex) { - if (typeof fromIndex == 'number') { - var length = array ? array.length : 0; - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); - } else if (fromIndex) { - var index = sortedIndex(array, value); - return array[index] === value ? index : -1; - } - return baseIndexOf(array, value, fromIndex); - } - - /** - * Gets all but the last element or last `n` elements of an array. If a - * callback is provided elements at the end of the array are excluded from - * the result as long as the callback returns truey. The callback is bound - * to `thisArg` and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - * - * _.initial([1, 2, 3], 2); - * // => [1] - * - * _.initial([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [1] - * - * var characters = [ - * { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.initial(characters, 'blocked'); - * // => [{ 'name': 'barney', 'blocked': false, 'employer': 'slate' }] - * - * // using "_.where" callback shorthand - * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name'); - * // => ['barney', 'fred'] - */ - function initial(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : callback || n; - } - return slice(array, 0, nativeMin(nativeMax(0, length - n), length)); - } - - /** - * Creates an array of unique values present in all provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of shared values. - * @example - * - * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); - * // => [1, 2] - */ - function intersection() { - var args = [], - argsIndex = -1, - argsLength = arguments.length, - caches = getArray(), - indexOf = getIndexOf(), - trustIndexOf = indexOf === baseIndexOf, - seen = getArray(); - - while (++argsIndex < argsLength) { - var value = arguments[argsIndex]; - if (isArray(value) || isArguments(value)) { - args.push(value); - caches.push(trustIndexOf && value.length >= largeArraySize && - createCache(argsIndex ? args[argsIndex] : seen)); - } - } - var array = args[0], - index = -1, - length = array ? array.length : 0, - result = []; - - outer: - while (++index < length) { - var cache = caches[0]; - value = array[index]; - - if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { - argsIndex = argsLength; - (cache || seen).push(value); - while (--argsIndex) { - cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { - continue outer; - } - } - result.push(value); - } - } - while (argsLength--) { - cache = caches[argsLength]; - if (cache) { - releaseObject(cache); - } - } - releaseArray(caches); - releaseArray(seen); - return result; - } - - /** - * Gets the last element or last `n` elements of an array. If a callback is - * provided elements at the end of the array are returned as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the last element(s) of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - * - * _.last([1, 2, 3], 2); - * // => [2, 3] - * - * _.last([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [2, 3] - * - * var characters = [ - * { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.pluck(_.last(characters, 'blocked'), 'name'); - * // => ['fred', 'pebbles'] - * - * // using "_.where" callback shorthand - * _.last(characters, { 'employer': 'na' }); - * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] - */ - function last(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[length - 1] : undefined; - } - } - return slice(array, nativeMax(0, length - n)); - } - - /** - * Gets the index at which the last occurrence of `value` is found using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); - * // => 4 - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var index = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Removes all provided values from the given array using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {...*} [value] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * _.pull(array, 2, 3); - * console.log(array); - * // => [1, 1] - */ - function pull(array) { - var args = arguments, - argsIndex = 0, - argsLength = args.length, - length = array ? array.length : 0; - - while (++argsIndex < argsLength) { - var index = -1, - value = args[argsIndex]; - while (++index < length) { - if (array[index] === value) { - splice.call(array, index--, 1); - length--; - } - } - } - return array; - } - - /** - * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. If `start` is less than `stop` a - * zero-length range is created unless a negative `step` is specified. - * - * @static - * @memberOf _ - * @category Arrays - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @param {number} [step=1] The value to increment or decrement by. - * @returns {Array} Returns a new range array. - * @example - * - * _.range(4); - * // => [0, 1, 2, 3] - * - * _.range(1, 5); - * // => [1, 2, 3, 4] - * - * _.range(0, 20, 5); - * // => [0, 5, 10, 15] - * - * _.range(0, -4, -1); - * // => [0, -1, -2, -3] - * - * _.range(1, 4, 0); - * // => [1, 1, 1] - * - * _.range(0); - * // => [] - */ - function range(start, end, step) { - start = +start || 0; - step = typeof step == 'number' ? step : (+step || 1); - - if (end == null) { - end = start; - start = 0; - } - // use `Array(length)` so engines like Chakra and V8 avoid slower modes - // http://youtu.be/XAqIpGU8ZZk#t=17m25s - var index = -1, - length = nativeMax(0, ceil((end - start) / (step || 1))), - result = Array(length); - - while (++index < length) { - result[index] = start; - start += step; - } - return result; - } - - /** - * Removes all elements from an array that the callback returns truey for - * and returns an array of removed elements. The callback is bound to `thisArg` - * and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4, 5, 6]; - * var evens = _.remove(array, function(num) { return num % 2 == 0; }); - * - * console.log(array); - * // => [1, 3, 5] - * - * console.log(evens); - * // => [2, 4, 6] - */ - function remove(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0, - result = []; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - var value = array[index]; - if (callback(value, index, array)) { - result.push(value); - splice.call(array, index--, 1); - length--; - } - } - return result; - } - - /** - * The opposite of `_.initial` this method gets all but the first element or - * first `n` elements of an array. If a callback function is provided elements - * at the beginning of the array are excluded from the result as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias drop, tail - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.rest([1, 2, 3]); - * // => [2, 3] - * - * _.rest([1, 2, 3], 2); - * // => [3] - * - * _.rest([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [3] - * - * var characters = [ - * { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.pluck(_.rest(characters, 'blocked'), 'name'); - * // => ['fred', 'pebbles'] - * - * // using "_.where" callback shorthand - * _.rest(characters, { 'employer': 'slate' }); - * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] - */ - function rest(array, callback, thisArg) { - if (typeof callback != 'number' && callback != null) { - var n = 0, - index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); - } - return slice(array, n); - } - - /** - * Uses a binary search to determine the smallest index at which a value - * should be inserted into a given sorted array in order to maintain the sort - * order of the array. If a callback is provided it will be executed for - * `value` and each element of `array` to compute their sort ranking. The - * callback is bound to `thisArg` and invoked with one argument; (value). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to inspect. - * @param {*} value The value to evaluate. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([20, 30, 50], 40); - * // => 2 - * - * // using "_.pluck" callback shorthand - * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - * // => 2 - * - * var dict = { - * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - * }; - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return dict.wordToNumber[word]; - * }); - * // => 2 - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return this.wordToNumber[word]; - * }, dict); - * // => 2 - */ - function sortedIndex(array, value, callback, thisArg) { - var low = 0, - high = array ? array.length : low; - - // explicitly reference `identity` for better inlining in Firefox - callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity; - value = callback(value); - - while (low < high) { - var mid = (low + high) >>> 1; - (callback(array[mid]) < value) - ? low = mid + 1 - : high = mid; - } - return low; - } - - /** - * Creates an array of unique values, in order, of the provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of combined values. - * @example - * - * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]); - * // => [1, 2, 3, 5, 4] - */ - function union() { - return baseUniq(baseFlatten(arguments, true, true)); - } - - /** - * Creates a duplicate-value-free version of an array using strict equality - * for comparisons, i.e. `===`. If the array is sorted, providing - * `true` for `isSorted` will use a faster algorithm. If a callback is provided - * each element of `array` is passed through the callback before uniqueness - * is computed. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias unique - * @category Arrays - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a duplicate-value-free array. - * @example - * - * _.uniq([1, 2, 1, 3, 1]); - * // => [1, 2, 3] - * - * _.uniq([1, 1, 2, 2, 3], true); - * // => [1, 2, 3] - * - * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); - * // => ['A', 'b', 'C'] - * - * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2.5, 3] - * - * // using "_.pluck" callback shorthand - * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniq(array, isSorted, callback, thisArg) { - // juggle arguments - if (typeof isSorted != 'boolean' && isSorted != null) { - thisArg = callback; - callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted; - isSorted = false; - } - if (callback != null) { - callback = lodash.createCallback(callback, thisArg, 3); - } - return baseUniq(array, isSorted, callback); - } - - /** - * Creates an array excluding all provided values using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to filter. - * @param {...*} [value] The values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); - * // => [2, 3, 4] - */ - function without(array) { - return baseDifference(array, slice(arguments, 1)); - } - - /** - * Creates an array that is the symmetric difference of the provided arrays. - * See http://en.wikipedia.org/wiki/Symmetric_difference. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of values. - * @example - * - * _.xor([1, 2, 3], [5, 2, 1, 4]); - * // => [3, 5, 4] - * - * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]); - * // => [1, 4, 5] - */ - function xor() { - var index = -1, - length = arguments.length; - - while (++index < length) { - var array = arguments[index]; - if (isArray(array) || isArguments(array)) { - var result = result - ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result))) - : array; - } - } - return result || []; - } - - /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second - * elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @alias unzip - * @category Arrays - * @param {...Array} [array] Arrays to process. - * @returns {Array} Returns a new array of grouped elements. - * @example - * - * _.zip(['fred', 'barney'], [30, 40], [true, false]); - * // => [['fred', 30, true], ['barney', 40, false]] - */ - function zip() { - var array = arguments.length > 1 ? arguments : arguments[0], - index = -1, - length = array ? max(pluck(array, 'length')) : 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = pluck(array, index); - } - return result; - } - - /** - * Creates an object composed from arrays of `keys` and `values`. Provide - * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` - * or two arrays, one of `keys` and one of corresponding `values`. - * - * @static - * @memberOf _ - * @alias object - * @category Arrays - * @param {Array} keys The array of keys. - * @param {Array} [values=[]] The array of values. - * @returns {Object} Returns an object composed of the given keys and - * corresponding values. - * @example - * - * _.zipObject(['fred', 'barney'], [30, 40]); - * // => { 'fred': 30, 'barney': 40 } - */ - function zipObject(keys, values) { - var index = -1, - length = keys ? keys.length : 0, - result = {}; - - if (!values && length && !isArray(keys[0])) { - values = []; - } - while (++index < length) { - var key = keys[index]; - if (values) { - result[key] = values[index]; - } else if (key) { - result[key[0]] = key[1]; - } - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that executes `func`, with the `this` binding and - * arguments of the created function, only after being called `n` times. - * - * @static - * @memberOf _ - * @category Functions - * @param {number} n The number of times the function must be called before - * `func` is executed. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('Done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => logs 'Done saving!', after all saves have completed - */ - function after(n, func) { - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that, when called, invokes `func` with the `this` - * binding of `thisArg` and prepends any additional `bind` arguments to those - * provided to the bound function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to bind. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var func = function(greeting) { - * return greeting + ' ' + this.name; - * }; - * - * func = _.bind(func, { 'name': 'fred' }, 'hi'); - * func(); - * // => 'hi fred' - */ - function bind(func, thisArg) { - return arguments.length > 2 - ? createWrapper(func, 17, slice(arguments, 2), null, thisArg) - : createWrapper(func, 1, null, null, thisArg); - } - - /** - * Binds methods of an object to the object itself, overwriting the existing - * method. Method names may be specified as individual arguments or as arrays - * of method names. If no method names are provided all the function properties - * of `object` will be bound. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodName] The object method names to - * bind, specified as individual method names or arrays of method names. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'onClick': function() { console.log('clicked ' + this.label); } - * }; - * - * _.bindAll(view); - * jQuery('#docs').on('click', view.onClick); - * // => logs 'clicked docs', when the button is clicked - */ - function bindAll(object) { - var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), - index = -1, - length = funcs.length; - - while (++index < length) { - var key = funcs[index]; - object[key] = createWrapper(object[key], 1, null, null, object); - } - return object; - } - - /** - * Creates a function that, when called, invokes the method at `object[key]` - * and prepends any additional `bindKey` arguments to those provided to the bound - * function. This method differs from `_.bind` by allowing bound functions to - * reference methods that will be redefined or don't yet exist. - * See http://michaux.ca/articles/lazy-function-definition-pattern. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object the method belongs to. - * @param {string} key The key of the method. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'name': 'fred', - * 'greet': function(greeting) { - * return greeting + ' ' + this.name; - * } - * }; - * - * var func = _.bindKey(object, 'greet', 'hi'); - * func(); - * // => 'hi fred' - * - * object.greet = function(greeting) { - * return greeting + 'ya ' + this.name + '!'; - * }; - * - * func(); - * // => 'hiya fred!' - */ - function bindKey(object, key) { - return arguments.length > 2 - ? createWrapper(key, 19, slice(arguments, 2), null, object) - : createWrapper(key, 3, null, null, object); - } - - /** - * Creates a function that is the composition of the provided functions, - * where each function consumes the return value of the function that follows. - * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. - * Each function is executed with the `this` binding of the composed function. - * - * @static - * @memberOf _ - * @category Functions - * @param {...Function} [func] Functions to compose. - * @returns {Function} Returns the new composed function. - * @example - * - * var realNameMap = { - * 'pebbles': 'penelope' - * }; - * - * var format = function(name) { - * name = realNameMap[name.toLowerCase()] || name; - * return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase(); - * }; - * - * var greet = function(formatted) { - * return 'Hiya ' + formatted + '!'; - * }; - * - * var welcome = _.compose(greet, format); - * welcome('pebbles'); - * // => 'Hiya Penelope!' - */ - function compose() { - var funcs = arguments, - length = funcs.length; - - while (length--) { - if (!isFunction(funcs[length])) { - throw new TypeError; - } - } - return function() { - var args = arguments, - length = funcs.length; - - while (length--) { - args = [funcs[length].apply(this, args)]; - } - return args[0]; - }; - } - - /** - * Creates a function which accepts one or more arguments of `func` that when - * invoked either executes `func` returning its result, if all `func` arguments - * have been provided, or returns a function that accepts one or more of the - * remaining `func` arguments, and so on. The arity of `func` can be specified - * if `func.length` is not sufficient. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @returns {Function} Returns the new curried function. - * @example - * - * var curried = _.curry(function(a, b, c) { - * console.log(a + b + c); - * }); - * - * curried(1)(2)(3); - * // => 6 - * - * curried(1, 2)(3); - * // => 6 - * - * curried(1, 2, 3); - * // => 6 - */ - function curry(func, arity) { - arity = typeof arity == 'number' ? arity : (+arity || func.length); - return createWrapper(func, 4, null, null, null, arity); - } - - /** - * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. - * Provide an options object to indicate that `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. Subsequent calls - * to the debounced function will return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the debounced function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to debounce. - * @param {number} wait The number of milliseconds to delay. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout. - * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // avoid costly calculations while the window size is in flux - * var lazyLayout = _.debounce(calculateLayout, 150); - * jQuery(window).on('resize', lazyLayout); - * - * // execute `sendMail` when the click event is fired, debouncing subsequent calls - * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * }); - * - * // ensure `batchLog` is executed once after 1 second of debounced calls - * var source = new EventSource('/stream'); - * source.addEventListener('message', _.debounce(batchLog, 250, { - * 'maxWait': 1000 - * }, false); - */ - function debounce(func, wait, options) { - var args, - maxTimeoutId, - result, - stamp, - thisArg, - timeoutId, - trailingCall, - lastCalled = 0, - maxWait = false, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - wait = nativeMax(0, wait) || 0; - if (options === true) { - var leading = true; - trailing = false; - } else if (isObject(options)) { - leading = options.leading; - maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); - trailing = 'trailing' in options ? options.trailing : trailing; - } - var delayed = function() { - var remaining = wait - (now() - stamp); - if (remaining <= 0) { - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - var isCalled = trailingCall; - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } - } else { - timeoutId = setTimeout(delayed, remaining); - } - }; - - var maxDelayed = function() { - if (timeoutId) { - clearTimeout(timeoutId); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (trailing || (maxWait !== wait)) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } - }; - - return function() { - args = arguments; - stamp = now(); - thisArg = this; - trailingCall = trailing && (timeoutId || !leading); - - if (maxWait === false) { - var leadingCall = leading && !timeoutId; - } else { - if (!maxTimeoutId && !leading) { - lastCalled = stamp; - } - var remaining = maxWait - (stamp - lastCalled), - isCalled = remaining <= 0; - - if (isCalled) { - if (maxTimeoutId) { - maxTimeoutId = clearTimeout(maxTimeoutId); - } - lastCalled = stamp; - result = func.apply(thisArg, args); - } - else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(maxDelayed, remaining); - } - } - if (isCalled && timeoutId) { - timeoutId = clearTimeout(timeoutId); - } - else if (!timeoutId && wait !== maxWait) { - timeoutId = setTimeout(delayed, wait); - } - if (leadingCall) { - isCalled = true; - result = func.apply(thisArg, args); - } - if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - return result; - }; - } - - /** - * Defers executing the `func` function until the current call stack has cleared. - * Additional arguments will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to defer. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { console.log(text); }, 'deferred'); - * // logs 'deferred' after one or more milliseconds - */ - function defer(func) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = slice(arguments, 1); - return setTimeout(function() { func.apply(undefined, args); }, 1); - } - - /** - * Executes the `func` function after `wait` milliseconds. Additional arguments - * will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay execution. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { console.log(text); }, 1000, 'later'); - * // => logs 'later' after one second - */ - function delay(func, wait) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = slice(arguments, 2); - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided it will be used to determine the cache key for storing the result - * based on the arguments provided to the memoized function. By default, the - * first argument provided to the memoized function is used as the cache key. - * The `func` is executed with the `this` binding of the memoized function. - * The result cache is exposed as the `cache` property on the memoized function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] A function used to resolve the cache key. - * @returns {Function} Returns the new memoizing function. - * @example - * - * var fibonacci = _.memoize(function(n) { - * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); - * }); - * - * fibonacci(9) - * // => 34 - * - * var data = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * - * // modifying the result cache - * var get = _.memoize(function(name) { return data[name]; }, _.identity); - * get('pebbles'); - * // => { 'name': 'pebbles', 'age': 1 } - * - * get.cache.pebbles.name = 'penelope'; - * get('pebbles'); - * // => { 'name': 'penelope', 'age': 1 } - */ - function memoize(func, resolver) { - if (!isFunction(func)) { - throw new TypeError; - } - var memoized = function() { - var cache = memoized.cache, - key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; - - return hasOwnProperty.call(cache, key) - ? cache[key] - : (cache[key] = func.apply(this, arguments)); - } - memoized.cache = {}; - return memoized; - } - - /** - * Creates a function that is restricted to execute `func` once. Repeat calls to - * the function will return the value of the first call. The `func` is executed - * with the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // `initialize` executes `createApplication` once - */ - function once(func) { - var ran, - result; - - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (ran) { - return result; - } - ran = true; - result = func.apply(this, arguments); - - // clear the `func` variable so the function may be garbage collected - func = null; - return result; - }; - } - - /** - * Creates a function that, when called, invokes `func` with any additional - * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind` except it does **not** alter the `this` binding. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var greet = function(greeting, name) { return greeting + ' ' + name; }; - * var hi = _.partial(greet, 'hi'); - * hi('fred'); - * // => 'hi fred' - */ - function partial(func) { - return createWrapper(func, 16, slice(arguments, 1)); - } - - /** - * This method is like `_.partial` except that `partial` arguments are - * appended to those provided to the new function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var defaultsDeep = _.partialRight(_.merge, _.defaults); - * - * var options = { - * 'variable': 'data', - * 'imports': { 'jq': $ } - * }; - * - * defaultsDeep(options, _.templateSettings); - * - * options.variable - * // => 'data' - * - * options.imports - * // => { '_': _, 'jq': $ } - */ - function partialRight(func) { - return createWrapper(func, 32, null, slice(arguments, 1)); - } - - /** - * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Provide an options object to - * indicate that `func` should be invoked on the leading and/or trailing edge - * of the `wait` timeout. Subsequent calls to the throttled function will - * return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the throttled function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to throttle. - * @param {number} wait The number of milliseconds to throttle executions to. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // avoid excessively updating the position while scrolling - * var throttled = _.throttle(updatePosition, 100); - * jQuery(window).on('scroll', throttled); - * - * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes - * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { - * 'trailing': false - * })); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - if (options === false) { - leading = false; - } else if (isObject(options)) { - leading = 'leading' in options ? options.leading : leading; - trailing = 'trailing' in options ? options.trailing : trailing; - } - debounceOptions.leading = leading; - debounceOptions.maxWait = wait; - debounceOptions.trailing = trailing; - - return debounce(func, wait, debounceOptions); - } - - /** - * Creates a function that provides `value` to the wrapper function as its - * first argument. Additional arguments provided to the function are appended - * to those provided to the wrapper function. The wrapper is executed with - * the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {*} value The value to wrap. - * @param {Function} wrapper The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

    ' + func(text) + '

    '; - * }); - * - * p('Fred, Wilma, & Pebbles'); - * // => '

    Fred, Wilma, & Pebbles

    ' - */ - function wrap(value, wrapper) { - return createWrapper(wrapper, 16, [value]); - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that returns `value`. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} value The value to return from the new function. - * @returns {Function} Returns the new function. - * @example - * - * var object = { 'name': 'fred' }; - * var getter = _.constant(object); - * getter() === object; - * // => true - */ - function constant(value) { - return function() { - return value; - }; - } - - /** - * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name the created callback will return the property value for a given element. - * If `func` is an object the created callback will return `true` for elements - * that contain the equivalent object properties, otherwise it will return `false`. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // wrap to create custom callback shorthands - * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) { - * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback); - * return !match ? func(callback, thisArg) : function(object) { - * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; - * }; - * }); - * - * _.filter(characters, 'age__gt38'); - * // => [{ 'name': 'fred', 'age': 40 }] - */ - function createCallback(func, thisArg, argCount) { - var type = typeof func; - if (func == null || type == 'function') { - return baseCreateCallback(func, thisArg, argCount); - } - // handle "_.pluck" style callback shorthands - if (type != 'object') { - return property(func); - } - var props = keys(func), - key = props[0], - a = func[key]; - - // handle "_.where" style callback shorthands - if (props.length == 1 && a === a && !isObject(a)) { - // fast path the common case of providing an object with a single - // property containing a primitive value - return function(object) { - var b = object[key]; - return a === b && (a !== 0 || (1 / a == 1 / b)); - }; - } - return function(object) { - var length = props.length, - result = false; - - while (length--) { - if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { - break; - } - } - return result; - }; - } - - /** - * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their - * corresponding HTML entities. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} string The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('Fred, Wilma, & Pebbles'); - * // => 'Fred, Wilma, & Pebbles' - */ - function escape(string) { - return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar); - } - - /** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'name': 'fred' }; - * _.identity(object) === object; - * // => true - */ - function identity(value) { - return value; - } - - /** - * Adds function properties of a source object to the destination object. - * If `object` is a function methods will be added to its prototype as well. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Function|Object} [object=lodash] object The destination object. - * @param {Object} source The object of functions to add. - * @param {Object} [options] The options object. - * @param {boolean} [options.chain=true] Specify whether the functions added are chainable. - * @example - * - * function capitalize(string) { - * return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); - * } - * - * _.mixin({ 'capitalize': capitalize }); - * _.capitalize('fred'); - * // => 'Fred' - * - * _('fred').capitalize().value(); - * // => 'Fred' - * - * _.mixin({ 'capitalize': capitalize }, { 'chain': false }); - * _('fred').capitalize(); - * // => 'Fred' - */ - function mixin(object, source, options) { - var chain = true, - methodNames = source && functions(source); - - if (!source || (!options && !methodNames.length)) { - if (options == null) { - options = source; - } - ctor = lodashWrapper; - source = object; - object = lodash; - methodNames = functions(source); - } - if (options === false) { - chain = false; - } else if (isObject(options) && 'chain' in options) { - chain = options.chain; - } - var ctor = object, - isFunc = isFunction(ctor); - - forEach(methodNames, function(methodName) { - var func = object[methodName] = source[methodName]; - if (isFunc) { - ctor.prototype[methodName] = function() { - var chainAll = this.__chain__, - value = this.__wrapped__, - args = [value]; - - push.apply(args, arguments); - var result = func.apply(object, args); - if (chain || chainAll) { - if (value === result && isObject(result)) { - return this; - } - result = new ctor(result); - result.__chain__ = chainAll; - } - return result; - }; - } - }); - } - - /** - * Reverts the '_' variable to its previous value and returns a reference to - * the `lodash` function. - * - * @static - * @memberOf _ - * @category Utilities - * @returns {Function} Returns the `lodash` function. - * @example - * - * var lodash = _.noConflict(); - */ - function noConflict() { - context._ = oldDash; - return this; - } - - /** - * A no-operation function. - * - * @static - * @memberOf _ - * @category Utilities - * @example - * - * var object = { 'name': 'fred' }; - * _.noop(object) === undefined; - * // => true - */ - function noop() { - // no operation performed - } - - /** - * Gets the number of milliseconds that have elapsed since the Unix epoch - * (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @category Utilities - * @example - * - * var stamp = _.now(); - * _.defer(function() { console.log(_.now() - stamp); }); - * // => logs the number of milliseconds it took for the deferred function to be called - */ - var now = isNative(now = Date.now) && now || function() { - return new Date().getTime(); - }; - - /** - * Converts the given value into an integer of the specified radix. - * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the - * `value` is a hexadecimal, in which case a `radix` of `16` is used. - * - * Note: This method avoids differences in native ES3 and ES5 `parseInt` - * implementations. See http://es5.github.io/#E. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} value The value to parse. - * @param {number} [radix] The radix used to interpret the value to parse. - * @returns {number} Returns the new integer value. - * @example - * - * _.parseInt('08'); - * // => 8 - */ - var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt` - return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); - }; - - /** - * Creates a "_.pluck" style function, which returns the `key` value of a - * given object. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} key The name of the property to retrieve. - * @returns {Function} Returns the new function. - * @example - * - * var characters = [ - * { 'name': 'fred', 'age': 40 }, - * { 'name': 'barney', 'age': 36 } - * ]; - * - * var getName = _.property('name'); - * - * _.map(characters, getName); - * // => ['barney', 'fred'] - * - * _.sortBy(characters, getName); - * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] - */ - function property(key) { - return function(object) { - return object[key]; - }; - } - - /** - * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided a number between `0` and the given number will be - * returned. If `floating` is truey or either `min` or `max` are floats a - * floating-point number will be returned instead of an integer. - * - * @static - * @memberOf _ - * @category Utilities - * @param {number} [min=0] The minimum possible value. - * @param {number} [max=1] The maximum possible value. - * @param {boolean} [floating=false] Specify returning a floating-point number. - * @returns {number} Returns a random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(min, max, floating) { - var noMin = min == null, - noMax = max == null; - - if (floating == null) { - if (typeof min == 'boolean' && noMax) { - floating = min; - min = 1; - } - else if (!noMax && typeof max == 'boolean') { - floating = max; - noMax = true; - } - } - if (noMin && noMax) { - max = 1; - } - min = +min || 0; - if (noMax) { - max = min; - min = 0; - } else { - max = +max || 0; - } - if (floating || min % 1 || max % 1) { - var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max); - } - return baseRandom(min, max); - } - - /** - * Resolves the value of property `key` on `object`. If `key` is a function - * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey then `undefined` - * is returned. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} object The object to inspect. - * @param {string} key The name of the property to resolve. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { - * 'cheese': 'crumpets', - * 'stuff': function() { - * return 'nonsense'; - * } - * }; - * - * _.result(object, 'cheese'); - * // => 'crumpets' - * - * _.result(object, 'stuff'); - * // => 'nonsense' - */ - function result(object, key) { - if (object) { - var value = object[key]; - return isFunction(value) ? object[key]() : value; - } - } - - /** - * A micro-templating method that handles arbitrary delimiters, preserves - * whitespace, and correctly escapes quotes within interpolated code. - * - * Note: In the development build, `_.template` utilizes sourceURLs for easier - * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - * - * For more information on precompiling templates see: - * http://lodash.com/custom-builds - * - * For more information on Chrome extension sandboxes see: - * http://developer.chrome.com/stable/extensions/sandboxingEval.html - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} text The template text. - * @param {Object} data The data object used to populate the text. - * @param {Object} [options] The options object. - * @param {RegExp} [options.escape] The "escape" delimiter. - * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as local variables. - * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [sourceURL] The sourceURL of the template's compiled source. - * @param {string} [variable] The data object variable name. - * @returns {Function|string} Returns a compiled function when no `data` object - * is given, else it returns the interpolated text. - * @example - * - * // using the "interpolate" delimiter to create a compiled template - * var compiled = _.template('hello <%= name %>'); - * compiled({ 'name': 'fred' }); - * // => 'hello fred' - * - * // using the "escape" delimiter to escape HTML in data property values - * _.template('<%- value %>', { 'value': ' - - - -## Documentation - -### Collections - -* [forEach](#forEach) -* [map](#map) -* [filter](#filter) -* [reject](#reject) -* [reduce](#reduce) -* [detect](#detect) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [whilst](#whilst) -* [until](#until) -* [waterfall](#waterfall) -* [queue](#queue) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - - -### forEach(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the forEach function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // assuming openFiles is an array of file names and saveFile is a function - // to save the modified contents of that file: - - async.forEach(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error - }); - ---------------------------------------- - - -### forEachSeries(arr, iterator, callback) - -The same as forEach only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - -### forEachLimit(arr, limit, iterator, callback) - -The same as forEach only the iterator is applied to batches of items in the -array, in series. The next batch of iterators is only called once the current -one has completed processing. - -__Arguments__ - -* arr - An array to iterate over. -* limit - How many items should be in each batch. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // Assume documents is an array of JSON objects and requestApi is a - // function that interacts with a rate-limited REST api. - - async.forEachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error - }); ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as filter, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then its probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback which accepts an optional error as its first argument, and the state - of the reduction as the second. If an error is passed to the callback, the - reduction is stopped and the main callback is immediately called with the - error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - - async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); - }, function(err, result){ - // result is now equal to the last value of memo, which is 6 - }); - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - - async.detect(['file1','file2','file3'], path.exists, function(result){ - // result now equals the first file in the list that exists - }); - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a value to use as the sort criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - - async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); - }, function(err, results){ - // results is now the original array of files sorted by - // modified date - }); - - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - - async.some(['file1','file2','file3'], path.exists, function(result){ - // if result is true then at least one of the files exists - }); - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - - async.every(['file1','file2','file3'], path.exists, function(result){ - // if result is true then every file exists - }); - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - - async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories - }); - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - }, - ], - // optional callback - function(err, results){ - // results is now equal to ['one', 'two'] - }); - - - // an example using an object instead of an array - async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equal to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed a - callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - }, - ], - // optional callback - function(err, results){ - // in this case, the results array will equal ['two','one'] - // because the functions were run in parallel and the second - // function had a shorter timeout before calling the callback. - }); - - - // an example using an object instead of an array - async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback which must be called once it has completed with an optional - error as the first argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - - var count = 0; - - async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } - }); - - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. -* callback(err) - An optional callback to run once all the functions have - completed. This function gets passed any error that may have occurred. - -__Example__ - - async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } - ]); - - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - - // create a queue object with concurrency 2 - - var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); - }, 2); - - - // assign a callback - q.drain = function() { - console.log('all items have been processed'); - } - - // add some items to the queue - - q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); - }); - q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); - }); - - ---------------------------------------- - - -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions on which they depend. - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - syntax is easier to understand by looking at the example. -* callback(err) - An optional callback which is called when all the tasks have - been completed. The callback may receive an error as an argument. - -__Example__ - - async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] - }); - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - - async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } - ], - function(results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - email_link: ['write_file', function(callback){ - // once the file is written let's email a link to it... - } - ]); - }); - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. Its also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. - -__Example__ - - var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } - ]); - - node> var iterator2 = iterator(); - 'one' - node> var iterator3 = iterator2(); - 'two' - node> iterator3(); - 'three' - node> var nextfn = iterator2.next(); - node> nextfn(); - 'three' - - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - - // using apply - - async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), - ]); - - - // the same process without using apply - - async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - }, - ]); - -It's possible to pass any number of additional arguments when calling the -continuation: - - node> var fn = async.apply(sys.puts, 'one'); - node> fn('two', 'three'); - one - two - three - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), -which means other higher priority events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - - var call_order = []; - async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two] - }); - call_order.push('one') - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - - var slow_fn = function (name, callback) { - // do something - callback(null, result); - }; - var fn = async.memoize(slow_fn); - - // fn can now be used as if it were slow_fn - fn('some name', function () { - // callback - }); - - -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); - }; - - node> async.log(hello, 'world'); - 'hello world' - - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); - }; - - node> async.dir(hello, 'world'); - {hello: 'world'} - - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/deps/nodeunit.css b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/deps/nodeunit.css deleted file mode 100644 index 274434a..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/deps/nodeunit.css +++ /dev/null @@ -1,70 +0,0 @@ -/*! - * Styles taken from qunit.css - */ - -h1#nodeunit-header, h1.nodeunit-header { - padding: 15px; - font-size: large; - background-color: #06b; - color: white; - font-family: 'trebuchet ms', verdana, arial; - margin: 0; -} - -h1#nodeunit-header a { - color: white; -} - -h2#nodeunit-banner { - height: 2em; - border-bottom: 1px solid white; - background-color: #eee; - margin: 0; - font-family: 'trebuchet ms', verdana, arial; -} -h2#nodeunit-banner.pass { - background-color: green; -} -h2#nodeunit-banner.fail { - background-color: red; -} - -h2#nodeunit-userAgent, h2.nodeunit-userAgent { - padding: 10px; - background-color: #eee; - color: black; - margin: 0; - font-size: small; - font-weight: normal; - font-family: 'trebuchet ms', verdana, arial; - font-size: 10pt; -} - -div#nodeunit-testrunner-toolbar { - background: #eee; - border-top: 1px solid black; - padding: 10px; - font-family: 'trebuchet ms', verdana, arial; - margin: 0; - font-size: 10pt; -} - -ol#nodeunit-tests { - font-family: 'trebuchet ms', verdana, arial; - font-size: 10pt; -} -ol#nodeunit-tests li strong { - cursor:pointer; -} -ol#nodeunit-tests .pass { - color: green; -} -ol#nodeunit-tests .fail { - color: red; -} - -p#nodeunit-testresult { - margin-left: 1em; - font-size: 10pt; - font-family: 'trebuchet ms', verdana, arial; -} diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/deps/nodeunit.js b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/deps/nodeunit.js deleted file mode 100644 index 5957184..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/deps/nodeunit.js +++ /dev/null @@ -1,1966 +0,0 @@ -/*! - * Nodeunit - * https://github.com/caolan/nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * json2.js - * http://www.JSON.org/json2.js - * Public Domain. - * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - */ -nodeunit = (function(){ -/* - http://www.JSON.org/json2.js - 2010-11-17 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, strict: false, regexp: false */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -if (!this.JSON) { - this.JSON = {}; -} - -(function () { - "use strict"; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function (key) { - - return isFinite(this.valueOf()) ? - this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' : null; - }; - - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function (key) { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? - '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? c : - '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : - '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 ? '[]' : - gap ? '[\n' + gap + - partial.join(',\n' + gap) + '\n' + - mind + ']' : - '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - k = rep[i]; - if (typeof k === 'string') { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 ? '{}' : - gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + - mind + '}' : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ -.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') -.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') -.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' ? - walk({'': j}, '') : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); -var assert = this.assert = {}; -var types = {}; -var core = {}; -var nodeunit = {}; -var reporter = {}; -/*global setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root = this, - previous_async = root.async; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - else { - root.async = async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _forEach(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _forEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - var _indexOf = function (arr, item) { - if (arr.indexOf) { - return arr.indexOf(item); - } - for (var i = 0; i < arr.length; i += 1) { - if (arr[i] === item) { - return i; - } - } - return -1; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - async.nextTick = function (fn) { - if (typeof process === 'undefined' || !(process.nextTick)) { - setTimeout(fn, 0); - } - else { - process.nextTick(fn); - } - }; - - async.forEach = function (arr, iterator, callback) { - if (!arr.length) { - return callback(); - } - var completed = 0; - _forEach(arr, function (x) { - iterator(x, function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - } - }); - }); - }; - - async.forEachSeries = function (arr, iterator, callback) { - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEach].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.forEachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var completed = []; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners, function (fn) { - fn(); - }); - }; - - addListener(function () { - if (completed.length === keys.length) { - callback(null); - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - completed.push(k); - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && _indexOf(completed, x) !== -1); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - if (!tasks.length) { - return callback(); - } - callback = callback || function () {}; - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args || null); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args || null); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var tasks = []; - var q = { - concurrency: concurrency, - push: function (data, callback) { - tasks.push({data: data, callback: callback}); - async.nextTick(q.process); - }, - process: function () { - if (workers < q.concurrency && tasks.length) { - var task = tasks.splice(0, 1)[0]; - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - q.process(); - }); - } - }, - length: function () { - return tasks.length; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - -}()); -(function(exports){ -/** - * This file is based on the node.js assert module, but with some small - * changes for browser-compatibility - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - */ - - -/** - * Added for browser compatibility - */ - -var _keys = function(obj){ - if(Object.keys) return Object.keys(obj); - var keys = []; - for(var k in obj){ - if(obj.hasOwnProperty(k)) keys.push(k); - } - return keys; -}; - - - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// 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 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 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. - - -var pSlice = Array.prototype.slice; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = exports; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({message: message, actual: actual, expected: expected}) - -assert.AssertionError = function AssertionError (options) { - this.name = "AssertionError"; - this.message = options.message; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } -}; -// code from util.inherits in node -assert.AssertionError.super_ = Error; - - -// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call -// TODO: test what effect this may have -var ctor = function () { this.constructor = assert.AssertionError; }; -ctor.prototype = Error.prototype; -assert.AssertionError.prototype = new ctor(); - - -assert.AssertionError.prototype.toString = function() { - if (this.message) { - return [this.name+":", this.message].join(' '); - } else { - return [ this.name+":" - , JSON.stringify(this.expected ) - , this.operator - , JSON.stringify(this.actual) - ].join(" "); - } -}; - -// assert.AssertionError instanceof Error - -assert.AssertionError.__proto__ = Error.prototype; - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -assert.ok = function ok(value, message) { - if (!!!value) fail(value, true, message, "==", assert.ok); -}; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, "==", assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, "!=", assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, "deepEqual", assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == "object", - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical "prototype" property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isUndefinedOrNull (value) { - return value === null || value === undefined; -} - -function isArguments (object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv (a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - // an identical "prototype" property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try{ - var ka = _keys(a), - kb = _keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key] )) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, "===", assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as determined by !==. -// assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, "!==", assert.notStrictEqual); - } -}; - -function _throws (shouldThrow, block, err, message) { - var exception = null, - threw = false, - typematters = true; - - message = message || ""; - - //handle optional arguments - if (arguments.length == 3) { - if (typeof(err) == "string") { - message = err; - typematters = false; - } - } else if (arguments.length == 2) { - typematters = false; - } - - try { - block(); - } catch (e) { - threw = true; - exception = e; - } - - if (shouldThrow && !threw) { - fail( "Missing expected exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if (!shouldThrow && threw && typematters && exception instanceof err) { - fail( "Got unwanted exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if ((shouldThrow && threw && typematters && !(exception instanceof err)) || - (!shouldThrow && threw)) { - throw exception; - } -}; - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function (err) { if (err) {throw err;}}; -})(assert); -(function(exports){ -/*! - * Nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -/** - * Module dependencies - */ - - - -/** - * Creates assertion objects representing the result of an assert call. - * Accepts an object or AssertionError as its argument. - * - * @param {object} obj - * @api public - */ - -exports.assertion = function (obj) { - return { - method: obj.method || '', - message: obj.message || (obj.error && obj.error.message) || '', - error: obj.error, - passed: function () { - return !this.error; - }, - failed: function () { - return Boolean(this.error); - } - }; -}; - -/** - * Creates an assertion list object representing a group of assertions. - * Accepts an array of assertion objects. - * - * @param {Array} arr - * @param {Number} duration - * @api public - */ - -exports.assertionList = function (arr, duration) { - var that = arr || []; - that.failures = function () { - var failures = 0; - for (var i=0; i(' + - '' + assertions.failures() + ', ' + - '' + assertions.passes() + ', ' + - assertions.length + - ')'; - test.className = assertions.failures() ? 'fail': 'pass'; - test.appendChild(strong); - - var aList = document.createElement('ol'); - aList.style.display = 'none'; - test.onclick = function () { - var d = aList.style.display; - aList.style.display = (d == 'none') ? 'block': 'none'; - }; - for (var i=0; i' + (a.error.stack || a.error) + ''; - li.className = 'fail'; - } - else { - li.innerHTML = a.message || a.method || 'no message'; - li.className = 'pass'; - } - aList.appendChild(li); - } - test.appendChild(aList); - tests.appendChild(test); - }, - done: function (assertions) { - var end = new Date().getTime(); - var duration = end - start; - - var failures = assertions.failures(); - banner.className = failures ? 'fail': 'pass'; - - result.innerHTML = 'Tests completed in ' + duration + - ' milliseconds.
    ' + - assertions.passes() + ' assertions of ' + - '' + assertions.length + ' passed, ' + - assertions.failures() + ' failed.'; - } - }); -}; -})(reporter); -nodeunit = core; -nodeunit.assert = assert; -nodeunit.reporter = reporter; -nodeunit.run = reporter.run; -return nodeunit; })(); diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/dist/async.min.js b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/dist/async.min.js deleted file mode 100644 index e4c898b..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/dist/async.min.js +++ /dev/null @@ -1 +0,0 @@ -/*global setTimeout: false, console: false */(function(){var a={},b=this,c=b.async;typeof module!="undefined"&&module.exports?module.exports=a:b.async=a,a.noConflict=function(){return b.async=c,a};var d=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;cd?1:0};d(null,e(b.sort(c),function(a){return a.value}))})},a.auto=function(a,b){b=b||function(){};var c=g(a);if(!c.length)return b(null);var e={},h=[],i=function(a){h.unshift(a)},j=function(a){for(var b=0;b b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners, function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - if (!tasks.length) { - return callback(); - } - callback = callback || function () {}; - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - q.tasks.push({data: data, callback: callback}); - if(q.saturated && q.tasks.length == concurrency) q.saturated(); - async.nextTick(q.process); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if(q.empty && q.tasks.length == 0) q.empty(); - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if(q.drain && q.tasks.length + workers == 0) q.drain(); - q.process(); - }); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - } - }; - -}()); diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/nodelint.cfg b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/nodelint.cfg deleted file mode 100644 index 457a967..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/nodelint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -var options = { - indent: 4, - onevar: false -}; diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/package.json b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/package.json deleted file mode 100644 index 80c41e2..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./index", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.1.15", - "repository": { - "type": "git", - "url": "git://github.com/caolan/async.git" - }, - "bugs": { - "url": "http://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/caolan/async/raw/master/LICENSE" - } - ], - "_npmUser": { - "name": "caolan", - "email": "caolan@caolanmcmahon.com" - }, - "_id": "async@0.1.15", - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.0.101", - "_nodeVersion": "v0.4.9", - "_defaultsLoaded": true, - "dist": { - "shasum": "2180eaca2cf2a6ca5280d41c0585bec9b3e49bd3", - "tarball": "http://registry.npmjs.org/async/-/async-0.1.15.tgz" - }, - "maintainers": [ - { - "name": "caolan", - "email": "caolan@caolanmcmahon.com" - } - ], - "directories": {}, - "_shasum": "2180eaca2cf2a6ca5280d41c0585bec9b3e49bd3", - "_from": "async@0.1.15", - "_resolved": "https://registry.npmjs.org/async/-/async-0.1.15.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/caolan/async" -} diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/test/test-async.js b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/test/test-async.js deleted file mode 100644 index d3eeddc..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/test/test-async.js +++ /dev/null @@ -1,1577 +0,0 @@ -var async = require('../lib/async'); - - -exports['auto'] = function(test){ - var callOrder = []; - var testdata = [{test: 'test'}]; - async.auto({ - task1: ['task2', function(callback){ - setTimeout(function(){ - callOrder.push('task1'); - callback(); - }, 25); - }], - task2: function(callback){ - setTimeout(function(){ - callOrder.push('task2'); - callback(); - }, 50); - }, - task3: ['task2', function(callback){ - callOrder.push('task3'); - callback(); - }], - task4: ['task1', 'task2', function(callback){ - callOrder.push('task4'); - callback(); - }] - }, - function(err){ - test.same(callOrder, ['task2','task3','task1','task4']); - test.done(); - }); -}; - -exports['auto results'] = function(test){ - var callOrder = []; - async.auto({ - task1: ['task2', function(callback, results){ - test.same(results.task2, 'task2'); - setTimeout(function(){ - callOrder.push('task1'); - callback(null, 'task1a', 'task1b'); - }, 25); - }], - task2: function(callback){ - setTimeout(function(){ - callOrder.push('task2'); - callback(null, 'task2'); - }, 50); - }, - task3: ['task2', function(callback, results){ - test.same(results.task2, 'task2'); - callOrder.push('task3'); - callback(null); - }], - task4: ['task1', 'task2', function(callback, results){ - test.same(results.task1, ['task1a','task1b']); - test.same(results.task2, 'task2'); - callOrder.push('task4'); - callback(null, 'task4'); - }] - }, - function(err, results){ - test.same(callOrder, ['task2','task3','task1','task4']); - test.same(results, {task1: ['task1a','task1b'], task2: 'task2', task3: undefined, task4: 'task4'}); - test.done(); - }); -}; - - -exports['auto empty object'] = function(test){ - async.auto({}, function(err){ - test.done(); - }); -}; - -exports['auto error'] = function(test){ - test.expect(1); - async.auto({ - task1: function(callback){ - callback('testerror'); - }, - task2: ['task1', function(callback){ - test.ok(false, 'task2 should not be called'); - callback(); - }], - task3: function(callback){ - callback('testerror2'); - } - }, - function(err){ - test.equals(err, 'testerror'); - }); - setTimeout(test.done, 100); -}; - -exports['auto no callback'] = function(test){ - async.auto({ - task1: function(callback){callback();}, - task2: ['task1', function(callback){callback(); test.done();}] - }); -}; - -exports['waterfall'] = function(test){ - test.expect(6); - var call_order = []; - async.waterfall([ - function(callback){ - call_order.push('fn1'); - setTimeout(function(){callback(null, 'one', 'two');}, 0); - }, - function(arg1, arg2, callback){ - call_order.push('fn2'); - test.equals(arg1, 'one'); - test.equals(arg2, 'two'); - setTimeout(function(){callback(null, arg1, arg2, 'three');}, 25); - }, - function(arg1, arg2, arg3, callback){ - call_order.push('fn3'); - test.equals(arg1, 'one'); - test.equals(arg2, 'two'); - test.equals(arg3, 'three'); - callback(null, 'four'); - }, - function(arg4, callback){ - call_order.push('fn4'); - test.same(call_order, ['fn1','fn2','fn3','fn4']); - callback(null, 'test'); - } - ], function(err){ - test.done(); - }); -}; - -exports['waterfall empty array'] = function(test){ - async.waterfall([], function(err){ - test.done(); - }); -}; - -exports['waterfall no callback'] = function(test){ - async.waterfall([ - function(callback){callback();}, - function(callback){callback(); test.done();} - ]); -}; - -exports['waterfall async'] = function(test){ - var call_order = []; - async.waterfall([ - function(callback){ - call_order.push(1); - callback(); - call_order.push(2); - }, - function(callback){ - call_order.push(3); - callback(); - }, - function(){ - test.same(call_order, [1,2,3]); - test.done(); - } - ]); -}; - -exports['waterfall error'] = function(test){ - test.expect(1); - async.waterfall([ - function(callback){ - callback('error'); - }, - function(callback){ - test.ok(false, 'next function should not be called'); - callback(); - } - ], function(err){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['waterfall multiple callback calls'] = function(test){ - var call_order = []; - var arr = [ - function(callback){ - call_order.push(1); - // call the callback twice. this should call function 2 twice - callback(null, 'one', 'two'); - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - call_order.push(2); - callback(null, arg1, arg2, 'three'); - }, - function(arg1, arg2, arg3, callback){ - call_order.push(3); - callback(null, 'four'); - }, - function(arg4){ - call_order.push(4); - arr[3] = function(){ - call_order.push(4); - test.same(call_order, [1,2,2,3,3,4,4]); - test.done(); - }; - } - ]; - async.waterfall(arr); -}; - - -exports['parallel'] = function(test){ - var call_order = []; - async.parallel([ - function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 50); - }, - function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 100); - }, - function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 25); - } - ], - function(err, results){ - test.equals(err, null); - test.same(call_order, [3,1,2]); - test.same(results, [1,2,[3,3]]); - test.done(); - }); -}; - -exports['parallel empty array'] = function(test){ - async.parallel([], function(err, results){ - test.equals(err, null); - test.same(results, []); - test.done(); - }); -}; - -exports['parallel error'] = function(test){ - async.parallel([ - function(callback){ - callback('error', 1); - }, - function(callback){ - callback('error2', 2); - } - ], - function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 100); -}; - -exports['parallel no callback'] = function(test){ - async.parallel([ - function(callback){callback();}, - function(callback){callback(); test.done();}, - ]); -}; - -exports['parallel object'] = function(test){ - var call_order = []; - async.parallel({ - one: function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 25); - }, - two: function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 50); - }, - three: function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 15); - } - }, - function(err, results){ - test.equals(err, null); - test.same(call_order, [3,1,2]); - test.same(results, { - one: 1, - two: 2, - three: [3,3] - }); - test.done(); - }); -}; - -exports['series'] = function(test){ - var call_order = []; - async.series([ - function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 25); - }, - function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 50); - }, - function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 15); - } - ], - function(err, results){ - test.equals(err, null); - test.same(results, [1,2,[3,3]]); - test.same(call_order, [1,2,3]); - test.done(); - }); -}; - -exports['series empty array'] = function(test){ - async.series([], function(err, results){ - test.equals(err, null); - test.same(results, []); - test.done(); - }); -}; - -exports['series error'] = function(test){ - test.expect(1); - async.series([ - function(callback){ - callback('error', 1); - }, - function(callback){ - test.ok(false, 'should not be called'); - callback('error2', 2); - } - ], - function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 100); -}; - -exports['series no callback'] = function(test){ - async.series([ - function(callback){callback();}, - function(callback){callback(); test.done();}, - ]); -}; - -exports['series object'] = function(test){ - var call_order = []; - async.series({ - one: function(callback){ - setTimeout(function(){ - call_order.push(1); - callback(null, 1); - }, 25); - }, - two: function(callback){ - setTimeout(function(){ - call_order.push(2); - callback(null, 2); - }, 50); - }, - three: function(callback){ - setTimeout(function(){ - call_order.push(3); - callback(null, 3,3); - }, 15); - } - }, - function(err, results){ - test.equals(err, null); - test.same(results, { - one: 1, - two: 2, - three: [3,3] - }); - test.same(call_order, [1,2,3]); - test.done(); - }); -}; - -exports['iterator'] = function(test){ - var call_order = []; - var iterator = async.iterator([ - function(){call_order.push(1);}, - function(arg1){ - test.equals(arg1, 'arg1'); - call_order.push(2); - }, - function(arg1, arg2){ - test.equals(arg1, 'arg1'); - test.equals(arg2, 'arg2'); - call_order.push(3); - } - ]); - iterator(); - test.same(call_order, [1]); - var iterator2 = iterator(); - test.same(call_order, [1,1]); - var iterator3 = iterator2('arg1'); - test.same(call_order, [1,1,2]); - var iterator4 = iterator3('arg1', 'arg2'); - test.same(call_order, [1,1,2,3]); - test.equals(iterator4, undefined); - test.done(); -}; - -exports['iterator empty array'] = function(test){ - var iterator = async.iterator([]); - test.equals(iterator(), undefined); - test.equals(iterator.next(), undefined); - test.done(); -}; - -exports['iterator.next'] = function(test){ - var call_order = []; - var iterator = async.iterator([ - function(){call_order.push(1);}, - function(arg1){ - test.equals(arg1, 'arg1'); - call_order.push(2); - }, - function(arg1, arg2){ - test.equals(arg1, 'arg1'); - test.equals(arg2, 'arg2'); - call_order.push(3); - } - ]); - var fn = iterator.next(); - var iterator2 = fn('arg1'); - test.same(call_order, [2]); - iterator2('arg1','arg2'); - test.same(call_order, [2,3]); - test.equals(iterator2.next(), undefined); - test.done(); -}; - -exports['forEach'] = function(test){ - var args = []; - async.forEach([1,3,2], function(x, callback){ - setTimeout(function(){ - args.push(x); - callback(); - }, x*25); - }, function(err){ - test.same(args, [1,2,3]); - test.done(); - }); -}; - -exports['forEach empty array'] = function(test){ - test.expect(1); - async.forEach([], function(x, callback){ - test.ok(false, 'iterator should not be called'); - callback(); - }, function(err){ - test.ok(true, 'should call callback'); - }); - setTimeout(test.done, 25); -}; - -exports['forEach error'] = function(test){ - test.expect(1); - async.forEach([1,2,3], function(x, callback){ - callback('error'); - }, function(err){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['forEachSeries'] = function(test){ - var args = []; - async.forEachSeries([1,3,2], function(x, callback){ - setTimeout(function(){ - args.push(x); - callback(); - }, x*25); - }, function(err){ - test.same(args, [1,3,2]); - test.done(); - }); -}; - -exports['forEachSeries empty array'] = function(test){ - test.expect(1); - async.forEachSeries([], function(x, callback){ - test.ok(false, 'iterator should not be called'); - callback(); - }, function(err){ - test.ok(true, 'should call callback'); - }); - setTimeout(test.done, 25); -}; - -exports['forEachSeries error'] = function(test){ - test.expect(2); - var call_order = []; - async.forEachSeries([1,2,3], function(x, callback){ - call_order.push(x); - callback('error'); - }, function(err){ - test.same(call_order, [1]); - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['forEachLimit'] = function(test){ - var args = []; - var arr = [0,1,2,3,4,5,6,7,8,9]; - async.forEachLimit(arr, 2, function(x,callback){ - setTimeout(function(){ - args.push(x); - callback(); - }, x*5); - }, function(err){ - test.same(args, arr); - test.done(); - }); -}; - -exports['forEachLimit empty array'] = function(test){ - test.expect(1); - async.forEachLimit([], 2, function(x, callback){ - test.ok(false, 'iterator should not be called'); - callback(); - }, function(err){ - test.ok(true, 'should call callback'); - }); - setTimeout(test.done, 25); -}; - -exports['forEachLimit limit exceeds size'] = function(test){ - var args = []; - var arr = [0,1,2,3,4,5,6,7,8,9]; - async.forEachLimit(arr, 20, function(x,callback){ - setTimeout(function(){ - args.push(x); - callback(); - }, x*5); - }, function(err){ - test.same(args, arr); - test.done(); - }); -}; - -exports['forEachLimit limit equal size'] = function(test){ - var args = []; - var arr = [0,1,2,3,4,5,6,7,8,9]; - async.forEachLimit(arr, 10, function(x,callback){ - setTimeout(function(){ - args.push(x); - callback(); - }, x*5); - }, function(err){ - test.same(args, arr); - test.done(); - }); -}; - -exports['forEachLimit zero limit'] = function(test){ - test.expect(1); - async.forEachLimit([0,1,2,3,4,5], 0, function(x, callback){ - test.ok(false, 'iterator should not be called'); - callback(); - }, function(err){ - test.ok(true, 'should call callback'); - }); - setTimeout(test.done, 25); -}; - -exports['forEachLimit error'] = function(test){ - test.expect(2); - var arr = [0,1,2,3,4,5,6,7,8,9]; - var call_order = []; - - async.forEachLimit(arr, 3, function(x, callback){ - call_order.push(x); - if (x === 2) { - callback('error'); - } - }, function(err){ - test.same(call_order, [0,1,2]); - test.equals(err, 'error'); - }); - setTimeout(test.done, 25); -}; - -exports['map'] = function(test){ - var call_order = []; - async.map([1,3,2], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(null, x*2); - }, x*25); - }, function(err, results){ - test.same(call_order, [1,2,3]); - test.same(results, [2,6,4]); - test.done(); - }); -}; - -exports['map original untouched'] = function(test){ - var a = [1,2,3]; - async.map(a, function(x, callback){ - callback(null, x*2); - }, function(err, results){ - test.same(results, [2,4,6]); - test.same(a, [1,2,3]); - test.done(); - }); -}; - -exports['map error'] = function(test){ - test.expect(1); - async.map([1,2,3], function(x, callback){ - callback('error'); - }, function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['mapSeries'] = function(test){ - var call_order = []; - async.mapSeries([1,3,2], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(null, x*2); - }, x*25); - }, function(err, results){ - test.same(call_order, [1,3,2]); - test.same(results, [2,6,4]); - test.done(); - }); -}; - -exports['mapSeries error'] = function(test){ - test.expect(1); - async.mapSeries([1,2,3], function(x, callback){ - callback('error'); - }, function(err, results){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['reduce'] = function(test){ - var call_order = []; - async.reduce([1,2,3], 0, function(a, x, callback){ - call_order.push(x); - callback(null, a + x); - }, function(err, result){ - test.equals(result, 6); - test.same(call_order, [1,2,3]); - test.done(); - }); -}; - -exports['reduce async with non-reference memo'] = function(test){ - async.reduce([1,3,2], 0, function(a, x, callback){ - setTimeout(function(){callback(null, a + x)}, Math.random()*100); - }, function(err, result){ - test.equals(result, 6); - test.done(); - }); -}; - -exports['reduce error'] = function(test){ - test.expect(1); - async.reduce([1,2,3], 0, function(a, x, callback){ - callback('error'); - }, function(err, result){ - test.equals(err, 'error'); - }); - setTimeout(test.done, 50); -}; - -exports['inject alias'] = function(test){ - test.equals(async.inject, async.reduce); - test.done(); -}; - -exports['foldl alias'] = function(test){ - test.equals(async.foldl, async.reduce); - test.done(); -}; - -exports['reduceRight'] = function(test){ - var call_order = []; - var a = [1,2,3]; - async.reduceRight(a, 0, function(a, x, callback){ - call_order.push(x); - callback(null, a + x); - }, function(err, result){ - test.equals(result, 6); - test.same(call_order, [3,2,1]); - test.same(a, [1,2,3]); - test.done(); - }); -}; - -exports['foldr alias'] = function(test){ - test.equals(async.foldr, async.reduceRight); - test.done(); -}; - -exports['filter'] = function(test){ - async.filter([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [3,1]); - test.done(); - }); -}; - -exports['filter original untouched'] = function(test){ - var a = [3,1,2]; - async.filter(a, function(x, callback){ - callback(x % 2); - }, function(results){ - test.same(results, [3,1]); - test.same(a, [3,1,2]); - test.done(); - }); -}; - -exports['filterSeries'] = function(test){ - async.filterSeries([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [3,1]); - test.done(); - }); -}; - -exports['select alias'] = function(test){ - test.equals(async.select, async.filter); - test.done(); -}; - -exports['selectSeries alias'] = function(test){ - test.equals(async.selectSeries, async.filterSeries); - test.done(); -}; - -exports['reject'] = function(test){ - async.reject([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [2]); - test.done(); - }); -}; - -exports['reject original untouched'] = function(test){ - var a = [3,1,2]; - async.reject(a, function(x, callback){ - callback(x % 2); - }, function(results){ - test.same(results, [2]); - test.same(a, [3,1,2]); - test.done(); - }); -}; - -exports['rejectSeries'] = function(test){ - async.rejectSeries([3,1,2], function(x, callback){ - setTimeout(function(){callback(x % 2);}, x*25); - }, function(results){ - test.same(results, [2]); - test.done(); - }); -}; - -exports['some true'] = function(test){ - async.some([3,1,2], function(x, callback){ - setTimeout(function(){callback(x === 1);}, 0); - }, function(result){ - test.equals(result, true); - test.done(); - }); -}; - -exports['some false'] = function(test){ - async.some([3,1,2], function(x, callback){ - setTimeout(function(){callback(x === 10);}, 0); - }, function(result){ - test.equals(result, false); - test.done(); - }); -}; - -exports['some early return'] = function(test){ - var call_order = []; - async.some([1,2,3], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x === 1); - }, x*25); - }, function(result){ - call_order.push('callback'); - }); - setTimeout(function(){ - test.same(call_order, [1,'callback',2,3]); - test.done(); - }, 100); -}; - -exports['any alias'] = function(test){ - test.equals(async.any, async.some); - test.done(); -}; - -exports['every true'] = function(test){ - async.every([1,2,3], function(x, callback){ - setTimeout(function(){callback(true);}, 0); - }, function(result){ - test.equals(result, true); - test.done(); - }); -}; - -exports['every false'] = function(test){ - async.every([1,2,3], function(x, callback){ - setTimeout(function(){callback(x % 2);}, 0); - }, function(result){ - test.equals(result, false); - test.done(); - }); -}; - -exports['every early return'] = function(test){ - var call_order = []; - async.every([1,2,3], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x === 1); - }, x*25); - }, function(result){ - call_order.push('callback'); - }); - setTimeout(function(){ - test.same(call_order, [1,2,'callback',3]); - test.done(); - }, 100); -}; - -exports['all alias'] = function(test){ - test.equals(async.all, async.every); - test.done(); -}; - -exports['detect'] = function(test){ - var call_order = []; - async.detect([3,2,1], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x == 2); - }, x*25); - }, function(result){ - call_order.push('callback'); - test.equals(result, 2); - }); - setTimeout(function(){ - test.same(call_order, [1,2,'callback',3]); - test.done(); - }, 100); -}; - -exports['detect - mulitple matches'] = function(test){ - var call_order = []; - async.detect([3,2,2,1,2], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x == 2); - }, x*25); - }, function(result){ - call_order.push('callback'); - test.equals(result, 2); - }); - setTimeout(function(){ - test.same(call_order, [1,2,'callback',2,2,3]); - test.done(); - }, 100); -}; - -exports['detectSeries'] = function(test){ - var call_order = []; - async.detectSeries([3,2,1], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x == 2); - }, x*25); - }, function(result){ - call_order.push('callback'); - test.equals(result, 2); - }); - setTimeout(function(){ - test.same(call_order, [3,2,'callback']); - test.done(); - }, 200); -}; - -exports['detectSeries - multiple matches'] = function(test){ - var call_order = []; - async.detectSeries([3,2,2,1,2], function(x, callback){ - setTimeout(function(){ - call_order.push(x); - callback(x == 2); - }, x*25); - }, function(result){ - call_order.push('callback'); - test.equals(result, 2); - }); - setTimeout(function(){ - test.same(call_order, [3,2,'callback']); - test.done(); - }, 200); -}; - -exports['sortBy'] = function(test){ - async.sortBy([{a:1},{a:15},{a:6}], function(x, callback){ - setTimeout(function(){callback(null, x.a);}, 0); - }, function(err, result){ - test.same(result, [{a:1},{a:6},{a:15}]); - test.done(); - }); -}; - -exports['apply'] = function(test){ - test.expect(6); - var fn = function(){ - test.same(Array.prototype.slice.call(arguments), [1,2,3,4]) - }; - async.apply(fn, 1, 2, 3, 4)(); - async.apply(fn, 1, 2, 3)(4); - async.apply(fn, 1, 2)(3, 4); - async.apply(fn, 1)(2, 3, 4); - async.apply(fn)(1, 2, 3, 4); - test.equals( - async.apply(function(name){return 'hello ' + name}, 'world')(), - 'hello world' - ); - test.done(); -}; - - -// generates tests for console functions such as async.log -var console_fn_tests = function(name){ - - if (typeof console !== 'undefined') { - exports[name] = function(test){ - test.expect(5); - var fn = function(arg1, callback){ - test.equals(arg1, 'one'); - setTimeout(function(){callback(null, 'test');}, 0); - }; - var fn_err = function(arg1, callback){ - test.equals(arg1, 'one'); - setTimeout(function(){callback('error');}, 0); - }; - var _console_fn = console[name]; - var _error = console.error; - console[name] = function(val){ - test.equals(val, 'test'); - test.equals(arguments.length, 1); - console.error = function(val){ - test.equals(val, 'error'); - console[name] = _console_fn; - console.error = _error; - test.done(); - }; - async[name](fn_err, 'one'); - }; - async[name](fn, 'one'); - }; - - exports[name + ' with multiple result params'] = function(test){ - var fn = function(callback){callback(null,'one','two','three');}; - var _console_fn = console[name]; - var called_with = []; - console[name] = function(x){ - called_with.push(x); - }; - async[name](fn); - test.same(called_with, ['one','two','three']); - console[name] = _console_fn; - test.done(); - }; - } - - // browser-only test - exports[name + ' without console.' + name] = function(test){ - if (typeof window !== 'undefined') { - var _console = window.console; - window.console = undefined; - var fn = function(callback){callback(null, 'val');}; - var fn_err = function(callback){callback('error');}; - async[name](fn); - async[name](fn_err); - window.console = _console; - } - test.done(); - }; - -}; - -console_fn_tests('log'); -console_fn_tests('dir'); -/*console_fn_tests('info'); -console_fn_tests('warn'); -console_fn_tests('error');*/ - -exports['nextTick'] = function(test){ - var call_order = []; - async.nextTick(function(){call_order.push('two');}); - call_order.push('one'); - setTimeout(function(){ - test.same(call_order, ['one','two']); - test.done(); - }, 50); -}; - -exports['nextTick in the browser'] = function(test){ - if (typeof process !== 'undefined') { - // skip this test in node - return test.done(); - } - test.expect(1); - - var call_order = []; - async.nextTick(function(){call_order.push('two');}); - - call_order.push('one'); - setTimeout(function(){ - if (typeof process !== 'undefined') { - process.nextTick = _nextTick; - } - test.same(call_order, ['one','two']); - }, 50); - setTimeout(test.done, 100); -}; - -exports['noConflict - node only'] = function(test){ - if (typeof process !== 'undefined') { - // node only test - test.expect(3); - var fs = require('fs'); - var filename = __dirname + '/../lib/async.js'; - fs.readFile(filename, function(err, content){ - if(err) return test.done(); - var Script = process.binding('evals').Script; - - var s = new Script(content, filename); - var s2 = new Script( - content + 'this.async2 = this.async.noConflict();', - filename - ); - - var sandbox1 = {async: 'oldvalue'}; - s.runInNewContext(sandbox1); - test.ok(sandbox1.async); - - var sandbox2 = {async: 'oldvalue'}; - s2.runInNewContext(sandbox2); - test.equals(sandbox2.async, 'oldvalue'); - test.ok(sandbox2.async2); - - test.done(); - }); - } - else test.done(); -}; - -exports['concat'] = function(test){ - var call_order = []; - var iterator = function (x, cb) { - setTimeout(function(){ - call_order.push(x); - var r = []; - while (x > 0) { - r.push(x); - x--; - } - cb(null, r); - }, x*25); - }; - async.concat([1,3,2], iterator, function(err, results){ - test.same(results, [1,2,1,3,2,1]); - test.same(call_order, [1,2,3]); - test.ok(!err); - test.done(); - }); -}; - -exports['concat error'] = function(test){ - var iterator = function (x, cb) { - cb(new Error('test error')); - }; - async.concat([1,2,3], iterator, function(err, results){ - test.ok(err); - test.done(); - }); -}; - -exports['concatSeries'] = function(test){ - var call_order = []; - var iterator = function (x, cb) { - setTimeout(function(){ - call_order.push(x); - var r = []; - while (x > 0) { - r.push(x); - x--; - } - cb(null, r); - }, x*25); - }; - async.concatSeries([1,3,2], iterator, function(err, results){ - test.same(results, [1,3,2,1,2,1]); - test.same(call_order, [1,3,2]); - test.ok(!err); - test.done(); - }); -}; - -exports['until'] = function (test) { - var call_order = []; - - var count = 0; - async.until( - function () { - call_order.push(['test', count]); - return (count == 5); - }, - function (cb) { - call_order.push(['iterator', count]); - count++; - cb(); - }, - function (err) { - test.same(call_order, [ - ['test', 0], - ['iterator', 0], ['test', 1], - ['iterator', 1], ['test', 2], - ['iterator', 2], ['test', 3], - ['iterator', 3], ['test', 4], - ['iterator', 4], ['test', 5], - ]); - test.equals(count, 5); - test.done(); - } - ); -}; - -exports['whilst'] = function (test) { - var call_order = []; - - var count = 0; - async.whilst( - function () { - call_order.push(['test', count]); - return (count < 5); - }, - function (cb) { - call_order.push(['iterator', count]); - count++; - cb(); - }, - function (err) { - test.same(call_order, [ - ['test', 0], - ['iterator', 0], ['test', 1], - ['iterator', 1], ['test', 2], - ['iterator', 2], ['test', 3], - ['iterator', 3], ['test', 4], - ['iterator', 4], ['test', 5], - ]); - test.equals(count, 5); - test.done(); - } - ); -}; - -exports['queue'] = function (test) { - var call_order = [], - delays = [40,20,60,20]; - - // worker1: --1-4 - // worker2: -2---3 - // order of completion: 2,1,4,3 - - var q = async.queue(function (task, callback) { - setTimeout(function () { - call_order.push('process ' + task); - callback('error', 'arg'); - }, delays.splice(0,1)[0]); - }, 2); - - q.push(1, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 1); - call_order.push('callback ' + 1); - }); - q.push(2, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 2); - call_order.push('callback ' + 2); - }); - q.push(3, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 0); - call_order.push('callback ' + 3); - }); - q.push(4, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 0); - call_order.push('callback ' + 4); - }); - test.equal(q.length(), 4); - test.equal(q.concurrency, 2); - - setTimeout(function () { - test.same(call_order, [ - 'process 2', 'callback 2', - 'process 1', 'callback 1', - 'process 4', 'callback 4', - 'process 3', 'callback 3' - ]); - test.equal(q.concurrency, 2); - test.equal(q.length(), 0); - test.done(); - }, 200); -}; - -exports['queue changing concurrency'] = function (test) { - var call_order = [], - delays = [40,20,60,20]; - - // worker1: --1-2---3-4 - // order of completion: 1,2,3,4 - - var q = async.queue(function (task, callback) { - setTimeout(function () { - call_order.push('process ' + task); - callback('error', 'arg'); - }, delays.splice(0,1)[0]); - }, 2); - - q.push(1, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 3); - call_order.push('callback ' + 1); - }); - q.push(2, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 2); - call_order.push('callback ' + 2); - }); - q.push(3, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 1); - call_order.push('callback ' + 3); - }); - q.push(4, function (err, arg) { - test.equal(err, 'error'); - test.equal(arg, 'arg'); - test.equal(q.length(), 0); - call_order.push('callback ' + 4); - }); - test.equal(q.length(), 4); - test.equal(q.concurrency, 2); - q.concurrency = 1; - - setTimeout(function () { - test.same(call_order, [ - 'process 1', 'callback 1', - 'process 2', 'callback 2', - 'process 3', 'callback 3', - 'process 4', 'callback 4' - ]); - test.equal(q.concurrency, 1); - test.equal(q.length(), 0); - test.done(); - }, 250); -}; - -exports['queue push without callback'] = function (test) { - var call_order = [], - delays = [40,20,60,20]; - - // worker1: --1-4 - // worker2: -2---3 - // order of completion: 2,1,4,3 - - var q = async.queue(function (task, callback) { - setTimeout(function () { - call_order.push('process ' + task); - callback('error', 'arg'); - }, delays.splice(0,1)[0]); - }, 2); - - q.push(1); - q.push(2); - q.push(3); - q.push(4); - - setTimeout(function () { - test.same(call_order, [ - 'process 2', - 'process 1', - 'process 4', - 'process 3' - ]); - test.done(); - }, 200); -}; - -exports['memoize'] = function (test) { - test.expect(4); - var call_order = []; - - var fn = function (arg1, arg2, callback) { - call_order.push(['fn', arg1, arg2]); - callback(null, arg1 + arg2); - }; - - var fn2 = async.memoize(fn); - fn2(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn2(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn2(2, 2, function (err, result) { - test.equal(result, 4); - }); - - test.same(call_order, [['fn',1,2], ['fn',2,2]]); - test.done(); -}; - -exports['unmemoize'] = function(test) { - test.expect(4); - var call_order = []; - - var fn = function (arg1, arg2, callback) { - call_order.push(['fn', arg1, arg2]); - callback(null, arg1 + arg2); - }; - - var fn2 = async.memoize(fn); - var fn3 = async.unmemoize(fn2); - fn3(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn3(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn3(2, 2, function (err, result) { - test.equal(result, 4); - }); - - test.same(call_order, [['fn',1,2], ['fn',1,2], ['fn',2,2]]); - - test.done(); -} - -exports['unmemoize a not memoized function'] = function(test) { - test.expect(1); - - var fn = function (arg1, arg2, callback) { - callback(null, arg1 + arg2); - }; - - var fn2 = async.unmemoize(fn); - fn2(1, 2, function(err, result) { - test.equal(result, 3); - }); - - test.done(); -} - -exports['memoize error'] = function (test) { - test.expect(1); - var testerr = new Error('test'); - var fn = function (arg1, arg2, callback) { - callback(testerr, arg1 + arg2); - }; - async.memoize(fn)(1, 2, function (err, result) { - test.equal(err, testerr); - }); - test.done(); -}; - -exports['memoize multiple calls'] = function (test) { - test.expect(3); - var fn = function (arg1, arg2, callback) { - test.ok(true); - setTimeout(function(){ - callback(null, arg1, arg2); - }, 10); - }; - var fn2 = async.memoize(fn); - fn2(1, 2, function(err, result) { - test.equal(result, 1, 2); - }); - fn2(1, 2, function(err, result) { - test.equal(result, 1, 2); - test.done(); - }); -}; - -exports['memoize custom hash function'] = function (test) { - test.expect(2); - var testerr = new Error('test'); - - var fn = function (arg1, arg2, callback) { - callback(testerr, arg1 + arg2); - }; - var fn2 = async.memoize(fn, function () { - return 'custom hash'; - }); - fn2(1, 2, function (err, result) { - test.equal(result, 3); - }); - fn2(2, 2, function (err, result) { - test.equal(result, 3); - }); - test.done(); -}; - -// Issue 10 on github: https://github.com/caolan/async/issues#issue/10 -exports['falsy return values in series'] = function (test) { - function taskFalse(callback) { - async.nextTick(function() { - callback(null, false); - }); - }; - function taskUndefined(callback) { - async.nextTick(function() { - callback(null, undefined); - }); - }; - function taskEmpty(callback) { - async.nextTick(function() { - callback(null); - }); - }; - function taskNull(callback) { - async.nextTick(function() { - callback(null, null); - }); - }; - async.series( - [taskFalse, taskUndefined, taskEmpty, taskNull], - function(err, results) { - test.equal(results.length, 4); - test.strictEqual(results[0], false); - test.strictEqual(results[1], undefined); - test.strictEqual(results[2], undefined); - test.strictEqual(results[3], null); - test.done(); - } - ); -}; - -// Issue 10 on github: https://github.com/caolan/async/issues#issue/10 -exports['falsy return values in parallel'] = function (test) { - function taskFalse(callback) { - async.nextTick(function() { - callback(null, false); - }); - }; - function taskUndefined(callback) { - async.nextTick(function() { - callback(null, undefined); - }); - }; - function taskEmpty(callback) { - async.nextTick(function() { - callback(null); - }); - }; - function taskNull(callback) { - async.nextTick(function() { - callback(null, null); - }); - }; - async.parallel( - [taskFalse, taskUndefined, taskEmpty, taskNull], - function(err, results) { - test.equal(results.length, 4); - test.strictEqual(results[0], false); - test.strictEqual(results[1], undefined); - test.strictEqual(results[2], undefined); - test.strictEqual(results[3], null); - test.done(); - } - ); -}; - -exports['queue events'] = function(test) { - var calls = []; - var q = async.queue(function(task, cb) { - // nop - calls.push('process ' + task); - cb(); - }, 3); - - q.saturated = function() { - test.ok(q.length() == 3, 'queue should be saturated now'); - calls.push('saturated'); - }; - q.empty = function() { - test.ok(q.length() == 0, 'queue should be empty now'); - calls.push('empty'); - }; - q.drain = function() { - test.ok( - q.length() == 0 && q.running() == 0, - 'queue should be empty now and no more workers should be running' - ); - calls.push('drain'); - test.same(calls, [ - 'saturated', - 'process foo', - 'foo cb', - 'process bar', - 'bar cb', - 'process zoo', - 'zoo cb', - 'process poo', - 'poo cb', - 'empty', - 'process moo', - 'moo cb', - 'drain', - ]); - test.done(); - }; - q.push('foo', function () {calls.push('foo cb');}); - q.push('bar', function () {calls.push('bar cb');}); - q.push('zoo', function () {calls.push('zoo cb');}); - q.push('poo', function () {calls.push('poo cb');}); - q.push('moo', function () {calls.push('moo cb');}); -}; diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/test/test.html b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/test/test.html deleted file mode 100644 index 2450e2d..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/node_modules/async/test/test.html +++ /dev/null @@ -1,24 +0,0 @@ - - - Async.js Test Suite - - - - - - - - -

    Async.js Test Suite

    - - - diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/package.json b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/package.json deleted file mode 100644 index 6557666..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/portscanner/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "portscanner", - "description": "Asynchronous port scanner for Node.js", - "keywords": [ - "portscanner", - "port", - "scanner", - "checker", - "status" - ], - "version": "0.2.3", - "preferGlobal": false, - "homepage": "https://github.com/baalexander/node-portscanner", - "author": "", - "repository": { - "type": "git", - "url": "git://github.com/baalexander/node-portscanner.git" - }, - "bugs": { - "url": "https://github.com/baalexander/node-portscanner/issues" - }, - "directories": { - "lib": "./lib" - }, - "main": "./lib/portscanner.js", - "dependencies": { - "async": "0.1.15" - }, - "devDependencies": {}, - "engines": { - "node": ">=0.4", - "npm": ">=1.0.0" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/baalexander/node-portscanner/raw/master/LICENSE" - } - ], - "_id": "portscanner@0.2.3", - "dist": { - "shasum": "40d8adc92e01b205ab020aa16f0e386ac5ed1978", - "tarball": "http://registry.npmjs.org/portscanner/-/portscanner-0.2.3.tgz" - }, - "_from": "portscanner@~0.2.2", - "_npmVersion": "1.4.3", - "_npmUser": { - "name": "smassa", - "email": "endangeredmassa@gmail.com" - }, - "maintainers": [ - { - "name": "baalexander", - "email": "baalexander@gmail.com" - }, - { - "name": "smassa", - "email": "endangeredmassa@gmail.com" - } - ], - "_shasum": "40d8adc92e01b205ab020aa16f0e386ac5ed1978", - "_resolved": "https://registry.npmjs.org/portscanner/-/portscanner-0.2.3.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/CONTRIBUTING.md b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/CONTRIBUTING.md deleted file mode 100644 index 500ab17..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/CONTRIBUTING.md +++ /dev/null @@ -1,40 +0,0 @@ - -For pull requests: - -- Be consistent with prevalent style and design decisions. -- Add a Jasmine spec to `specs/q-spec.js`. -- Use `npm test` to avoid regressions. -- Run tests in `q-spec/run.html` in as many supported browsers as you - can find the will to deal with. -- Do not build minified versions; we do this each release. -- If you would be so kind, add a note to `CHANGES.md` in an - appropriate section: - - - `Next Major Version` if it introduces backward incompatibilities - to code in the wild using documented features. - - `Next Minor Version` if it adds a new feature. - - `Next Patch Version` if it fixes a bug. - -For releases: - -- Run `npm test`. -- Run tests in `q-spec/run.html` in a representative sample of every - browser under the sun. -- Run `npm run cover` and make sure you're happy with the results. -- Run `npm run minify` and be sure to commit the resulting `q.min.js`. -- Note the Gzipped size output by the previous command, and update - `README.md` if it has changed to 1 significant digit. -- Stash any local changes. -- Update `CHANGES.md` to reflect all changes in the differences - between `HEAD` and the previous tagged version. Give credit where - credit is due. -- Update `README.md` to address all new, non-experimental features. -- Update the API reference on the Wiki to reflect all non-experimental - features. -- Use `npm version major|minor|patch` to update `package.json`, - commit, and tag the new version. -- Use `npm publish` to send up a new release. -- Send an email to the q-continuum mailing list announcing the new - release and the notes from the change log. This helps folks - maintaining other package ecosystems. - diff --git a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/LICENSE b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/LICENSE deleted file mode 100644 index 8a706b5..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved. -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 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/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/README.md b/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/README.md deleted file mode 100644 index bdd4168..0000000 --- a/node_modules/browser-sync/node_modules/portscanner-plus/node_modules/q/README.md +++ /dev/null @@ -1,820 +0,0 @@ -[![Build Status](https://secure.travis-ci.org/kriskowal/q.png?branch=master)](http://travis-ci.org/kriskowal/q) - -
    - Promises/A+ logo - - -*This is Q version 1, from the `v1` branch in Git. This documentation applies to -the latest of both the version 1 and version 0.9 release trains. These releases -are stable. There will be no further releases of 0.9 after 0.9.7 which is nearly -equivalent to version 1.0.0. All further releases of `q@~1.0` will be backward -compatible. The version 2 release train introduces significant but -backward-incompatible changes and is experimental at this time.* - -If a function cannot return a value or throw an exception without -blocking, it can return a promise instead. A promise is an object -that represents the return value or the thrown exception that the -function may eventually provide. A promise can also be used as a -proxy for a [remote object][Q-Connection] to overcome latency. - -[Q-Connection]: https://github.com/kriskowal/q-connection - -On the first pass, promises can mitigate the “[Pyramid of -Doom][POD]â€: the situation where code marches to the right faster -than it marches forward. - -[POD]: http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/ - -```javascript -step1(function (value1) { - step2(value1, function(value2) { - step3(value2, function(value3) { - step4(value3, function(value4) { - // Do something with value4 - }); - }); - }); -}); -``` - -With a promise library, you can flatten the pyramid. - -```javascript -Q.fcall(promisedStep1) -.then(promisedStep2) -.then(promisedStep3) -.then(promisedStep4) -.then(function (value4) { - // Do something with value4 -}) -.catch(function (error) { - // Handle any error from all above steps -}) -.done(); -``` - -With this approach, you also get implicit error propagation, just like `try`, -`catch`, and `finally`. An error in `promisedStep1` will flow all the way to -the `catch` function, where it’s caught and handled. (Here `promisedStepN` is -a version of `stepN` that returns a promise.) - -The callback approach is called an “inversion of controlâ€. -A function that accepts a callback instead of a return value -is saying, “Don’t call me, I’ll call you.â€. Promises -[un-invert][IOC] the inversion, cleanly separating the input -arguments from control flow arguments. This simplifies the -use and creation of API’s, particularly variadic, -rest and spread arguments. - -[IOC]: http://www.slideshare.net/domenicdenicola/callbacks-promises-and-coroutines-oh-my-the-evolution-of-asynchronicity-in-javascript - - -## Getting Started - -The Q module can be loaded as: - -- A `` - - - -
    -

    {linked-path}

    - {files} -
    - - \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/application_xp.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/application_xp.png deleted file mode 100644 index d22860a..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/application_xp.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/application_xp_terminal.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/application_xp_terminal.png deleted file mode 100644 index c28dd63..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/application_xp_terminal.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/box.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/box.png deleted file mode 100644 index 8443c23..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/box.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/cd.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/cd.png deleted file mode 100644 index ef43223..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/cd.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/controller.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/controller.png deleted file mode 100644 index 5cf76ed..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/controller.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/drive.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/drive.png deleted file mode 100644 index 37b7c9b..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/drive.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/film.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/film.png deleted file mode 100644 index b0ce7bb..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/film.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/folder.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/folder.png deleted file mode 100644 index 698f3d3..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/folder.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/font.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/font.png deleted file mode 100644 index b7960db..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/font.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/image.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/image.png deleted file mode 100644 index fc3c393..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/image.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/map.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/map.png deleted file mode 100644 index f90ef25..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/map.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page.png deleted file mode 100644 index 03ddd79..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_add.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_add.png deleted file mode 100644 index d5bfa07..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_add.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_attach.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_attach.png deleted file mode 100644 index 89ee2da..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_attach.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_code.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_code.png deleted file mode 100644 index f7ea904..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_code.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_copy.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_copy.png deleted file mode 100644 index 195dc6d..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_copy.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_delete.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_delete.png deleted file mode 100644 index 3141467..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_delete.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_edit.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_edit.png deleted file mode 100644 index 046811e..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_edit.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_error.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_error.png deleted file mode 100644 index f07f449..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_error.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_excel.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_excel.png deleted file mode 100644 index eb6158e..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_excel.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_find.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_find.png deleted file mode 100644 index 2f19388..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_find.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_gear.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_gear.png deleted file mode 100644 index 8e83281..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_gear.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_go.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_go.png deleted file mode 100644 index 80fe1ed..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_go.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_green.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_green.png deleted file mode 100644 index de8e003..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_green.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_key.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_key.png deleted file mode 100644 index d6626cb..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_key.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_lightning.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_lightning.png deleted file mode 100644 index 7e56870..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_lightning.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_link.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_link.png deleted file mode 100644 index 312eab0..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_link.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_paintbrush.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_paintbrush.png deleted file mode 100644 index 246a2f0..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_paintbrush.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_paste.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_paste.png deleted file mode 100644 index 968f073..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_paste.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_red.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_red.png deleted file mode 100644 index 0b18247..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_red.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_refresh.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_refresh.png deleted file mode 100644 index cf347c7..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_refresh.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_save.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_save.png deleted file mode 100644 index caea546..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_save.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white.png deleted file mode 100644 index 8b8b1ca..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_acrobat.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_acrobat.png deleted file mode 100644 index 8f8095e..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_acrobat.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_actionscript.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_actionscript.png deleted file mode 100644 index 159b240..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_actionscript.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_add.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_add.png deleted file mode 100644 index aa23dde..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_add.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_c.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_c.png deleted file mode 100644 index 34a05cc..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_c.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_camera.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_camera.png deleted file mode 100644 index f501a59..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_camera.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cd.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cd.png deleted file mode 100644 index 848bdaf..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cd.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_code.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_code.png deleted file mode 100644 index 0c76bd1..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_code.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_code_red.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_code_red.png deleted file mode 100644 index 87a6914..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_code_red.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_coldfusion.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_coldfusion.png deleted file mode 100644 index c66011f..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_coldfusion.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_compressed.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_compressed.png deleted file mode 100644 index 2b6b100..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_compressed.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_copy.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_copy.png deleted file mode 100644 index a9f31a2..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_copy.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cplusplus.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cplusplus.png deleted file mode 100644 index a87cf84..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cplusplus.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_csharp.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_csharp.png deleted file mode 100644 index ffb8fc9..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_csharp.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cup.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cup.png deleted file mode 100644 index 0a7d6f4..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_cup.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_database.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_database.png deleted file mode 100644 index bddba1f..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_database.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_delete.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_delete.png deleted file mode 100644 index af1ecaf..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_delete.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_dvd.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_dvd.png deleted file mode 100644 index 4cc537a..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_dvd.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_edit.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_edit.png deleted file mode 100644 index b93e776..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_edit.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_error.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_error.png deleted file mode 100644 index 9fc5a0a..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_error.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_excel.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_excel.png deleted file mode 100644 index b977d7e..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_excel.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_find.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_find.png deleted file mode 100644 index 5818436..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_find.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_flash.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_flash.png deleted file mode 100644 index 5769120..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_flash.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_freehand.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_freehand.png deleted file mode 100644 index 8d719df..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_freehand.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_gear.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_gear.png deleted file mode 100644 index 106f5aa..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_gear.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_get.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_get.png deleted file mode 100644 index e4a1ecb..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_get.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_go.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_go.png deleted file mode 100644 index 7e62a92..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_go.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_h.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_h.png deleted file mode 100644 index e902abb..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_h.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_horizontal.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_horizontal.png deleted file mode 100644 index 1d2d0a4..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_horizontal.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_key.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_key.png deleted file mode 100644 index d616484..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_key.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_lightning.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_lightning.png deleted file mode 100644 index 7215d1e..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_lightning.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_link.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_link.png deleted file mode 100644 index bf7bd1c..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_link.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_magnify.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_magnify.png deleted file mode 100644 index f6b74cc..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_magnify.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_medal.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_medal.png deleted file mode 100644 index d3fffb6..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_medal.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_office.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_office.png deleted file mode 100644 index a65bcb3..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_office.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paint.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paint.png deleted file mode 100644 index 23a37b8..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paint.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paintbrush.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paintbrush.png deleted file mode 100644 index f907e44..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paintbrush.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paste.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paste.png deleted file mode 100644 index 5b2cbb3..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_paste.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_php.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_php.png deleted file mode 100644 index 7868a25..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_php.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_picture.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_picture.png deleted file mode 100644 index 134b669..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_picture.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_powerpoint.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_powerpoint.png deleted file mode 100644 index c4eff03..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_powerpoint.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_put.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_put.png deleted file mode 100644 index 884ffd6..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_put.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_ruby.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_ruby.png deleted file mode 100644 index f59b7c4..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_ruby.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_stack.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_stack.png deleted file mode 100644 index 44084ad..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_stack.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_star.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_star.png deleted file mode 100644 index 3a1441c..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_star.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_swoosh.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_swoosh.png deleted file mode 100644 index e770829..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_swoosh.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_text.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_text.png deleted file mode 100644 index 813f712..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_text.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_text_width.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_text_width.png deleted file mode 100644 index d9cf132..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_text_width.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_tux.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_tux.png deleted file mode 100644 index 52699bf..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_tux.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_vector.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_vector.png deleted file mode 100644 index 4a05955..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_vector.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_visualstudio.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_visualstudio.png deleted file mode 100644 index a0a433d..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_visualstudio.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_width.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_width.png deleted file mode 100644 index 1eb8809..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_width.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_word.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_word.png deleted file mode 100644 index ae8ecbf..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_word.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_world.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_world.png deleted file mode 100644 index 6ed2490..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_world.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_wrench.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_wrench.png deleted file mode 100644 index fecadd0..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_wrench.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_zip.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_zip.png deleted file mode 100644 index fd4bbcc..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_white_zip.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_word.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_word.png deleted file mode 100644 index 834cdfa..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_word.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_world.png b/node_modules/browser-sync/node_modules/serve-index/public/icons/page_world.png deleted file mode 100644 index b8895dd..0000000 Binary files a/node_modules/browser-sync/node_modules/serve-index/public/icons/page_world.png and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/serve-index/public/style.css b/node_modules/browser-sync/node_modules/serve-index/public/style.css deleted file mode 100644 index eb99dc9..0000000 --- a/node_modules/browser-sync/node_modules/serve-index/public/style.css +++ /dev/null @@ -1,257 +0,0 @@ -* { - margin: 0; - padding: 0; - outline: 0; -} - -body { - padding: 80px 100px; - font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; - background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); - background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); - background-repeat: no-repeat; - color: #555; - -webkit-font-smoothing: antialiased; -} -h1, h2, h3 { - font-size: 22px; - color: #343434; -} -h1 em, h2 em { - padding: 0 5px; - font-weight: normal; -} -h1 { - font-size: 60px; -} -h2 { - margin-top: 10px; -} -h3 { - margin: 5px 0 10px 0; - padding-bottom: 5px; - border-bottom: 1px solid #eee; - font-size: 18px; -} -ul li { - list-style: none; -} -ul li:hover { - cursor: pointer; - color: #2e2e2e; -} -ul li .path { - padding-left: 5px; - font-weight: bold; -} -ul li .line { - padding-right: 5px; - font-style: italic; -} -ul li:first-child .path { - padding-left: 0; -} -p { - line-height: 1.5; -} -a { - color: #555; - text-decoration: none; -} -a:hover { - color: #303030; -} -#stacktrace { - margin-top: 15px; -} -.directory h1 { - margin-bottom: 15px; - font-size: 18px; -} -ul#files { - width: 100%; - height: 100%; - overflow: hidden; -} -ul#files li { - float: left; - width: 30%; - line-height: 25px; - margin: 1px; -} -ul#files li a { - display: block; - height: 25px; - border: 1px solid transparent; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - overflow: hidden; - white-space: nowrap; -} -ul#files li a:focus, -ul#files li a:hover { - background: rgba(255,255,255,0.65); - border: 1px solid #ececec; -} -ul#files li a.highlight { - -webkit-transition: background .4s ease-in-out; - background: #ffff4f; - border-color: #E9DC51; -} -#search { - display: block; - position: fixed; - top: 20px; - right: 20px; - width: 90px; - -webkit-transition: width ease 0.2s, opacity ease 0.4s; - -moz-transition: width ease 0.2s, opacity ease 0.4s; - -webkit-border-radius: 32px; - -moz-border-radius: 32px; - -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); - -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); - -webkit-font-smoothing: antialiased; - text-align: left; - font: 13px "Helvetica Neue", Arial, sans-serif; - padding: 4px 10px; - border: none; - background: transparent; - margin-bottom: 0; - outline: none; - opacity: 0.7; - color: #888; -} -#search:focus { - width: 120px; - opacity: 1.0; -} - -/*views*/ -#files span { - display: inline-block; - overflow: hidden; - text-overflow: ellipsis; - text-indent: 10px; -} -#files .name { - background-repeat: no-repeat; -} -#files .icon .name { - text-indent: 28px; -} - -/*tiles*/ -.view-tiles .name { - width: 100%; - background-position: 8px 5px; -} -.view-tiles .size, -.view-tiles .date { - display: none; -} - -/*details*/ -ul#files.view-details li { - float: none; - display: block; - width: 90%; -} -ul#files.view-details li.header { - height: 25px; - background: #000; - color: #fff; - font-weight: bold; -} -.view-details .header { - border-radius: 5px; -} -.view-details .name { - width: 60%; - background-position: 8px 5px; -} -.view-details .size { - width: 10%; -} -.view-details .date { - width: 30%; -} -.view-details .size, -.view-details .date { - text-align: right; - direction: rtl; -} - -/*mobile*/ -@media (max-width: 768px) { - body { - font-size: 13px; - line-height: 16px; - padding: 0; - } - #search { - position: static; - width: 100%; - font-size: 2em; - line-height: 1.8em; - text-indent: 10px; - border: 0; - border-radius: 0; - padding: 10px 0; - margin: 0; - } - #search:focus { - width: 100%; - border: 0; - opacity: 1; - } - .directory h1 { - font-size: 2em; - line-height: 1.5em; - color: #fff; - background: #000; - padding: 15px 10px; - margin: 0; - } - ul#files { - border-top: 1px solid #cacaca; - } - ul#files li { - float: none; - width: auto !important; - display: block; - border-bottom: 1px solid #cacaca; - font-size: 2em; - line-height: 1.2em; - text-indent: 0; - margin: 0; - } - ul#files li:nth-child(odd) { - background: #e0e0e0; - } - ul#files li a { - height: auto; - border: 0; - border-radius: 0; - padding: 15px 10px; - } - ul#files li a:focus, - ul#files li a:hover { - border: 0; - } - #files .header, - #files .size, - #files .date { - display: none !important; - } - #files .name { - float: none; - display: inline-block; - width: 100%; - text-indent: 0; - background-position: 0 50%; - } - #files .icon .name { - text-indent: 41px; - } -} diff --git a/node_modules/browser-sync/node_modules/serve-static/HISTORY.md b/node_modules/browser-sync/node_modules/serve-static/HISTORY.md deleted file mode 100644 index 5692c01..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/HISTORY.md +++ /dev/null @@ -1,201 +0,0 @@ -1.7.1 / 2014-10-22 -================== - - * deps: send@0.10.1 - - deps: on-finished@~2.1.1 - -1.7.0 / 2014-10-15 -================== - - * deps: send@0.10.0 - - deps: debug@~2.1.0 - - deps: depd@~1.0.0 - - deps: etag@~1.5.0 - -1.6.4 / 2014-10-08 -================== - - * Fix redirect loop when index file serving disabled - -1.6.3 / 2014-09-24 -================== - - * deps: send@0.9.3 - - deps: etag@~1.4.0 - -1.6.2 / 2014-09-15 -================== - - * deps: send@0.9.2 - - deps: depd@0.4.5 - - deps: etag@~1.3.1 - - deps: range-parser@~1.0.2 - -1.6.1 / 2014-09-07 -================== - - * deps: send@0.9.1 - - deps: fresh@0.2.4 - -1.6.0 / 2014-09-07 -================== - - * deps: send@0.9.0 - - Add `lastModified` option - - Use `etag` to generate `ETag` header - - deps: debug@~2.0.0 - -1.5.4 / 2014-09-04 -================== - - * deps: send@0.8.5 - - Fix a path traversal issue when using `root` - - Fix malicious path detection for empty string path - -1.5.3 / 2014-08-17 -================== - - * deps: send@0.8.3 - -1.5.2 / 2014-08-14 -================== - - * deps: send@0.8.2 - - Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` - -1.5.1 / 2014-08-09 -================== - - * Fix parsing of weird `req.originalUrl` values - * deps: parseurl@~1.3.0 - * deps: utils-merge@1.0.0 - -1.5.0 / 2014-08-05 -================== - - * deps: send@0.8.1 - - Add `extensions` option - -1.4.4 / 2014-08-04 -================== - - * deps: send@0.7.4 - - Fix serving index files without root dir - -1.4.3 / 2014-07-29 -================== - - * deps: send@0.7.3 - - Fix incorrect 403 on Windows and Node.js 0.11 - -1.4.2 / 2014-07-27 -================== - - * deps: send@0.7.2 - - deps: depd@0.4.4 - -1.4.1 / 2014-07-26 -================== - - * deps: send@0.7.1 - - deps: depd@0.4.3 - -1.4.0 / 2014-07-21 -================== - - * deps: parseurl@~1.2.0 - - Cache URLs based on original value - - Remove no-longer-needed URL mis-parse work-around - - Simplify the "fast-path" `RegExp` - * deps: send@0.7.0 - - Add `dotfiles` option - - deps: debug@1.0.4 - - deps: depd@0.4.2 - -1.3.2 / 2014-07-11 -================== - - * deps: send@0.6.0 - - Cap `maxAge` value to 1 year - - deps: debug@1.0.3 - -1.3.1 / 2014-07-09 -================== - - * deps: parseurl@~1.1.3 - - faster parsing of href-only URLs - -1.3.0 / 2014-06-28 -================== - - * Add `setHeaders` option - * Include HTML link in redirect response - * deps: send@0.5.0 - - Accept string for `maxAge` (converted by `ms`) - -1.2.3 / 2014-06-11 -================== - - * deps: send@0.4.3 - - Do not throw un-catchable error on file open race condition - - Use `escape-html` for HTML escaping - - deps: debug@1.0.2 - - deps: finished@1.2.2 - - deps: fresh@0.2.2 - -1.2.2 / 2014-06-09 -================== - - * deps: send@0.4.2 - - fix "event emitter leak" warnings - - deps: debug@1.0.1 - - deps: finished@1.2.1 - -1.2.1 / 2014-06-02 -================== - - * use `escape-html` for escaping - * deps: send@0.4.1 - - Send `max-age` in `Cache-Control` in correct format - -1.2.0 / 2014-05-29 -================== - - * deps: send@0.4.0 - - Calculate ETag with md5 for reduced collisions - - Fix wrong behavior when index file matches directory - - Ignore stream errors after request ends - - Skip directories in index file search - - deps: debug@0.8.1 - -1.1.0 / 2014-04-24 -================== - - * Accept options directly to `send` module - * deps: send@0.3.0 - -1.0.4 / 2014-04-07 -================== - - * Resolve relative paths at middleware setup - * Use parseurl to parse the URL from request - -1.0.3 / 2014-03-20 -================== - - * Do not rely on connect-like environments - -1.0.2 / 2014-03-06 -================== - - * deps: send@0.2.0 - -1.0.1 / 2014-03-05 -================== - - * Add mime export for back-compat - -1.0.0 / 2014-03-05 -================== - - * Genesis from `connect` diff --git a/node_modules/browser-sync/node_modules/serve-static/LICENSE b/node_modules/browser-sync/node_modules/serve-static/LICENSE deleted file mode 100644 index b7bc085..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -(The MIT License) - -Copyright (c) 2010 Sencha Inc. -Copyright (c) 2011 LearnBoost -Copyright (c) 2011 TJ Holowaychuk -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/serve-static/README.md b/node_modules/browser-sync/node_modules/serve-static/README.md deleted file mode 100644 index 0be4fb8..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/README.md +++ /dev/null @@ -1,159 +0,0 @@ -# serve-static - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] -[![Gratipay][gratipay-image]][gratipay-url] - -## Install - -```sh -$ npm install serve-static -``` - -## API - -```js -var serveStatic = require('serve-static') -``` - -### serveStatic(root, options) - -Create a new middleware function to serve files from within a given root -directory. The file to serve will be determined by combining `req.url` -with the provided root directory. When a file is not found, instead of -sending a 404 response, this module will instead call `next()` to move on -to the next middleware, allowing for stacking and fall-backs. - -#### Options - -##### dotfiles - - Set how "dotfiles" are treated when encountered. A dotfile is a file -or directory that begins with a dot ("."). Note this check is done on -the path itself without checking if the path actually exists on the -disk. If `root` is specified, only the dotfiles above the root are -checked (i.e. the root itself can be within a dotfile when when set -to "deny"). - -The default value is `'ignore'`. - - - `'allow'` No special treatment for dotfiles. - - `'deny'` Send a 403 for any request for a dotfile. - - `'ignore'` Pretend like the dotfile does not exist and call `next()`. - -##### etag - -Enable or disable etag generation, defaults to true. - -##### extensions - -Set file extension fallbacks. When set, if a file is not found, the given -extensions will be added to the file name and search for. The first that -exists will be served. Example: `['html', 'htm']`. - -The default value is `false`. - -##### index - -By default this module will send "index.html" files in response to a request -on a directory. To disable this set `false` or to supply a new index pass a -string or an array in preferred order. - -##### lastModified - -Enable or disable `Last-Modified` header, defaults to true. Uses the file -system's last modified value. - -##### maxAge - -Provide a max-age in milliseconds for http caching, defaults to 0. This -can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme) -module. - -##### redirect - -Redirect to trailing "/" when the pathname is a dir. Defaults to `true`. - -##### setHeaders - -Function to set custom headers on response. - -## Examples - -### Serve files with vanilla node.js http server - -```js -var finalhandler = require('finalhandler') -var http = require('http') -var serveStatic = require('serve-static') - -// Serve up public/ftp folder -var serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']}) - -// Create server -var server = http.createServer(function(req, res){ - var done = finalhandler(req, res) - serve(req, res, done) -}) - -// Listen -server.listen(3000) -``` - -### Serve all files as downloads - -```js -var contentDisposition = require('content-disposition') -var finalhandler = require('finalhandler') -var http = require('http') -var serveStatic = require('serve-static') - -// Serve up public/ftp folder -var serve = serveStatic('public/ftp', { - 'index': false, - 'setHeaders': setHeaders -}) - -// Set header to force download -function setHeaders(res, path) { - res.setHeader('Content-Disposition', contentDisposition(path)) -} - -// Create server -var server = http.createServer(function(req, res){ - var done = finalhandler(req, res) - serve(req, res, done) -}) - -// Listen -server.listen(3000) -``` - -### Serving using express - -```js -var connect = require('connect') -var serveStatic = require('serve-static') - -var app = connect() - -app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']})) -app.listen(3000) -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/serve-static.svg?style=flat -[npm-url]: https://npmjs.org/package/serve-static -[travis-image]: https://img.shields.io/travis/expressjs/serve-static.svg?style=flat -[travis-url]: https://travis-ci.org/expressjs/serve-static -[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-static.svg?style=flat -[coveralls-url]: https://coveralls.io/r/expressjs/serve-static -[downloads-image]: https://img.shields.io/npm/dm/serve-static.svg?style=flat -[downloads-url]: https://npmjs.org/package/serve-static -[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg?style=flat -[gratipay-url]: https://gratipay.com/dougwilson/ diff --git a/node_modules/browser-sync/node_modules/serve-static/index.js b/node_modules/browser-sync/node_modules/serve-static/index.js deleted file mode 100644 index 12ea659..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/index.js +++ /dev/null @@ -1,118 +0,0 @@ -/*! - * serve-static - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var escapeHtml = require('escape-html'); -var merge = require('utils-merge'); -var parseurl = require('parseurl'); -var resolve = require('path').resolve; -var send = require('send'); -var url = require('url'); - -/** - * @param {String} root - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function serveStatic(root, options) { - if (!root) { - throw new TypeError('root path required') - } - - if (typeof root !== 'string') { - throw new TypeError('root path must be a string') - } - - // copy options object - options = merge({}, options) - - // resolve root to absolute - root = resolve(root) - - // default redirect - var redirect = options.redirect !== false - - // headers listener - var setHeaders = options.setHeaders - delete options.setHeaders - - if (setHeaders && typeof setHeaders !== 'function') { - throw new TypeError('option setHeaders must be function') - } - - // setup options for send - options.maxage = options.maxage || options.maxAge || 0 - options.root = root - - return function serveStatic(req, res, next) { - if (req.method !== 'GET' && req.method !== 'HEAD') { - return next() - } - - var opts = merge({}, options) - var originalUrl = parseurl.original(req) - var path = parseurl(req).pathname - var hasTrailingSlash = originalUrl.pathname[originalUrl.pathname.length - 1] === '/' - - if (path === '/' && !hasTrailingSlash) { - // make sure redirect occurs at mount - path = '' - } - - // create send stream - var stream = send(req, path, opts) - - if (redirect) { - // redirect relative to originalUrl - stream.on('directory', function redirect() { - if (hasTrailingSlash) { - return next() - } - - originalUrl.pathname += '/' - - var target = url.format(originalUrl) - - res.statusCode = 303 - res.setHeader('Content-Type', 'text/html; charset=utf-8') - res.setHeader('Location', target) - res.end('Redirecting to ' + escapeHtml(target) + '\n') - }) - } else { - // forward to next middleware on directory - stream.on('directory', next) - } - - // add headers listener - if (setHeaders) { - stream.on('headers', setHeaders) - } - - // forward non-404 errors - stream.on('error', function error(err) { - next(err.status === 404 ? null : err) - }) - - // pipe - stream.pipe(res) - } -} - -/** - * Expose mime module. - * - * If you wish to extend the mime table use this - * reference to the "mime" module in the npm registry. - */ - -exports.mime = send.mime diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/.npmignore b/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/.npmignore deleted file mode 100644 index 48a2e24..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -components -build diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/Makefile b/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/Makefile deleted file mode 100644 index 3f6119d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/Makefile +++ /dev/null @@ -1,11 +0,0 @@ - -build: components index.js - @component build - -components: - @Component install - -clean: - rm -fr build components template.js - -.PHONY: clean diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/Readme.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/Readme.md deleted file mode 100644 index 2cfcc99..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/Readme.md +++ /dev/null @@ -1,15 +0,0 @@ - -# escape-html - - Escape HTML entities - -## Example - -```js -var escape = require('escape-html'); -escape(str); -``` - -## License - - MIT \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/component.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/component.json deleted file mode 100644 index cb9740f..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "escape-html", - "description": "Escape HTML entities", - "version": "1.0.1", - "keywords": ["escape", "html", "utility"], - "dependencies": {}, - "scripts": [ - "index.js" - ] -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/index.js deleted file mode 100644 index 2765211..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/index.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Escape special characters in the given string of html. - * - * @param {String} html - * @return {String} - * @api private - */ - -module.exports = function(html) { - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(/'/g, ''') - .replace(//g, '>'); -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/package.json deleted file mode 100644 index ee240f0..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/escape-html/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "escape-html", - "description": "Escape HTML entities", - "version": "1.0.1", - "keywords": [ - "escape", - "html", - "utility" - ], - "dependencies": {}, - "main": "index.js", - "component": { - "scripts": { - "escape-html/index.js": "index.js" - } - }, - "repository": { - "type": "git", - "url": "https://github.com/component/escape-html.git" - }, - "readme": "\n# escape-html\n\n Escape HTML entities\n\n## Example\n\n```js\nvar escape = require('escape-html');\nescape(str);\n```\n\n## License\n\n MIT", - "readmeFilename": "Readme.md", - "bugs": { - "url": "https://github.com/component/escape-html/issues" - }, - "homepage": "https://github.com/component/escape-html", - "_id": "escape-html@1.0.1", - "dist": { - "shasum": "181a286ead397a39a92857cfb1d43052e356bff0", - "tarball": "http://registry.npmjs.org/escape-html/-/escape-html-1.0.1.tgz" - }, - "_from": "escape-html@1.0.1", - "_npmVersion": "1.3.15", - "_npmUser": { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - } - ], - "directories": {}, - "_shasum": "181a286ead397a39a92857cfb1d43052e356bff0", - "_resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.1.tgz" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/.npmignore b/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/.npmignore deleted file mode 100644 index 85c82a5..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -benchmark/ -coverage/ -test/ -.travis.yml diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/HISTORY.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/HISTORY.md deleted file mode 100644 index 65a0860..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/HISTORY.md +++ /dev/null @@ -1,42 +0,0 @@ -1.3.0 / 2014-08-09 -================== - - * Add `parseurl.original` for parsing `req.originalUrl` with fallback - * Return `undefined` if `req.url` is `undefined` - -1.2.0 / 2014-07-21 -================== - - * Cache URLs based on original value - * Remove no-longer-needed URL mis-parse work-around - * Simplify the "fast-path" `RegExp` - -1.1.3 / 2014-07-08 -================== - - * Fix typo - -1.1.2 / 2014-07-08 -================== - - * Seriously fix Node.js 0.8 compatibility - -1.1.1 / 2014-07-08 -================== - - * Fix Node.js 0.8 compatibility - -1.1.0 / 2014-07-08 -================== - - * Incorporate URL href-only parse fast-path - -1.0.1 / 2014-03-08 -================== - - * Add missing `require` - -1.0.0 / 2014-03-08 -================== - - * Genesis from `connect` diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/LICENSE deleted file mode 100644 index ec7dfe7..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ - -(The MIT License) - -Copyright (c) 2014 Jonathan Ong -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/README.md deleted file mode 100644 index 0db1d02..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/README.md +++ /dev/null @@ -1,107 +0,0 @@ -# parseurl - -[![NPM version](https://badge.fury.io/js/parseurl.svg)](http://badge.fury.io/js/parseurl) -[![Build Status](https://travis-ci.org/expressjs/parseurl.svg?branch=master)](https://travis-ci.org/expressjs/parseurl) -[![Coverage Status](https://img.shields.io/coveralls/expressjs/parseurl.svg?branch=master)](https://coveralls.io/r/expressjs/parseurl) - -Parse a URL with memoization. - -## Install - -```bash -$ npm install parseurl -``` - -## API - -```js -var parseurl = require('parseurl') -``` - -### parseurl(req) - -Parse the URL of the given request object (looks at the `req.url` property) -and return the result. The result is the same as `url.parse` in Node.js core. -Calling this function multiple times on the same `req` where `req.url` does -not change will return a cached parsed object, rather than parsing again. - -### parseurl.original(req) - -Parse the original URL of the given request object and return the result. -This works by trying to parse `req.originalUrl` if it is a string, otherwise -parses `req.url`. The result is the same as `url.parse` in Node.js core. -Calling this function multiple times on the same `req` where `req.originalUrl` -does not change will return a cached parsed object, rather than parsing again. - -## Benchmark - -```bash -$ npm run-script bench - -> parseurl@1.3.0 bench nodejs-parseurl -> node benchmark/index.js - -> node benchmark/fullurl.js - - Parsing URL "http://localhost:8888/foo/bar?user=tj&pet=fluffy" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 1,290,780 ops/sec ±0.46% (195 runs sampled) - nativeurl x 56,401 ops/sec ±0.22% (196 runs sampled) - parseurl x 55,231 ops/sec ±0.22% (194 runs sampled) - -> node benchmark/pathquery.js - - Parsing URL "/foo/bar?user=tj&pet=fluffy" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 1,986,668 ops/sec ±0.27% (190 runs sampled) - nativeurl x 98,740 ops/sec ±0.21% (195 runs sampled) - parseurl x 2,628,171 ops/sec ±0.36% (195 runs sampled) - -> node benchmark/samerequest.js - - Parsing URL "/foo/bar?user=tj&pet=fluffy" on same request object - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 2,184,468 ops/sec ±0.40% (194 runs sampled) - nativeurl x 99,437 ops/sec ±0.71% (194 runs sampled) - parseurl x 10,498,005 ops/sec ±0.61% (186 runs sampled) - -> node benchmark/simplepath.js - - Parsing URL "/foo/bar" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 4,535,825 ops/sec ±0.27% (191 runs sampled) - nativeurl x 98,769 ops/sec ±0.54% (191 runs sampled) - parseurl x 4,164,865 ops/sec ±0.34% (192 runs sampled) - -> node benchmark/slash.js - - Parsing URL "/" - - 1 test completed. - 2 tests completed. - 3 tests completed. - - fasturl x 4,908,405 ops/sec ±0.42% (191 runs sampled) - nativeurl x 100,945 ops/sec ±0.59% (188 runs sampled) - parseurl x 4,333,208 ops/sec ±0.27% (194 runs sampled) -``` - -## License - - [MIT](LICENSE) diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/index.js deleted file mode 100644 index 8632347..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/index.js +++ /dev/null @@ -1,136 +0,0 @@ -/*! - * parseurl - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url') -var parse = url.parse -var Url = url.Url - -/** - * Pattern for a simple path case. - * See: https://github.com/joyent/node/pull/7878 - */ - -var simplePathRegExp = /^(\/\/?(?!\/)[^\?#\s]*)(\?[^#\s]*)?$/ - -/** - * Exports. - */ - -module.exports = parseurl -module.exports.original = originalurl - -/** - * Parse the `req` url with memoization. - * - * @param {ServerRequest} req - * @return {Object} - * @api public - */ - -function parseurl(req) { - var url = req.url - - if (url === undefined) { - // URL is undefined - return undefined - } - - var parsed = req._parsedUrl - - if (fresh(url, parsed)) { - // Return cached URL parse - return parsed - } - - // Parse the URL - parsed = fastparse(url) - parsed._raw = url - - return req._parsedUrl = parsed -}; - -/** - * Parse the `req` original url with fallback and memoization. - * - * @param {ServerRequest} req - * @return {Object} - * @api public - */ - -function originalurl(req) { - var url = req.originalUrl - - if (typeof url !== 'string') { - // Fallback - return parseurl(req) - } - - var parsed = req._parsedOriginalUrl - - if (fresh(url, parsed)) { - // Return cached URL parse - return parsed - } - - // Parse the URL - parsed = fastparse(url) - parsed._raw = url - - return req._parsedOriginalUrl = parsed -}; - -/** - * Parse the `str` url with fast-path short-cut. - * - * @param {string} str - * @return {Object} - * @api private - */ - -function fastparse(str) { - // Try fast path regexp - // See: https://github.com/joyent/node/pull/7878 - var simplePath = typeof str === 'string' && simplePathRegExp.exec(str) - - // Construct simple URL - if (simplePath) { - var pathname = simplePath[1] - var search = simplePath[2] || null - var url = Url !== undefined - ? new Url() - : {} - url.path = str - url.href = str - url.pathname = pathname - url.search = search - url.query = search && search.substr(1) - - return url - } - - return parse(str) -} - -/** - * Determine if parsed is still fresh for url. - * - * @param {string} url - * @param {object} parsedUrl - * @return {boolean} - * @api private - */ - -function fresh(url, parsedUrl) { - return typeof parsedUrl === 'object' - && parsedUrl !== null - && (Url === undefined || parsedUrl instanceof Url) - && parsedUrl._raw === url -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/package.json deleted file mode 100644 index 6fbd23e..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/parseurl/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "parseurl", - "description": "parse a url with memoization", - "version": "1.3.0", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "repository": { - "type": "git", - "url": "https://github.com/expressjs/parseurl" - }, - "license": "MIT", - "devDependencies": { - "benchmark": "1.0.0", - "beautify-benchmark": "0.2.4", - "fast-url-parser": "~1.0.0", - "istanbul": "0.3.0", - "mocha": "~1.21.4" - }, - "scripts": { - "bench": "node benchmark/index.js", - "test": "mocha --check-leaks --bail --reporter spec test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/" - }, - "gitHead": "03b7ccca240e2bef5df6c25797e99175d28fb2cb", - "bugs": { - "url": "https://github.com/expressjs/parseurl/issues" - }, - "homepage": "https://github.com/expressjs/parseurl", - "_id": "parseurl@1.3.0", - "_shasum": "b58046db4223e145afa76009e61bac87cc2281b3", - "_from": "parseurl@~1.3.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "shtylman", - "email": "shtylman@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "mscdex", - "email": "mscdex@mscdex.net" - }, - { - "name": "fishrock123", - "email": "fishrock123@rocketmail.com" - } - ], - "dist": { - "shasum": "b58046db4223e145afa76009e61bac87cc2281b3", - "tarball": "http://registry.npmjs.org/parseurl/-/parseurl-1.3.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/History.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/History.md deleted file mode 100644 index ad5efc5..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/History.md +++ /dev/null @@ -1,221 +0,0 @@ -0.10.1 / 2014-10-22 -=================== - - * deps: on-finished@~2.1.1 - - Fix handling of pipelined requests - -0.10.0 / 2014-10-15 -=================== - - * deps: debug@~2.1.0 - - Implement `DEBUG_FD` env variable support - * deps: depd@~1.0.0 - * deps: etag@~1.5.0 - - Improve string performance - - Slightly improve speed for weak ETags over 1KB - -0.9.3 / 2014-09-24 -================== - - * deps: etag@~1.4.0 - - Support "fake" stats objects - -0.9.2 / 2014-09-15 -================== - - * deps: depd@0.4.5 - * deps: etag@~1.3.1 - * deps: range-parser@~1.0.2 - -0.9.1 / 2014-09-07 -================== - - * deps: fresh@0.2.4 - -0.9.0 / 2014-09-07 -================== - - * Add `lastModified` option - * Use `etag` to generate `ETag` header - * deps: debug@~2.0.0 - -0.8.5 / 2014-09-04 -================== - - * Fix malicious path detection for empty string path - -0.8.4 / 2014-09-04 -================== - - * Fix a path traversal issue when using `root` - -0.8.3 / 2014-08-16 -================== - - * deps: destroy@1.0.3 - - renamed from dethroy - * deps: on-finished@2.1.0 - -0.8.2 / 2014-08-14 -================== - - * Work around `fd` leak in Node.js 0.10 for `fs.ReadStream` - * deps: dethroy@1.0.2 - -0.8.1 / 2014-08-05 -================== - - * Fix `extensions` behavior when file already has extension - -0.8.0 / 2014-08-05 -================== - - * Add `extensions` option - -0.7.4 / 2014-08-04 -================== - - * Fix serving index files without root dir - -0.7.3 / 2014-07-29 -================== - - * Fix incorrect 403 on Windows and Node.js 0.11 - -0.7.2 / 2014-07-27 -================== - - * deps: depd@0.4.4 - - Work-around v8 generating empty stack traces - -0.7.1 / 2014-07-26 -================== - - * deps: depd@0.4.3 - - Fix exception when global `Error.stackTraceLimit` is too low - -0.7.0 / 2014-07-20 -================== - - * Deprecate `hidden` option; use `dotfiles` option - * Add `dotfiles` option - * deps: debug@1.0.4 - * deps: depd@0.4.2 - - Add `TRACE_DEPRECATION` environment variable - - Remove non-standard grey color from color output - - Support `--no-deprecation` argument - - Support `--trace-deprecation` argument - -0.6.0 / 2014-07-11 -================== - - * Deprecate `from` option; use `root` option - * Deprecate `send.etag()` -- use `etag` in `options` - * Deprecate `send.hidden()` -- use `hidden` in `options` - * Deprecate `send.index()` -- use `index` in `options` - * Deprecate `send.maxage()` -- use `maxAge` in `options` - * Deprecate `send.root()` -- use `root` in `options` - * Cap `maxAge` value to 1 year - * deps: debug@1.0.3 - - Add support for multiple wildcards in namespaces - -0.5.0 / 2014-06-28 -================== - - * Accept string for `maxAge` (converted by `ms`) - * Add `headers` event - * Include link in default redirect response - * Use `EventEmitter.listenerCount` to count listeners - -0.4.3 / 2014-06-11 -================== - - * Do not throw un-catchable error on file open race condition - * Use `escape-html` for HTML escaping - * deps: debug@1.0.2 - - fix some debugging output colors on node.js 0.8 - * deps: finished@1.2.2 - * deps: fresh@0.2.2 - -0.4.2 / 2014-06-09 -================== - - * fix "event emitter leak" warnings - * deps: debug@1.0.1 - * deps: finished@1.2.1 - -0.4.1 / 2014-06-02 -================== - - * Send `max-age` in `Cache-Control` in correct format - -0.4.0 / 2014-05-27 -================== - - * Calculate ETag with md5 for reduced collisions - * Fix wrong behavior when index file matches directory - * Ignore stream errors after request ends - - Goodbye `EBADF, read` - * Skip directories in index file search - * deps: debug@0.8.1 - -0.3.0 / 2014-04-24 -================== - - * Fix sending files with dots without root set - * Coerce option types - * Accept API options in options object - * Set etags to "weak" - * Include file path in etag - * Make "Can't set headers after they are sent." catchable - * Send full entity-body for multi range requests - * Default directory access to 403 when index disabled - * Support multiple index paths - * Support "If-Range" header - * Control whether to generate etags - * deps: mime@1.2.11 - -0.2.0 / 2014-01-29 -================== - - * update range-parser and fresh - -0.1.4 / 2013-08-11 -================== - - * update fresh - -0.1.3 / 2013-07-08 -================== - - * Revert "Fix fd leak" - -0.1.2 / 2013-07-03 -================== - - * Fix fd leak - -0.1.0 / 2012-08-25 -================== - - * add options parameter to send() that is passed to fs.createReadStream() [kanongil] - -0.0.4 / 2012-08-16 -================== - - * allow custom "Accept-Ranges" definition - -0.0.3 / 2012-07-16 -================== - - * fix normalization of the root directory. Closes #3 - -0.0.2 / 2012-07-09 -================== - - * add passing of req explicitly for now (YUCK) - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/LICENSE deleted file mode 100644 index 3b87e2d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/Readme.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/Readme.md deleted file mode 100644 index 78bd40d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/Readme.md +++ /dev/null @@ -1,182 +0,0 @@ -# send - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] -[![Gittip][gittip-image]][gittip-url] - - Send is Connect's `static()` extracted for generalized use, a streaming static file - server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework. - -## Installation - -```bash -$ npm install send -``` - -## API - -```js -var send = require('send') -``` - -### send(req, path, [options]) - -Create a new `SendStream` for the given path to send to a `res`. The `req` is -the Node.js HTTP request and the `path` is a urlencoded path to send (urlencoded, -not the actual file-system path). - -#### Options - -##### dotfiles - - Set how "dotfiles" are treated when encountered. A dotfile is a file - or directory that begins with a dot ("."). Note this check is done on - the path itself without checking if the path actually exists on the - disk. If `root` is specified, only the dotfiles above the root are - checked (i.e. the root itself can be within a dotfile when when set - to "deny"). - - The default value is `'ignore'`. - - - `'allow'` No special treatment for dotfiles. - - `'deny'` Send a 403 for any request for a dotfile. - - `'ignore'` Pretend like the dotfile does not exist and 404. - -##### etag - - Enable or disable etag generation, defaults to true. - -##### extensions - - If a given file doesn't exist, try appending one of the given extensions, - in the given order. By default, this is disabled (set to `false`). An - example value that will serve extension-less HTML files: `['html', 'htm']`. - This is skipped if the requested file already has an extension. - -##### index - - By default send supports "index.html" files, to disable this - set `false` or to supply a new index pass a string or an array - in preferred order. - -##### lastModified - - Enable or disable `Last-Modified` header, defaults to true. Uses the file - system's last modified value. - -##### maxAge - - Provide a max-age in milliseconds for http caching, defaults to 0. - This can also be a string accepted by the - [ms](https://www.npmjs.org/package/ms#readme) module. - -##### root - - Serve files relative to `path`. - -### Events - -The `SendStream` is an event emitter and will emit the following events: - - - `error` an error occurred `(err)` - - `directory` a directory was requested - - `file` a file was requested `(path, stat)` - - `headers` the headers are about to be set on a file `(res, path, stat)` - - `stream` file streaming has started `(stream)` - - `end` streaming has completed - -### .pipe - -The `pipe` method is used to pipe the response into the Node.js HTTP response -object, typically `send(req, path, options).pipe(res)`. - -## Error-handling - - By default when no `error` listeners are present an automatic response will be made, otherwise you have full control over the response, aka you may show a 5xx page etc. - -## Caching - - It does _not_ perform internal caching, you should use a reverse proxy cache such - as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;). - -## Debugging - - To enable `debug()` instrumentation output export __DEBUG__: - -``` -$ DEBUG=send node app -``` - -## Running tests - -``` -$ npm install -$ npm test -``` - -## Examples - - Small: - -```js -var http = require('http'); -var send = require('send'); - -var app = http.createServer(function(req, res){ - send(req, req.url).pipe(res); -}).listen(3000); -``` - - Serving from a root directory with custom error-handling: - -```js -var http = require('http'); -var send = require('send'); -var url = require('url'); - -var app = http.createServer(function(req, res){ - // your custom error-handling logic: - function error(err) { - res.statusCode = err.status || 500; - res.end(err.message); - } - - // your custom headers - function headers(res, path, stat) { - // serve all files for download - res.setHeader('Content-Disposition', 'attachment'); - } - - // your custom directory handling logic: - function redirect() { - res.statusCode = 301; - res.setHeader('Location', req.url + '/'); - res.end('Redirecting to ' + req.url + '/'); - } - - // transfer arbitrary files from within - // /www/example.com/public/* - send(req, url.parse(req.url).pathname, {root: '/www/example.com/public'}) - .on('error', error) - .on('directory', redirect) - .on('headers', headers) - .pipe(res); -}).listen(3000); -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/send.svg?style=flat -[npm-url]: https://npmjs.org/package/send -[travis-image]: https://img.shields.io/travis/tj/send.svg?style=flat -[travis-url]: https://travis-ci.org/tj/send -[coveralls-image]: https://img.shields.io/coveralls/tj/send.svg?style=flat -[coveralls-url]: https://coveralls.io/r/tj/send?branch=master -[downloads-image]: https://img.shields.io/npm/dm/send.svg?style=flat -[downloads-url]: https://npmjs.org/package/send -[gittip-image]: https://img.shields.io/gittip/dougwilson.svg?style=flat -[gittip-url]: https://www.gittip.com/dougwilson/ diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/index.js deleted file mode 100644 index 64b6d64..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/index.js +++ /dev/null @@ -1,773 +0,0 @@ - -/** - * Module dependencies. - */ - -var debug = require('debug')('send') -var deprecate = require('depd')('send') -var destroy = require('destroy') -var escapeHtml = require('escape-html') - , parseRange = require('range-parser') - , Stream = require('stream') - , mime = require('mime') - , fresh = require('fresh') - , path = require('path') - , http = require('http') - , fs = require('fs') - , normalize = path.normalize - , join = path.join -var etag = require('etag') -var EventEmitter = require('events').EventEmitter; -var ms = require('ms'); -var onFinished = require('on-finished') - -/** - * Variables. - */ -var extname = path.extname -var maxMaxAge = 60 * 60 * 24 * 365 * 1000; // 1 year -var resolve = path.resolve -var sep = path.sep -var toString = Object.prototype.toString -var upPathRegexp = /(?:^|[\\\/])\.\.(?:[\\\/]|$)/ - -/** - * Expose `send`. - */ - -exports = module.exports = send; - -/** - * Expose mime module. - */ - -exports.mime = mime; - -/** - * Shim EventEmitter.listenerCount for node.js < 0.10 - */ - -/* istanbul ignore next */ -var listenerCount = EventEmitter.listenerCount - || function(emitter, type){ return emitter.listeners(type).length; }; - -/** - * Return a `SendStream` for `req` and `path`. - * - * @param {Request} req - * @param {String} path - * @param {Object} options - * @return {SendStream} - * @api public - */ - -function send(req, path, options) { - return new SendStream(req, path, options); -} - -/** - * Initialize a `SendStream` with the given `path`. - * - * @param {Request} req - * @param {String} path - * @param {Object} options - * @api private - */ - -function SendStream(req, path, options) { - var self = this; - options = options || {}; - this.req = req; - this.path = path; - this.options = options; - - this._etag = options.etag !== undefined - ? Boolean(options.etag) - : true - - this._dotfiles = options.dotfiles !== undefined - ? options.dotfiles - : 'ignore' - - if (['allow', 'deny', 'ignore'].indexOf(this._dotfiles) === -1) { - throw new TypeError('dotfiles option must be "allow", "deny", or "ignore"') - } - - this._hidden = Boolean(options.hidden) - - if ('hidden' in options) { - deprecate('hidden: use dotfiles: \'' + (this._hidden ? 'allow' : 'ignore') + '\' instead') - } - - // legacy support - if (!('dotfiles' in options)) { - this._dotfiles = undefined - } - - this._extensions = options.extensions !== undefined - ? normalizeList(options.extensions) - : [] - - this._index = options.index !== undefined - ? normalizeList(options.index) - : ['index.html'] - - this._lastModified = options.lastModified !== undefined - ? Boolean(options.lastModified) - : true - - this._maxage = options.maxAge || options.maxage - this._maxage = typeof this._maxage === 'string' - ? ms(this._maxage) - : Number(this._maxage) - this._maxage = !isNaN(this._maxage) - ? Math.min(Math.max(0, this._maxage), maxMaxAge) - : 0 - - this._root = options.root - ? resolve(options.root) - : null - - if (!this._root && options.from) { - this.from(options.from); - } -} - -/** - * Inherits from `Stream.prototype`. - */ - -SendStream.prototype.__proto__ = Stream.prototype; - -/** - * Enable or disable etag generation. - * - * @param {Boolean} val - * @return {SendStream} - * @api public - */ - -SendStream.prototype.etag = deprecate.function(function etag(val) { - val = Boolean(val); - debug('etag %s', val); - this._etag = val; - return this; -}, 'send.etag: pass etag as option'); - -/** - * Enable or disable "hidden" (dot) files. - * - * @param {Boolean} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.hidden = deprecate.function(function hidden(val) { - val = Boolean(val); - debug('hidden %s', val); - this._hidden = val; - this._dotfiles = undefined - return this; -}, 'send.hidden: use dotfiles option'); - -/** - * Set index `paths`, set to a falsy - * value to disable index support. - * - * @param {String|Boolean|Array} paths - * @return {SendStream} - * @api public - */ - -SendStream.prototype.index = deprecate.function(function index(paths) { - var index = !paths ? [] : normalizeList(paths); - debug('index %o', paths); - this._index = index; - return this; -}, 'send.index: pass index as option'); - -/** - * Set root `path`. - * - * @param {String} path - * @return {SendStream} - * @api public - */ - -SendStream.prototype.root = function(path){ - path = String(path); - this._root = resolve(path) - return this; -}; - -SendStream.prototype.from = deprecate.function(SendStream.prototype.root, - 'send.from: pass root as option'); - -SendStream.prototype.root = deprecate.function(SendStream.prototype.root, - 'send.root: pass root as option'); - -/** - * Set max-age to `maxAge`. - * - * @param {Number} maxAge - * @return {SendStream} - * @api public - */ - -SendStream.prototype.maxage = deprecate.function(function maxage(maxAge) { - maxAge = typeof maxAge === 'string' - ? ms(maxAge) - : Number(maxAge); - if (isNaN(maxAge)) maxAge = 0; - if (Infinity == maxAge) maxAge = 60 * 60 * 24 * 365 * 1000; - debug('max-age %d', maxAge); - this._maxage = maxAge; - return this; -}, 'send.maxage: pass maxAge as option'); - -/** - * Emit error with `status`. - * - * @param {Number} status - * @api private - */ - -SendStream.prototype.error = function(status, err){ - var res = this.res; - var msg = http.STATUS_CODES[status]; - - err = err || new Error(msg); - err.status = status; - - // emit if listeners instead of responding - if (listenerCount(this, 'error') !== 0) { - return this.emit('error', err); - } - - // wipe all existing headers - res._headers = undefined; - - res.statusCode = err.status; - res.end(msg); -}; - -/** - * Check if the pathname ends with "/". - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.hasTrailingSlash = function(){ - return '/' == this.path[this.path.length - 1]; -}; - -/** - * Check if this is a conditional GET request. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isConditionalGET = function(){ - return this.req.headers['if-none-match'] - || this.req.headers['if-modified-since']; -}; - -/** - * Strip content-* header fields. - * - * @api private - */ - -SendStream.prototype.removeContentHeaderFields = function(){ - var res = this.res; - Object.keys(res._headers).forEach(function(field){ - if (0 == field.indexOf('content')) { - res.removeHeader(field); - } - }); -}; - -/** - * Respond with 304 not modified. - * - * @api private - */ - -SendStream.prototype.notModified = function(){ - var res = this.res; - debug('not modified'); - this.removeContentHeaderFields(); - res.statusCode = 304; - res.end(); -}; - -/** - * Raise error that headers already sent. - * - * @api private - */ - -SendStream.prototype.headersAlreadySent = function headersAlreadySent(){ - var err = new Error('Can\'t set headers after they are sent.'); - debug('headers already sent'); - this.error(500, err); -}; - -/** - * Check if the request is cacheable, aka - * responded with 2xx or 304 (see RFC 2616 section 14.2{5,6}). - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isCachable = function(){ - var res = this.res; - return (res.statusCode >= 200 && res.statusCode < 300) || 304 == res.statusCode; -}; - -/** - * Handle stat() error. - * - * @param {Error} err - * @api private - */ - -SendStream.prototype.onStatError = function(err){ - var notfound = ['ENOENT', 'ENAMETOOLONG', 'ENOTDIR']; - if (~notfound.indexOf(err.code)) return this.error(404, err); - this.error(500, err); -}; - -/** - * Check if the cache is fresh. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isFresh = function(){ - return fresh(this.req.headers, this.res._headers); -}; - -/** - * Check if the range is fresh. - * - * @return {Boolean} - * @api private - */ - -SendStream.prototype.isRangeFresh = function isRangeFresh(){ - var ifRange = this.req.headers['if-range']; - - if (!ifRange) return true; - - return ~ifRange.indexOf('"') - ? ~ifRange.indexOf(this.res._headers['etag']) - : Date.parse(this.res._headers['last-modified']) <= Date.parse(ifRange); -}; - -/** - * Redirect to `path`. - * - * @param {String} path - * @api private - */ - -SendStream.prototype.redirect = function(path){ - if (listenerCount(this, 'directory') !== 0) { - return this.emit('directory'); - } - - if (this.hasTrailingSlash()) return this.error(403); - var res = this.res; - path += '/'; - res.statusCode = 301; - res.setHeader('Content-Type', 'text/html; charset=utf-8'); - res.setHeader('Location', path); - res.end('Redirecting to ' + escapeHtml(path) + '\n'); -}; - -/** - * Pipe to `res. - * - * @param {Stream} res - * @return {Stream} res - * @api public - */ - -SendStream.prototype.pipe = function(res){ - var self = this - , args = arguments - , root = this._root; - - // references - this.res = res; - - // decode the path - var path = decode(this.path) - if (path === -1) return this.error(400) - - // null byte(s) - if (~path.indexOf('\0')) return this.error(400); - - var parts - if (root !== null) { - // join / normalize from optional root dir - path = normalize(join(root, path)) - root = normalize(root + sep) - - // malicious path - if ((path + sep).substr(0, root.length) !== root) { - debug('malicious path "%s"', path) - return this.error(403) - } - - // explode path parts - parts = path.substr(root.length).split(sep) - } else { - // ".." is malicious without "root" - if (upPathRegexp.test(path)) { - debug('malicious path "%s"', path) - return this.error(403) - } - - // explode path parts - parts = normalize(path).split(sep) - - // resolve the path - path = resolve(path) - } - - // dotfile handling - if (containsDotFile(parts)) { - var access = this._dotfiles - - // legacy support - if (access === undefined) { - access = parts[parts.length - 1][0] === '.' - ? (this._hidden ? 'allow' : 'ignore') - : 'allow' - } - - debug('%s dotfile "%s"', access, path) - switch (access) { - case 'allow': - break - case 'deny': - return this.error(403) - case 'ignore': - default: - return this.error(404) - } - } - - // index file support - if (this._index.length && this.path[this.path.length - 1] === '/') { - this.sendIndex(path); - return res; - } - - this.sendFile(path); - return res; -}; - -/** - * Transfer `path`. - * - * @param {String} path - * @api public - */ - -SendStream.prototype.send = function(path, stat){ - var options = this.options; - var len = stat.size; - var res = this.res; - var req = this.req; - var ranges = req.headers.range; - var offset = options.start || 0; - - if (res._header) { - // impossible to send now - return this.headersAlreadySent(); - } - - debug('pipe "%s"', path) - - // set header fields - this.setHeader(path, stat); - - // set content-type - this.type(path); - - // conditional GET support - if (this.isConditionalGET() - && this.isCachable() - && this.isFresh()) { - return this.notModified(); - } - - // adjust len to start/end options - len = Math.max(0, len - offset); - if (options.end !== undefined) { - var bytes = options.end - offset + 1; - if (len > bytes) len = bytes; - } - - // Range support - if (ranges) { - ranges = parseRange(len, ranges); - - // If-Range support - if (!this.isRangeFresh()) { - debug('range stale'); - ranges = -2; - } - - // unsatisfiable - if (-1 == ranges) { - debug('range unsatisfiable'); - res.setHeader('Content-Range', 'bytes */' + stat.size); - return this.error(416); - } - - // valid (syntactically invalid/multiple ranges are treated as a regular response) - if (-2 != ranges && ranges.length === 1) { - debug('range %j', ranges); - - options.start = offset + ranges[0].start; - options.end = offset + ranges[0].end; - - // Content-Range - res.statusCode = 206; - res.setHeader('Content-Range', 'bytes ' - + ranges[0].start - + '-' - + ranges[0].end - + '/' - + len); - len = options.end - options.start + 1; - } - } - - // content-length - res.setHeader('Content-Length', len); - - // HEAD support - if ('HEAD' == req.method) return res.end(); - - this.stream(path, options); -}; - -/** - * Transfer file for `path`. - * - * @param {String} path - * @api private - */ -SendStream.prototype.sendFile = function sendFile(path) { - var i = 0 - var self = this - - debug('stat "%s"', path); - fs.stat(path, function onstat(err, stat) { - if (err && err.code === 'ENOENT' - && !extname(path) - && path[path.length - 1] !== sep) { - // not found, check extensions - return next(err) - } - if (err) return self.onStatError(err) - if (stat.isDirectory()) return self.redirect(self.path) - self.emit('file', path, stat) - self.send(path, stat) - }) - - function next(err) { - if (self._extensions.length <= i) { - return err - ? self.onStatError(err) - : self.error(404) - } - - var p = path + '.' + self._extensions[i++] - - debug('stat "%s"', p) - fs.stat(p, function (err, stat) { - if (err) return next(err) - if (stat.isDirectory()) return next() - self.emit('file', p, stat) - self.send(p, stat) - }) - } -} - -/** - * Transfer index for `path`. - * - * @param {String} path - * @api private - */ -SendStream.prototype.sendIndex = function sendIndex(path){ - var i = -1; - var self = this; - - function next(err){ - if (++i >= self._index.length) { - if (err) return self.onStatError(err); - return self.error(404); - } - - var p = join(path, self._index[i]); - - debug('stat "%s"', p); - fs.stat(p, function(err, stat){ - if (err) return next(err); - if (stat.isDirectory()) return next(); - self.emit('file', p, stat); - self.send(p, stat); - }); - } - - next(); -}; - -/** - * Stream `path` to the response. - * - * @param {String} path - * @param {Object} options - * @api private - */ - -SendStream.prototype.stream = function(path, options){ - // TODO: this is all lame, refactor meeee - var finished = false; - var self = this; - var res = this.res; - var req = this.req; - - // pipe - var stream = fs.createReadStream(path, options); - this.emit('stream', stream); - stream.pipe(res); - - // response finished, done with the fd - onFinished(res, function onfinished(){ - finished = true; - destroy(stream); - }); - - // error handling code-smell - stream.on('error', function onerror(err){ - // request already finished - if (finished) return; - - // clean up stream - finished = true; - destroy(stream); - - // error - self.onStatError(err); - }); - - // end - stream.on('end', function onend(){ - self.emit('end'); - }); -}; - -/** - * Set content-type based on `path` - * if it hasn't been explicitly set. - * - * @param {String} path - * @api private - */ - -SendStream.prototype.type = function(path){ - var res = this.res; - if (res.getHeader('Content-Type')) return; - var type = mime.lookup(path); - var charset = mime.charsets.lookup(type); - debug('content-type %s', type); - res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')); -}; - -/** - * Set response header fields, most - * fields may be pre-defined. - * - * @param {String} path - * @param {Object} stat - * @api private - */ - -SendStream.prototype.setHeader = function setHeader(path, stat){ - var res = this.res; - - this.emit('headers', res, path, stat); - - if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes'); - if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString()); - if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + Math.floor(this._maxage / 1000)); - - if (this._lastModified && !res.getHeader('Last-Modified')) { - var modified = stat.mtime.toUTCString() - debug('modified %s', modified) - res.setHeader('Last-Modified', modified) - } - - if (this._etag && !res.getHeader('ETag')) { - var val = etag(stat) - debug('etag %s', val) - res.setHeader('ETag', val) - } -}; - -/** - * Determine if path parts contain a dotfile. - * - * @api private - */ - -function containsDotFile(parts) { - for (var i = 0; i < parts.length; i++) { - if (parts[i][0] === '.') { - return true - } - } - - return false -} - -/** - * decodeURIComponent. - * - * Allows V8 to only deoptimize this fn instead of all - * of send(). - * - * @param {String} path - * @api private - */ - -function decode(path) { - try { - return decodeURIComponent(path) - } catch (err) { - return -1 - } -} - -/** - * Normalize the index option into an array. - * - * @param {boolean|string|array} val - * @api private - */ - -function normalizeList(val){ - return [].concat(val || []) -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/.jshintrc b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/.jshintrc deleted file mode 100644 index 299877f..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "laxbreak": true -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/.npmignore b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/.npmignore deleted file mode 100644 index 7e6163d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -support -test -examples -example -*.sock -dist diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/History.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/History.md deleted file mode 100644 index bcbc3bd..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/History.md +++ /dev/null @@ -1,157 +0,0 @@ - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/Makefile b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/Makefile deleted file mode 100644 index b0bde6e..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 -THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) - -# BIN directory -BIN := $(THIS_DIR)/node_modules/.bin - -# applications -NODE ?= $(shell which node) -NPM ?= $(NODE) $(shell which npm) -BROWSERIFY ?= $(NODE) $(BIN)/browserify - -all: dist/debug.js - -install: node_modules - -clean: - @rm -rf node_modules dist - -dist: - @mkdir -p $@ - -dist/debug.js: node_modules browser.js debug.js dist - @$(BROWSERIFY) \ - --standalone debug \ - . > $@ - -node_modules: package.json - @NODE_ENV= $(NPM) install - @touch node_modules - -.PHONY: all install clean diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/Readme.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/Readme.md deleted file mode 100644 index e59b9ad..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/Readme.md +++ /dev/null @@ -1,156 +0,0 @@ -# debug - - tiny node.js debugging utility modelled after node core's debugging technique. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - - With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. - -Example _app.js_: - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example _worker.js_: - -```js -var debug = require('debug')('worker'); - -setInterval(function(){ - debug('doing some work'); -}, 1000); -``` - - The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: - - ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) - - ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - -#### Web Inspector Colors - - Colors are also enabled on "Web Inspectors" that understand the `%c` formatting - option. These are WebKit web inspectors, Firefox ([since version - 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) - and the Firebug plugin for Firefox (any version). - - Colored output looks something like: - - ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) - -### stderr vs stdout - -You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: - -Example _stderr.js_: - -```js -var debug = require('../'); -var log = debug('app:log'); - -// by default console.log is used -log('goes to stdout!'); - -var error = debug('app:error'); -// set this namespace to log via console.error -error.log = console.error.bind(console); // don't forget to bind to console! -error('goes to stderr'); -log('still goes to stdout!'); - -// set all output to go via console.warn -// overrides all per-namespace log settings -debug.log = console.warn.bind(console); -log('now goes to stderr via console.warn'); -error('still goes to stderr, but via console.warn now'); -``` - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - -## License - -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/browser.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/browser.js deleted file mode 100644 index ce6369f..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/browser.js +++ /dev/null @@ -1,147 +0,0 @@ - -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args; - - var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // This hackery is required for IE8, - // where the `console.log` function doesn't have 'apply' - return 'object' == typeof console - && 'function' == typeof console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - localStorage.removeItem('debug'); - } else { - localStorage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = localStorage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/component.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/component.json deleted file mode 100644 index 7ee3d13..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "debug", - "repo": "visionmedia/debug", - "description": "small debugging utility", - "version": "2.1.0", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "guille/ms.js": "0.6.1" - } -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/debug.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/debug.js deleted file mode 100644 index 7571a86..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/debug.js +++ /dev/null @@ -1,197 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = debug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - -exports.formatters = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function debug(namespace) { - - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; - - // define the `enabled` version - function enabled() { - - var self = enabled; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - enabled.enabled = true; - - var fn = exports.enabled(namespace) ? enabled : disabled; - - fn.namespace = namespace; - - return fn; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/node.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/node.js deleted file mode 100644 index 5dc999f..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/node.js +++ /dev/null @@ -1,209 +0,0 @@ - -/** - * Module dependencies. - */ - -var tty = require('tty'); -var util = require('util'); - -/** - * This is the Node.js implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -/** - * The file descriptor to write the `debug()` calls to. - * Set the `DEBUG_FD` env variable to override with another value. i.e.: - * - * $ DEBUG_FD=3 node script.js 3>debug.log - */ - -var fd = parseInt(process.env.DEBUG_FD, 10) || 2; -var stream = 1 === fd ? process.stdout : - 2 === fd ? process.stderr : - createWritableStdioStream(fd); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); - if (0 === debugColors.length) { - return tty.isatty(fd); - } else { - return '0' !== debugColors - && 'no' !== debugColors - && 'false' !== debugColors - && 'disabled' !== debugColors; - } -} - -/** - * Map %o to `util.inspect()`, since Node doesn't do that out of the box. - */ - -var inspect = (4 === util.inspect.length ? - // node <= 0.8.x - function (v, colors) { - return util.inspect(v, void 0, void 0, colors); - } : - // node > 0.8.x - function (v, colors) { - return util.inspect(v, { colors: colors }); - } -); - -exports.formatters.o = function(v) { - return inspect(v, this.useColors) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - var name = this.namespace; - - if (useColors) { - var c = this.color; - - args[0] = ' \u001b[9' + c + 'm' + name + ' ' - + '\u001b[0m' - + args[0] + '\u001b[3' + c + 'm' - + ' +' + exports.humanize(this.diff) + '\u001b[0m'; - } else { - args[0] = new Date().toUTCString() - + ' ' + name + ' ' + args[0]; - } - return args; -} - -/** - * Invokes `console.error()` with the specified arguments. - */ - -function log() { - return stream.write(util.format.apply(this, arguments) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Copied from `node/src/node.js`. - * - * XXX: It's lame that node doesn't expose this API out-of-the-box. It also - * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. - */ - -function createWritableStdioStream (fd) { - var stream; - var tty_wrap = process.binding('tty_wrap'); - - // Note stream._type is used for test-module-load-list.js - - switch (tty_wrap.guessHandleType(fd)) { - case 'TTY': - stream = new tty.WriteStream(fd); - stream._type = 'tty'; - - // Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - case 'FILE': - var fs = require('fs'); - stream = new fs.SyncWriteStream(fd, { autoClose: false }); - stream._type = 'fs'; - break; - - case 'PIPE': - case 'TCP': - var net = require('net'); - stream = new net.Socket({ - fd: fd, - readable: false, - writable: true - }); - - // FIXME Should probably have an option in net.Socket to create a - // stream from an existing fd which is writable only. But for now - // we'll just add this hack and set the `readable` member to false. - // Test: ./node test/fixtures/echo.js < /etc/passwd - stream.readable = false; - stream.read = null; - stream._type = 'pipe'; - - // FIXME Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - default: - // Probably an error on in uv_guess_handle() - throw new Error('Implement me. Unknown stream file type!'); - } - - // For supporting legacy API we put the FD here. - stream.fd = fd; - - stream._isStdio = true; - - return stream; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/package.json deleted file mode 100644 index 3e41f8f..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/debug/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "debug", - "version": "2.1.0", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - } - ], - "license": "MIT", - "dependencies": { - "ms": "0.6.2" - }, - "devDependencies": { - "browserify": "6.1.0", - "mocha": "*" - }, - "main": "./node.js", - "browser": "./browser.js", - "component": { - "scripts": { - "debug/index.js": "browser.js", - "debug/debug.js": "debug.js" - } - }, - "gitHead": "953162b4fa8849268d147f4bac91c737baee55bb", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "homepage": "https://github.com/visionmedia/debug", - "_id": "debug@2.1.0", - "scripts": {}, - "_shasum": "33ab915659d8c2cc8a41443d94d6ebd37697ed21", - "_from": "debug@~2.1.0", - "_npmVersion": "2.1.3", - "_nodeVersion": "0.10.32", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "dist": { - "shasum": "33ab915659d8c2cc8a41443d94d6ebd37697ed21", - "tarball": "http://registry.npmjs.org/debug/-/debug-2.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/debug/-/debug-2.1.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/History.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/History.md deleted file mode 100644 index bdbcf58..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/History.md +++ /dev/null @@ -1,67 +0,0 @@ -1.0.0 / 2014-09-17 -================== - - * No changes - -0.4.5 / 2014-09-09 -================== - - * Improve call speed to functions using the function wrapper - * Support Node.js 0.6 - -0.4.4 / 2014-07-27 -================== - - * Work-around v8 generating empty stack traces - -0.4.3 / 2014-07-26 -================== - - * Fix exception when global `Error.stackTraceLimit` is too low - -0.4.2 / 2014-07-19 -================== - - * Correct call site for wrapped functions and properties - -0.4.1 / 2014-07-19 -================== - - * Improve automatic message generation for function properties - -0.4.0 / 2014-07-19 -================== - - * Add `TRACE_DEPRECATION` environment variable - * Remove non-standard grey color from color output - * Support `--no-deprecation` argument - * Support `--trace-deprecation` argument - * Support `deprecate.property(fn, prop, message)` - -0.3.0 / 2014-06-16 -================== - - * Add `NO_DEPRECATION` environment variable - -0.2.0 / 2014-06-15 -================== - - * Add `deprecate.property(obj, prop, message)` - * Remove `supports-color` dependency for node.js 0.8 - -0.1.0 / 2014-06-15 -================== - - * Add `deprecate.function(fn, message)` - * Add `process.on('deprecation', fn)` emitter - * Automatically generate message when omitted from `deprecate()` - -0.0.1 / 2014-06-15 -================== - - * Fix warning for dynamic calls at singe call site - -0.0.0 / 2014-06-15 -================== - - * Initial implementation diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/LICENSE deleted file mode 100644 index b7dce6c..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/Readme.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/Readme.md deleted file mode 100644 index 9fb2737..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/Readme.md +++ /dev/null @@ -1,271 +0,0 @@ -# depd - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Node.js Version][node-image]][node-url] -[![Build Status][travis-image]][travis-url] -[![Coverage Status][coveralls-image]][coveralls-url] -[![Gratipay][gratipay-image]][gratipay-url] - -Deprecate all the things - -> With great modules comes great responsibility; mark things deprecated! - -## Install - -```sh -$ npm install depd -``` - -## API - -```js -var deprecate = require('depd')('my-module') -``` - -This library allows you to display deprecation messages to your users. -This library goes above and beyond with deprecation warnings by -introspection of the call stack (but only the bits that it is interested -in). - -Instead of just warning on the first invocation of a deprecated -function and never again, this module will warn on the first invocation -of a deprecated function per unique call site, making it ideal to alert -users of all deprecated uses across the code base, rather than just -whatever happens to execute first. - -The deprecation warnings from this module also include the file and line -information for the call into the module that the deprecated function was -in. - -**NOTE** this library has a similar interface to the `debug` module, and -this module uses the calling file to get the boundary for the call stacks, -so you should always create a new `deprecate` object in each file and not -within some central file. - -### depd(namespace) - -Create a new deprecate function that uses the given namespace name in the -messages and will display the call site prior to the stack entering the -file this function was called from. It is highly suggested you use the -name of your module as the namespace. - -### deprecate(message) - -Call this function from deprecated code to display a deprecation message. -This message will appear once per unique caller site. Caller site is the -first call site in the stack in a different file from the caller of this -function. - -If the message is omitted, a message is generated for you based on the site -of the `deprecate()` call and will display the name of the function called, -similar to the name displayed in a stack trace. - -### deprecate.function(fn, message) - -Call this function to wrap a given function in a deprecation message on any -call to the function. An optional message can be supplied to provide a custom -message. - -### deprecate.property(obj, prop, message) - -Call this function to wrap a given property on object in a deprecation message -on any accessing or setting of the property. An optional message can be supplied -to provide a custom message. - -The method must be called on the object where the property belongs (not -inherited from the prototype). - -If the property is a data descriptor, it will be converted to an accessor -descriptor in order to display the deprecation message. - -### process.on('deprecation', fn) - -This module will allow easy capturing of deprecation errors by emitting the -errors as the type "deprecation" on the global `process`. If there are no -listeners for this type, the errors are written to STDERR as normal, but if -there are any listeners, nothing will be written to STDERR and instead only -emitted. From there, you can write the errors in a different format or to a -logging source. - -The error represents the deprecation and is emitted only once with the same -rules as writing to STDERR. The error has the following properties: - - - `message` - This is the message given by the library - - `name` - This is always `'DeprecationError'` - - `namespace` - This is the namespace the deprecation came from - - `stack` - This is the stack of the call to the deprecated thing - -Example `error.stack` output: - -``` -DeprecationError: my-cool-module deprecated oldfunction - at Object. ([eval]-wrapper:6:22) - at Module._compile (module.js:456:26) - at evalScript (node.js:532:25) - at startup (node.js:80:7) - at node.js:902:3 -``` - -### process.env.NO_DEPRECATION - -As a user of modules that are deprecated, the environment variable `NO_DEPRECATION` -is provided as a quick solution to silencing deprecation warnings from being -output. The format of this is similar to that of `DEBUG`: - -```sh -$ NO_DEPRECATION=my-module,othermod node app.js -``` - -This will suppress deprecations from being output for "my-module" and "othermod". -The value is a list of comma-separated namespaces. To suppress every warning -across all namespaces, use the value `*` for a namespace. - -Providing the argument `--no-deprecation` to the `node` executable will suppress -all deprecations (only available in Node.js 0.8 or higher). - -**NOTE** This will not suppress the deperecations given to any "deprecation" -event listeners, just the output to STDERR. - -### process.env.TRACE_DEPRECATION - -As a user of modules that are deprecated, the environment variable `TRACE_DEPRECATION` -is provided as a solution to getting more detailed location information in deprecation -warnings by including the entire stack trace. The format of this is the same as -`NO_DEPRECATION`: - -```sh -$ TRACE_DEPRECATION=my-module,othermod node app.js -``` - -This will include stack traces for deprecations being output for "my-module" and -"othermod". The value is a list of comma-separated namespaces. To trace every -warning across all namespaces, use the value `*` for a namespace. - -Providing the argument `--trace-deprecation` to the `node` executable will trace -all deprecations (only available in Node.js 0.8 or higher). - -**NOTE** This will not trace the deperecations silenced by `NO_DEPRECATION`. - -## Display - -![message](files/message.png) - -When a user calls a function in your library that you mark deprecated, they -will see the following written to STDERR (in the given colors, similar colors -and layout to the `debug` module): - -``` -bright cyan bright yellow -| | reset cyan -| | | | -▼ ▼ ▼ ▼ -my-cool-module deprecated oldfunction [eval]-wrapper:6:22 -▲ ▲ ▲ ▲ -| | | | -namespace | | location of mycoolmod.oldfunction() call - | deprecation message - the word "deprecated" -``` - -If the user redirects their STDERR to a file or somewhere that does not support -colors, they see (similar layout to the `debug` module): - -``` -Sun, 15 Jun 2014 05:21:37 GMT my-cool-module deprecated oldfunction at [eval]-wrapper:6:22 -▲ ▲ ▲ ▲ ▲ -| | | | | -timestamp of message namespace | | location of mycoolmod.oldfunction() call - | deprecation message - the word "deprecated" -``` - -## Examples - -### Deprecating all calls to a function - -This will display a deprecated message about "oldfunction" being deprecated -from "my-module" on STDERR. - -```js -var deprecate = require('depd')('my-cool-module') - -// message automatically derived from function name -// Object.oldfunction -exports.oldfunction = deprecate.function(function oldfunction() { - // all calls to function are deprecated -}) - -// specific message -exports.oldfunction = deprecate.function(function () { - // all calls to function are deprecated -}, 'oldfunction') -``` - -### Conditionally deprecating a function call - -This will display a deprecated message about "weirdfunction" being deprecated -from "my-module" on STDERR when called with less than 2 arguments. - -```js -var deprecate = require('depd')('my-cool-module') - -exports.weirdfunction = function () { - if (arguments.length < 2) { - // calls with 0 or 1 args are deprecated - deprecate('weirdfunction args < 2') - } -} -``` - -When calling `deprecate` as a function, the warning is counted per call site -within your own module, so you can display different deprecations depending -on different situations and the users will still get all the warnings: - -```js -var deprecate = require('depd')('my-cool-module') - -exports.weirdfunction = function () { - if (arguments.length < 2) { - // calls with 0 or 1 args are deprecated - deprecate('weirdfunction args < 2') - } else if (typeof arguments[0] !== 'string') { - // calls with non-string first argument are deprecated - deprecate('weirdfunction non-string first arg') - } -} -``` - -### Deprecating property access - -This will display a deprecated message about "oldprop" being deprecated -from "my-module" on STDERR when accessed. A deprecation will be displayed -when setting the value and when getting the value. - -```js -var deprecate = require('depd')('my-cool-module') - -exports.oldprop = 'something' - -// message automatically derives from property name -deprecate.property(exports, 'oldprop') - -// explicit message -deprecate.property(exports, 'oldprop', 'oldprop >= 0.10') -``` - -## License - -[MIT](LICENSE) - -[npm-version-image]: https://img.shields.io/npm/v/depd.svg?style=flat -[npm-downloads-image]: https://img.shields.io/npm/dm/depd.svg?style=flat -[npm-url]: https://npmjs.org/package/depd -[travis-image]: https://img.shields.io/travis/dougwilson/nodejs-depd.svg?style=flat -[travis-url]: https://travis-ci.org/dougwilson/nodejs-depd -[coveralls-image]: https://img.shields.io/coveralls/dougwilson/nodejs-depd.svg?style=flat -[coveralls-url]: https://coveralls.io/r/dougwilson/nodejs-depd?branch=master -[node-image]: https://img.shields.io/node/v/depd.svg?style=flat -[node-url]: http://nodejs.org/download/ -[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg?style=flat -[gratipay-url]: https://www.gratipay.com/dougwilson/ diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/index.js deleted file mode 100644 index 4fee4d9..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/index.js +++ /dev/null @@ -1,522 +0,0 @@ -/*! - * depd - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var callSiteToString = require('./lib/compat').callSiteToString -var EventEmitter = require('events').EventEmitter -var relative = require('path').relative - -/** - * Module exports. - */ - -module.exports = depd - -/** - * Get the path to base files on. - */ - -var basePath = process.cwd() - -/** - * Get listener count on event emitter. - */ - -/*istanbul ignore next*/ -var eventListenerCount = EventEmitter.listenerCount - || function (emitter, type) { return emitter.listeners(type).length } - -/** - * Determine if namespace is contained in the string. - */ - -function containsNamespace(str, namespace) { - var val = str.split(/[ ,]+/) - - namespace = String(namespace).toLowerCase() - - for (var i = 0 ; i < val.length; i++) { - if (!(str = val[i])) continue; - - // namespace contained - if (str === '*' || str.toLowerCase() === namespace) { - return true - } - } - - return false -} - -/** - * Convert a data descriptor to accessor descriptor. - */ - -function convertDataDescriptorToAccessor(obj, prop, message) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop) - var value = descriptor.value - - descriptor.get = function getter() { return value } - - if (descriptor.writable) { - descriptor.set = function setter(val) { return value = val } - } - - delete descriptor.value - delete descriptor.writable - - Object.defineProperty(obj, prop, descriptor) - - return descriptor -} - -/** - * Create arguments string to keep arity. - */ - -function createArgumentsString(arity) { - var str = '' - - for (var i = 0; i < arity; i++) { - str += ', arg' + i - } - - return str.substr(2) -} - -/** - * Create stack string from stack. - */ - -function createStackString(stack) { - var str = this.name + ': ' + this.namespace - - if (this.message) { - str += ' deprecated ' + this.message - } - - for (var i = 0; i < stack.length; i++) { - str += '\n at ' + callSiteToString(stack[i]) - } - - return str -} - -/** - * Create deprecate for namespace in caller. - */ - -function depd(namespace) { - if (!namespace) { - throw new TypeError('argument namespace is required') - } - - var stack = getStack() - var site = callSiteLocation(stack[1]) - var file = site[0] - - function deprecate(message) { - // call to self as log - log.call(deprecate, message) - } - - deprecate._file = file - deprecate._ignored = isignored(namespace) - deprecate._namespace = namespace - deprecate._traced = istraced(namespace) - deprecate._warned = Object.create(null) - - deprecate.function = wrapfunction - deprecate.property = wrapproperty - - return deprecate -} - -/** - * Determine if namespace is ignored. - */ - -function isignored(namespace) { - /* istanbul ignore next: tested in a child processs */ - if (process.noDeprecation) { - // --no-deprecation support - return true - } - - var str = process.env.NO_DEPRECATION || '' - - // namespace ignored - return containsNamespace(str, namespace) -} - -/** - * Determine if namespace is traced. - */ - -function istraced(namespace) { - /* istanbul ignore next: tested in a child processs */ - if (process.traceDeprecation) { - // --trace-deprecation support - return true - } - - var str = process.env.TRACE_DEPRECATION || '' - - // namespace traced - return containsNamespace(str, namespace) -} - -/** - * Display deprecation message. - */ - -function log(message, site) { - var haslisteners = eventListenerCount(process, 'deprecation') !== 0 - - // abort early if no destination - if (!haslisteners && this._ignored) { - return - } - - var caller - var callFile - var callSite - var i = 0 - var seen = false - var stack = getStack() - var file = this._file - - if (site) { - // provided site - callSite = callSiteLocation(stack[1]) - callSite.name = site.name - file = callSite[0] - } else { - // get call site - i = 2 - site = callSiteLocation(stack[i]) - callSite = site - } - - // get caller of deprecated thing in relation to file - for (; i < stack.length; i++) { - caller = callSiteLocation(stack[i]) - callFile = caller[0] - - if (callFile === file) { - seen = true - } else if (callFile === this._file) { - file = this._file - } else if (seen) { - break - } - } - - var key = caller - ? site.join(':') + '__' + caller.join(':') - : undefined - - if (key !== undefined && key in this._warned) { - // already warned - return - } - - this._warned[key] = true - - // generate automatic message from call site - if (!message) { - message = callSite === site || !callSite.name - ? defaultMessage(site) - : defaultMessage(callSite) - } - - // emit deprecation if listeners exist - if (haslisteners) { - var err = DeprecationError(this._namespace, message, stack.slice(i)) - process.emit('deprecation', err) - return - } - - // format and write message - var format = process.stderr.isTTY - ? formatColor - : formatPlain - var msg = format.call(this, message, caller, stack.slice(i)) - process.stderr.write(msg + '\n', 'utf8') - - return -} - -/** - * Get call site location as array. - */ - -function callSiteLocation(callSite) { - var file = callSite.getFileName() || '' - var line = callSite.getLineNumber() - var colm = callSite.getColumnNumber() - - if (callSite.isEval()) { - file = callSite.getEvalOrigin() + ', ' + file - } - - var site = [file, line, colm] - - site.callSite = callSite - site.name = callSite.getFunctionName() - - return site -} - -/** - * Generate a default message from the site. - */ - -function defaultMessage(site) { - var callSite = site.callSite - var funcName = site.name - var typeName = callSite.getTypeName() - - // make useful anonymous name - if (!funcName) { - funcName = '' - } - - // make useful type name - if (typeName === 'Function') { - typeName = callSite.getThis().name || typeName - } - - return callSite.getMethodName() - ? typeName + '.' + funcName - : funcName -} - -/** - * Format deprecation message without color. - */ - -function formatPlain(msg, caller, stack) { - var timestamp = new Date().toUTCString() - - var formatted = timestamp - + ' ' + this._namespace - + ' deprecated ' + msg - - // add stack trace - if (this._traced) { - for (var i = 0; i < stack.length; i++) { - formatted += '\n at ' + callSiteToString(stack[i]) - } - - return formatted - } - - if (caller) { - formatted += ' at ' + formatLocation(caller) - } - - return formatted -} - -/** - * Format deprecation message with color. - */ - -function formatColor(msg, caller, stack) { - var formatted = '\x1b[36;1m' + this._namespace + '\x1b[22;39m' // bold cyan - + ' \x1b[33;1mdeprecated\x1b[22;39m' // bold yellow - + ' \x1b[0m' + msg + '\x1b[39m' // reset - - // add stack trace - if (this._traced) { - for (var i = 0; i < stack.length; i++) { - formatted += '\n \x1b[36mat ' + callSiteToString(stack[i]) + '\x1b[39m' // cyan - } - - return formatted - } - - if (caller) { - formatted += ' \x1b[36m' + formatLocation(caller) + '\x1b[39m' // cyan - } - - return formatted -} - -/** - * Format call site location. - */ - -function formatLocation(callSite) { - return relative(basePath, callSite[0]) - + ':' + callSite[1] - + ':' + callSite[2] -} - -/** - * Get the stack as array of call sites. - */ - -function getStack() { - var limit = Error.stackTraceLimit - var obj = {} - var prep = Error.prepareStackTrace - - Error.prepareStackTrace = prepareObjectStackTrace - Error.stackTraceLimit = Math.max(10, limit) - - // capture the stack - Error.captureStackTrace(obj) - - // slice this function off the top - var stack = obj.stack.slice(1) - - Error.prepareStackTrace = prep - Error.stackTraceLimit = limit - - return stack -} - -/** - * Capture call site stack from v8. - */ - -function prepareObjectStackTrace(obj, stack) { - return stack -} - -/** - * Return a wrapped function in a deprecation message. - */ - -function wrapfunction(fn, message) { - if (typeof fn !== 'function') { - throw new TypeError('argument fn must be a function') - } - - var args = createArgumentsString(fn.length) - var deprecate = this - var stack = getStack() - var site = callSiteLocation(stack[1]) - - site.name = fn.name - - var deprecatedfn = eval('(function (' + args + ') {\n' - + '"use strict"\n' - + 'log.call(deprecate, message, site)\n' - + 'return fn.apply(this, arguments)\n' - + '})') - - return deprecatedfn -} - -/** - * Wrap property in a deprecation message. - */ - -function wrapproperty(obj, prop, message) { - if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { - throw new TypeError('argument obj must be object') - } - - var descriptor = Object.getOwnPropertyDescriptor(obj, prop) - - if (!descriptor) { - throw new TypeError('must call property on owner object') - } - - if (!descriptor.configurable) { - throw new TypeError('property must be configurable') - } - - var deprecate = this - var stack = getStack() - var site = callSiteLocation(stack[1]) - - // set site name - site.name = prop - - // convert data descriptor - if ('value' in descriptor) { - descriptor = convertDataDescriptorToAccessor(obj, prop, message) - } - - var get = descriptor.get - var set = descriptor.set - - // wrap getter - if (typeof get === 'function') { - descriptor.get = function getter() { - log.call(deprecate, message, site) - return get.apply(this, arguments) - } - } - - // wrap setter - if (typeof set === 'function') { - descriptor.set = function setter() { - log.call(deprecate, message, site) - return set.apply(this, arguments) - } - } - - Object.defineProperty(obj, prop, descriptor) -} - -/** - * Create DeprecationError for deprecation - */ - -function DeprecationError(namespace, message, stack) { - var error = new Error() - var stackString - - Object.defineProperty(error, 'constructor', { - value: DeprecationError - }) - - Object.defineProperty(error, 'message', { - configurable: true, - enumerable: false, - value: message, - writable: true - }) - - Object.defineProperty(error, 'name', { - enumerable: false, - configurable: true, - value: 'DeprecationError', - writable: true - }) - - Object.defineProperty(error, 'namespace', { - configurable: true, - enumerable: false, - value: namespace, - writable: true - }) - - Object.defineProperty(error, 'stack', { - configurable: true, - enumerable: false, - get: function () { - if (stackString !== undefined) { - return stackString - } - - // prepare stack trace - return stackString = createStackString.call(this, stack) - }, - set: function setter(val) { - stackString = val - } - }) - - return error -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/buffer-concat.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/buffer-concat.js deleted file mode 100644 index 09d9721..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/buffer-concat.js +++ /dev/null @@ -1,33 +0,0 @@ -/*! - * depd - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module exports. - */ - -module.exports = bufferConcat - -/** - * Concatenate an array of Buffers. - */ - -function bufferConcat(bufs) { - var length = 0 - - for (var i = 0, len = bufs.length; i < len; i++) { - length += bufs[i].length - } - - var buf = new Buffer(length) - var pos = 0 - - for (var i = 0, len = bufs.length; i < len; i++) { - bufs[i].copy(buf, pos) - pos += bufs[i].length - } - - return buf -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/callsite-tostring.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/callsite-tostring.js deleted file mode 100644 index 17cf7ed..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/callsite-tostring.js +++ /dev/null @@ -1,101 +0,0 @@ -/*! - * depd - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module exports. - */ - -module.exports = callSiteToString - -/** - * Format a CallSite file location to a string. - */ - -function callSiteFileLocation(callSite) { - var fileName - var fileLocation = '' - - if (callSite.isNative()) { - fileLocation = 'native' - } else if (callSite.isEval()) { - fileName = callSite.getScriptNameOrSourceURL() - if (!fileName) { - fileLocation = callSite.getEvalOrigin() - } - } else { - fileName = callSite.getFileName() - } - - if (fileName) { - fileLocation += fileName - - var lineNumber = callSite.getLineNumber() - if (lineNumber != null) { - fileLocation += ':' + lineNumber - - var columnNumber = callSite.getColumnNumber() - if (columnNumber) { - fileLocation += ':' + columnNumber - } - } - } - - return fileLocation || 'unknown source' -} - -/** - * Format a CallSite to a string. - */ - -function callSiteToString(callSite) { - var addSuffix = true - var fileLocation = callSiteFileLocation(callSite) - var functionName = callSite.getFunctionName() - var isConstructor = callSite.isConstructor() - var isMethodCall = !(callSite.isToplevel() || isConstructor) - var line = '' - - if (isMethodCall) { - var methodName = callSite.getMethodName() - var typeName = getConstructorName(callSite) - - if (functionName) { - if (typeName && functionName.indexOf(typeName) !== 0) { - line += typeName + '.' - } - - line += functionName - - if (methodName && functionName.lastIndexOf('.' + methodName) !== functionName.length - methodName.length - 1) { - line += ' [as ' + methodName + ']' - } - } else { - line += typeName + '.' + (methodName || '') - } - } else if (isConstructor) { - line += 'new ' + (functionName || '') - } else if (functionName) { - line += functionName - } else { - addSuffix = false - line += fileLocation - } - - if (addSuffix) { - line += ' (' + fileLocation + ')' - } - - return line -} - -/** - * Get constructor name of reviver. - */ - -function getConstructorName(obj) { - var receiver = obj.receiver - return (receiver.constructor && receiver.constructor.name) || null -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/index.js deleted file mode 100644 index 7fee026..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/lib/compat/index.js +++ /dev/null @@ -1,69 +0,0 @@ -/*! - * depd - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module exports. - */ - -lazyProperty(module.exports, 'bufferConcat', function bufferConcat() { - return Buffer.concat || require('./buffer-concat') -}) - -lazyProperty(module.exports, 'callSiteToString', function callSiteToString() { - var limit = Error.stackTraceLimit - var obj = {} - var prep = Error.prepareStackTrace - - function prepareObjectStackTrace(obj, stack) { - return stack - } - - Error.prepareStackTrace = prepareObjectStackTrace - Error.stackTraceLimit = 2 - - // capture the stack - Error.captureStackTrace(obj) - - // slice the stack - var stack = obj.stack.slice() - - Error.prepareStackTrace = prep - Error.stackTraceLimit = limit - - return stack[0].toString ? toString : require('./callsite-tostring') -}) - -/** - * Define a lazy property. - */ - -function lazyProperty(obj, prop, getter) { - function get() { - var val = getter() - - Object.defineProperty(obj, prop, { - configurable: true, - enumerable: true, - value: val - }) - - return val - } - - Object.defineProperty(obj, prop, { - configurable: true, - enumerable: true, - get: get - }) -} - -/** - * Call toString() on the obj - */ - -function toString(obj) { - return obj.toString() -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/package.json deleted file mode 100644 index b72bf60..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/depd/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "depd", - "description": "Deprecate all the things", - "version": "1.0.0", - "author": { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - "license": "MIT", - "keywords": [ - "deprecate", - "deprecated" - ], - "repository": { - "type": "git", - "url": "https://github.com/dougwilson/nodejs-depd" - }, - "devDependencies": { - "benchmark": "1.0.0", - "beautify-benchmark": "0.2.4", - "istanbul": "0.3.2", - "mocha": "~1.21.4", - "should": "~4.0.4" - }, - "files": [ - "lib/", - "History.md", - "LICENSE", - "index.js", - "Readme.md" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "bench": "node benchmark/index.js", - "test": "mocha --reporter spec --bail --require should test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --require should test/" - }, - "gitHead": "08b5a2182c8c1fdf7420e4ff8532bfd7e266a7b2", - "bugs": { - "url": "https://github.com/dougwilson/nodejs-depd/issues" - }, - "homepage": "https://github.com/dougwilson/nodejs-depd", - "_id": "depd@1.0.0", - "_shasum": "2fda0d00e98aae2845d4991ab1bf1f2a199073d5", - "_from": "depd@~1.0.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "dist": { - "shasum": "2fda0d00e98aae2845d4991ab1bf1f2a199073d5", - "tarball": "http://registry.npmjs.org/depd/-/depd-1.0.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/depd/-/depd-1.0.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/README.md deleted file mode 100644 index 665acb7..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Destroy - -[![NPM version][npm-image]][npm-url] -[![Build status][travis-image]][travis-url] -[![Test coverage][coveralls-image]][coveralls-url] -[![Dependency Status][david-image]][david-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] -[![Gittip][gittip-image]][gittip-url] - -Destroy a stream. - -## API - -```js -var destroy = require('destroy') - -var fs = require('fs') -var stream = fs.createReadStream('package.json') -destroy(stream) -``` - -[npm-image]: https://img.shields.io/npm/v/destroy.svg?style=flat-square -[npm-url]: https://npmjs.org/package/destroy -[github-tag]: http://img.shields.io/github/tag/stream-utils/destroy.svg?style=flat-square -[github-url]: https://github.com/stream-utils/destroy/tags -[travis-image]: https://img.shields.io/travis/stream-utils/destroy.svg?style=flat-square -[travis-url]: https://travis-ci.org/stream-utils/destroy -[coveralls-image]: https://img.shields.io/coveralls/stream-utils/destroy.svg?style=flat-square -[coveralls-url]: https://coveralls.io/r/stream-utils/destroy?branch=master -[david-image]: http://img.shields.io/david/stream-utils/destroy.svg?style=flat-square -[david-url]: https://david-dm.org/stream-utils/destroy -[license-image]: http://img.shields.io/npm/l/destroy.svg?style=flat-square -[license-url]: LICENSE.md -[downloads-image]: http://img.shields.io/npm/dm/destroy.svg?style=flat-square -[downloads-url]: https://npmjs.org/package/destroy -[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square -[gittip-url]: https://www.gittip.com/jonathanong/ diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/index.js deleted file mode 100644 index b455217..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/index.js +++ /dev/null @@ -1,36 +0,0 @@ -var ReadStream = require('fs').ReadStream -var Stream = require('stream') - -module.exports = function destroy(stream) { - if (stream instanceof ReadStream) { - return destroyReadStream(stream) - } - - if (!(stream instanceof Stream)) { - return stream - } - - if (typeof stream.destroy === 'function') { - stream.destroy() - } - - return stream -} - -function destroyReadStream(stream) { - stream.destroy() - - if (typeof stream.close === 'function') { - // node.js core bug work-around - stream.on('open', onopenClose) - } - - return stream -} - -function onopenClose() { - if (typeof this.fd === 'number') { - // actually close down the fd - this.close() - } -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/package.json deleted file mode 100644 index c88380a..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/destroy/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "destroy", - "description": "destroy a stream if possible", - "version": "1.0.3", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/stream-utils/destroy" - }, - "devDependencies": { - "istanbul": "0", - "mocha": "1" - }, - "scripts": { - "test": "mocha --reporter spec", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" - }, - "files": [ - "index.js" - ], - "keywords": [ - "stream", - "streams", - "destroy", - "cleanup", - "leak", - "fd" - ], - "gitHead": "50af95ece4a70202f9301bc3edc8f9fdbbad0f26", - "bugs": { - "url": "https://github.com/stream-utils/destroy/issues" - }, - "homepage": "https://github.com/stream-utils/destroy", - "_id": "destroy@1.0.3", - "_shasum": "b433b4724e71fd8551d9885174851c5fc377e2c9", - "_from": "destroy@1.0.3", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - "maintainers": [ - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - } - ], - "dist": { - "shasum": "b433b4724e71fd8551d9885174851c5fc377e2c9", - "tarball": "http://registry.npmjs.org/destroy/-/destroy-1.0.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.3.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/HISTORY.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/HISTORY.md deleted file mode 100644 index 10cf504..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/HISTORY.md +++ /dev/null @@ -1,55 +0,0 @@ -1.5.1 / 2014-11-19 -================== - - * deps: crc@3.2.1 - - Minor fixes - -1.5.0 / 2014-10-14 -================== - - * Improve string performance - * Slightly improve speed for weak ETags over 1KB - -1.4.0 / 2014-09-21 -================== - - * Support "fake" stats objects - * Support Node.js 0.6 - -1.3.1 / 2014-09-14 -================== - - * Use the (new and improved) `crc` for crc32 - -1.3.0 / 2014-08-29 -================== - - * Default strings to strong ETags - * Improve speed for weak ETags over 1KB - -1.2.1 / 2014-08-29 -================== - - * Use the (much faster) `buffer-crc32` for crc32 - -1.2.0 / 2014-08-24 -================== - - * Add support for file stat objects - -1.1.0 / 2014-08-24 -================== - - * Add fast-path for empty entity - * Add weak ETag generation - * Shrink size of generated ETags - -1.0.1 / 2014-08-24 -================== - - * Fix behavior of string containing Unicode - -1.0.0 / 2014-05-18 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/LICENSE deleted file mode 100644 index b7dce6c..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/README.md deleted file mode 100644 index 68c16d5..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/README.md +++ /dev/null @@ -1,141 +0,0 @@ -# etag - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Create simple ETags - -## Installation - -```sh -$ npm install etag -``` - -## API - -```js -var etag = require('etag') -``` - -### etag(entity, [options]) - -Generate a strong ETag for the given entity. This should be the complete -body of the entity. Strings, `Buffer`s, and `fs.Stats` are accepted. By -default, a strong ETag is generated except for `fs.Stats`, which will -generate a weak ETag (this can be overwritten by `options.weak`). - -```js -res.setHeader('ETag', etag(body)) -``` - -#### Options - -`etag` accepts these properties in the options object. - -##### weak - -Specifies if a "strong" or a "weak" ETag will be generated. The ETag can only -really be a strong as the given input. - -## Testing - -```sh -$ npm test -``` - -## Benchmark - -```bash -$ npm run-script bench - -> etag@1.5.1 bench nodejs-etag -> node benchmark/index.js - -> node benchmark/body0-100b.js - - 100B body - - 1 test completed. - 2 tests completed. - 3 tests completed. - 4 tests completed. - - buffer - strong x 425,007 ops/sec ±1.47% (184 runs sampled) -* buffer - weak x 1,009,859 ops/sec ±0.18% (197 runs sampled) - string - strong x 442,096 ops/sec ±1.20% (181 runs sampled) - string - weak x 325,063 ops/sec ±0.31% (192 runs sampled) - -> node benchmark/body1-1kb.js - - 1KB body - - 1 test completed. - 2 tests completed. - 3 tests completed. - 4 tests completed. - - buffer - strong x 263,069 ops/sec ±1.60% (190 runs sampled) -* buffer - weak x 295,732 ops/sec ±0.43% (199 runs sampled) - string - strong x 274,822 ops/sec ±1.15% (191 runs sampled) - string - weak x 169,473 ops/sec ±1.59% (194 runs sampled) - -> node benchmark/body2-5kb.js - - 5KB body - - 1 test completed. - 2 tests completed. - 3 tests completed. - 4 tests completed. - - buffer - strong x 104,299 ops/sec ±0.60% (193 runs sampled) -* buffer - weak x 108,126 ops/sec ±0.65% (196 runs sampled) - string - strong x 101,736 ops/sec ±0.78% (194 runs sampled) - string - weak x 101,266 ops/sec ±0.85% (192 runs sampled) - -> node benchmark/body3-10kb.js - - 10KB body - - 1 test completed. - 2 tests completed. - 3 tests completed. - 4 tests completed. - - buffer - strong x 59,007 ops/sec ±0.29% (198 runs sampled) -* buffer - weak x 60,968 ops/sec ±0.48% (197 runs sampled) - string - strong x 51,873 ops/sec ±1.78% (178 runs sampled) - string - weak x 52,307 ops/sec ±2.63% (193 runs sampled) - -> node benchmark/body4-100kb.js - - 100KB body - - 1 test completed. - 2 tests completed. - 3 tests completed. - 4 tests completed. - - buffer - strong x 6,712 ops/sec ±0.11% (198 runs sampled) -* buffer - weak x 6,716 ops/sec ±0.50% (196 runs sampled) - string - strong x 6,397 ops/sec ±0.36% (196 runs sampled) - string - weak x 6,635 ops/sec ±0.15% (198 runs sampled) -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/etag.svg?style=flat -[npm-url]: https://npmjs.org/package/etag -[node-version-image]: https://img.shields.io/node/v/etag.svg?style=flat -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/etag.svg?style=flat -[travis-url]: https://travis-ci.org/jshttp/etag -[coveralls-image]: https://img.shields.io/coveralls/jshttp/etag.svg?style=flat -[coveralls-url]: https://coveralls.io/r/jshttp/etag?branch=master -[downloads-image]: https://img.shields.io/npm/dm/etag.svg?style=flat -[downloads-url]: https://npmjs.org/package/etag diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/index.js deleted file mode 100644 index bb05eb7..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/index.js +++ /dev/null @@ -1,171 +0,0 @@ -/*! - * etag - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module exports. - */ - -module.exports = etag - -/** - * Module dependencies. - */ - -var crc = require('crc').crc32 -var crypto = require('crypto') -var Stats = require('fs').Stats - -/** - * Module variables. - */ - -var crc32threshold = 1000 // 1KB -var NULL = new Buffer([0]) -var toString = Object.prototype.toString - -/** - * Create a simple ETag. - * - * @param {string|Buffer|Stats} entity - * @param {object} [options] - * @param {boolean} [options.weak] - * @return {String} - * @api public - */ - -function etag(entity, options) { - if (entity == null) { - throw new TypeError('argument entity is required') - } - - var isStats = isstats(entity) - var weak = options && typeof options.weak === 'boolean' - ? options.weak - : isStats - - // support fs.Stats object - if (isStats) { - return stattag(entity, weak) - } - - if (typeof entity !== 'string' && !Buffer.isBuffer(entity)) { - throw new TypeError('argument entity must be string, Buffer, or fs.Stats') - } - - var hash = weak - ? weakhash(entity) - : stronghash(entity) - - return weak - ? 'W/"' + hash + '"' - : '"' + hash + '"' -} - -/** - * Determine if object is a Stats object. - * - * @param {object} obj - * @return {boolean} - * @api private - */ - -function isstats(obj) { - // not even an object - if (obj === null || typeof obj !== 'object') { - return false - } - - // genuine fs.Stats - if (obj instanceof Stats) { - return true - } - - // quack quack - return 'atime' in obj && toString.call(obj.atime) === '[object Date]' - && 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' - && 'mtime' in obj && toString.call(obj.mtime) === '[object Date]' - && 'ino' in obj && typeof obj.ino === 'number' - && 'size' in obj && typeof obj.size === 'number' -} - -/** - * Generate a tag for a stat. - * - * @param {Buffer} entity - * @return {String} - * @api private - */ - -function stattag(stat, weak) { - var mtime = stat.mtime.toISOString() - var size = stat.size.toString(16) - - if (weak) { - return 'W/"' + size + '-' + crc(mtime) + '"' - } - - var hash = crypto - .createHash('md5') - .update('file', 'utf8') - .update(NULL) - .update(size, 'utf8') - .update(NULL) - .update(mtime, 'utf8') - .digest('base64') - - return '"' + hash + '"' -} - -/** - * Generate a strong hash. - * - * @param {Buffer} entity - * @return {String} - * @api private - */ - -function stronghash(entity) { - if (entity.length === 0) { - // fast-path empty - return '1B2M2Y8AsgTpgAmY7PhCfg==' - } - - return crypto - .createHash('md5') - .update(entity, 'utf8') - .digest('base64') -} - -/** - * Generate a weak hash. - * - * @param {Buffer} entity - * @return {String} - * @api private - */ - -function weakhash(entity) { - if (entity.length === 0) { - // fast-path empty - return '0-0' - } - - var len = typeof entity === 'string' - ? Buffer.byteLength(entity, 'utf8') - : entity.length - - if (len <= crc32threshold) { - // crc32 plus length when it's fast - // crc(str) only accepts utf-8 encoding - return len.toString(16) + '-' + crc(entity).toString(16) - } - - // use md4 for long strings - return crypto - .createHash('md4') - .update(entity, 'utf8') - .digest('base64') -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/.npmignore b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/.npmignore deleted file mode 100644 index 57d4cb8..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -benchmark -src -test -.travis.yml -bitcoin.png diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/LICENSE deleted file mode 100644 index c49097c..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright 2014 Alex Gorbatchev - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/README.md deleted file mode 100644 index 6473cbd..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/README.md +++ /dev/null @@ -1,98 +0,0 @@ -# crc - -[![GitTip](http://img.shields.io/gittip/alexgorbatchev.svg?style=flat)](https://www.gittip.com/alexgorbatchev/) -[![Dependency status](http://img.shields.io/david/alexgorbatchev/node-crc.svg?style=flat)](https://david-dm.org/alexgorbatchev/node-crc) -[![devDependency Status](http://img.shields.io/david/dev/alexgorbatchev/node-crc.svg?style=flat)](https://david-dm.org/alexgorbatchev/node-crc#info=devDependencies) -[![Build Status](http://img.shields.io/travis/alexgorbatchev/node-crc.svg?style=flat&branch=master)](https://travis-ci.org/alexgorbatchev/node-crc) - -[![NPM](https://nodei.co/npm/crc.svg?style=flat)](https://npmjs.org/package/node-crc) - -Module for calculating Cyclic Redundancy Check (CRC). - -## Features - -* Full test suite comparing values against reference `pycrc` implementation. -* Version 3.x is 3x to 4x faster than version 2.x. -* Pure JavaScript implementation, no dependencies. -* Provides CRC Tables for optimized calculations. -* Provides support for the following CRC algorithms: - * CRC1 `crc.crc1(…)` - * CRC8 `crc.crc8(…)` - * CRC8 1-Wire `crc.crc81wire(…)` - * CRC16 `crc.crc16(…)` - * CRC16 CCITT `crc.crc16ccitt(…)` - * CRC16 Modbus `crc.crc16modbus(…)` - * CRC24 `crc.crc24(…)` - * CRC32 `crc.crc32(…)` - -## IMPORTANT - -If you've used `crc` module prior to version 2.x, you might have some inconsistentcies with the current implementation because it relied on very old code and wasn't checked against reference implementation. If you upgrading from 1.x, please take special care. - -## Support - - Please support me on [GitTip](https://www.gittip.com/alexgorbatchev/). I've spend days developing and grooming this module and hope to spend more time. If you have bitcoin, please use the QR code or this wallet address [`1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ`](https://blockchain.info/address/1CZyBREeHTmy8C5zVGHZHPwqBuWFmEuUCQ): - -## Installation - - npm install crc - -## Running tests - - $ npm install - $ npm test - -## Usage Example - -Calculate a CRC32: - - var crc = require('crc'); - - crc.crc32('hello').toString(16); - # => "3610a686" - -Calculate a CRC32 of a file: - - crc.crc32(fs.readFileSync('README.md', 'utf8')).toString(16); - # => "127ad531" - -Or using a `Buffer`: - - crc.crc32(fs.readFileSync('README.md')).toString(16); - # => "127ad531" - -Incrementally calculate a CRC32: - - value = crc32('one'); - value = crc32('two', value); - value = crc32('three', value); - value.toString(16); - # => "09e1c092" - -## Thanks! - -[pycrc](http://www.tty1.net/pycrc/) library is which the source of all of the CRC tables. - -# License - -The MIT License (MIT) - -Copyright (c) 2014 Alex Gorbatchev - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc.js deleted file mode 100644 index 1c342b7..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc.js +++ /dev/null @@ -1,71 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var CRC, hex; - -hex = require('./hex'); - -module.exports = CRC = (function() { - CRC.prototype.INIT_CRC = 0x00; - - CRC.prototype.XOR_MASK = 0x00; - - CRC.prototype.WIDTH = 0; - - CRC.prototype.pack = function(crc) { - return ''; - }; - - CRC.prototype.each_byte = function(buf, cb) { - var i, _i, _ref, _results; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - _results = []; - for (i = _i = 0, _ref = buf.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) { - _results.push(cb(buf[i])); - } - return _results; - }; - - function CRC() { - this.crc = this.INIT_CRC; - } - - CRC.prototype.digest_length = function() { - return Math.ceil(this.WIDTH / 8.0); - }; - - CRC.prototype.update = function(data) {}; - - CRC.prototype.reset = function() { - return this.crc = this.INIT_CRC; - }; - - CRC.prototype.checksum = function(signed) { - var sum; - if (signed == null) { - signed = true; - } - sum = this.crc ^ this.XOR_MASK; - if (signed) { - sum = sum >>> 0; - } - return sum; - }; - - CRC.prototype.finish = function() { - return this.pack(this.checksum()); - }; - - CRC.prototype.hexdigest = function(value) { - var result; - if (value != null) { - this.update(value); - } - result = this.finish(); - this.reset(); - return result; - }; - - return CRC; - -})(); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc1.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc1.js deleted file mode 100644 index f094567..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc1.js +++ /dev/null @@ -1,21 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -module.exports = create('crc1', function(buf, previous) { - var accum, byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = ~~previous; - accum = 0; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - accum += byte; - } - crc += accum % 256; - return crc % 256; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16.js deleted file mode 100644 index a09cd1e..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, TABLE, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040]; - -if (typeof Int32Array !== 'undefined') { - TABLE = new Int32Array(TABLE); -} - -module.exports = create('crc-16', function(buf, previous) { - var byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = ~~previous; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - crc = (TABLE[(crc ^ byte) & 0xff] ^ (crc >> 8)) & 0xffff; - } - return crc; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16_ccitt.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16_ccitt.js deleted file mode 100644 index 0bdb0bf..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16_ccitt.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, TABLE, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -TABLE = [0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0]; - -if (typeof Int32Array !== 'undefined') { - TABLE = new Int32Array(TABLE); -} - -module.exports = create('ccitt', function(buf, previous) { - var byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = previous != null ? ~~previous : 0xffff; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - crc = (TABLE[((crc >> 8) ^ byte) & 0xff] ^ (crc << 8)) & 0xffff; - } - return crc; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16_modbus.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16_modbus.js deleted file mode 100644 index 52a536a..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc16_modbus.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, TABLE, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -TABLE = [0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040]; - -if (typeof Int32Array !== 'undefined') { - TABLE = new Int32Array(TABLE); -} - -module.exports = create('crc-16-modbus', function(buf, previous) { - var byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = previous != null ? ~~previous : 0xffff; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - crc = (TABLE[(crc ^ byte) & 0xff] ^ (crc >> 8)) & 0xffff; - } - return crc; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc24.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc24.js deleted file mode 100644 index ff67bc1..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc24.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, TABLE, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -TABLE = [0x000000, 0x864cfb, 0x8ad50d, 0x0c99f6, 0x93e6e1, 0x15aa1a, 0x1933ec, 0x9f7f17, 0xa18139, 0x27cdc2, 0x2b5434, 0xad18cf, 0x3267d8, 0xb42b23, 0xb8b2d5, 0x3efe2e, 0xc54e89, 0x430272, 0x4f9b84, 0xc9d77f, 0x56a868, 0xd0e493, 0xdc7d65, 0x5a319e, 0x64cfb0, 0xe2834b, 0xee1abd, 0x685646, 0xf72951, 0x7165aa, 0x7dfc5c, 0xfbb0a7, 0x0cd1e9, 0x8a9d12, 0x8604e4, 0x00481f, 0x9f3708, 0x197bf3, 0x15e205, 0x93aefe, 0xad50d0, 0x2b1c2b, 0x2785dd, 0xa1c926, 0x3eb631, 0xb8faca, 0xb4633c, 0x322fc7, 0xc99f60, 0x4fd39b, 0x434a6d, 0xc50696, 0x5a7981, 0xdc357a, 0xd0ac8c, 0x56e077, 0x681e59, 0xee52a2, 0xe2cb54, 0x6487af, 0xfbf8b8, 0x7db443, 0x712db5, 0xf7614e, 0x19a3d2, 0x9fef29, 0x9376df, 0x153a24, 0x8a4533, 0x0c09c8, 0x00903e, 0x86dcc5, 0xb822eb, 0x3e6e10, 0x32f7e6, 0xb4bb1d, 0x2bc40a, 0xad88f1, 0xa11107, 0x275dfc, 0xdced5b, 0x5aa1a0, 0x563856, 0xd074ad, 0x4f0bba, 0xc94741, 0xc5deb7, 0x43924c, 0x7d6c62, 0xfb2099, 0xf7b96f, 0x71f594, 0xee8a83, 0x68c678, 0x645f8e, 0xe21375, 0x15723b, 0x933ec0, 0x9fa736, 0x19ebcd, 0x8694da, 0x00d821, 0x0c41d7, 0x8a0d2c, 0xb4f302, 0x32bff9, 0x3e260f, 0xb86af4, 0x2715e3, 0xa15918, 0xadc0ee, 0x2b8c15, 0xd03cb2, 0x567049, 0x5ae9bf, 0xdca544, 0x43da53, 0xc596a8, 0xc90f5e, 0x4f43a5, 0x71bd8b, 0xf7f170, 0xfb6886, 0x7d247d, 0xe25b6a, 0x641791, 0x688e67, 0xeec29c, 0x3347a4, 0xb50b5f, 0xb992a9, 0x3fde52, 0xa0a145, 0x26edbe, 0x2a7448, 0xac38b3, 0x92c69d, 0x148a66, 0x181390, 0x9e5f6b, 0x01207c, 0x876c87, 0x8bf571, 0x0db98a, 0xf6092d, 0x7045d6, 0x7cdc20, 0xfa90db, 0x65efcc, 0xe3a337, 0xef3ac1, 0x69763a, 0x578814, 0xd1c4ef, 0xdd5d19, 0x5b11e2, 0xc46ef5, 0x42220e, 0x4ebbf8, 0xc8f703, 0x3f964d, 0xb9dab6, 0xb54340, 0x330fbb, 0xac70ac, 0x2a3c57, 0x26a5a1, 0xa0e95a, 0x9e1774, 0x185b8f, 0x14c279, 0x928e82, 0x0df195, 0x8bbd6e, 0x872498, 0x016863, 0xfad8c4, 0x7c943f, 0x700dc9, 0xf64132, 0x693e25, 0xef72de, 0xe3eb28, 0x65a7d3, 0x5b59fd, 0xdd1506, 0xd18cf0, 0x57c00b, 0xc8bf1c, 0x4ef3e7, 0x426a11, 0xc426ea, 0x2ae476, 0xaca88d, 0xa0317b, 0x267d80, 0xb90297, 0x3f4e6c, 0x33d79a, 0xb59b61, 0x8b654f, 0x0d29b4, 0x01b042, 0x87fcb9, 0x1883ae, 0x9ecf55, 0x9256a3, 0x141a58, 0xefaaff, 0x69e604, 0x657ff2, 0xe33309, 0x7c4c1e, 0xfa00e5, 0xf69913, 0x70d5e8, 0x4e2bc6, 0xc8673d, 0xc4fecb, 0x42b230, 0xddcd27, 0x5b81dc, 0x57182a, 0xd154d1, 0x26359f, 0xa07964, 0xace092, 0x2aac69, 0xb5d37e, 0x339f85, 0x3f0673, 0xb94a88, 0x87b4a6, 0x01f85d, 0x0d61ab, 0x8b2d50, 0x145247, 0x921ebc, 0x9e874a, 0x18cbb1, 0xe37b16, 0x6537ed, 0x69ae1b, 0xefe2e0, 0x709df7, 0xf6d10c, 0xfa48fa, 0x7c0401, 0x42fa2f, 0xc4b6d4, 0xc82f22, 0x4e63d9, 0xd11cce, 0x575035, 0x5bc9c3, 0xdd8538]; - -if (typeof Int32Array !== 'undefined') { - TABLE = new Int32Array(TABLE); -} - -module.exports = create('crc-24', function(buf, previous) { - var byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = previous != null ? ~~previous : 0xb704ce; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - crc = (TABLE[((crc >> 16) ^ byte) & 0xff] ^ (crc << 8)) & 0xffffff; - } - return crc; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc32.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc32.js deleted file mode 100644 index 20bc024..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc32.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, TABLE, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -TABLE = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d]; - -if (typeof Int32Array !== 'undefined') { - TABLE = new Int32Array(TABLE); -} - -module.exports = create('crc-32', function(buf, previous) { - var byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = previous === 0 ? 0 : ~~previous ^ -1; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - crc = TABLE[(crc ^ byte) & 0xff] ^ (crc >>> 8); - } - return crc ^ -1; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc8.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc8.js deleted file mode 100644 index 6ebe77c..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc8.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, TABLE, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -TABLE = [0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3]; - -if (typeof Int32Array !== 'undefined') { - TABLE = new Int32Array(TABLE); -} - -module.exports = create('crc-8', function(buf, previous) { - var byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = ~~previous; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - crc = TABLE[(crc ^ byte) & 0xff] & 0xff; - } - return crc; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc8_1wire.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc8_1wire.js deleted file mode 100644 index b561246..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/crc8_1wire.js +++ /dev/null @@ -1,25 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -var Buffer, TABLE, create; - -Buffer = require('buffer').Buffer; - -create = require('./create'); - -TABLE = [0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc, 0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62, 0xbe, 0xe0, 0x02, 0x5c, 0xdf, 0x81, 0x63, 0x3d, 0x7c, 0x22, 0xc0, 0x9e, 0x1d, 0x43, 0xa1, 0xff, 0x46, 0x18, 0xfa, 0xa4, 0x27, 0x79, 0x9b, 0xc5, 0x84, 0xda, 0x38, 0x66, 0xe5, 0xbb, 0x59, 0x07, 0xdb, 0x85, 0x67, 0x39, 0xba, 0xe4, 0x06, 0x58, 0x19, 0x47, 0xa5, 0xfb, 0x78, 0x26, 0xc4, 0x9a, 0x65, 0x3b, 0xd9, 0x87, 0x04, 0x5a, 0xb8, 0xe6, 0xa7, 0xf9, 0x1b, 0x45, 0xc6, 0x98, 0x7a, 0x24, 0xf8, 0xa6, 0x44, 0x1a, 0x99, 0xc7, 0x25, 0x7b, 0x3a, 0x64, 0x86, 0xd8, 0x5b, 0x05, 0xe7, 0xb9, 0x8c, 0xd2, 0x30, 0x6e, 0xed, 0xb3, 0x51, 0x0f, 0x4e, 0x10, 0xf2, 0xac, 0x2f, 0x71, 0x93, 0xcd, 0x11, 0x4f, 0xad, 0xf3, 0x70, 0x2e, 0xcc, 0x92, 0xd3, 0x8d, 0x6f, 0x31, 0xb2, 0xec, 0x0e, 0x50, 0xaf, 0xf1, 0x13, 0x4d, 0xce, 0x90, 0x72, 0x2c, 0x6d, 0x33, 0xd1, 0x8f, 0x0c, 0x52, 0xb0, 0xee, 0x32, 0x6c, 0x8e, 0xd0, 0x53, 0x0d, 0xef, 0xb1, 0xf0, 0xae, 0x4c, 0x12, 0x91, 0xcf, 0x2d, 0x73, 0xca, 0x94, 0x76, 0x28, 0xab, 0xf5, 0x17, 0x49, 0x08, 0x56, 0xb4, 0xea, 0x69, 0x37, 0xd5, 0x8b, 0x57, 0x09, 0xeb, 0xb5, 0x36, 0x68, 0x8a, 0xd4, 0x95, 0xcb, 0x29, 0x77, 0xf4, 0xaa, 0x48, 0x16, 0xe9, 0xb7, 0x55, 0x0b, 0x88, 0xd6, 0x34, 0x6a, 0x2b, 0x75, 0x97, 0xc9, 0x4a, 0x14, 0xf6, 0xa8, 0x74, 0x2a, 0xc8, 0x96, 0x15, 0x4b, 0xa9, 0xf7, 0xb6, 0xe8, 0x0a, 0x54, 0xd7, 0x89, 0x6b, 0x35]; - -if (typeof Int32Array !== 'undefined') { - TABLE = new Int32Array(TABLE); -} - -module.exports = create('dallas-1-wire', function(buf, previous) { - var byte, crc, _i, _len; - if (!Buffer.isBuffer(buf)) { - buf = Buffer(buf); - } - crc = ~~previous; - for (_i = 0, _len = buf.length; _i < _len; _i++) { - byte = buf[_i]; - crc = TABLE[(crc ^ byte) & 0xff] & 0xff; - } - return crc; -}); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/create.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/create.js deleted file mode 100644 index 2d856bd..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/create.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -module.exports = function(model, calc) { - var fn; - fn = function(buf, previous) { - return calc(buf, previous) >>> 0; - }; - fn.signed = calc; - fn.unsigned = fn; - fn.model = model; - return fn; -}; diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/hex.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/hex.js deleted file mode 100644 index 0a6aa4c..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/hex.js +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -module.exports = function(number) { - var result; - result = number.toString(16); - while (result.length % 2) { - result = "0" + result; - } - return result; -}; diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/index.js deleted file mode 100644 index 15ac34c..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/lib/index.js +++ /dev/null @@ -1,11 +0,0 @@ -// Generated by CoffeeScript 1.7.1 -module.exports = { - crc1: require('./crc1'), - crc8: require('./crc8'), - crc81wire: require('./crc8_1wire'), - crc16: require('./crc16'), - crc16ccitt: require('./crc16_ccitt'), - crc16modbus: require('./crc16_modbus'), - crc24: require('./crc24'), - crc32: require('./crc32') -}; diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/package.json deleted file mode 100644 index b0ceb1e..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/node_modules/crc/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "crc", - "version": "3.2.1", - "description": "Various CRC JavaScript implementations", - "keywords": [ - "crc" - ], - "main": "./lib/index.js", - "scripts": { - "test": "mocha test/*.spec.coffee", - "pretest": "coffee --bare --output ./lib --compile ./src/*.coffee" - }, - "author": { - "name": "Alex Gorbatchev", - "url": "https://github.com/alexgorbatchev" - }, - "devDependencies": { - "beautify-benchmark": "^0.2.4", - "benchmark": "^1.0.0", - "buffer-crc32": "^0.2.3", - "chai": "~1.9.1", - "coffee-errors": "~0.8.6", - "coffee-script": "~1.7.1", - "mocha": "*", - "seedrandom": "^2.3.6" - }, - "homepage": "https://github.com/alexgorbatchev/node-crc", - "bugs": { - "url": "https://github.com/alexgorbatchev/node-crc/issues" - }, - "repository": { - "type": "git", - "url": "git://github.com/alexgorbatchev/node-crc.git" - }, - "license": "MIT", - "gitHead": "71caf362b061992bfe4ca8706ee264e764d2e88e", - "_id": "crc@3.2.1", - "_shasum": "5d9c8fb77a245cd5eca291e5d2d005334bab0082", - "_from": "crc@3.2.1", - "_npmVersion": "1.4.13", - "_npmUser": { - "name": "alexgorbatchev", - "email": "alex.gorbatchev@gmail.com" - }, - "maintainers": [ - { - "name": "alexgorbatchev", - "email": "alex.gorbatchev@gmail.com" - } - ], - "dist": { - "shasum": "5d9c8fb77a245cd5eca291e5d2d005334bab0082", - "tarball": "http://registry.npmjs.org/crc/-/crc-3.2.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/crc/-/crc-3.2.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/package.json deleted file mode 100644 index 4b9e201..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/etag/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "etag", - "description": "Create simple ETags", - "version": "1.5.1", - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "David Björklund", - "email": "david.bjorklund@gmail.com" - } - ], - "license": "MIT", - "keywords": [ - "etag", - "http", - "res" - ], - "repository": { - "type": "git", - "url": "https://github.com/jshttp/etag" - }, - "dependencies": { - "crc": "3.2.1" - }, - "devDependencies": { - "benchmark": "1.0.0", - "beautify-benchmark": "0.2.4", - "istanbul": "0.3.2", - "mocha": "~1.21.4", - "seedrandom": "~2.3.6" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "bench": "node benchmark/index.js", - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "gitHead": "27335e2265388109e50a9f037452081dc8a8260f", - "bugs": { - "url": "https://github.com/jshttp/etag/issues" - }, - "homepage": "https://github.com/jshttp/etag", - "_id": "etag@1.5.1", - "_shasum": "54c50de04ee42695562925ac566588291be7e9ea", - "_from": "etag@~1.5.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "dist": { - "shasum": "54c50de04ee42695562925ac566588291be7e9ea", - "tarball": "http://registry.npmjs.org/etag/-/etag-1.5.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/etag/-/etag-1.5.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/HISTORY.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/HISTORY.md deleted file mode 100644 index 56361df..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/HISTORY.md +++ /dev/null @@ -1,24 +0,0 @@ -0.2.4 / 2014-09-07 -================== - - * Support Node.js 0.6 - -0.2.3 / 2014-09-07 -================== - - * Move repository to jshttp - -0.2.2 / 2014-02-19 -================== - - * Revert "Fix for blank page on Safari reload" - -0.2.1 / 2014-01-29 -================== - - * fix: support max-age=0 for end-to-end revalidation - -0.2.0 / 2013-08-11 -================== - - * fix: return false for no-cache diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/LICENSE deleted file mode 100644 index f527394..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 TJ Holowaychuk - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/README.md deleted file mode 100644 index 54a885f..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# fresh - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -HTTP response freshness testing - -## Installation - -``` -$ npm install fresh -``` - -## API - -```js -var fresh = require('fresh') -``` - -### fresh(req, res) - - Check freshness of `req` and `res` headers. - - When the cache is "fresh" __true__ is returned, - otherwise __false__ is returned to indicate that - the cache is now stale. - -## Example - -```js -var req = { 'if-none-match': 'tobi' }; -var res = { 'etag': 'luna' }; -fresh(req, res); -// => false - -var req = { 'if-none-match': 'tobi' }; -var res = { 'etag': 'tobi' }; -fresh(req, res); -// => true -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/fresh.svg?style=flat -[npm-url]: https://npmjs.org/package/fresh -[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/fresh.svg?style=flat -[travis-url]: https://travis-ci.org/jshttp/fresh -[coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh.svg?style=flat -[coveralls-url]: https://coveralls.io/r/jshttp/fresh?branch=master -[downloads-image]: https://img.shields.io/npm/dm/fresh.svg?style=flat -[downloads-url]: https://npmjs.org/package/fresh diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/index.js deleted file mode 100644 index 9c3f47d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/index.js +++ /dev/null @@ -1,53 +0,0 @@ - -/** - * Expose `fresh()`. - */ - -module.exports = fresh; - -/** - * Check freshness of `req` and `res` headers. - * - * When the cache is "fresh" __true__ is returned, - * otherwise __false__ is returned to indicate that - * the cache is now stale. - * - * @param {Object} req - * @param {Object} res - * @return {Boolean} - * @api public - */ - -function fresh(req, res) { - // defaults - var etagMatches = true; - var notModified = true; - - // fields - var modifiedSince = req['if-modified-since']; - var noneMatch = req['if-none-match']; - var lastModified = res['last-modified']; - var etag = res['etag']; - var cc = req['cache-control']; - - // unconditional request - if (!modifiedSince && !noneMatch) return false; - - // check for no-cache cache request directive - if (cc && cc.indexOf('no-cache') !== -1) return false; - - // parse if-none-match - if (noneMatch) noneMatch = noneMatch.split(/ *, */); - - // if-none-match - if (noneMatch) etagMatches = ~noneMatch.indexOf(etag) || '*' == noneMatch[0]; - - // if-modified-since - if (modifiedSince) { - modifiedSince = new Date(modifiedSince); - lastModified = new Date(lastModified); - notModified = lastModified <= modifiedSince; - } - - return !! (etagMatches && notModified); -} \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/package.json deleted file mode 100644 index a153522..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/fresh/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "fresh", - "description": "HTTP response freshness testing", - "version": "0.2.4", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "license": "MIT", - "keywords": [ - "fresh", - "http", - "conditional", - "cache" - ], - "repository": { - "type": "git", - "url": "https://github.com/jshttp/fresh" - }, - "devDependencies": { - "istanbul": "0", - "mocha": "1", - "should": "3" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "test": "mocha --reporter spec --require should", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --require should" - }, - "gitHead": "8440a4ca75fb091dec06e88654b3b1c31d7e7164", - "bugs": { - "url": "https://github.com/jshttp/fresh/issues" - }, - "homepage": "https://github.com/jshttp/fresh", - "_id": "fresh@0.2.4", - "_shasum": "3582499206c9723714190edd74b4604feb4a614c", - "_from": "fresh@0.2.4", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "jonathanong", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - } - ], - "dist": { - "shasum": "3582499206c9723714190edd74b4604feb4a614c", - "tarball": "http://registry.npmjs.org/fresh/-/fresh-0.2.4.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.2.4.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/LICENSE deleted file mode 100644 index 451fc45..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Benjamin Thomas, Robert Kieffer - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/README.md deleted file mode 100644 index 6ca19bd..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# mime - -Comprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community. - -## Install - -Install with [npm](http://github.com/isaacs/npm): - - npm install mime - -## API - Queries - -### mime.lookup(path) -Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g. - - var mime = require('mime'); - - mime.lookup('/path/to/file.txt'); // => 'text/plain' - mime.lookup('file.txt'); // => 'text/plain' - mime.lookup('.TXT'); // => 'text/plain' - mime.lookup('htm'); // => 'text/html' - -### mime.default_type -Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.) - -### mime.extension(type) -Get the default extension for `type` - - mime.extension('text/html'); // => 'html' - mime.extension('application/octet-stream'); // => 'bin' - -### mime.charsets.lookup() - -Map mime-type to charset - - mime.charsets.lookup('text/plain'); // => 'UTF-8' - -(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) - -## API - Defining Custom Types - -The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types). - -### mime.define() - -Add custom mime/extension mappings - - mime.define({ - 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], - 'application/x-my-type': ['x-mt', 'x-mtt'], - // etc ... - }); - - mime.lookup('x-sft'); // => 'text/x-some-format' - -The first entry in the extensions array is returned by `mime.extension()`. E.g. - - mime.extension('text/x-some-format'); // => 'x-sf' - -### mime.load(filepath) - -Load mappings from an Apache ".types" format file - - mime.load('./my_project.types'); - -The .types file format is simple - See the `types` dir for examples. diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/mime.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/mime.js deleted file mode 100644 index 48be0c5..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/mime.js +++ /dev/null @@ -1,114 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -function Mime() { - // Map of extension -> mime type - this.types = Object.create(null); - - // Map of mime type -> extension - this.extensions = Object.create(null); -} - -/** - * Define mimetype -> extension mappings. Each key is a mime-type that maps - * to an array of extensions associated with the type. The first extension is - * used as the default extension for the type. - * - * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); - * - * @param map (Object) type definitions - */ -Mime.prototype.define = function (map) { - for (var type in map) { - var exts = map[type]; - - for (var i = 0; i < exts.length; i++) { - if (process.env.DEBUG_MIME && this.types[exts]) { - console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' + - this.types[exts] + ' to ' + type); - } - - this.types[exts[i]] = type; - } - - // Default extension is the first one we encounter - if (!this.extensions[type]) { - this.extensions[type] = exts[0]; - } - } -}; - -/** - * Load an Apache2-style ".types" file - * - * This may be called multiple times (it's expected). Where files declare - * overlapping types/extensions, the last file wins. - * - * @param file (String) path of file to load. - */ -Mime.prototype.load = function(file) { - - this._loading = file; - // Read file and split into lines - var map = {}, - content = fs.readFileSync(file, 'ascii'), - lines = content.split(/[\r\n]+/); - - lines.forEach(function(line) { - // Clean up whitespace/comments, and split into fields - var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); - map[fields.shift()] = fields; - }); - - this.define(map); - - this._loading = null; -}; - -/** - * Lookup a mime type based on extension - */ -Mime.prototype.lookup = function(path, fallback) { - var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase(); - - return this.types[ext] || fallback || this.default_type; -}; - -/** - * Return file extension associated with a mime type - */ -Mime.prototype.extension = function(mimeType) { - var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase(); - return this.extensions[type]; -}; - -// Default instance -var mime = new Mime(); - -// Load local copy of -// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -mime.load(path.join(__dirname, 'types/mime.types')); - -// Load additional types from node.js community -mime.load(path.join(__dirname, 'types/node.types')); - -// Default type -mime.default_type = mime.lookup('bin'); - -// -// Additional API specific to the default instance -// - -mime.Mime = Mime; - -/** - * Lookup a charset based on mime type. - */ -mime.charsets = { - lookup: function(mimeType, fallback) { - // Assume text types are utf8 - return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; - } -}; - -module.exports = mime; diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/package.json deleted file mode 100644 index 917e6af..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "author": { - "name": "Robert Kieffer", - "email": "robert@broofa.com", - "url": "http://github.com/broofa" - }, - "contributors": [ - { - "name": "Benjamin Thomas", - "email": "benjamin@benjaminthomas.org", - "url": "http://github.com/bentomas" - } - ], - "dependencies": {}, - "description": "A comprehensive library for mime-type mapping", - "devDependencies": {}, - "keywords": [ - "util", - "mime" - ], - "main": "mime.js", - "name": "mime", - "repository": { - "url": "https://github.com/broofa/node-mime", - "type": "git" - }, - "version": "1.2.11", - "readme": "# mime\n\nComprehensive MIME type mapping API. Includes all 600+ types and 800+ extensions defined by the Apache project, plus additional types submitted by the node.js community.\n\n## Install\n\nInstall with [npm](http://github.com/isaacs/npm):\n\n npm install mime\n\n## API - Queries\n\n### mime.lookup(path)\nGet the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.\n\n var mime = require('mime');\n\n mime.lookup('/path/to/file.txt'); // => 'text/plain'\n mime.lookup('file.txt'); // => 'text/plain'\n mime.lookup('.TXT'); // => 'text/plain'\n mime.lookup('htm'); // => 'text/html'\n\n### mime.default_type\nSets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)\n\n### mime.extension(type)\nGet the default extension for `type`\n\n mime.extension('text/html'); // => 'html'\n mime.extension('application/octet-stream'); // => 'bin'\n\n### mime.charsets.lookup()\n\nMap mime-type to charset\n\n mime.charsets.lookup('text/plain'); // => 'UTF-8'\n\n(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)\n\n## API - Defining Custom Types\n\nThe following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/broofa/node-mime/wiki/Requesting-New-Types).\n\n### mime.define()\n\nAdd custom mime/extension mappings\n\n mime.define({\n 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],\n 'application/x-my-type': ['x-mt', 'x-mtt'],\n // etc ...\n });\n\n mime.lookup('x-sft'); // => 'text/x-some-format'\n\nThe first entry in the extensions array is returned by `mime.extension()`. E.g.\n\n mime.extension('text/x-some-format'); // => 'x-sf'\n\n### mime.load(filepath)\n\nLoad mappings from an Apache \".types\" format file\n\n mime.load('./my_project.types');\n\nThe .types file format is simple - See the `types` dir for examples.\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/broofa/node-mime/issues" - }, - "_id": "mime@1.2.11", - "dist": { - "shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10", - "tarball": "http://registry.npmjs.org/mime/-/mime-1.2.11.tgz" - }, - "_from": "mime@1.2.11", - "_npmVersion": "1.3.6", - "_npmUser": { - "name": "broofa", - "email": "robert@broofa.com" - }, - "maintainers": [ - { - "name": "broofa", - "email": "robert@broofa.com" - }, - { - "name": "bentomas", - "email": "benjamin@benjaminthomas.org" - } - ], - "directories": {}, - "_shasum": "58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10", - "_resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", - "homepage": "https://github.com/broofa/node-mime" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/test.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/test.js deleted file mode 100644 index 2cda1c7..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/test.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Usage: node test.js - */ - -var mime = require('./mime'); -var assert = require('assert'); -var path = require('path'); - -function eq(a, b) { - console.log('Test: ' + a + ' === ' + b); - assert.strictEqual.apply(null, arguments); -} - -console.log(Object.keys(mime.extensions).length + ' types'); -console.log(Object.keys(mime.types).length + ' extensions\n'); - -// -// Test mime lookups -// - -eq('text/plain', mime.lookup('text.txt')); // normal file -eq('text/plain', mime.lookup('TEXT.TXT')); // uppercase -eq('text/plain', mime.lookup('dir/text.txt')); // dir + file -eq('text/plain', mime.lookup('.text.txt')); // hidden file -eq('text/plain', mime.lookup('.txt')); // nameless -eq('text/plain', mime.lookup('txt')); // extension-only -eq('text/plain', mime.lookup('/txt')); // extension-less () -eq('text/plain', mime.lookup('\\txt')); // Windows, extension-less -eq('application/octet-stream', mime.lookup('text.nope')); // unrecognized -eq('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default - -// -// Test extensions -// - -eq('txt', mime.extension(mime.types.text)); -eq('html', mime.extension(mime.types.htm)); -eq('bin', mime.extension('application/octet-stream')); -eq('bin', mime.extension('application/octet-stream ')); -eq('html', mime.extension(' text/html; charset=UTF-8')); -eq('html', mime.extension('text/html; charset=UTF-8 ')); -eq('html', mime.extension('text/html; charset=UTF-8')); -eq('html', mime.extension('text/html ; charset=UTF-8')); -eq('html', mime.extension('text/html;charset=UTF-8')); -eq('html', mime.extension('text/Html;charset=UTF-8')); -eq(undefined, mime.extension('unrecognized')); - -// -// Test node.types lookups -// - -eq('application/font-woff', mime.lookup('file.woff')); -eq('application/octet-stream', mime.lookup('file.buffer')); -eq('audio/mp4', mime.lookup('file.m4a')); -eq('font/opentype', mime.lookup('file.otf')); - -// -// Test charsets -// - -eq('UTF-8', mime.charsets.lookup('text/plain')); -eq(undefined, mime.charsets.lookup(mime.types.js)); -eq('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); - -// -// Test for overlaps between mime.types and node.types -// - -var apacheTypes = new mime.Mime(), nodeTypes = new mime.Mime(); -apacheTypes.load(path.join(__dirname, 'types/mime.types')); -nodeTypes.load(path.join(__dirname, 'types/node.types')); - -var keys = [].concat(Object.keys(apacheTypes.types)) - .concat(Object.keys(nodeTypes.types)); -keys.sort(); -for (var i = 1; i < keys.length; i++) { - if (keys[i] == keys[i-1]) { - console.warn('Warning: ' + - 'node.types defines ' + keys[i] + '->' + nodeTypes.types[keys[i]] + - ', mime.types defines ' + keys[i] + '->' + apacheTypes.types[keys[i]]); - } -} - -console.log('\nOK'); diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/types/mime.types b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/types/mime.types deleted file mode 100644 index da8cd69..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/types/mime.types +++ /dev/null @@ -1,1588 +0,0 @@ -# This file maps Internet media types to unique file extension(s). -# Although created for httpd, this file is used by many software systems -# and has been placed in the public domain for unlimited redisribution. -# -# The table below contains both registered and (common) unregistered types. -# A type that has no unique extension can be ignored -- they are listed -# here to guide configurations toward known types and to make it easier to -# identify "new" types. File extensions are also commonly used to indicate -# content languages and encodings, so choose them carefully. -# -# Internet media types should be registered as described in RFC 4288. -# The registry is at . -# -# MIME type (lowercased) Extensions -# ============================================ ========== -# application/1d-interleaved-parityfec -# application/3gpp-ims+xml -# application/activemessage -application/andrew-inset ez -# application/applefile -application/applixware aw -application/atom+xml atom -application/atomcat+xml atomcat -# application/atomicmail -application/atomsvc+xml atomsvc -# application/auth-policy+xml -# application/batch-smtp -# application/beep+xml -# application/calendar+xml -# application/cals-1840 -# application/ccmp+xml -application/ccxml+xml ccxml -application/cdmi-capability cdmia -application/cdmi-container cdmic -application/cdmi-domain cdmid -application/cdmi-object cdmio -application/cdmi-queue cdmiq -# application/cea-2018+xml -# application/cellml+xml -# application/cfw -# application/cnrp+xml -# application/commonground -# application/conference-info+xml -# application/cpl+xml -# application/csta+xml -# application/cstadata+xml -application/cu-seeme cu -# application/cybercash -application/davmount+xml davmount -# application/dca-rft -# application/dec-dx -# application/dialog-info+xml -# application/dicom -# application/dns -application/docbook+xml dbk -# application/dskpp+xml -application/dssc+der dssc -application/dssc+xml xdssc -# application/dvcs -application/ecmascript ecma -# application/edi-consent -# application/edi-x12 -# application/edifact -application/emma+xml emma -# application/epp+xml -application/epub+zip epub -# application/eshop -# application/example -application/exi exi -# application/fastinfoset -# application/fastsoap -# application/fits -application/font-tdpfr pfr -# application/framework-attributes+xml -application/gml+xml gml -application/gpx+xml gpx -application/gxf gxf -# application/h224 -# application/held+xml -# application/http -application/hyperstudio stk -# application/ibe-key-request+xml -# application/ibe-pkg-reply+xml -# application/ibe-pp-data -# application/iges -# application/im-iscomposing+xml -# application/index -# application/index.cmd -# application/index.obj -# application/index.response -# application/index.vnd -application/inkml+xml ink inkml -# application/iotp -application/ipfix ipfix -# application/ipp -# application/isup -application/java-archive jar -application/java-serialized-object ser -application/java-vm class -application/javascript js -application/json json -application/jsonml+json jsonml -# application/kpml-request+xml -# application/kpml-response+xml -application/lost+xml lostxml -application/mac-binhex40 hqx -application/mac-compactpro cpt -# application/macwriteii -application/mads+xml mads -application/marc mrc -application/marcxml+xml mrcx -application/mathematica ma nb mb -# application/mathml-content+xml -# application/mathml-presentation+xml -application/mathml+xml mathml -# application/mbms-associated-procedure-description+xml -# application/mbms-deregister+xml -# application/mbms-envelope+xml -# application/mbms-msk+xml -# application/mbms-msk-response+xml -# application/mbms-protection-description+xml -# application/mbms-reception-report+xml -# application/mbms-register+xml -# application/mbms-register-response+xml -# application/mbms-user-service-description+xml -application/mbox mbox -# application/media_control+xml -application/mediaservercontrol+xml mscml -application/metalink+xml metalink -application/metalink4+xml meta4 -application/mets+xml mets -# application/mikey -application/mods+xml mods -# application/moss-keys -# application/moss-signature -# application/mosskey-data -# application/mosskey-request -application/mp21 m21 mp21 -application/mp4 mp4s -# application/mpeg4-generic -# application/mpeg4-iod -# application/mpeg4-iod-xmt -# application/msc-ivr+xml -# application/msc-mixer+xml -application/msword doc dot -application/mxf mxf -# application/nasdata -# application/news-checkgroups -# application/news-groupinfo -# application/news-transmission -# application/nss -# application/ocsp-request -# application/ocsp-response -application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy -application/oda oda -application/oebps-package+xml opf -application/ogg ogx -application/omdoc+xml omdoc -application/onenote onetoc onetoc2 onetmp onepkg -application/oxps oxps -# application/parityfec -application/patch-ops-error+xml xer -application/pdf pdf -application/pgp-encrypted pgp -# application/pgp-keys -application/pgp-signature asc sig -application/pics-rules prf -# application/pidf+xml -# application/pidf-diff+xml -application/pkcs10 p10 -application/pkcs7-mime p7m p7c -application/pkcs7-signature p7s -application/pkcs8 p8 -application/pkix-attr-cert ac -application/pkix-cert cer -application/pkix-crl crl -application/pkix-pkipath pkipath -application/pkixcmp pki -application/pls+xml pls -# application/poc-settings+xml -application/postscript ai eps ps -# application/prs.alvestrand.titrax-sheet -application/prs.cww cww -# application/prs.nprend -# application/prs.plucker -# application/prs.rdf-xml-crypt -# application/prs.xsf+xml -application/pskc+xml pskcxml -# application/qsig -application/rdf+xml rdf -application/reginfo+xml rif -application/relax-ng-compact-syntax rnc -# application/remote-printing -application/resource-lists+xml rl -application/resource-lists-diff+xml rld -# application/riscos -# application/rlmi+xml -application/rls-services+xml rs -application/rpki-ghostbusters gbr -application/rpki-manifest mft -application/rpki-roa roa -# application/rpki-updown -application/rsd+xml rsd -application/rss+xml rss -application/rtf rtf -# application/rtx -# application/samlassertion+xml -# application/samlmetadata+xml -application/sbml+xml sbml -application/scvp-cv-request scq -application/scvp-cv-response scs -application/scvp-vp-request spq -application/scvp-vp-response spp -application/sdp sdp -# application/set-payment -application/set-payment-initiation setpay -# application/set-registration -application/set-registration-initiation setreg -# application/sgml -# application/sgml-open-catalog -application/shf+xml shf -# application/sieve -# application/simple-filter+xml -# application/simple-message-summary -# application/simplesymbolcontainer -# application/slate -# application/smil -application/smil+xml smi smil -# application/soap+fastinfoset -# application/soap+xml -application/sparql-query rq -application/sparql-results+xml srx -# application/spirits-event+xml -application/srgs gram -application/srgs+xml grxml -application/sru+xml sru -application/ssdl+xml ssdl -application/ssml+xml ssml -# application/tamp-apex-update -# application/tamp-apex-update-confirm -# application/tamp-community-update -# application/tamp-community-update-confirm -# application/tamp-error -# application/tamp-sequence-adjust -# application/tamp-sequence-adjust-confirm -# application/tamp-status-query -# application/tamp-status-response -# application/tamp-update -# application/tamp-update-confirm -application/tei+xml tei teicorpus -application/thraud+xml tfi -# application/timestamp-query -# application/timestamp-reply -application/timestamped-data tsd -# application/tve-trigger -# application/ulpfec -# application/vcard+xml -# application/vemmi -# application/vividence.scriptfile -# application/vnd.3gpp.bsf+xml -application/vnd.3gpp.pic-bw-large plb -application/vnd.3gpp.pic-bw-small psb -application/vnd.3gpp.pic-bw-var pvb -# application/vnd.3gpp.sms -# application/vnd.3gpp2.bcmcsinfo+xml -# application/vnd.3gpp2.sms -application/vnd.3gpp2.tcap tcap -application/vnd.3m.post-it-notes pwn -application/vnd.accpac.simply.aso aso -application/vnd.accpac.simply.imp imp -application/vnd.acucobol acu -application/vnd.acucorp atc acutc -application/vnd.adobe.air-application-installer-package+zip air -application/vnd.adobe.formscentral.fcdt fcdt -application/vnd.adobe.fxp fxp fxpl -# application/vnd.adobe.partial-upload -application/vnd.adobe.xdp+xml xdp -application/vnd.adobe.xfdf xfdf -# application/vnd.aether.imp -# application/vnd.ah-barcode -application/vnd.ahead.space ahead -application/vnd.airzip.filesecure.azf azf -application/vnd.airzip.filesecure.azs azs -application/vnd.amazon.ebook azw -application/vnd.americandynamics.acc acc -application/vnd.amiga.ami ami -# application/vnd.amundsen.maze+xml -application/vnd.android.package-archive apk -application/vnd.anser-web-certificate-issue-initiation cii -application/vnd.anser-web-funds-transfer-initiation fti -application/vnd.antix.game-component atx -application/vnd.apple.installer+xml mpkg -application/vnd.apple.mpegurl m3u8 -# application/vnd.arastra.swi -application/vnd.aristanetworks.swi swi -application/vnd.astraea-software.iota iota -application/vnd.audiograph aep -# application/vnd.autopackage -# application/vnd.avistar+xml -application/vnd.blueice.multipass mpm -# application/vnd.bluetooth.ep.oob -application/vnd.bmi bmi -application/vnd.businessobjects rep -# application/vnd.cab-jscript -# application/vnd.canon-cpdl -# application/vnd.canon-lips -# application/vnd.cendio.thinlinc.clientconf -application/vnd.chemdraw+xml cdxml -application/vnd.chipnuts.karaoke-mmd mmd -application/vnd.cinderella cdy -# application/vnd.cirpack.isdn-ext -application/vnd.claymore cla -application/vnd.cloanto.rp9 rp9 -application/vnd.clonk.c4group c4g c4d c4f c4p c4u -application/vnd.cluetrust.cartomobile-config c11amc -application/vnd.cluetrust.cartomobile-config-pkg c11amz -# application/vnd.collection+json -# application/vnd.commerce-battelle -application/vnd.commonspace csp -application/vnd.contact.cmsg cdbcmsg -application/vnd.cosmocaller cmc -application/vnd.crick.clicker clkx -application/vnd.crick.clicker.keyboard clkk -application/vnd.crick.clicker.palette clkp -application/vnd.crick.clicker.template clkt -application/vnd.crick.clicker.wordbank clkw -application/vnd.criticaltools.wbs+xml wbs -application/vnd.ctc-posml pml -# application/vnd.ctct.ws+xml -# application/vnd.cups-pdf -# application/vnd.cups-postscript -application/vnd.cups-ppd ppd -# application/vnd.cups-raster -# application/vnd.cups-raw -# application/vnd.curl -application/vnd.curl.car car -application/vnd.curl.pcurl pcurl -# application/vnd.cybank -application/vnd.dart dart -application/vnd.data-vision.rdz rdz -application/vnd.dece.data uvf uvvf uvd uvvd -application/vnd.dece.ttml+xml uvt uvvt -application/vnd.dece.unspecified uvx uvvx -application/vnd.dece.zip uvz uvvz -application/vnd.denovo.fcselayout-link fe_launch -# application/vnd.dir-bi.plate-dl-nosuffix -application/vnd.dna dna -application/vnd.dolby.mlp mlp -# application/vnd.dolby.mobile.1 -# application/vnd.dolby.mobile.2 -application/vnd.dpgraph dpg -application/vnd.dreamfactory dfac -application/vnd.ds-keypoint kpxx -application/vnd.dvb.ait ait -# application/vnd.dvb.dvbj -# application/vnd.dvb.esgcontainer -# application/vnd.dvb.ipdcdftnotifaccess -# application/vnd.dvb.ipdcesgaccess -# application/vnd.dvb.ipdcesgaccess2 -# application/vnd.dvb.ipdcesgpdd -# application/vnd.dvb.ipdcroaming -# application/vnd.dvb.iptv.alfec-base -# application/vnd.dvb.iptv.alfec-enhancement -# application/vnd.dvb.notif-aggregate-root+xml -# application/vnd.dvb.notif-container+xml -# application/vnd.dvb.notif-generic+xml -# application/vnd.dvb.notif-ia-msglist+xml -# application/vnd.dvb.notif-ia-registration-request+xml -# application/vnd.dvb.notif-ia-registration-response+xml -# application/vnd.dvb.notif-init+xml -# application/vnd.dvb.pfr -application/vnd.dvb.service svc -# application/vnd.dxr -application/vnd.dynageo geo -# application/vnd.easykaraoke.cdgdownload -# application/vnd.ecdis-update -application/vnd.ecowin.chart mag -# application/vnd.ecowin.filerequest -# application/vnd.ecowin.fileupdate -# application/vnd.ecowin.series -# application/vnd.ecowin.seriesrequest -# application/vnd.ecowin.seriesupdate -# application/vnd.emclient.accessrequest+xml -application/vnd.enliven nml -# application/vnd.eprints.data+xml -application/vnd.epson.esf esf -application/vnd.epson.msf msf -application/vnd.epson.quickanime qam -application/vnd.epson.salt slt -application/vnd.epson.ssf ssf -# application/vnd.ericsson.quickcall -application/vnd.eszigno3+xml es3 et3 -# application/vnd.etsi.aoc+xml -# application/vnd.etsi.cug+xml -# application/vnd.etsi.iptvcommand+xml -# application/vnd.etsi.iptvdiscovery+xml -# application/vnd.etsi.iptvprofile+xml -# application/vnd.etsi.iptvsad-bc+xml -# application/vnd.etsi.iptvsad-cod+xml -# application/vnd.etsi.iptvsad-npvr+xml -# application/vnd.etsi.iptvservice+xml -# application/vnd.etsi.iptvsync+xml -# application/vnd.etsi.iptvueprofile+xml -# application/vnd.etsi.mcid+xml -# application/vnd.etsi.overload-control-policy-dataset+xml -# application/vnd.etsi.sci+xml -# application/vnd.etsi.simservs+xml -# application/vnd.etsi.tsl+xml -# application/vnd.etsi.tsl.der -# application/vnd.eudora.data -application/vnd.ezpix-album ez2 -application/vnd.ezpix-package ez3 -# application/vnd.f-secure.mobile -application/vnd.fdf fdf -application/vnd.fdsn.mseed mseed -application/vnd.fdsn.seed seed dataless -# application/vnd.ffsns -# application/vnd.fints -application/vnd.flographit gph -application/vnd.fluxtime.clip ftc -# application/vnd.font-fontforge-sfd -application/vnd.framemaker fm frame maker book -application/vnd.frogans.fnc fnc -application/vnd.frogans.ltf ltf -application/vnd.fsc.weblaunch fsc -application/vnd.fujitsu.oasys oas -application/vnd.fujitsu.oasys2 oa2 -application/vnd.fujitsu.oasys3 oa3 -application/vnd.fujitsu.oasysgp fg5 -application/vnd.fujitsu.oasysprs bh2 -# application/vnd.fujixerox.art-ex -# application/vnd.fujixerox.art4 -# application/vnd.fujixerox.hbpl -application/vnd.fujixerox.ddd ddd -application/vnd.fujixerox.docuworks xdw -application/vnd.fujixerox.docuworks.binder xbd -# application/vnd.fut-misnet -application/vnd.fuzzysheet fzs -application/vnd.genomatix.tuxedo txd -# application/vnd.geocube+xml -application/vnd.geogebra.file ggb -application/vnd.geogebra.tool ggt -application/vnd.geometry-explorer gex gre -application/vnd.geonext gxt -application/vnd.geoplan g2w -application/vnd.geospace g3w -# application/vnd.globalplatform.card-content-mgt -# application/vnd.globalplatform.card-content-mgt-response -application/vnd.gmx gmx -application/vnd.google-earth.kml+xml kml -application/vnd.google-earth.kmz kmz -application/vnd.grafeq gqf gqs -# application/vnd.gridmp -application/vnd.groove-account gac -application/vnd.groove-help ghf -application/vnd.groove-identity-message gim -application/vnd.groove-injector grv -application/vnd.groove-tool-message gtm -application/vnd.groove-tool-template tpl -application/vnd.groove-vcard vcg -# application/vnd.hal+json -application/vnd.hal+xml hal -application/vnd.handheld-entertainment+xml zmm -application/vnd.hbci hbci -# application/vnd.hcl-bireports -application/vnd.hhe.lesson-player les -application/vnd.hp-hpgl hpgl -application/vnd.hp-hpid hpid -application/vnd.hp-hps hps -application/vnd.hp-jlyt jlt -application/vnd.hp-pcl pcl -application/vnd.hp-pclxl pclxl -# application/vnd.httphone -application/vnd.hydrostatix.sof-data sfd-hdstx -# application/vnd.hzn-3d-crossword -# application/vnd.ibm.afplinedata -# application/vnd.ibm.electronic-media -application/vnd.ibm.minipay mpy -application/vnd.ibm.modcap afp listafp list3820 -application/vnd.ibm.rights-management irm -application/vnd.ibm.secure-container sc -application/vnd.iccprofile icc icm -application/vnd.igloader igl -application/vnd.immervision-ivp ivp -application/vnd.immervision-ivu ivu -# application/vnd.informedcontrol.rms+xml -# application/vnd.informix-visionary -# application/vnd.infotech.project -# application/vnd.infotech.project+xml -# application/vnd.innopath.wamp.notification -application/vnd.insors.igm igm -application/vnd.intercon.formnet xpw xpx -application/vnd.intergeo i2g -# application/vnd.intertrust.digibox -# application/vnd.intertrust.nncp -application/vnd.intu.qbo qbo -application/vnd.intu.qfx qfx -# application/vnd.iptc.g2.conceptitem+xml -# application/vnd.iptc.g2.knowledgeitem+xml -# application/vnd.iptc.g2.newsitem+xml -# application/vnd.iptc.g2.newsmessage+xml -# application/vnd.iptc.g2.packageitem+xml -# application/vnd.iptc.g2.planningitem+xml -application/vnd.ipunplugged.rcprofile rcprofile -application/vnd.irepository.package+xml irp -application/vnd.is-xpr xpr -application/vnd.isac.fcs fcs -application/vnd.jam jam -# application/vnd.japannet-directory-service -# application/vnd.japannet-jpnstore-wakeup -# application/vnd.japannet-payment-wakeup -# application/vnd.japannet-registration -# application/vnd.japannet-registration-wakeup -# application/vnd.japannet-setstore-wakeup -# application/vnd.japannet-verification -# application/vnd.japannet-verification-wakeup -application/vnd.jcp.javame.midlet-rms rms -application/vnd.jisp jisp -application/vnd.joost.joda-archive joda -application/vnd.kahootz ktz ktr -application/vnd.kde.karbon karbon -application/vnd.kde.kchart chrt -application/vnd.kde.kformula kfo -application/vnd.kde.kivio flw -application/vnd.kde.kontour kon -application/vnd.kde.kpresenter kpr kpt -application/vnd.kde.kspread ksp -application/vnd.kde.kword kwd kwt -application/vnd.kenameaapp htke -application/vnd.kidspiration kia -application/vnd.kinar kne knp -application/vnd.koan skp skd skt skm -application/vnd.kodak-descriptor sse -application/vnd.las.las+xml lasxml -# application/vnd.liberty-request+xml -application/vnd.llamagraphics.life-balance.desktop lbd -application/vnd.llamagraphics.life-balance.exchange+xml lbe -application/vnd.lotus-1-2-3 123 -application/vnd.lotus-approach apr -application/vnd.lotus-freelance pre -application/vnd.lotus-notes nsf -application/vnd.lotus-organizer org -application/vnd.lotus-screencam scm -application/vnd.lotus-wordpro lwp -application/vnd.macports.portpkg portpkg -# application/vnd.marlin.drm.actiontoken+xml -# application/vnd.marlin.drm.conftoken+xml -# application/vnd.marlin.drm.license+xml -# application/vnd.marlin.drm.mdcf -application/vnd.mcd mcd -application/vnd.medcalcdata mc1 -application/vnd.mediastation.cdkey cdkey -# application/vnd.meridian-slingshot -application/vnd.mfer mwf -application/vnd.mfmp mfm -application/vnd.micrografx.flo flo -application/vnd.micrografx.igx igx -application/vnd.mif mif -# application/vnd.minisoft-hp3000-save -# application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf daf -application/vnd.mobius.dis dis -application/vnd.mobius.mbk mbk -application/vnd.mobius.mqy mqy -application/vnd.mobius.msl msl -application/vnd.mobius.plc plc -application/vnd.mobius.txf txf -application/vnd.mophun.application mpn -application/vnd.mophun.certificate mpc -# application/vnd.motorola.flexsuite -# application/vnd.motorola.flexsuite.adsi -# application/vnd.motorola.flexsuite.fis -# application/vnd.motorola.flexsuite.gotap -# application/vnd.motorola.flexsuite.kmr -# application/vnd.motorola.flexsuite.ttc -# application/vnd.motorola.flexsuite.wem -# application/vnd.motorola.iprm -application/vnd.mozilla.xul+xml xul -application/vnd.ms-artgalry cil -# application/vnd.ms-asf -application/vnd.ms-cab-compressed cab -# application/vnd.ms-color.iccprofile -application/vnd.ms-excel xls xlm xla xlc xlt xlw -application/vnd.ms-excel.addin.macroenabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb -application/vnd.ms-excel.sheet.macroenabled.12 xlsm -application/vnd.ms-excel.template.macroenabled.12 xltm -application/vnd.ms-fontobject eot -application/vnd.ms-htmlhelp chm -application/vnd.ms-ims ims -application/vnd.ms-lrm lrm -# application/vnd.ms-office.activex+xml -application/vnd.ms-officetheme thmx -# application/vnd.ms-opentype -# application/vnd.ms-package.obfuscated-opentype -application/vnd.ms-pki.seccat cat -application/vnd.ms-pki.stl stl -# application/vnd.ms-playready.initiator+xml -application/vnd.ms-powerpoint ppt pps pot -application/vnd.ms-powerpoint.addin.macroenabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm -application/vnd.ms-powerpoint.slide.macroenabled.12 sldm -application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm -application/vnd.ms-powerpoint.template.macroenabled.12 potm -# application/vnd.ms-printing.printticket+xml -application/vnd.ms-project mpp mpt -# application/vnd.ms-tnef -# application/vnd.ms-wmdrm.lic-chlg-req -# application/vnd.ms-wmdrm.lic-resp -# application/vnd.ms-wmdrm.meter-chlg-req -# application/vnd.ms-wmdrm.meter-resp -application/vnd.ms-word.document.macroenabled.12 docm -application/vnd.ms-word.template.macroenabled.12 dotm -application/vnd.ms-works wps wks wcm wdb -application/vnd.ms-wpl wpl -application/vnd.ms-xpsdocument xps -application/vnd.mseq mseq -# application/vnd.msign -# application/vnd.multiad.creator -# application/vnd.multiad.creator.cif -# application/vnd.music-niff -application/vnd.musician mus -application/vnd.muvee.style msty -application/vnd.mynfc taglet -# application/vnd.ncd.control -# application/vnd.ncd.reference -# application/vnd.nervana -# application/vnd.netfpx -application/vnd.neurolanguage.nlu nlu -application/vnd.nitf ntf nitf -application/vnd.noblenet-directory nnd -application/vnd.noblenet-sealer nns -application/vnd.noblenet-web nnw -# application/vnd.nokia.catalogs -# application/vnd.nokia.conml+wbxml -# application/vnd.nokia.conml+xml -# application/vnd.nokia.isds-radio-presets -# application/vnd.nokia.iptv.config+xml -# application/vnd.nokia.landmark+wbxml -# application/vnd.nokia.landmark+xml -# application/vnd.nokia.landmarkcollection+xml -# application/vnd.nokia.n-gage.ac+xml -application/vnd.nokia.n-gage.data ngdat -application/vnd.nokia.n-gage.symbian.install n-gage -# application/vnd.nokia.ncd -# application/vnd.nokia.pcd+wbxml -# application/vnd.nokia.pcd+xml -application/vnd.nokia.radio-preset rpst -application/vnd.nokia.radio-presets rpss -application/vnd.novadigm.edm edm -application/vnd.novadigm.edx edx -application/vnd.novadigm.ext ext -# application/vnd.ntt-local.file-transfer -# application/vnd.ntt-local.sip-ta_remote -# application/vnd.ntt-local.sip-ta_tcp_stream -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template odft -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -# application/vnd.obn -# application/vnd.oftn.l10n+json -# application/vnd.oipf.contentaccessdownload+xml -# application/vnd.oipf.contentaccessstreaming+xml -# application/vnd.oipf.cspg-hexbinary -# application/vnd.oipf.dae.svg+xml -# application/vnd.oipf.dae.xhtml+xml -# application/vnd.oipf.mippvcontrolmessage+xml -# application/vnd.oipf.pae.gem -# application/vnd.oipf.spdiscovery+xml -# application/vnd.oipf.spdlist+xml -# application/vnd.oipf.ueprofile+xml -# application/vnd.oipf.userprofile+xml -application/vnd.olpc-sugar xo -# application/vnd.oma-scws-config -# application/vnd.oma-scws-http-request -# application/vnd.oma-scws-http-response -# application/vnd.oma.bcast.associated-procedure-parameter+xml -# application/vnd.oma.bcast.drm-trigger+xml -# application/vnd.oma.bcast.imd+xml -# application/vnd.oma.bcast.ltkm -# application/vnd.oma.bcast.notification+xml -# application/vnd.oma.bcast.provisioningtrigger -# application/vnd.oma.bcast.sgboot -# application/vnd.oma.bcast.sgdd+xml -# application/vnd.oma.bcast.sgdu -# application/vnd.oma.bcast.simple-symbol-container -# application/vnd.oma.bcast.smartcard-trigger+xml -# application/vnd.oma.bcast.sprov+xml -# application/vnd.oma.bcast.stkm -# application/vnd.oma.cab-address-book+xml -# application/vnd.oma.cab-feature-handler+xml -# application/vnd.oma.cab-pcc+xml -# application/vnd.oma.cab-user-prefs+xml -# application/vnd.oma.dcd -# application/vnd.oma.dcdc -application/vnd.oma.dd2+xml dd2 -# application/vnd.oma.drm.risd+xml -# application/vnd.oma.group-usage-list+xml -# application/vnd.oma.pal+xml -# application/vnd.oma.poc.detailed-progress-report+xml -# application/vnd.oma.poc.final-report+xml -# application/vnd.oma.poc.groups+xml -# application/vnd.oma.poc.invocation-descriptor+xml -# application/vnd.oma.poc.optimized-progress-report+xml -# application/vnd.oma.push -# application/vnd.oma.scidm.messages+xml -# application/vnd.oma.xcap-directory+xml -# application/vnd.omads-email+xml -# application/vnd.omads-file+xml -# application/vnd.omads-folder+xml -# application/vnd.omaloc-supl-init -application/vnd.openofficeorg.extension oxt -# application/vnd.openxmlformats-officedocument.custom-properties+xml -# application/vnd.openxmlformats-officedocument.customxmlproperties+xml -# application/vnd.openxmlformats-officedocument.drawing+xml -# application/vnd.openxmlformats-officedocument.drawingml.chart+xml -# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml -# application/vnd.openxmlformats-officedocument.extended-properties+xml -# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml -# application/vnd.openxmlformats-officedocument.presentationml.comments+xml -# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml -application/vnd.openxmlformats-officedocument.presentationml.slide sldx -# application/vnd.openxmlformats-officedocument.presentationml.slide+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml -# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml -# application/vnd.openxmlformats-officedocument.presentationml.tags+xml -application/vnd.openxmlformats-officedocument.presentationml.template potx -# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml -# application/vnd.openxmlformats-officedocument.theme+xml -# application/vnd.openxmlformats-officedocument.themeoverride+xml -# application/vnd.openxmlformats-officedocument.vmldrawing -# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml -# application/vnd.openxmlformats-package.core-properties+xml -# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml -# application/vnd.openxmlformats-package.relationships+xml -# application/vnd.quobject-quoxdocument -# application/vnd.osa.netdeploy -application/vnd.osgeo.mapguide.package mgp -# application/vnd.osgi.bundle -application/vnd.osgi.dp dp -application/vnd.osgi.subsystem esa -# application/vnd.otps.ct-kip+xml -application/vnd.palm pdb pqa oprc -# application/vnd.paos.xml -application/vnd.pawaafile paw -application/vnd.pg.format str -application/vnd.pg.osasli ei6 -# application/vnd.piaccess.application-licence -application/vnd.picsel efif -application/vnd.pmi.widget wg -# application/vnd.poc.group-advertisement+xml -application/vnd.pocketlearn plf -application/vnd.powerbuilder6 pbd -# application/vnd.powerbuilder6-s -# application/vnd.powerbuilder7 -# application/vnd.powerbuilder7-s -# application/vnd.powerbuilder75 -# application/vnd.powerbuilder75-s -# application/vnd.preminet -application/vnd.previewsystems.box box -application/vnd.proteus.magazine mgz -application/vnd.publishare-delta-tree qps -application/vnd.pvi.ptid1 ptid -# application/vnd.pwg-multiplexed -# application/vnd.pwg-xhtml-print+xml -# application/vnd.qualcomm.brew-app-res -application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb -# application/vnd.radisys.moml+xml -# application/vnd.radisys.msml+xml -# application/vnd.radisys.msml-audit+xml -# application/vnd.radisys.msml-audit-conf+xml -# application/vnd.radisys.msml-audit-conn+xml -# application/vnd.radisys.msml-audit-dialog+xml -# application/vnd.radisys.msml-audit-stream+xml -# application/vnd.radisys.msml-conf+xml -# application/vnd.radisys.msml-dialog+xml -# application/vnd.radisys.msml-dialog-base+xml -# application/vnd.radisys.msml-dialog-fax-detect+xml -# application/vnd.radisys.msml-dialog-fax-sendrecv+xml -# application/vnd.radisys.msml-dialog-group+xml -# application/vnd.radisys.msml-dialog-speech+xml -# application/vnd.radisys.msml-dialog-transform+xml -# application/vnd.rainstor.data -# application/vnd.rapid -application/vnd.realvnc.bed bed -application/vnd.recordare.musicxml mxl -application/vnd.recordare.musicxml+xml musicxml -# application/vnd.renlearn.rlprint -application/vnd.rig.cryptonote cryptonote -application/vnd.rim.cod cod -application/vnd.rn-realmedia rm -application/vnd.rn-realmedia-vbr rmvb -application/vnd.route66.link66+xml link66 -# application/vnd.rs-274x -# application/vnd.ruckus.download -# application/vnd.s3sms -application/vnd.sailingtracker.track st -# application/vnd.sbm.cid -# application/vnd.sbm.mid2 -# application/vnd.scribus -# application/vnd.sealed.3df -# application/vnd.sealed.csf -# application/vnd.sealed.doc -# application/vnd.sealed.eml -# application/vnd.sealed.mht -# application/vnd.sealed.net -# application/vnd.sealed.ppt -# application/vnd.sealed.tiff -# application/vnd.sealed.xls -# application/vnd.sealedmedia.softseal.html -# application/vnd.sealedmedia.softseal.pdf -application/vnd.seemail see -application/vnd.sema sema -application/vnd.semd semd -application/vnd.semf semf -application/vnd.shana.informed.formdata ifm -application/vnd.shana.informed.formtemplate itp -application/vnd.shana.informed.interchange iif -application/vnd.shana.informed.package ipk -application/vnd.simtech-mindmapper twd twds -application/vnd.smaf mmf -# application/vnd.smart.notebook -application/vnd.smart.teacher teacher -# application/vnd.software602.filler.form+xml -# application/vnd.software602.filler.form-xml-zip -application/vnd.solent.sdkm+xml sdkm sdkd -application/vnd.spotfire.dxp dxp -application/vnd.spotfire.sfs sfs -# application/vnd.sss-cod -# application/vnd.sss-dtf -# application/vnd.sss-ntf -application/vnd.stardivision.calc sdc -application/vnd.stardivision.draw sda -application/vnd.stardivision.impress sdd -application/vnd.stardivision.math smf -application/vnd.stardivision.writer sdw vor -application/vnd.stardivision.writer-global sgl -application/vnd.stepmania.package smzip -application/vnd.stepmania.stepchart sm -# application/vnd.street-stream -application/vnd.sun.xml.calc sxc -application/vnd.sun.xml.calc.template stc -application/vnd.sun.xml.draw sxd -application/vnd.sun.xml.draw.template std -application/vnd.sun.xml.impress sxi -application/vnd.sun.xml.impress.template sti -application/vnd.sun.xml.math sxm -application/vnd.sun.xml.writer sxw -application/vnd.sun.xml.writer.global sxg -application/vnd.sun.xml.writer.template stw -# application/vnd.sun.wadl+xml -application/vnd.sus-calendar sus susp -application/vnd.svd svd -# application/vnd.swiftview-ics -application/vnd.symbian.install sis sisx -application/vnd.syncml+xml xsm -application/vnd.syncml.dm+wbxml bdm -application/vnd.syncml.dm+xml xdm -# application/vnd.syncml.dm.notification -# application/vnd.syncml.ds.notification -application/vnd.tao.intent-module-archive tao -application/vnd.tcpdump.pcap pcap cap dmp -application/vnd.tmobile-livetv tmo -application/vnd.trid.tpt tpt -application/vnd.triscape.mxs mxs -application/vnd.trueapp tra -# application/vnd.truedoc -# application/vnd.ubisoft.webplayer -application/vnd.ufdl ufd ufdl -application/vnd.uiq.theme utz -application/vnd.umajin umj -application/vnd.unity unityweb -application/vnd.uoml+xml uoml -# application/vnd.uplanet.alert -# application/vnd.uplanet.alert-wbxml -# application/vnd.uplanet.bearer-choice -# application/vnd.uplanet.bearer-choice-wbxml -# application/vnd.uplanet.cacheop -# application/vnd.uplanet.cacheop-wbxml -# application/vnd.uplanet.channel -# application/vnd.uplanet.channel-wbxml -# application/vnd.uplanet.list -# application/vnd.uplanet.list-wbxml -# application/vnd.uplanet.listcmd -# application/vnd.uplanet.listcmd-wbxml -# application/vnd.uplanet.signal -application/vnd.vcx vcx -# application/vnd.vd-study -# application/vnd.vectorworks -# application/vnd.verimatrix.vcas -# application/vnd.vidsoft.vidconference -application/vnd.visio vsd vst vss vsw -application/vnd.visionary vis -# application/vnd.vividence.scriptfile -application/vnd.vsf vsf -# application/vnd.wap.sic -# application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo wtb -# application/vnd.wfa.wsc -# application/vnd.wmc -# application/vnd.wmf.bootstrap -# application/vnd.wolfram.mathematica -# application/vnd.wolfram.mathematica.package -application/vnd.wolfram.player nbp -application/vnd.wordperfect wpd -application/vnd.wqd wqd -# application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf stf -# application/vnd.wv.csp+wbxml -# application/vnd.wv.csp+xml -# application/vnd.wv.ssp+xml -application/vnd.xara xar -application/vnd.xfdl xfdl -# application/vnd.xfdl.webform -# application/vnd.xmi+xml -# application/vnd.xmpie.cpkg -# application/vnd.xmpie.dpkg -# application/vnd.xmpie.plan -# application/vnd.xmpie.ppkg -# application/vnd.xmpie.xlim -application/vnd.yamaha.hv-dic hvd -application/vnd.yamaha.hv-script hvs -application/vnd.yamaha.hv-voice hvp -application/vnd.yamaha.openscoreformat osf -application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg -# application/vnd.yamaha.remote-setup -application/vnd.yamaha.smaf-audio saf -application/vnd.yamaha.smaf-phrase spf -# application/vnd.yamaha.through-ngn -# application/vnd.yamaha.tunnel-udpencap -application/vnd.yellowriver-custom-menu cmp -application/vnd.zul zir zirz -application/vnd.zzazz.deck+xml zaz -application/voicexml+xml vxml -# application/vq-rtcpxr -# application/watcherinfo+xml -# application/whoispp-query -# application/whoispp-response -application/widget wgt -application/winhlp hlp -# application/wita -# application/wordperfect5.1 -application/wsdl+xml wsdl -application/wspolicy+xml wspolicy -application/x-7z-compressed 7z -application/x-abiword abw -application/x-ace-compressed ace -# application/x-amf -application/x-apple-diskimage dmg -application/x-authorware-bin aab x32 u32 vox -application/x-authorware-map aam -application/x-authorware-seg aas -application/x-bcpio bcpio -application/x-bittorrent torrent -application/x-blorb blb blorb -application/x-bzip bz -application/x-bzip2 bz2 boz -application/x-cbr cbr cba cbt cbz cb7 -application/x-cdlink vcd -application/x-cfs-compressed cfs -application/x-chat chat -application/x-chess-pgn pgn -application/x-conference nsc -# application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-debian-package deb udeb -application/x-dgc-compressed dgc -application/x-director dir dcr dxr cst cct cxt w3d fgd swa -application/x-doom wad -application/x-dtbncx+xml ncx -application/x-dtbook+xml dtb -application/x-dtbresource+xml res -application/x-dvi dvi -application/x-envoy evy -application/x-eva eva -application/x-font-bdf bdf -# application/x-font-dos -# application/x-font-framemaker -application/x-font-ghostscript gsf -# application/x-font-libgrx -application/x-font-linux-psf psf -application/x-font-otf otf -application/x-font-pcf pcf -application/x-font-snf snf -# application/x-font-speedo -# application/x-font-sunos-news -application/x-font-ttf ttf ttc -application/x-font-type1 pfa pfb pfm afm -application/font-woff woff -# application/x-font-vfont -application/x-freearc arc -application/x-futuresplash spl -application/x-gca-compressed gca -application/x-glulx ulx -application/x-gnumeric gnumeric -application/x-gramps-xml gramps -application/x-gtar gtar -# application/x-gzip -application/x-hdf hdf -application/x-install-instructions install -application/x-iso9660-image iso -application/x-java-jnlp-file jnlp -application/x-latex latex -application/x-lzh-compressed lzh lha -application/x-mie mie -application/x-mobipocket-ebook prc mobi -application/x-ms-application application -application/x-ms-shortcut lnk -application/x-ms-wmd wmd -application/x-ms-wmz wmz -application/x-ms-xbap xbap -application/x-msaccess mdb -application/x-msbinder obd -application/x-mscardfile crd -application/x-msclip clp -application/x-msdownload exe dll com bat msi -application/x-msmediaview mvb m13 m14 -application/x-msmetafile wmf wmz emf emz -application/x-msmoney mny -application/x-mspublisher pub -application/x-msschedule scd -application/x-msterminal trm -application/x-mswrite wri -application/x-netcdf nc cdf -application/x-nzb nzb -application/x-pkcs12 p12 pfx -application/x-pkcs7-certificates p7b spc -application/x-pkcs7-certreqresp p7r -application/x-rar-compressed rar -application/x-research-info-systems ris -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-silverlight-app xap -application/x-sql sql -application/x-stuffit sit -application/x-stuffitx sitx -application/x-subrip srt -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-t3vm-image t3 -application/x-tads gam -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-tex-tfm tfm -application/x-texinfo texinfo texi -application/x-tgif obj -application/x-ustar ustar -application/x-wais-source src -application/x-x509-ca-cert der crt -application/x-xfig fig -application/x-xliff+xml xlf -application/x-xpinstall xpi -application/x-xz xz -application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 -# application/x400-bp -application/xaml+xml xaml -# application/xcap-att+xml -# application/xcap-caps+xml -application/xcap-diff+xml xdf -# application/xcap-el+xml -# application/xcap-error+xml -# application/xcap-ns+xml -# application/xcon-conference-info-diff+xml -# application/xcon-conference-info+xml -application/xenc+xml xenc -application/xhtml+xml xhtml xht -# application/xhtml-voice+xml -application/xml xml xsl -application/xml-dtd dtd -# application/xml-external-parsed-entity -# application/xmpp+xml -application/xop+xml xop -application/xproc+xml xpl -application/xslt+xml xslt -application/xspf+xml xspf -application/xv+xml mxml xhvml xvml xvm -application/yang yang -application/yin+xml yin -application/zip zip -# audio/1d-interleaved-parityfec -# audio/32kadpcm -# audio/3gpp -# audio/3gpp2 -# audio/ac3 -audio/adpcm adp -# audio/amr -# audio/amr-wb -# audio/amr-wb+ -# audio/asc -# audio/atrac-advanced-lossless -# audio/atrac-x -# audio/atrac3 -audio/basic au snd -# audio/bv16 -# audio/bv32 -# audio/clearmode -# audio/cn -# audio/dat12 -# audio/dls -# audio/dsr-es201108 -# audio/dsr-es202050 -# audio/dsr-es202211 -# audio/dsr-es202212 -# audio/dv -# audio/dvi4 -# audio/eac3 -# audio/evrc -# audio/evrc-qcp -# audio/evrc0 -# audio/evrc1 -# audio/evrcb -# audio/evrcb0 -# audio/evrcb1 -# audio/evrcwb -# audio/evrcwb0 -# audio/evrcwb1 -# audio/example -# audio/fwdred -# audio/g719 -# audio/g722 -# audio/g7221 -# audio/g723 -# audio/g726-16 -# audio/g726-24 -# audio/g726-32 -# audio/g726-40 -# audio/g728 -# audio/g729 -# audio/g7291 -# audio/g729d -# audio/g729e -# audio/gsm -# audio/gsm-efr -# audio/gsm-hr-08 -# audio/ilbc -# audio/ip-mr_v2.5 -# audio/isac -# audio/l16 -# audio/l20 -# audio/l24 -# audio/l8 -# audio/lpc -audio/midi mid midi kar rmi -# audio/mobile-xmf -audio/mp4 mp4a -# audio/mp4a-latm -# audio/mpa -# audio/mpa-robust -audio/mpeg mpga mp2 mp2a mp3 m2a m3a -# audio/mpeg4-generic -# audio/musepack -audio/ogg oga ogg spx -# audio/opus -# audio/parityfec -# audio/pcma -# audio/pcma-wb -# audio/pcmu-wb -# audio/pcmu -# audio/prs.sid -# audio/qcelp -# audio/red -# audio/rtp-enc-aescm128 -# audio/rtp-midi -# audio/rtx -audio/s3m s3m -audio/silk sil -# audio/smv -# audio/smv0 -# audio/smv-qcp -# audio/sp-midi -# audio/speex -# audio/t140c -# audio/t38 -# audio/telephone-event -# audio/tone -# audio/uemclip -# audio/ulpfec -# audio/vdvi -# audio/vmr-wb -# audio/vnd.3gpp.iufp -# audio/vnd.4sb -# audio/vnd.audiokoz -# audio/vnd.celp -# audio/vnd.cisco.nse -# audio/vnd.cmles.radio-events -# audio/vnd.cns.anp1 -# audio/vnd.cns.inf1 -audio/vnd.dece.audio uva uvva -audio/vnd.digital-winds eol -# audio/vnd.dlna.adts -# audio/vnd.dolby.heaac.1 -# audio/vnd.dolby.heaac.2 -# audio/vnd.dolby.mlp -# audio/vnd.dolby.mps -# audio/vnd.dolby.pl2 -# audio/vnd.dolby.pl2x -# audio/vnd.dolby.pl2z -# audio/vnd.dolby.pulse.1 -audio/vnd.dra dra -audio/vnd.dts dts -audio/vnd.dts.hd dtshd -# audio/vnd.dvb.file -# audio/vnd.everad.plj -# audio/vnd.hns.audio -audio/vnd.lucent.voice lvp -audio/vnd.ms-playready.media.pya pya -# audio/vnd.nokia.mobile-xmf -# audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 ecelp4800 -audio/vnd.nuera.ecelp7470 ecelp7470 -audio/vnd.nuera.ecelp9600 ecelp9600 -# audio/vnd.octel.sbc -# audio/vnd.qcelp -# audio/vnd.rhetorex.32kadpcm -audio/vnd.rip rip -# audio/vnd.sealedmedia.softseal.mpeg -# audio/vnd.vmx.cvsd -# audio/vorbis -# audio/vorbis-config -audio/webm weba -audio/x-aac aac -audio/x-aiff aif aiff aifc -audio/x-caf caf -audio/x-flac flac -audio/x-matroska mka -audio/x-mpegurl m3u -audio/x-ms-wax wax -audio/x-ms-wma wma -audio/x-pn-realaudio ram ra -audio/x-pn-realaudio-plugin rmp -# audio/x-tta -audio/x-wav wav -audio/xm xm -chemical/x-cdx cdx -chemical/x-cif cif -chemical/x-cmdf cmdf -chemical/x-cml cml -chemical/x-csml csml -# chemical/x-pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -# image/example -# image/fits -image/g3fax g3 -image/gif gif -image/ief ief -# image/jp2 -image/jpeg jpeg jpg jpe -# image/jpm -# image/jpx -image/ktx ktx -# image/naplps -image/png png -image/prs.btif btif -# image/prs.pti -image/sgi sgi -image/svg+xml svg svgz -# image/t38 -image/tiff tiff tif -# image/tiff-fx -image/vnd.adobe.photoshop psd -# image/vnd.cns.inf2 -image/vnd.dece.graphic uvi uvvi uvg uvvg -image/vnd.dvb.subtitle sub -image/vnd.djvu djvu djv -image/vnd.dwg dwg -image/vnd.dxf dxf -image/vnd.fastbidsheet fbs -image/vnd.fpx fpx -image/vnd.fst fst -image/vnd.fujixerox.edmics-mmr mmr -image/vnd.fujixerox.edmics-rlc rlc -# image/vnd.globalgraphics.pgb -# image/vnd.microsoft.icon -# image/vnd.mix -image/vnd.ms-modi mdi -image/vnd.ms-photo wdp -image/vnd.net-fpx npx -# image/vnd.radiance -# image/vnd.sealed.png -# image/vnd.sealedmedia.softseal.gif -# image/vnd.sealedmedia.softseal.jpg -# image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff xif -image/webp webp -image/x-3ds 3ds -image/x-cmu-raster ras -image/x-cmx cmx -image/x-freehand fh fhc fh4 fh5 fh7 -image/x-icon ico -image/x-mrsid-image sid -image/x-pcx pcx -image/x-pict pic pct -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-tga tga -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -# message/cpim -# message/delivery-status -# message/disposition-notification -# message/example -# message/external-body -# message/feedback-report -# message/global -# message/global-delivery-status -# message/global-disposition-notification -# message/global-headers -# message/http -# message/imdn+xml -# message/news -# message/partial -message/rfc822 eml mime -# message/s-http -# message/sip -# message/sipfrag -# message/tracking-status -# message/vnd.si.simp -# model/example -model/iges igs iges -model/mesh msh mesh silo -model/vnd.collada+xml dae -model/vnd.dwf dwf -# model/vnd.flatland.3dml -model/vnd.gdl gdl -# model/vnd.gs-gdl -# model/vnd.gs.gdl -model/vnd.gtw gtw -# model/vnd.moml+xml -model/vnd.mts mts -# model/vnd.parasolid.transmit.binary -# model/vnd.parasolid.transmit.text -model/vnd.vtu vtu -model/vrml wrl vrml -model/x3d+binary x3db x3dbz -model/x3d+vrml x3dv x3dvz -model/x3d+xml x3d x3dz -# multipart/alternative -# multipart/appledouble -# multipart/byteranges -# multipart/digest -# multipart/encrypted -# multipart/example -# multipart/form-data -# multipart/header-set -# multipart/mixed -# multipart/parallel -# multipart/related -# multipart/report -# multipart/signed -# multipart/voice-message -# text/1d-interleaved-parityfec -text/cache-manifest appcache -text/calendar ics ifb -text/css css -text/csv csv -# text/directory -# text/dns -# text/ecmascript -# text/enriched -# text/example -# text/fwdred -text/html html htm -# text/javascript -text/n3 n3 -# text/parityfec -text/plain txt text conf def list log in -# text/prs.fallenstein.rst -text/prs.lines.tag dsc -# text/vnd.radisys.msml-basic-layout -# text/red -# text/rfc822-headers -text/richtext rtx -# text/rtf -# text/rtp-enc-aescm128 -# text/rtx -text/sgml sgml sgm -# text/t140 -text/tab-separated-values tsv -text/troff t tr roff man me ms -text/turtle ttl -# text/ulpfec -text/uri-list uri uris urls -text/vcard vcard -# text/vnd.abc -text/vnd.curl curl -text/vnd.curl.dcurl dcurl -text/vnd.curl.scurl scurl -text/vnd.curl.mcurl mcurl -# text/vnd.dmclientscript -text/vnd.dvb.subtitle sub -# text/vnd.esmertec.theme-descriptor -text/vnd.fly fly -text/vnd.fmi.flexstor flx -text/vnd.graphviz gv -text/vnd.in3d.3dml 3dml -text/vnd.in3d.spot spot -# text/vnd.iptc.newsml -# text/vnd.iptc.nitf -# text/vnd.latex-z -# text/vnd.motorola.reflex -# text/vnd.ms-mediapackage -# text/vnd.net2phone.commcenter.command -# text/vnd.si.uricatalogue -text/vnd.sun.j2me.app-descriptor jad -# text/vnd.trolltech.linguist -# text/vnd.wap.si -# text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-asm s asm -text/x-c c cc cxx cpp h hh dic -text/x-fortran f for f77 f90 -text/x-java-source java -text/x-opml opml -text/x-pascal p pas -text/x-nfo nfo -text/x-setext etx -text/x-sfv sfv -text/x-uuencode uu -text/x-vcalendar vcs -text/x-vcard vcf -# text/xml -# text/xml-external-parsed-entity -# video/1d-interleaved-parityfec -video/3gpp 3gp -# video/3gpp-tt -video/3gpp2 3g2 -# video/bmpeg -# video/bt656 -# video/celb -# video/dv -# video/example -video/h261 h261 -video/h263 h263 -# video/h263-1998 -# video/h263-2000 -video/h264 h264 -# video/h264-rcdo -# video/h264-svc -video/jpeg jpgv -# video/jpeg2000 -video/jpm jpm jpgm -video/mj2 mj2 mjp2 -# video/mp1s -# video/mp2p -# video/mp2t -video/mp4 mp4 mp4v mpg4 -# video/mp4v-es -video/mpeg mpeg mpg mpe m1v m2v -# video/mpeg4-generic -# video/mpv -# video/nv -video/ogg ogv -# video/parityfec -# video/pointer -video/quicktime qt mov -# video/raw -# video/rtp-enc-aescm128 -# video/rtx -# video/smpte292m -# video/ulpfec -# video/vc1 -# video/vnd.cctv -video/vnd.dece.hd uvh uvvh -video/vnd.dece.mobile uvm uvvm -# video/vnd.dece.mp4 -video/vnd.dece.pd uvp uvvp -video/vnd.dece.sd uvs uvvs -video/vnd.dece.video uvv uvvv -# video/vnd.directv.mpeg -# video/vnd.directv.mpeg-tts -# video/vnd.dlna.mpeg-tts -video/vnd.dvb.file dvb -video/vnd.fvt fvt -# video/vnd.hns.video -# video/vnd.iptvforum.1dparityfec-1010 -# video/vnd.iptvforum.1dparityfec-2005 -# video/vnd.iptvforum.2dparityfec-1010 -# video/vnd.iptvforum.2dparityfec-2005 -# video/vnd.iptvforum.ttsavc -# video/vnd.iptvforum.ttsmpeg2 -# video/vnd.motorola.video -# video/vnd.motorola.videop -video/vnd.mpegurl mxu m4u -video/vnd.ms-playready.media.pyv pyv -# video/vnd.nokia.interleaved-multimedia -# video/vnd.nokia.videovoip -# video/vnd.objectvideo -# video/vnd.sealed.mpeg1 -# video/vnd.sealed.mpeg4 -# video/vnd.sealed.swf -# video/vnd.sealedmedia.softseal.mov -video/vnd.uvvu.mp4 uvu uvvu -video/vnd.vivo viv -video/webm webm -video/x-f4v f4v -video/x-fli fli -video/x-flv flv -video/x-m4v m4v -video/x-matroska mkv mk3d mks -video/x-mng mng -video/x-ms-asf asf asx -video/x-ms-vob vob -video/x-ms-wm wm -video/x-ms-wmv wmv -video/x-ms-wmx wmx -video/x-ms-wvx wvx -video/x-msvideo avi -video/x-sgi-movie movie -video/x-smv smv -x-conference/x-cooltalk ice diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/types/node.types b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/types/node.types deleted file mode 100644 index 55b2cf7..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/mime/types/node.types +++ /dev/null @@ -1,77 +0,0 @@ -# What: WebVTT -# Why: To allow formats intended for marking up external text track resources. -# http://dev.w3.org/html5/webvtt/ -# Added by: niftylettuce -text/vtt vtt - -# What: Google Chrome Extension -# Why: To allow apps to (work) be served with the right content type header. -# http://codereview.chromium.org/2830017 -# Added by: niftylettuce -application/x-chrome-extension crx - -# What: HTC support -# Why: To properly render .htc files such as CSS3PIE -# Added by: niftylettuce -text/x-component htc - -# What: HTML5 application cache manifes ('.manifest' extension) -# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps -# per https://developer.mozilla.org/en/offline_resources_in_firefox -# Added by: louisremi -text/cache-manifest manifest - -# What: node binary buffer format -# Why: semi-standard extension w/in the node community -# Added by: tootallnate -application/octet-stream buffer - -# What: The "protected" MP-4 formats used by iTunes. -# Why: Required for streaming music to browsers (?) -# Added by: broofa -application/mp4 m4p -audio/mp4 m4a - -# What: Video format, Part of RFC1890 -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -video/MP2T ts - -# What: EventSource mime type -# Why: mime type of Server-Sent Events stream -# http://www.w3.org/TR/eventsource/#text-event-stream -# Added by: francois2metz -text/event-stream event-stream - -# What: Mozilla App manifest mime type -# Why: https://developer.mozilla.org/en/Apps/Manifest#Serving_manifests -# Added by: ednapiranha -application/x-web-app-manifest+json webapp - -# What: Lua file types -# Why: Googling around shows de-facto consensus on these -# Added by: creationix (Issue #45) -text/x-lua lua -application/x-lua-bytecode luac - -# What: Markdown files, as per http://daringfireball.net/projects/markdown/syntax -# Why: http://stackoverflow.com/questions/10701983/what-is-the-mime-type-for-markdown -# Added by: avoidwork -text/x-markdown markdown md mkd - -# What: ini files -# Why: because they're just text files -# Added by: Matthew Kastor -text/plain ini - -# What: DASH Adaptive Streaming manifest -# Why: https://developer.mozilla.org/en-US/docs/DASH_Adaptive_Streaming_for_HTML_5_Video -# Added by: eelcocramer -application/dash+xml mdp - -# What: OpenType font files - http://www.microsoft.com/typography/otspec/ -# Why: Browsers usually ignore the font MIME types and sniff the content, -# but Chrome, shows a warning if OpenType fonts aren't served with -# the `font/opentype` MIME type: http://i.imgur.com/8c5RN8M.png. -# Added by: alrra -font/opentype otf diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/.npmignore b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/.npmignore deleted file mode 100644 index d1aa0ce..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -test -History.md -Makefile -component.json diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/README.md deleted file mode 100644 index d4ab12a..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# ms.js: miliseconds conversion utility - -```js -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5s') // 5000 -ms('100') // 100 -``` - -```js -ms(60000) // "1m" -ms(2 * 60000) // "2m" -ms(ms('10 hours')) // "10h" -``` - -```js -ms(60000, { long: true }) // "1 minute" -ms(2 * 60000, { long: true }) // "2 minutes" -ms(ms('10 hours', { long: true })) // "10 hours" -``` - -- Node/Browser compatible. Published as `ms` in NPM. -- If a number is supplied to `ms`, a string with a unit is returned. -- If a string that contains the number is supplied, it returns it as -a number (e.g: it returns `100` for `'100'`). -- If you pass a string with a number and a valid unit, the number of -equivalent ms is returned. - -## License - -MIT \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/index.js deleted file mode 100644 index c5847f8..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/index.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 's': - return n * s; - case 'ms': - return n; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/package.json deleted file mode 100644 index 9ad9189..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/ms/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "ms", - "version": "0.6.2", - "description": "Tiny ms conversion utility", - "repository": { - "type": "git", - "url": "git://github.com/guille/ms.js.git" - }, - "main": "./index", - "devDependencies": { - "mocha": "*", - "expect.js": "*", - "serve": "*" - }, - "component": { - "scripts": { - "ms/index.js": "index.js" - } - }, - "bugs": { - "url": "https://github.com/guille/ms.js/issues" - }, - "_id": "ms@0.6.2", - "dist": { - "shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.6.2.tgz" - }, - "_from": "ms@0.6.2", - "_npmVersion": "1.2.30", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "directories": {}, - "_shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c", - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/guille/ms.js", - "scripts": {} -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/HISTORY.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/HISTORY.md deleted file mode 100644 index 1a4063d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/HISTORY.md +++ /dev/null @@ -1,71 +0,0 @@ -2.1.1 / 2014-10-22 -================== - - * Fix handling of pipelined requests - -2.1.0 / 2014-08-16 -================== - - * Check if `socket` is detached - * Return `undefined` for `isFinished` if state unknown - -2.0.0 / 2014-08-16 -================== - - * Add `isFinished` function - * Move to `jshttp` organization - * Remove support for plain socket argument - * Rename to `on-finished` - * Support both `req` and `res` as arguments - * deps: ee-first@1.0.5 - -1.2.2 / 2014-06-10 -================== - - * Reduce listeners added to emitters - - avoids "event emitter leak" warnings when used multiple times on same request - -1.2.1 / 2014-06-08 -================== - - * Fix returned value when already finished - -1.2.0 / 2014-06-05 -================== - - * Call callback when called on already-finished socket - -1.1.4 / 2014-05-27 -================== - - * Support node.js 0.8 - -1.1.3 / 2014-04-30 -================== - - * Make sure errors passed as instanceof `Error` - -1.1.2 / 2014-04-18 -================== - - * Default the `socket` to passed-in object - -1.1.1 / 2014-01-16 -================== - - * Rename module to `finished` - -1.1.0 / 2013-12-25 -================== - - * Call callback when called on already-errored socket - -1.0.1 / 2013-12-20 -================== - - * Actually pass the error to the callback - -1.0.0 / 2013-12-20 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/LICENSE deleted file mode 100644 index 5931fd2..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Jonathan Ong -Copyright (c) 2014 Douglas Christopher Wilson - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/README.md deleted file mode 100644 index 6fb0e4d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# on-finished - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Execute a callback when a request closes, finishes, or errors. - -## Install - -```sh -$ npm install on-finished -``` - -## API - -```js -var onFinished = require('on-finished') -``` - -### onFinished(res, listener) - -Attach a listener to listen for the response to finish. The listener will -be invoked only once when the response finished. If the response finished -to to an error, the first argument will contain the error. - -Listening to the end of a response would be used to close things associated -with the response, like open files. - -```js -onFinished(res, function (err) { - // clean up open fds, etc. -}) -``` - -### onFinished(req, listener) - -Attach a listener to listen for the request to finish. The listener will -be invoked only once when the request finished. If the request finished -to to an error, the first argument will contain the error. - -Listening to the end of a request would be used to know when to continue -after reading the data. - -```js -var data = '' - -req.setEncoding('utf8') -res.on('data', function (str) { - data += str -}) - -onFinished(req, function (err) { - // data is read unless there is err -}) -``` - -### onFinished.isFinished(res) - -Determine if `res` is already finished. This would be useful to check and -not even start certain operations if the response has already finished. - -### onFinished.isFinished(req) - -Determine if `req` is already finished. This would be useful to check and -not even start certain operations if the request has already finished. - -### Example - -The following code ensures that file descriptors are always closed -once the response finishes. - -```js -var destroy = require('destroy') -var http = require('http') -var onFinished = require('on-finished') - -http.createServer(function onRequest(req, res) { - var stream = fs.createReadStream('package.json') - stream.pipe(res) - onFinished(res, function (err) { - destroy(stream) - }) -}) -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/on-finished.svg?style=flat -[npm-url]: https://npmjs.org/package/on-finished -[node-version-image]: https://img.shields.io/node/v/on-finished.svg?style=flat -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/on-finished.svg?style=flat -[travis-url]: https://travis-ci.org/jshttp/on-finished -[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished.svg?style=flat -[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master -[downloads-image]: https://img.shields.io/npm/dm/on-finished.svg?style=flat -[downloads-url]: https://npmjs.org/package/on-finished diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/index.js deleted file mode 100644 index e75a7e9..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/index.js +++ /dev/null @@ -1,191 +0,0 @@ -/*! - * on-finished - * Copyright(c) 2013 Jonathan Ong - * Copyright(c) 2014 Douglas Christopher Wilson - * MIT Licensed - */ - -/** - * Module exports. - */ - -module.exports = onFinished; -module.exports.isFinished = isFinished; - -/** -* Module dependencies. -*/ - -var first = require('ee-first') - -/** -* Variables. -*/ - -/* istanbul ignore next */ -var defer = typeof setImmediate === 'function' - ? setImmediate - : function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) } - -/** - * Invoke callback when the response has finished, useful for - * cleaning up resources afterwards. - * - * @param {object} msg - * @param {function} listener - * @return {object} - * @api public - */ - -function onFinished(msg, listener) { - if (isFinished(msg) !== false) { - defer(listener) - return msg - } - - // attach the listener to the message - attachListener(msg, listener) - - return msg -} - -/** - * Determine if message is already finished. - * - * @param {object} msg - * @return {boolean} - * @api public - */ - -function isFinished(msg) { - var socket = msg.socket - - if (typeof msg.finished === 'boolean') { - // OutgoingMessage - return Boolean(msg.finished || (socket && !socket.writable)) - } - - if (typeof msg.complete === 'boolean') { - // IncomingMessage - return Boolean(!socket || msg.complete || !socket.readable) - } - - // don't know - return undefined -} - -/** - * Attach a finished listener to the message. - * - * @param {object} msg - * @param {function} callback - * @private - */ - -function attachFinishedListener(msg, callback) { - var eeMsg - var eeSocket - var finished = false - - function onFinish(error) { - eeMsg.cancel() - eeSocket.cancel() - - finished = true - callback(error) - } - - // finished on first message event - eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish) - - function onSocket(socket) { - // remove listener - msg.removeListener('socket', onSocket) - - if (finished) return - if (eeMsg !== eeSocket) return - - // finished on first socket event - eeSocket = first([[socket, 'error', 'close']], onFinish) - } - - if (msg.socket) { - // socket already assigned - onSocket(msg.socket) - return - } - - // wait for socket to be assigned - msg.on('socket', onSocket) - - if (msg.socket === undefined) { - // node.js 0.8 patch - patchAssignSocket(msg, onSocket) - } -} - -/** - * Attach the listener to the message. - * - * @param {object} msg - * @return {function} - * @api private - */ - -function attachListener(msg, listener) { - var attached = msg.__onFinished - - // create a private single listener with queue - if (!attached || !attached.queue) { - attached = msg.__onFinished = createListener(msg) - attachFinishedListener(msg, attached) - } - - attached.queue.push(listener) -} - -/** - * Create listener on message. - * - * @param {object} msg - * @return {function} - * @api private - */ - -function createListener(msg) { - function listener(err) { - if (msg.__onFinished === listener) msg.__onFinished = null - if (!listener.queue) return - - var queue = listener.queue - listener.queue = null - - for (var i = 0; i < queue.length; i++) { - queue[i](err) - } - } - - listener.queue = [] - - return listener -} - -/** - * Patch ServerResponse.prototype.assignSocket for node.js 0.8. - * - * @param {ServerResponse} res - * @param {function} callback - * @private - */ - -function patchAssignSocket(res, callback) { - var assignSocket = res.assignSocket - - if (typeof assignSocket !== 'function') return - - // res.on('socket', callback) is broken in 0.8 - res.assignSocket = function _assignSocket(socket) { - assignSocket.call(this, socket) - callback(socket) - } -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/LICENSE deleted file mode 100644 index c1b15a1..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2014 Jonathan Ong me@jongleberry.com - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/README.md deleted file mode 100644 index bb16aab..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# EE First - -[![NPM version][npm-image]][npm-url] -[![Build status][travis-image]][travis-url] -[![Test coverage][coveralls-image]][coveralls-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] -[![Gittip][gittip-image]][gittip-url] - -Get the first event in a set of event emitters and event pairs, -then clean up after itself. - -## Install - -```sh -$ npm install ee-first -``` - -## API - -```js -var first = require('ee-first') -``` - -### first(arr, listener) - -Invoke `listener` on the first event from the list specified in `arr`. `arr` is -an array of arrays, with each array in the format `[ee, ...event]`. `listener` -will be called only once, the first time any of the given events are emitted. If -`error` is one of the listened events, then if that fires first, the `listener` -will be given the `err` argument. - -The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the -first argument emitted from an `error` event, if applicable; `ee` is the event -emitter that fired; `event` is the string event name that fired; and `args` is an -array of the arguments that were emitted on the event. - -```js -var ee1 = new EventEmitter() -var ee2 = new EventEmitter() - -first([ - [ee1, 'close', 'end', 'error'], - [ee2, 'error'] -], function (err, ee, event, args) { - // listener invoked -}) -``` - -#### .cancel() - -The group of listeners can be cancelled before being invoked and have all the event -listeners removed from the underlying event emitters. - -```js -var thunk = first([ - [ee1, 'close', 'end', 'error'], - [ee2, 'error'] -], function (err, ee, event, args) { - // listener invoked -}) - -// cancel and clean up -thunk.cancel() -``` - -[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square -[npm-url]: https://npmjs.org/package/ee-first -[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square -[github-url]: https://github.com/jonathanong/ee-first/tags -[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square -[travis-url]: https://travis-ci.org/jonathanong/ee-first -[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square -[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master -[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square -[license-url]: LICENSE.md -[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square -[downloads-url]: https://npmjs.org/package/ee-first -[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square -[gittip-url]: https://www.gittip.com/jonathanong/ diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/index.js deleted file mode 100644 index 1d66203..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/index.js +++ /dev/null @@ -1,68 +0,0 @@ - -module.exports = function first(stuff, done) { - if (!Array.isArray(stuff)) - throw new TypeError('arg must be an array of [ee, events...] arrays') - - var cleanups = [] - - for (var i = 0; i < stuff.length; i++) { - var arr = stuff[i] - - if (!Array.isArray(arr) || arr.length < 2) - throw new TypeError('each array member must be [ee, events...]') - - var ee = arr[0] - - for (var j = 1; j < arr.length; j++) { - var event = arr[j] - var fn = listener(event, callback) - - // listen to the event - ee.on(event, fn) - // push this listener to the list of cleanups - cleanups.push({ - ee: ee, - event: event, - fn: fn, - }) - } - } - - function callback() { - cleanup() - done.apply(null, arguments) - } - - function cleanup() { - var x - for (var i = 0; i < cleanups.length; i++) { - x = cleanups[i] - x.ee.removeListener(x.event, x.fn) - } - } - - function thunk(fn) { - done = fn - } - - thunk.cancel = cleanup - - return thunk -} - -function listener(event, done) { - return function onevent(arg1) { - var args = new Array(arguments.length) - var ee = this - var err = event === 'error' - ? arg1 - : null - - // copy args to prevent arguments escaping scope - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - - done(err, ee, event, args) - } -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/package.json deleted file mode 100644 index 5b39931..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/node_modules/ee-first/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "ee-first", - "description": "return the first event in a set of ee/event pairs", - "version": "1.1.0", - "author": { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/jonathanong/ee-first" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "1" - }, - "files": [ - "index.js", - "LICENSE" - ], - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "gitHead": "a6412004da4745941af2fc98ec30c8da570da7ea", - "bugs": { - "url": "https://github.com/jonathanong/ee-first/issues" - }, - "homepage": "https://github.com/jonathanong/ee-first", - "_id": "ee-first@1.1.0", - "_shasum": "6a0d7c6221e490feefd92ec3f441c9ce8cd097f4", - "_from": "ee-first@1.1.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "dist": { - "shasum": "6a0d7c6221e490feefd92ec3f441c9ce8cd097f4", - "tarball": "http://registry.npmjs.org/ee-first/-/ee-first-1.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/package.json deleted file mode 100644 index ea60078..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/on-finished/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "on-finished", - "description": "Execute a callback when a request closes, finishes, or errors", - "version": "2.1.1", - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/jshttp/on-finished" - }, - "dependencies": { - "ee-first": "1.1.0" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "~2.0.0" - }, - "engines": { - "node": ">= 0.8" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "index.js" - ], - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/" - }, - "gitHead": "8ec5fa639ace400b543b5bc1821ce909b9acdc03", - "bugs": { - "url": "https://github.com/jshttp/on-finished/issues" - }, - "homepage": "https://github.com/jshttp/on-finished", - "_id": "on-finished@2.1.1", - "_shasum": "f82ca1c9e3a4f3286b1b9938610e5b8636bd3cb2", - "_from": "on-finished@~2.1.1", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - } - ], - "dist": { - "shasum": "f82ca1c9e3a4f3286b1b9938610e5b8636bd3cb2", - "tarball": "http://registry.npmjs.org/on-finished/-/on-finished-2.1.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.1.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/HISTORY.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/HISTORY.md deleted file mode 100644 index 1bb53bd..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/HISTORY.md +++ /dev/null @@ -1,35 +0,0 @@ -1.0.2 / 2014-09-08 -================== - - * Support Node.js 0.6 - -1.0.1 / 2014-09-07 -================== - - * Move repository to jshttp - -1.0.0 / 2013-12-11 -================== - - * Add repository to package.json - * Add MIT license - -0.0.4 / 2012-06-17 -================== - - * Change ret -1 for unsatisfiable and -2 when invalid - -0.0.3 / 2012-06-17 -================== - - * Fix last-byte-pos default to len - 1 - -0.0.2 / 2012-06-14 -================== - - * Add `.type` - -0.0.1 / 2012-06-11 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/LICENSE deleted file mode 100644 index a491841..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012-2014 TJ Holowaychuk - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/README.md deleted file mode 100644 index 6a2682f..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# range-parser - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -Range header field parser. - -## Installation - -``` -$ npm install range-parser -``` - -## Examples - -```js -assert(-1 == parse(200, 'bytes=500-20')); -assert(-2 == parse(200, 'bytes=malformed')); -parse(200, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 199 }])); -parse(1000, 'bytes=0-499').should.eql(arr('bytes', [{ start: 0, end: 499 }])); -parse(1000, 'bytes=40-80').should.eql(arr('bytes', [{ start: 40, end: 80 }])); -parse(1000, 'bytes=-500').should.eql(arr('bytes', [{ start: 500, end: 999 }])); -parse(1000, 'bytes=-400').should.eql(arr('bytes', [{ start: 600, end: 999 }])); -parse(1000, 'bytes=500-').should.eql(arr('bytes', [{ start: 500, end: 999 }])); -parse(1000, 'bytes=400-').should.eql(arr('bytes', [{ start: 400, end: 999 }])); -parse(1000, 'bytes=0-0').should.eql(arr('bytes', [{ start: 0, end: 0 }])); -parse(1000, 'bytes=-1').should.eql(arr('bytes', [{ start: 999, end: 999 }])); -parse(1000, 'items=0-5').should.eql(arr('items', [{ start: 0, end: 5 }])); -parse(1000, 'bytes=40-80,-1').should.eql(arr('bytes', [{ start: 40, end: 80 }, { start: 999, end: 999 }])); -``` - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/range-parser.svg?style=flat -[npm-url]: https://npmjs.org/package/range-parser -[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/range-parser.svg?style=flat -[travis-url]: https://travis-ci.org/jshttp/range-parser -[coveralls-image]: https://img.shields.io/coveralls/jshttp/range-parser.svg?style=flat -[coveralls-url]: https://coveralls.io/r/jshttp/range-parser -[downloads-image]: https://img.shields.io/npm/dm/range-parser.svg?style=flat -[downloads-url]: https://npmjs.org/package/range-parser diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/index.js deleted file mode 100644 index 09a6c40..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/index.js +++ /dev/null @@ -1,49 +0,0 @@ - -/** - * Parse "Range" header `str` relative to the given file `size`. - * - * @param {Number} size - * @param {String} str - * @return {Array} - * @api public - */ - -module.exports = function(size, str){ - var valid = true; - var i = str.indexOf('='); - - if (-1 == i) return -2; - - var arr = str.slice(i + 1).split(',').map(function(range){ - var range = range.split('-') - , start = parseInt(range[0], 10) - , end = parseInt(range[1], 10); - - // -nnn - if (isNaN(start)) { - start = size - end; - end = size - 1; - // nnn- - } else if (isNaN(end)) { - end = size - 1; - } - - // limit last-byte-pos to current length - if (end > size - 1) end = size - 1; - - // invalid - if (isNaN(start) - || isNaN(end) - || start > end - || start < 0) valid = false; - - return { - start: start, - end: end - }; - }); - - arr.type = str.slice(0, i); - - return valid ? arr : -1; -}; diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/package.json deleted file mode 100644 index 9fc243b..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/node_modules/range-parser/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "range-parser", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "description": "Range header field string parser", - "version": "1.0.2", - "license": "MIT", - "keywords": [ - "range", - "parser", - "http" - ], - "repository": { - "type": "git", - "url": "https://github.com/jshttp/range-parser" - }, - "devDependencies": { - "istanbul": "0", - "mocha": "1", - "should": "2" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "test": "mocha --reporter spec --require should", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require should", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --require should" - }, - "gitHead": "ae23b02ce705b56e7f7c48e832d41fa710227ecc", - "bugs": { - "url": "https://github.com/jshttp/range-parser/issues" - }, - "homepage": "https://github.com/jshttp/range-parser", - "_id": "range-parser@1.0.2", - "_shasum": "06a12a42e5131ba8e457cd892044867f2344e549", - "_from": "range-parser@~1.0.2", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "jonathanong", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - } - ], - "dist": { - "shasum": "06a12a42e5131ba8e457cd892044867f2344e549", - "tarball": "http://registry.npmjs.org/range-parser/-/range-parser-1.0.2.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.0.2.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/send/package.json deleted file mode 100644 index de43e7d..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/send/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "send", - "description": "Better streaming static file server with Range and conditional-GET support", - "version": "0.10.1", - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - } - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/tj/send" - }, - "keywords": [ - "static", - "file", - "server" - ], - "dependencies": { - "debug": "~2.1.0", - "depd": "~1.0.0", - "destroy": "1.0.3", - "escape-html": "1.0.1", - "etag": "~1.5.0", - "fresh": "0.2.4", - "mime": "1.2.11", - "ms": "0.6.2", - "on-finished": "~2.1.1", - "range-parser": "~1.0.2" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "~2.0.0", - "should": "~4.1.0", - "supertest": "~0.14.0" - }, - "files": [ - "History.md", - "LICENSE", - "index.js" - ], - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "mocha --check-leaks --reporter spec --bail", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec" - }, - "gitHead": "a5e6237f3e812a99d079e2100f6294251ef5f465", - "bugs": { - "url": "https://github.com/tj/send/issues" - }, - "homepage": "https://github.com/tj/send", - "_id": "send@0.10.1", - "_shasum": "7745c50ec72f115115980e8fb179aec01900e08a", - "_from": "send@0.10.1", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - } - ], - "dist": { - "shasum": "7745c50ec72f115115980e8fb179aec01900e08a", - "tarball": "http://registry.npmjs.org/send/-/send-0.10.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/send/-/send-0.10.1.tgz" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/.travis.yml b/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/.travis.yml deleted file mode 100644 index af92b02..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: "node_js" -node_js: - - "0.4" - - "0.6" - - "0.8" - - "0.10" diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/LICENSE b/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/LICENSE deleted file mode 100644 index e33bd10..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2013 Jared Hanson - -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 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/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/README.md b/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/README.md deleted file mode 100644 index 2f94e9b..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# utils-merge - -Merges the properties from a source object into a destination object. - -## Install - - $ npm install utils-merge - -## Usage - -```javascript -var a = { foo: 'bar' } - , b = { bar: 'baz' }; - -merge(a, b); -// => { foo: 'bar', bar: 'baz' } -``` - -## Tests - - $ npm install - $ npm test - -[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge) - -## Credits - - - [Jared Hanson](http://github.com/jaredhanson) - -## License - -[The MIT License](http://opensource.org/licenses/MIT) - -Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)> diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/index.js b/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/index.js deleted file mode 100644 index 4265c69..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api public - */ - -exports = module.exports = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; - } - } - return a; -}; diff --git a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/package.json b/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/package.json deleted file mode 100644 index e655383..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/node_modules/utils-merge/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "utils-merge", - "version": "1.0.0", - "description": "merge() utility function", - "keywords": [ - "util" - ], - "repository": { - "type": "git", - "url": "git://github.com/jaredhanson/utils-merge.git" - }, - "bugs": { - "url": "http://github.com/jaredhanson/utils-merge/issues" - }, - "author": { - "name": "Jared Hanson", - "email": "jaredhanson@gmail.com", - "url": "http://www.jaredhanson.net/" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "main": "./index", - "dependencies": {}, - "devDependencies": { - "mocha": "1.x.x", - "chai": "1.x.x" - }, - "scripts": { - "test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js" - }, - "engines": { - "node": ">= 0.4.0" - }, - "readme": "# utils-merge\n\nMerges the properties from a source object into a destination object.\n\n## Install\n\n $ npm install utils-merge\n\n## Usage\n\n```javascript\nvar a = { foo: 'bar' }\n , b = { bar: 'baz' };\n\nmerge(a, b);\n// => { foo: 'bar', bar: 'baz' }\n```\n\n## Tests\n\n $ npm install\n $ npm test\n\n[![Build Status](https://secure.travis-ci.org/jaredhanson/utils-merge.png)](http://travis-ci.org/jaredhanson/utils-merge)\n\n## Credits\n\n - [Jared Hanson](http://github.com/jaredhanson)\n\n## License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n\nCopyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>\n", - "readmeFilename": "README.md", - "_id": "utils-merge@1.0.0", - "dist": { - "shasum": "0294fb922bb9375153541c4f7096231f287c8af8", - "tarball": "http://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz" - }, - "_from": "utils-merge@1.0.0", - "_npmVersion": "1.2.25", - "_npmUser": { - "name": "jaredhanson", - "email": "jaredhanson@gmail.com" - }, - "maintainers": [ - { - "name": "jaredhanson", - "email": "jaredhanson@gmail.com" - } - ], - "directories": {}, - "_shasum": "0294fb922bb9375153541c4f7096231f287c8af8", - "_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", - "homepage": "https://github.com/jaredhanson/utils-merge" -} diff --git a/node_modules/browser-sync/node_modules/serve-static/package.json b/node_modules/browser-sync/node_modules/serve-static/package.json deleted file mode 100644 index 5915cfa..0000000 --- a/node_modules/browser-sync/node_modules/serve-static/package.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "serve-static", - "description": "Serve static files", - "version": "1.7.1", - "author": { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/expressjs/serve-static" - }, - "dependencies": { - "escape-html": "1.0.1", - "parseurl": "~1.3.0", - "send": "0.10.1", - "utils-merge": "1.0.0" - }, - "devDependencies": { - "istanbul": "0.3.2", - "mocha": "~2.0.0", - "should": "~4.1.0", - "supertest": "~0.14.0" - }, - "files": [ - "LICENSE", - "HISTORY.md", - "index.js" - ], - "engines": { - "node": ">= 0.8.0" - }, - "scripts": { - "test": "mocha --reporter spec --bail --check-leaks --require should test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks --require should test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks --require should test/" - }, - "gitHead": "61f59894e6a3d41532383ca440a395772bcdc8ed", - "bugs": { - "url": "https://github.com/expressjs/serve-static/issues" - }, - "homepage": "https://github.com/expressjs/serve-static", - "_id": "serve-static@1.7.1", - "_shasum": "6ea54d5ba7ef563f00e5fad25d0e4f5307e9809b", - "_from": "serve-static@^1.4.2", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - }, - { - "name": "shtylman", - "email": "shtylman@gmail.com" - }, - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "mscdex", - "email": "mscdex@mscdex.net" - }, - { - "name": "fishrock123", - "email": "fishrock123@rocketmail.com" - } - ], - "dist": { - "shasum": "6ea54d5ba7ef563f00e5fad25d0e4f5307e9809b", - "tarball": "http://registry.npmjs.org/serve-static/-/serve-static-1.7.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.7.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/.npmignore b/node_modules/browser-sync/node_modules/socket.io/.npmignore deleted file mode 100644 index 55a736b..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -.gitignore diff --git a/node_modules/browser-sync/node_modules/socket.io/.travis.yml b/node_modules/browser-sync/node_modules/socket.io/.travis.yml deleted file mode 100644 index 1e811f5..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.11" - -git: - depth: 1 - -matrix: - fast_finish: true - allow_failures: - - node_js: "0.11" - -notifications: - irc: "irc.freenode.org#socket.io" diff --git a/node_modules/browser-sync/node_modules/socket.io/History.md b/node_modules/browser-sync/node_modules/socket.io/History.md deleted file mode 100644 index b1bab94..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/History.md +++ /dev/null @@ -1,451 +0,0 @@ - -1.2.1 / 2014-11-21 -================== - - * fix protocol violations and improve error handling (GH-1880) - * package: bump `engine.io` for websocket leak fix [3rd-Eden] - * style tweaks - -1.2.0 / 2014-10-27 -================== - - * package: bump `engine.io` - * downloads badge - * add test to check that empty rooms are autopruned - * added Server#origins(v:Function) description for dynamic CORS - * added test coverage for Server#origins(function) for dynamic CORS - * added optional Server#origins(function) for dynamic CORS - * fix usage example for Server#close - * package: fix main file for example application 'chat' - * package: bump `socket.io-parser` - * update README http ctor to createServer() - * bump adapter with a lot of fixes for room bookkeeping - -1.1.0 / 2014-09-04 -================== - - * examples: minor fix of escaping - * testing for equivalence of namespaces starting with / or without - * update index.js - * added relevant tests - * take "" and "/" as equivalent namespaces on server - * use svg instead of png to get better image quality in readme - * make CI build faster - * fix splice arguments and `socket.rooms` value update in `socket.leaveAll`. - * client cannot connect to non-existing namespaces - * bump engine.io version to get the cached IP address - * fixed handshake object address property and made the test case more strict. - * package: bump `engine.io` - * fixed the failing test where server crashes on disconnect involving connectBuffer - * npmignore: ignore `.gitignore` (fixes #1607) - * test: added failing case for `socket.disconnect` and nsps - * fix repo in package.json - * improve Close documentation - * use ephemeral ports - * fix: We should use the standard http protocol to handler the etag header. - * override default browser font-family for inputs - * update has-binary-data to 1.0.3 - * add close specs - * add ability to stop the http server even if not created inside socket.io - * make sure server gets close - * Add test case for checking that reconnect_failed is fired only once upon failure - * package: bump `socket.io-parser` for `component-emitter` dep fix - -1.0.6 / 2014-06-19 -================== - - * package: bump `socket.io-client` - -1.0.5 / 2014-06-16 -================== - - * package: bump `engine.io` to fix jsonp `\n` bug and CORS warnings - * index: fix typo [yanatan16] - * add `removeListener` to blacklisted events - * examples: clearer instructions to install chat example - * index: fix namespace `connectBuffer` issue - -1.0.4 / 2014-06-02 -================== - - * package: bump socket.io-client - -1.0.3 / 2014-05-31 -================== - - * package: bump `socket.io-client` - * package: bump `socket.io-parser` for binary ACK fix - * package: bump `engine.io` for binary UTF8 fix - * example: fix XSS in chat example - -1.0.2 / 2014-05-28 -================== - - * package: bump `socket.io-parser` for windows fix - -1.0.1 / 2014-05-28 -================== - - * bump due to bad npm tag - -1.0.0 / 2014-05-28 -================== - - * stable release - -1.0.0-pre5 / 2014-05-22 -======================= - - * package: bump `socket.io-client` for parser fixes - * package: bump `engine.io` - -1.0.0-pre4 / 2014-05-19 -======================= - - * package: bump client - -1.0.0-pre3 / 2014-05-17 -======================= - - * package: bump parser - * package: bump engine.io - -1.0.0-pre2 / 2014-04-27 -======================= - - * package: bump `engine.io` - * added backwards compatible of engine.io maxHttpBufferSize - * added test that server and client using same protocol - * added support for setting allowed origins - * added information about logging - * the set function in server can be used to set some attributes for BC - * fix error in callback call 'done' instead of 'next' in docs - * package: bump `socket.io-parser` - * package: bump `expect.js` - * added some new tests, including binary with acks - -1.0.0-pre / 2014-03-14 -====================== - - * implemented `engine.io` - * implemented `socket.io-adapter` - * implemented `socket.io-protocol` - * implemented `debug` and improved instrumentation - * added binary support - * added new `require('io')(srv)` signature - * simplified `socket.io-client` serving - -0.9.14 / 2013-03-29 -=================== - - * manager: fix memory leak with SSL [jpallen] - -0.9.13 / 2012-12-13 -=================== - - * package: fixed `base64id` requirement - -0.9.12 / 2012-12-13 -=================== - - * manager: fix for latest node which is returning a clone with `listeners` [viirya] - -0.9.11 / 2012-11-02 -=================== - - * package: move redis to optionalDependenices [3rd-Eden] - * bumped client - -0.9.10 / 2012-08-10 -=================== - - * Don't lowercase log messages - * Always set the HTTP response in case an error should be returned to the client - * Create or destroy the flash policy server on configuration change - * Honour configuration to disable flash policy server - * Add express 3.0 instructions on Readme.md - * Bump client - -0.9.9 / 2012-08-01 -================== - - * Fixed sync disconnect xhrs handling - * Put license text in its own file (#965) - * Add warning to .listen() to ease the migration to Express 3.x - * Restored compatibility with node 0.4.x - -0.9.8 / 2012-07-24 -================== - - * Bumped client. - -0.9.7 / 2012-07-24 -================== - - * Prevent crash when socket leaves a room twice. - * Corrects unsafe usage of for..in - * Fix for node 0.8 with `gzip compression` [vadimi] - * Update redis to support Node 0.8.x - * Made ID generation securely random - * Fix Redis Store race condition in manager onOpen unsubscribe callback - * Fix for EventEmitters always reusing the same Array instance for listeners - -0.9.6 / 2012-04-17 -================== - - * Fixed XSS in jsonp-polling. - -0.9.5 / 2012-04-05 -================== - - * Added test for polling and socket close. - * Ensure close upon request close. - * Fix disconnection reason being lost for polling transports. - * Ensure that polling transports work with Connection: close. - * Log disconnection reason. - -0.9.4 / 2012-04-01 -================== - - * Disconnecting from namespace improvement (#795) [DanielBaulig] - * Bumped client with polling reconnection loop (#438) - -0.9.3 / 2012-03-28 -================== - - * Fix "Syntax error" on FF Web Console with XHR Polling [mikito] - -0.9.2 / 2012-03-13 -================== - - * More sensible close `timeout default` (fixes disconnect issue) - -0.9.1-1 / 2012-03-02 -==================== - - * Bumped client with NPM dependency fix. - -0.9.1 / 2012-03-02 -================== - - * Changed heartbeat timeout and interval defaults (60 and 25 seconds) - * Make tests work both on 0.4 and 0.6 - * Updated client (improvements + bug fixes). - -0.9.0 / 2012-02-26 -================== - - * Make it possible to use a regexp to match the socket.io resource URL. - We need this because we have to prefix the socket.io URL with a variable ID. - * Supplemental fix to gavinuhma/authfix, it looks like the same Access-Control-Origin logic is needed in the http and xhr-polling transports - * Updated express dep for windows compatibility. - * Combine two substr calls into one in decodePayload to improve performance - * Minor documentation fix - * Minor. Conform to style of other files. - * Switching setting to 'match origin protocol' - * Revert "Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect()." - * Revert "Handle leaked dispatch:[id] subscription." - * Merge pull request #667 from dshaw/patch/redis-disconnect - * Handle leaked dispatch:[id] subscription. - * Fixes leaking Redis subscriptions for #663. The local flag was not getting passed through onClientDisconnect(). - * Prevent memory leaking on uncompleted requests & add max post size limitation - * Fix for testcase - * Set Access-Control-Allow-Credentials true, regardless of cookie - * Remove assertvarnish from package as it breaks on 0.6 - * Correct irc channel - * Added proper return after reserved field error - * Fixes manager.js failure to close connection after transport error has happened - * Added implicit port 80 for origin checks. fixes #638 - * Fixed bug #432 in 0.8.7 - * Set Access-Control-Allow-Origin header to origin to enable withCredentials - * Adding configuration variable matchOriginProtocol - * Fixes location mismatch error in Safari. - * Use tty to detect if we should add colors or not by default. - * Updated the package location. - -0.8.7 / 2011-11-05 -================== - - * Fixed memory leaks in closed clients. - * Fixed memory leaks in namespaces. - * Fixed websocket handling for malformed requests from proxies. [einaros] - * Node 0.6 compatibility. [einaros] [3rd-Eden] - * Adapted tests and examples. - -0.8.6 / 2011-10-27 -================== - - * Added JSON decoding on jsonp-polling transport. - * Fixed README example. - * Major speed optimizations [3rd-Eden] [einaros] [visionmedia] - * Added decode/encode benchmarks [visionmedia] - * Added support for black-listing client sent events. - * Fixed logging options, closes #540 [3rd-Eden] - * Added vary header for gzip [3rd-Eden] - * Properly cleaned up async websocket / flashsocket tests, after patching node-websocket-client - * Patched to properly shut down when a finishClose call is made during connection establishment - * Added support for socket.io version on url and far-future Expires [3rd-Eden] [getify] - * Began IE10 compatibility [einaros] [tbranyen] - * Misc WebSocket fixes [einaros] - * Added UTF8 to respone headers for htmlfile [3rd-Eden] - -0.8.5 / 2011-10-07 -================== - - * Added websocket draft HyBi-16 support. [einaros] - * Fixed websocket continuation bugs. [einaros] - * Fixed flashsocket transport name. - * Fixed websocket tests. - * Ensured `parser#decodePayload` doesn't choke. - * Added http referrer verification to manager verifyOrigin. - * Added access control for cross domain xhr handshakes [3rd-Eden] - * Added support for automatic generation of socket.io files [3rd-Eden] - * Added websocket binary support [einaros] - * Added gzip support for socket.io.js [3rd-Eden] - * Expose socket.transport [3rd-Eden] - * Updated client. - -0.8.4 / 2011-09-06 -================== - - * Client build - -0.8.3 / 2011-09-03 -================== - - * Fixed `\n` parsing for non-JSON packets (fixes #479). - * Fixed parsing of certain unicode characters (fixes #451). - * Fixed transport message packet logging. - * Fixed emission of `error` event resulting in an uncaught exception if unhandled (fixes #476). - * Fixed; allow for falsy values as the configuration value of `log level` (fixes #491). - * Fixed repository URI in `package.json`. Fixes #504. - * Added text/plain content-type to handshake responses [einaros] - * Improved single byte writes [einaros] - * Updated socket.io-flashsocket default port from 843 to 10843 [3rd-Eden] - * Updated client. - -0.8.2 / 2011-08-29 -================== - - * Updated client. - -0.8.1 / 2011-08-29 -================== - - * Fixed utf8 bug in send framing in websocket [einaros] - * Fixed typo in docs [Znarkus] - * Fixed bug in send framing for over 64kB of data in websocket [einaros] - * Corrected ping handling in websocket transport [einaros] - -0.8.0 / 2011-08-28 -================== - - * Updated to work with two-level websocket versioning. [einaros] - * Added hybi07 support. [einaros] - * Added hybi10 support. [einaros] - * Added http referrer verification to manager.js verifyOrigin. [einaors] - -0.7.11 / 2011-08-27 -=================== - - * Updated socket.io-client. - -0.7.10 / 2011-08-27 -=================== - - * Updated socket.io-client. - -0.7.9 / 2011-08-12 -================== - - * Updated socket.io-client. - * Make sure we only do garbage collection when the server we receive is actually run. - -0.7.8 / 2011-08-08 -================== - - * Changed; make sure sio#listen passes options to both HTTP server and socket.io manager. - * Added docs for sio#listen. - * Added options parameter support for Manager constructor. - * Added memory leaks tests and test-leaks Makefile task. - * Removed auto npm-linking from make test. - * Make sure that you can disable heartbeats. [3rd-Eden] - * Fixed rooms memory leak [3rd-Eden] - * Send response once we got all POST data, not immediately [Pita] - * Fixed onLeave behavior with missing clientsk [3rd-Eden] - * Prevent duplicate references in rooms. - * Added alias for `to` to `in` and `in` to `to`. - * Fixed roomClients definition. - * Removed dependency on redis for installation without npm [3rd-Eden] - * Expose path and querystring in handshakeData [3rd-Eden] - -0.7.7 / 2011-07-12 -================== - - * Fixed double dispatch handling with emit to closed clients. - * Added test for emitting to closed clients to prevent regression. - * Fixed race condition in redis test. - * Changed Transport#end instrumentation. - * Leveraged $emit instead of emit internally. - * Made tests faster. - * Fixed double disconnect events. - * Fixed disconnect logic - * Simplified remote events handling in Socket. - * Increased testcase timeout. - * Fixed unknown room emitting (GH-291). [3rd-Eden] - * Fixed `address` in handshakeData. [3rd-Eden] - * Removed transports definition in chat example. - * Fixed room cleanup - * Fixed; make sure the client is cleaned up after booting. - * Make sure to mark the client as non-open if the connection is closed. - * Removed unneeded `buffer` declarations. - * Fixed; make sure to clear socket handlers and subscriptions upon transport close. - -0.7.6 / 2011-06-30 -================== - - * Fixed general dispatching when a client has closed. - -0.7.5 / 2011-06-30 -================== - - * Fixed dispatching to clients that are disconnected. - -0.7.4 / 2011-06-30 -================== - - * Fixed; only clear handlers if they were set. [level09] - -0.7.3 / 2011-06-30 -================== - - * Exposed handshake data to clients. - * Refactored dispatcher interface. - * Changed; Moved id generation method into the manager. - * Added sub-namespace authorization. [3rd-Eden] - * Changed; normalized SocketNamespace local eventing [dvv] - * Changed; Use packet.reason or default to 'packet' [3rd-Eden] - * Changed console.error to console.log. - * Fixed; bind both servers at the same time do that the test never times out. - * Added 304 support. - * Removed `Transport#name` for abstract interface. - * Changed; lazily require http and https module only when needed. [3rd-Eden] - -0.7.2 / 2011-06-22 -================== - - * Make sure to write a packet (of type `noop`) when closing a poll. - This solves a problem with cross-domain requests being flagged as aborted and - reconnection being triggered. - * Added `noop` message type. - -0.7.1 / 2011-06-21 -================== - - * Fixed cross-domain XHR. - * Added CORS test to xhr-polling suite. - -0.7.0 / 2010-06-21 -================== - - * http://socket.io/announcement.html diff --git a/node_modules/browser-sync/node_modules/socket.io/LICENSE b/node_modules/browser-sync/node_modules/socket.io/LICENSE deleted file mode 100644 index 81a9275..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Automattic - -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 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/node_modules/browser-sync/node_modules/socket.io/Makefile b/node_modules/browser-sync/node_modules/socket.io/Makefile deleted file mode 100644 index 4acf1e5..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/Makefile +++ /dev/null @@ -1,15 +0,0 @@ - -REPORTER = dot - -test: - @./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - --slow 200ms \ - --bail - -test-cov: - @./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \ - --reporter $(REPORTER) \ - test/ - -.PHONY: test diff --git a/node_modules/browser-sync/node_modules/socket.io/Readme.md b/node_modules/browser-sync/node_modules/socket.io/Readme.md deleted file mode 100644 index 271ac43..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/Readme.md +++ /dev/null @@ -1,374 +0,0 @@ - -# socket.io - -[![Build Status](https://secure.travis-ci.org/Automattic/socket.io.svg)](http://travis-ci.org/Automattic/socket.io) -[![NPM version](https://badge.fury.io/js/socket.io.svg)](http://badge.fury.io/js/socket.io) -![Downloads](http://img.shields.io/npm/dm/socket.io.svg) - -## How to use - -The following example attaches socket.io to a plain Node.JS -HTTP server listening on port `3000`. - -```js -var server = require('http').createServer(); -var io = require('socket.io')(server); -io.on('connection', function(socket){ - socket.on('event', function(data){}); - socket.on('disconnect', function(){}); -}); -server.listen(3000); -``` - -### Standalone - -```js -var io = require('socket.io')(); -io.on('connection', function(socket){}); -io.listen(3000); -``` - -### In conjunction with Express - -Starting with **3.0**, express applications have become request handler -functions that you pass to `http` or `http` `Server` instances. You need -to pass the `Server` to `socket.io`, and not the express application -function. - -```js -var app = require('express')(); -var server = require('http').createServer(app); -var io = require('socket.io')(server); -io.on('connection', function(){ /* … */ }); -server.listen(3000); -``` - -### In conjunction with Koa - -Like Express.JS, Koa works by exposing an application as a request -handler function, but only by calling the `callback` method. - -```js -var app = require('koa')(); -var server = require('http').createServer(app.callback()); -var io = require('socket.io')(server); -io.on('connection', function(){ /* … */ }); -server.listen(3000); -``` - -## API - -### Server - - Exposed by `require('socket.io')`. - -### Server() - - Creates a new `Server`. Works with and without `new`: - - ```js - var io = require('socket.io')(); - // or - var Server = require('socket.io'); - var io = new Server(); - ``` - -### Server(opts:Object) - - Optionally, the first or second argument (see below) of the `Server` - constructor can be an options object. - - The following options are supported: - - - `serveClient` sets the value for Server#serveClient() - - `path` sets the value for Server#path() - - The same options passed to socket.io are always passed to - the `engine.io` `Server` that gets created. See engine.io - [options](https://github.com/learnboost/engine.io#methods-1) - as reference. - -### Server(srv:http#Server, opts:Object) - - Creates a new `Server` and attaches it to the given `srv`. Optionally - `opts` can be passed. - -### Server(port:Number, opts:Object) - - Binds socket.io to a new `http.Server` that listens on `port`. - -### Server#serveClient(v:Boolean):Server - - If `v` is `true` the attached server (see `Server#attach`) will serve - the client files. Defaults to `true`. - - This method has no effect after `attach` is called. - - ```js - // pass a server and the `serveClient` option - var io = require('socket.io')(http, { serveClient: false }); - - // or pass no server and then you can call the method - var io = require('socket.io')(); - io.serveClient(false); - io.attach(http); - ``` - - If no arguments are supplied this method returns the current value. - -### Server#path(v:String):Server - - Sets the path `v` under which `engine.io` and the static files will be - served. Defaults to `/socket.io`. - - If no arguments are supplied this method returns the current value. - -### Server#adapter(v:Adapter):Server - - Sets the adapter `v`. Defaults to an instance of the `Adapter` that - ships with socket.io which is memory based. See - [socket.io-adapter](https://github.com/Automattic/socket.io-adapter). - - If no arguments are supplied this method returns the current value. - -### Server#origins(v:String):Server - - Sets the allowed origins `v`. Defaults to any origins being allowed. - - If no arguments are supplied this method returns the current value. - -### Server#origins(v:Function):Server - - Sets the allowed origins as dynamic function. Function takes two arguments `origin:String` and `callback(error, success)`, where `success` is a boolean value indicating whether origin is allowed or not. - - __Potential drawbacks__: - * in some situations, when it is not possible to determine `origin` it may have value of `*` - * As this function will be executed for every request, it is advised to make this function work as fast as possible - * If `socket.io` is used together with `Express`, the CORS headers will be affected only for `socket.io` requests. For Express can use [cors](https://github.com/troygoode/node-cors/) - - -### Server#sockets:Namespace - - The default (`/`) namespace. - -### Server#attach(srv:http#Server, opts:Object):Server - - Attaches the `Server` to an engine.io instance on `srv` with the - supplied `opts` (optionally). - -### Server#attach(port:Number, opts:Object):Server - - Attaches the `Server` to an engine.io instance that is bound to `port` - with the given `opts` (optionally). - -### Server#listen - - Synonym of `Server#attach`. - -### Server#bind(srv:engine#Server):Server - - Advanced use only. Binds the server to a specific engine.io `Server` - (or compatible API) instance. - -### Server#onconnection(socket:engine#Socket):Server - - Advanced use only. Creates a new `socket.io` client from the incoming - engine.io (or compatible API) `socket`. - -### Server#of(nsp:String):Namespace - - Initializes and retrieves the given `Namespace` by its pathname - identifier `nsp`. - - If the namespace was already initialized it returns it right away. - -### Server#emit - - Emits an event to all connected clients. The following two are - equivalent: - - ```js - var io = require('socket.io')(); - io.sockets.emit('an event sent to all connected clients'); - io.emit('an event sent to all connected clients'); - ``` - - For other available methods, see `Namespace` below. - -### Server#close - - Closes socket server - - ```js - var Server = require('socket.io'); - var PORT = 3030; - var server = require('http').Server(); - - var io = Server(PORT); - - io.close(); // Close current server - - server.listen(PORT); // PORT is free to use - - io = Server(server); - ``` - -### Server#use - - See `Namespace#use` below. - -### Namespace - - Represents a pool of sockets connected under a given scope identified - by a pathname (eg: `/chat`). - - By default the client always connects to `/`. - -#### Events - - - `connection` / `connect`. Fired upon a connection. - - Parameters: - - `Socket` the incoming socket. - -### Namespace#name:String - - The namespace identifier property. - -### Namespace#connected:Object - - Hash of `Socket` objects that are connected to this namespace indexed - by `id`. - -### Namespace#use(fn:Function):Namespace - - Registers a middleware, which is a function that gets executed for - every incoming `Socket` and receives as parameter the socket and a - function to optionally defer execution to the next registered - middleware. - - ```js - var io = require('socket.io')(); - io.use(function(socket, next){ - if (socket.request.headers.cookie) return next(); - next(new Error('Authentication error')); - }); - ``` - - Errors passed to middleware callbacks are sent as special `error` - packets to clients. - -### Socket - - A `Socket` is the fundamental class for interacting with browser - clients. A `Socket` belongs to a certain `Namespace` (by default `/`) - and uses an underlying `Client` to communicate. - -### Socket#rooms:Array - - A list of strings identifying the rooms this socket is in. - -### Socket#client:Client - - A reference to the underlying `Client` object. - -### Socket#conn:Socket - - A reference to the underyling `Client` transport connection (engine.io - `Socket` object). - -### Socket#request:Request - - A getter proxy that returns the reference to the `request` that - originated the underlying engine.io `Client`. Useful for accessing - request headers such as `Cookie` or `User-Agent`. - -### Socket#id:String - - A unique identifier for the socket session, that comes from the - underlying `Client`. - -### Socket#emit(name:String[, …]):Socket - - Emits an event to the socket identified by the string `name`. Any - other parameters can be included. - - All datastructures are supported, including `Buffer`. JavaScript - functions can't be serialized/deserialized. - - ```js - var io = require('socket.io')(); - io.on('connection', function(socket){ - socket.emit('an event', { some: 'data' }); - }); - ``` - -### Socket#join(name:String[, fn:Function]):Socket - - Adds the socket to the `room`, and fires optionally a callback `fn` - with `err` signature (if any). - - The socket is automatically a member of a room identified with its - session id (see `Socket#id`). - - The mechanics of joining rooms are handled by the `Adapter` - that has been configured (see `Server#adapter` above), defaulting to - [socket.io-adapter](https://github.com/Automattic/socket.io-adapter). - -### Socket#leave(name:String[, fn:Function]):Socket - - Removes the socket from `room`, and fires optionally a callback `fn` - with `err` signature (if any). - - **Rooms are left automatically upon disconnection**. - - The mechanics of leaving rooms are handled by the `Adapter` - that has been configured (see `Server#adapter` above), defaulting to - [socket.io-adapter](https://github.com/Automattic/socket.io-adapter). - -### Socket#to(room:String):Socket -### Socket#in(room:String):Socket - - Sets a modifier for a subsequent event emission that the event will - only be _broadcasted_ to sockets that have joined the given `room`. - - To emit to multiple rooms, you can call `to` several times. - - ```js - var io = require('socket.io')(); - io.on('connection', function(socket){ - socket.to('others').emit('an event', { some: 'data' }); - }); - ``` - -### Client - - The `Client` class represents an incoming transport (engine.io) - connection. A `Client` can be associated with many multiplexed `Socket` - that belong to different `Namespace`s. - -### Client#conn - - A reference to the underlying `engine.io` `Socket` connection. - -### Client#request - - A getter proxy that returns the reference to the `request` that - originated the engine.io connection. Useful for accessing - request headers such as `Cookie` or `User-Agent`. - -## Debug / logging - -Socket.IO is powered by [debug](http://github.com/visionmedia/debug). -In order to see all the debug output, run your app with the environment variable -`DEBUG` including the desired scope. - -To see the output from all of Socket.IO's debugging scopes you can use: - -``` -DEBUG=socket.io* node myapp -``` - -## License - -MIT diff --git a/node_modules/browser-sync/node_modules/socket.io/index.js b/node_modules/browser-sync/node_modules/socket.io/index.js deleted file mode 100644 index ce22d97..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib'); diff --git a/node_modules/browser-sync/node_modules/socket.io/lib/client.js b/node_modules/browser-sync/node_modules/socket.io/lib/client.js deleted file mode 100644 index 440c75e..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/lib/client.js +++ /dev/null @@ -1,247 +0,0 @@ - -/** - * Module dependencies. - */ - -var parser = require('socket.io-parser'); -var debug = require('debug')('socket.io:client'); - -/** - * Module exports. - */ - -module.exports = Client; - -/** - * Client constructor. - * - * @param {Server} server instance - * @param {Socket} connection - * @api private - */ - -function Client(server, conn){ - this.server = server; - this.conn = conn; - this.encoder = new parser.Encoder(); - this.decoder = new parser.Decoder(); - this.id = conn.id; - this.request = conn.request; - this.setup(); - this.sockets = []; - this.nsps = {}; - this.connectBuffer = []; -} - -/** - * Sets up event listeners. - * - * @api private - */ - -Client.prototype.setup = function(){ - this.onclose = this.onclose.bind(this); - this.ondata = this.ondata.bind(this); - this.onerror = this.onerror.bind(this); - this.ondecoded = this.ondecoded.bind(this); - - this.decoder.on('decoded', this.ondecoded); - this.conn.on('data', this.ondata); - this.conn.on('error', this.onerror); - this.conn.on('close', this.onclose); -}; - -/** - * Connects a client to a namespace. - * - * @param {String} namespace name - * @api private - */ - -Client.prototype.connect = function(name){ - debug('connecting to namespace %s', name); - if (!this.server.nsps[name]) { - this.packet({ type: parser.ERROR, nsp: name, data : 'Invalid namespace'}); - return; - } - var nsp = this.server.of(name); - if ('/' != name && !this.nsps['/']) { - this.connectBuffer.push(name); - return; - } - - var self = this; - var socket = nsp.add(this, function(){ - self.sockets.push(socket); - self.nsps[nsp.name] = socket; - - if ('/' == nsp.name && self.connectBuffer.length > 0) { - self.connectBuffer.forEach(self.connect, self); - self.connectBuffer = []; - } - }); -}; - -/** - * Disconnects from all namespaces and closes transport. - * - * @api private - */ - -Client.prototype.disconnect = function(){ - var socket; - // we don't use a for loop because the length of - // `sockets` changes upon each iteration - while (socket = this.sockets.shift()) { - socket.disconnect(); - } - this.close(); -}; - -/** - * Removes a socket. Called by each `Socket`. - * - * @api private - */ - -Client.prototype.remove = function(socket){ - var i = this.sockets.indexOf(socket); - if (~i) { - var nsp = this.sockets[i].nsp.name; - this.sockets.splice(i, 1); - delete this.nsps[nsp]; - } else { - debug('ignoring remove for %s', socket.id); - } -}; - -/** - * Closes the underlying connection. - * - * @api private - */ - -Client.prototype.close = function(){ - if ('open' == this.conn.readyState) { - debug('forcing transport close'); - this.conn.close(); - this.onclose('forced server close'); - } -}; - -/** - * Writes a packet to the transport. - * - * @param {Object} packet object - * @param {Boolean} whether packet is already encoded - * @param {Boolean} whether packet is volatile - * @api private - */ - -Client.prototype.packet = function(packet, preEncoded, volatile){ - var self = this; - - // this writes to the actual connection - function writeToEngine(encodedPackets) { - if (volatile && !self.conn.transport.writable) return; - for (var i = 0; i < encodedPackets.length; i++) { - self.conn.write(encodedPackets[i]); - } - } - - if ('open' == this.conn.readyState) { - debug('writing packet %j', packet); - if(!preEncoded) { // not broadcasting, need to encode - this.encoder.encode(packet, function (encodedPackets) { // encode, then write results to engine - writeToEngine(encodedPackets); - }); - } else { // a broadcast pre-encodes a packet - writeToEngine(packet); - } - } else { - debug('ignoring packet write %j', packet); - } -}; - -/** - * Called with incoming transport data. - * - * @api private - */ - -Client.prototype.ondata = function(data){ - // try/catch is needed for protocol violations (GH-1880) - try { - this.decoder.add(data); - } catch(e) { - this.onerror(e); - } -}; - -/** - * Called when parser fully decodes a packet. - * - * @api private - */ - -Client.prototype.ondecoded = function(packet) { - if (parser.CONNECT == packet.type) { - this.connect(packet.nsp); - } else { - var socket = this.nsps[packet.nsp]; - if (socket) { - socket.onpacket(packet); - } else { - debug('no socket for namespace %s', packet.nsp); - } - } -}; - -/** - * Handles an error. - * - * @param {Objcet} error object - * @api private - */ - -Client.prototype.onerror = function(err){ - this.sockets.forEach(function(socket){ - socket.onerror(err); - }); - this.onclose('client error'); -}; - -/** - * Called upon transport close. - * - * @param {String} reason - * @api private - */ - -Client.prototype.onclose = function(reason){ - debug('client close with reason %s', reason); - - // ignore a potential subsequent `close` event - this.destroy(); - - // `nsps` and `sockets` are cleaned up seamlessly - var socket; - while (socket = this.sockets.shift()) { - socket.onclose(reason); - } - - this.decoder.destroy(); // clean up decoder -}; - -/** - * Cleans up event listeners. - * - * @api private - */ - -Client.prototype.destroy = function(){ - this.conn.removeListener('data', this.ondata); - this.conn.removeListener('error', this.onerror); - this.conn.removeListener('close', this.onclose); - this.decoder.removeListener('decoded', this.ondecoded); -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/lib/index.js b/node_modules/browser-sync/node_modules/socket.io/lib/index.js deleted file mode 100644 index 92170c3..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/lib/index.js +++ /dev/null @@ -1,379 +0,0 @@ - -/** - * Module dependencies. - */ - -var http = require('http'); -var read = require('fs').readFileSync; -var parse = require('url').parse; -var engine = require('engine.io'); -var client = require('socket.io-client'); -var clientVersion = require('socket.io-client/package').version; -var Client = require('./client'); -var Namespace = require('./namespace'); -var Adapter = require('socket.io-adapter'); -var debug = require('debug')('socket.io:server'); -var url = require('url'); - -/** - * Module exports. - */ - -module.exports = Server; - -/** - * Socket.IO client source. - */ - -var clientSource = read(require.resolve('socket.io-client/socket.io.js'), 'utf-8'); - -/** - * Server constructor. - * - * @param {http.Server|Number|Object} http server, port or options - * @param {Object} options - * @api public - */ - -function Server(srv, opts){ - if (!(this instanceof Server)) return new Server(srv, opts); - if ('object' == typeof srv && !srv.listen) { - opts = srv; - srv = null; - } - opts = opts || {}; - this.nsps = {}; - this.path(opts.path || '/socket.io'); - this.serveClient(false !== opts.serveClient); - this.adapter(opts.adapter || Adapter); - this.origins(opts.origins || '*:*'); - this.sockets = this.of('/'); - if (srv) this.attach(srv, opts); -} - -/** - * Server request verification function, that checks for allowed origins - * - * @param {http.IncomingMessage} request - * @param {Function} callback to be called with the result: `fn(err, success)` - */ - -Server.prototype.checkRequest = function(req, fn) { - var origin = req.headers.origin || req.headers.referer; - - // file:// URLs produce a null Origin which can't be authorized via echo-back - if ('null' == origin) origin = '*'; - - if (!!origin && typeof(this._origins) == 'function') return this._origins(origin, fn); - if (this._origins.indexOf('*:*') !== -1) return fn(null, true); - if (origin) { - try { - var parts = url.parse(origin); - parts.port = parts.port || 80; - var ok = - ~this._origins.indexOf(parts.hostname + ':' + parts.port) || - ~this._origins.indexOf(parts.hostname + ':*') || - ~this._origins.indexOf('*:' + parts.port); - return fn(null, !!ok); - } catch (ex) { - } - } - fn(null, false); -}; - -/** - * Sets/gets whether client code is being served. - * - * @param {Boolean} whether to serve client code - * @return {Server|Boolean} self when setting or value when getting - * @api public - */ - -Server.prototype.serveClient = function(v){ - if (!arguments.length) return this._serveClient; - this._serveClient = v; - return this; -}; - -/** - * Old settings for backwards compatibility - */ - -var oldSettings = { - "transports": "transports", - "heartbeat timeout": "pingTimeout", - "heartbeat interval": "pingInterval", - "destroy buffer size": "maxHttpBufferSize" -}; - -/** - * Backwards compatiblity. - * - * @api public - */ - -Server.prototype.set = function(key, val){ - if ('authorization' == key && val) { - this.use(function(socket, next) { - val(socket.request, function(err, authorized) { - if (err) return next(new Error(err)); - if (!authorized) return next(new Error('Not authorized')); - next(); - }); - }); - } else if ('origins' == key && val) { - this.origins(val); - } else if ('resource' == key) { - this.path(val); - } else if (oldSettings[key] && this.eio[oldSettings[key]]) { - this.eio[oldSettings[key]] = val; - } else { - console.error('Option %s is not valid. Please refer to the README.', key); - } - - return this; -}; - -/** - * Sets the client serving path. - * - * @param {String} pathname - * @return {Server|String} self when setting or value when getting - * @api public - */ - -Server.prototype.path = function(v){ - if (!arguments.length) return this._path; - this._path = v.replace(/\/$/, ''); - return this; -}; - -/** - * Sets the adapter for rooms. - * - * @param {Adapter} pathname - * @return {Server|Adapter} self when setting or value when getting - * @api public - */ - -Server.prototype.adapter = function(v){ - if (!arguments.length) return this._adapter; - this._adapter = v; - for (var i in this.nsps) { - if (this.nsps.hasOwnProperty(i)) { - this.nsps[i].initAdapter(); - } - } - return this; -}; - -/** - * Sets the allowed origins for requests. - * - * @param {String} origins - * @return {Server|Adapter} self when setting or value when getting - * @api public - */ - -Server.prototype.origins = function(v){ - if (!arguments.length) return this._origins; - - this._origins = v; - return this; -}; - -/** - * Attaches socket.io to a server or port. - * - * @param {http.Server|Number} server or port - * @param {Object} options passed to engine.io - * @return {Server} self - * @api public - */ - -Server.prototype.listen = -Server.prototype.attach = function(srv, opts){ - if ('function' == typeof srv) { - var msg = 'You are trying to attach socket.io to an express' + - 'request handler function. Please pass a http.Server instance.'; - throw new Error(msg); - } - - // handle a port as a string - if (Number(srv) == srv) { - srv = Number(srv); - } - - if ('number' == typeof srv) { - debug('creating http server and binding to %d', srv); - var port = srv; - srv = http.Server(function(req, res){ - res.writeHead(404); - res.end(); - }); - srv.listen(port); - - } - - // set engine.io path to `/socket.io` - opts = opts || {}; - opts.path = opts.path || this.path(); - // set origins verification - opts.allowRequest = this.checkRequest.bind(this); - - // initialize engine - debug('creating engine.io instance with opts %j', opts); - this.eio = engine.attach(srv, opts); - - // attach static file serving - if (this._serveClient) this.attachServe(srv); - - // Export http server - this.httpServer = srv; - - // bind to engine events - this.bind(this.eio); - - return this; -}; - -/** - * Attaches the static file serving. - * - * @param {Function|http.Server} http server - * @api private - */ - -Server.prototype.attachServe = function(srv){ - debug('attaching client serving req handler'); - var url = this._path + '/socket.io.js'; - var evs = srv.listeners('request').slice(0); - var self = this; - srv.removeAllListeners('request'); - srv.on('request', function(req, res) { - if (0 == req.url.indexOf(url)) { - self.serve(req, res); - } else { - for (var i = 0; i < evs.length; i++) { - evs[i].call(srv, req, res); - } - } - }); -}; - -/** - * Handles a request serving `/socket.io.js` - * - * @param {http.Request} req - * @param {http.Response} res - * @api private - */ - -Server.prototype.serve = function(req, res){ - var etag = req.headers['if-none-match']; - if (etag) { - if (clientVersion == etag) { - debug('serve client 304'); - res.writeHead(304); - res.end(); - return; - } - } - - debug('serve client source'); - res.setHeader('Content-Type', 'application/javascript'); - res.setHeader('ETag', clientVersion); - res.writeHead(200); - res.end(clientSource); -}; - -/** - * Binds socket.io to an engine.io instance. - * - * @param {engine.Server} engine.io (or compatible) server - * @return {Server} self - * @api public - */ - -Server.prototype.bind = function(engine){ - this.engine = engine; - this.engine.on('connection', this.onconnection.bind(this)); - return this; -}; - -/** - * Called with each incoming transport connection. - * - * @param {engine.Socket} socket - * @return {Server} self - * @api public - */ - -Server.prototype.onconnection = function(conn){ - debug('incoming connection with id %s', conn.id); - var client = new Client(this, conn); - client.connect('/'); - return this; -}; - -/** - * Looks up a namespace. - * - * @param {String} nsp name - * @param {Function} optional, nsp `connection` ev handler - * @api public - */ - -Server.prototype.of = function(name, fn){ - if (String(name)[0] !== '/') name = '/' + name; - - if (!this.nsps[name]) { - debug('initializing namespace %s', name); - var nsp = new Namespace(this, name); - this.nsps[name] = nsp; - } - if (fn) this.nsps[name].on('connect', fn); - return this.nsps[name]; -}; - -/** - * Closes server connection - * - * @api public - */ - -Server.prototype.close = function(){ - this.nsps['/'].sockets.forEach(function(socket){ - socket.onclose(); - }); - - this.engine.close(); - - if(this.httpServer){ - this.httpServer.close(); - } -}; - -/** - * Expose main namespace (/). - */ - -['on', 'to', 'in', 'use', 'emit', 'send', 'write'].forEach(function(fn){ - Server.prototype[fn] = function(){ - var nsp = this.sockets[fn]; - return nsp.apply(this.sockets, arguments); - }; -}); - -Namespace.flags.forEach(function(flag){ - Server.prototype.__defineGetter__(flag, function(name){ - this.flags.push(name); - return this; - }); -}); - -/** - * BC with `io.listen` - */ - -Server.listen = Server; diff --git a/node_modules/browser-sync/node_modules/socket.io/lib/namespace.js b/node_modules/browser-sync/node_modules/socket.io/lib/namespace.js deleted file mode 100644 index 4ae0b15..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/lib/namespace.js +++ /dev/null @@ -1,242 +0,0 @@ - -/** - * Module dependencies. - */ - -var Socket = require('./socket'); -var Emitter = require('events').EventEmitter; -var parser = require('socket.io-parser'); -var debug = require('debug')('socket.io:namespace'); -var hasBin = require('has-binary-data'); - -/** - * Module exports. - */ - -module.exports = exports = Namespace; - -/** - * Blacklisted events. - */ - -exports.events = [ - 'connect', // for symmetry with client - 'connection', - 'newListener' -]; - -/** - * Flags. - */ - -exports.flags = ['json']; - -/** - * `EventEmitter#emit` reference. - */ - -var emit = Emitter.prototype.emit; - -/** - * Namespace constructor. - * - * @param {Server} server instance - * @param {Socket} name - * @api private - */ - -function Namespace(server, name){ - this.name = name; - this.server = server; - this.sockets = []; - this.connected = {}; - this.fns = []; - this.ids = 0; - this.acks = {}; - this.initAdapter(); -} - -/** - * Inherits from `EventEmitter`. - */ - -Namespace.prototype.__proto__ = Emitter.prototype; - -/** - * Apply flags from `Socket`. - */ - -exports.flags.forEach(function(flag){ - Namespace.prototype.__defineGetter__(flag, function(){ - this.flags = this.flags || {}; - this.flags[flag] = true; - return this; - }); -}); - -/** - * Initializes the `Adapter` for this nsp. - * Run upon changing adapter by `Server#adapter` - * in addition to the constructor. - * - * @api private - */ - -Namespace.prototype.initAdapter = function(){ - this.adapter = new (this.server.adapter())(this); -}; - -/** - * Sets up namespace middleware. - * - * @return {Namespace} self - * @api public - */ - -Namespace.prototype.use = function(fn){ - this.fns.push(fn); - return this; -}; - -/** - * Executes the middleware for an incoming client. - * - * @param {Socket} socket that will get added - * @param {Function} last fn call in the middleware - * @api private - */ - -Namespace.prototype.run = function(socket, fn){ - var fns = this.fns.slice(0); - if (!fns.length) return fn(null); - - function run(i){ - fns[i](socket, function(err){ - // upon error, short-circuit - if (err) return fn(err); - - // if no middleware left, summon callback - if (!fns[i + 1]) return fn(null); - - // go on to next - run(i + 1); - }); - } - - run(0); -}; - -/** - * Targets a room when emitting. - * - * @param {String} name - * @return {Namespace} self - * @api public - */ - -Namespace.prototype.to = -Namespace.prototype['in'] = function(name){ - this.rooms = this.rooms || []; - if (!~this.rooms.indexOf(name)) this.rooms.push(name); - return this; -}; - -/** - * Adds a new client. - * - * @return {Socket} - * @api private - */ - -Namespace.prototype.add = function(client, fn){ - debug('adding socket to nsp %s', this.name); - var socket = new Socket(this, client); - var self = this; - this.run(socket, function(err){ - process.nextTick(function(){ - if ('open' == client.conn.readyState) { - if (err) return socket.error(err.data || err.message); - - // track socket - self.sockets.push(socket); - - // it's paramount that the internal `onconnect` logic - // fires before user-set events to prevent state order - // violations (such as a disconnection before the connection - // logic is complete) - socket.onconnect(); - if (fn) fn(); - - // fire user-set events - self.emit('connect', socket); - self.emit('connection', socket); - } else { - debug('next called after client was closed - ignoring socket'); - } - }); - }); - return socket; -}; - -/** - * Removes a client. Called by each `Socket`. - * - * @api private - */ - -Namespace.prototype.remove = function(socket){ - var i = this.sockets.indexOf(socket); - if (~i) { - this.sockets.splice(i, 1); - } else { - debug('ignoring remove for %s', socket.id); - } -}; - -/** - * Emits to all clients. - * - * @return {Namespace} self - * @api public - */ - -Namespace.prototype.emit = function(ev){ - if (~exports.events.indexOf(ev)) { - emit.apply(this, arguments); - } else { - // set up packet object - var args = Array.prototype.slice.call(arguments); - var parserType = parser.EVENT; // default - if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary - - var packet = { type: parserType, data: args }; - - if ('function' == typeof args[args.length - 1]) { - throw new Error('Callbacks are not supported when broadcasting'); - } - - this.adapter.broadcast(packet, { - rooms: this.rooms, - flags: this.flags - }); - - delete this.rooms; - delete this.flags; - } - return this; -}; - -/** - * Sends a `message` event to all clients. - * - * @return {Namespace} self - * @api public - */ - -Namespace.prototype.send = -Namespace.prototype.write = function(){ - var args = Array.prototype.slice.call(arguments); - args.unshift('message'); - this.emit.apply(this, args); - return this; -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/lib/socket.js b/node_modules/browser-sync/node_modules/socket.io/lib/socket.js deleted file mode 100644 index 4a3aa3d..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/lib/socket.js +++ /dev/null @@ -1,441 +0,0 @@ - -/** - * Module dependencies. - */ - -var Emitter = require('events').EventEmitter; -var parser = require('socket.io-parser'); -var url = require('url'); -var debug = require('debug')('socket.io:socket'); -var hasBin = require('has-binary-data'); - -/** - * Module exports. - */ - -module.exports = exports = Socket; - -/** - * Blacklisted events. - * - * @api public - */ - -exports.events = [ - 'error', - 'connect', - 'disconnect', - 'newListener', - 'removeListener' -]; - -/** - * Flags. - * - * @api private - */ - -var flags = [ - 'json', - 'volatile', - 'broadcast' -]; - -/** - * `EventEmitter#emit` reference. - */ - -var emit = Emitter.prototype.emit; - -/** - * Interface to a `Client` for a given `Namespace`. - * - * @param {Namespace} nsp - * @param {Client} client - * @api public - */ - -function Socket(nsp, client){ - this.nsp = nsp; - this.server = nsp.server; - this.adapter = this.nsp.adapter; - this.id = client.id; - this.request = client.request; - this.client = client; - this.conn = client.conn; - this.rooms = []; - this.acks = {}; - this.connected = true; - this.disconnected = false; - this.handshake = this.buildHandshake(); -} - -/** - * Inherits from `EventEmitter`. - */ - -Socket.prototype.__proto__ = Emitter.prototype; - -/** - * Apply flags from `Socket`. - */ - -flags.forEach(function(flag){ - Socket.prototype.__defineGetter__(flag, function(){ - this.flags = this.flags || {}; - this.flags[flag] = true; - return this; - }); -}); - -/** - * `request` engine.io shorcut. - * - * @api public - */ - -Socket.prototype.__defineGetter__('request', function(){ - return this.conn.request; -}); - -/** - * Builds the `handshake` BC object - * - * @api private - */ - -Socket.prototype.buildHandshake = function(){ - return { - headers: this.request.headers, - time: (new Date) + '', - address: this.conn.remoteAddress, - xdomain: !!this.request.headers.origin, - secure: !!this.request.connection.encrypted, - issued: +(new Date), - url: this.request.url, - query: url.parse(this.request.url, true).query || {} - }; -}; - -/** - * Emits to this client. - * - * @return {Socket} self - * @api public - */ - -Socket.prototype.emit = function(ev){ - if (~exports.events.indexOf(ev)) { - emit.apply(this, arguments); - } else { - var args = Array.prototype.slice.call(arguments); - var packet = {}; - packet.type = hasBin(args) ? parser.BINARY_EVENT : parser.EVENT; - packet.data = args; - - // access last argument to see if it's an ACK callback - if ('function' == typeof args[args.length - 1]) { - if (this._rooms || (this.flags && this.flags.broadcast)) { - throw new Error('Callbacks are not supported when broadcasting'); - } - - debug('emitting packet with ack id %d', this.nsp.ids); - this.acks[this.nsp.ids] = args.pop(); - packet.id = this.nsp.ids++; - } - - if (this._rooms || (this.flags && this.flags.broadcast)) { - this.adapter.broadcast(packet, { - except: [this.id], - rooms: this._rooms, - flags: this.flags - }); - } else { - // dispatch packet - this.packet(packet); - } - - // reset flags - delete this._rooms; - delete this.flags; - } - return this; -}; - -/** - * Targets a room when broadcasting. - * - * @param {String} name - * @return {Socket} self - * @api public - */ - -Socket.prototype.to = -Socket.prototype.in = function(name){ - this._rooms = this._rooms || []; - if (!~this._rooms.indexOf(name)) this._rooms.push(name); - return this; -}; - -/** - * Sends a `message` event. - * - * @return {Socket} self - * @api public - */ - -Socket.prototype.send = -Socket.prototype.write = function(){ - var args = Array.prototype.slice.call(arguments); - args.unshift('message'); - this.emit.apply(this, args); - return this; -}; - -/** - * Writes a packet. - * - * @param {Object} packet object - * @api private - */ - -Socket.prototype.packet = function(packet, preEncoded){ - packet.nsp = this.nsp.name; - var volatile = this.flags && this.flags.volatile; - this.client.packet(packet, preEncoded, volatile); -}; - -/** - * Joins a room. - * - * @param {String} room - * @param {Function} optional, callback - * @return {Socket} self - * @api private - */ - -Socket.prototype.join = function(room, fn){ - debug('joining room %s', room); - var self = this; - if (~this.rooms.indexOf(room)) return this; - this.adapter.add(this.id, room, function(err){ - if (err) return fn && fn(err); - debug('joined room %s', room); - self.rooms.push(room); - fn && fn(null); - }); - return this; -}; - -/** - * Leaves a room. - * - * @param {String} room - * @param {Function} optional, callback - * @return {Socket} self - * @api private - */ - -Socket.prototype.leave = function(room, fn){ - debug('leave room %s', room); - var self = this; - this.adapter.del(this.id, room, function(err){ - if (err) return fn && fn(err); - debug('left room %s', room); - self.rooms.splice(self.rooms.indexOf(room), 1); - fn && fn(null); - }); - return this; -}; - -/** - * Leave all rooms. - * - * @api private - */ - -Socket.prototype.leaveAll = function(){ - this.adapter.delAll(this.id); - this.rooms = []; -}; - -/** - * Called by `Namespace` upon succesful - * middleware execution (ie: authorization). - * - * @api private - */ - -Socket.prototype.onconnect = function(){ - debug('socket connected - writing packet'); - this.join(this.id); - this.packet({ type: parser.CONNECT }); - this.nsp.connected[this.id] = this; -}; - -/** - * Called with each packet. Called by `Client`. - * - * @param {Object} packet - * @api private - */ - -Socket.prototype.onpacket = function(packet){ - debug('got packet %j', packet); - switch (packet.type) { - case parser.EVENT: - this.onevent(packet); - break; - - case parser.BINARY_EVENT: - this.onevent(packet); - break; - - case parser.ACK: - this.onack(packet); - break; - - case parser.BINARY_ACK: - this.onack(packet); - break; - - case parser.DISCONNECT: - this.ondisconnect(); - break; - - case parser.ERROR: - this.emit('error', packet.data); - } -}; - -/** - * Called upon event packet. - * - * @param {Object} packet object - * @api private - */ - -Socket.prototype.onevent = function(packet){ - var args = packet.data || []; - debug('emitting event %j', args); - - if (null != packet.id) { - debug('attaching ack callback to event'); - args.push(this.ack(packet.id)); - } - - emit.apply(this, args); -}; - -/** - * Produces an ack callback to emit with an event. - * - * @param {Number} packet id - * @api private - */ - -Socket.prototype.ack = function(id){ - var self = this; - var sent = false; - return function(){ - // prevent double callbacks - if (sent) return; - var args = Array.prototype.slice.call(arguments); - debug('sending ack %j', args); - - var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK; - self.packet({ - id: id, - type: type, - data: args - }); - }; -}; - -/** - * Called upon ack packet. - * - * @api private - */ - -Socket.prototype.onack = function(packet){ - var ack = this.acks[packet.id]; - if ('function' == typeof ack) { - debug('calling ack %s with %j', packet.id, packet.data); - ack.apply(this, packet.data); - delete this.acks[packet.id]; - } else { - debug('bad ack %s', packet.id); - } -}; - -/** - * Called upon client disconnect packet. - * - * @api private - */ - -Socket.prototype.ondisconnect = function(){ - debug('got disconnect packet'); - this.onclose('client namespace disconnect'); -}; - -/** - * Handles a client error. - * - * @api private - */ - -Socket.prototype.onerror = function(err){ - this.emit('error', err); -}; - -/** - * Called upon closing. Called by `Client`. - * - * @param {String} reason - * @param {Error} optional error object - * @api private - */ - -Socket.prototype.onclose = function(reason){ - if (!this.connected) return this; - debug('closing socket - reason %s', reason); - this.leaveAll(); - this.nsp.remove(this); - this.client.remove(this); - this.connected = false; - this.disconnected = true; - delete this.nsp.connected[this.id]; - this.emit('disconnect', reason); -}; - -/** - * Produces an `error` packet. - * - * @param {Object} error object - * @api private - */ - -Socket.prototype.error = function(err){ - this.packet({ type: parser.ERROR, data: err }); -}; - -/** - * Disconnects this client. - * - * @param {Boolean} if `true`, closes the underlying connection - * @return {Socket} self - * @api public - */ - -Socket.prototype.disconnect = function(close){ - if (!this.connected) return this; - if (close) { - this.client.disconnect(); - } else { - this.packet({ type: parser.DISCONNECT }); - this.onclose('server namespace disconnect'); - } - return this; -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/Readme.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/Readme.md deleted file mode 100644 index c5a34e8..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/Readme.md +++ /dev/null @@ -1,115 +0,0 @@ -# debug - - tiny node.js debugging utility modelled after node core's debugging technique. - -## Installation - -``` -$ npm install debug -``` - -## Usage - - With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. - -Example _app.js_: - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example _worker.js_: - -```js -var debug = require('debug')('worker'); - -setInterval(function(){ - debug('doing some work'); -}, 1000); -``` - - The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: - - ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) - - ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stderr is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - _(NOTE: Debug now uses stderr instead of stdout, so the correct shell command for this example is actually `DEBUG=* node example/worker 2> out &`)_ - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - a('doing some work'); -}, 1200); -``` - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -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 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/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/debug.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/debug.js deleted file mode 100644 index 509dc0d..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/debug.js +++ /dev/null @@ -1,137 +0,0 @@ - -/** - * Expose `debug()` as the module. - */ - -module.exports = debug; - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - if (!debug.enabled(name)) return function(){}; - - return function(fmt){ - fmt = coerce(fmt); - - var curr = new Date; - var ms = curr - (debug[name] || curr); - debug[name] = curr; - - fmt = name - + ' ' - + fmt - + ' +' + debug.humanize(ms); - - // This hackery is required for IE8 - // where `console.log` doesn't have 'apply' - window.console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); - } -} - -/** - * The currently active debug mode names. - */ - -debug.names = []; -debug.skips = []; - -/** - * Enables a debug mode by name. This can include modes - * separated by a colon and wildcards. - * - * @param {String} name - * @api public - */ - -debug.enable = function(name) { - try { - localStorage.debug = name; - } catch(e){} - - var split = (name || '').split(/[\s,]+/) - , len = split.length; - - for (var i = 0; i < len; i++) { - name = split[i].replace('*', '.*?'); - if (name[0] === '-') { - debug.skips.push(new RegExp('^' + name.substr(1) + '$')); - } - else { - debug.names.push(new RegExp('^' + name + '$')); - } - } -}; - -/** - * Disable debug output. - * - * @api public - */ - -debug.disable = function(){ - debug.enable(''); -}; - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -debug.humanize = function(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -}; - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -debug.enabled = function(name) { - for (var i = 0, len = debug.skips.length; i < len; i++) { - if (debug.skips[i].test(name)) { - return false; - } - } - for (var i = 0, len = debug.names.length; i < len; i++) { - if (debug.names[i].test(name)) { - return true; - } - } - return false; -}; - -/** - * Coerce `val`. - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} - -// persist - -try { - if (window.localStorage) debug.enable(localStorage.debug); -} catch(e){} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/index.js deleted file mode 100644 index e02c13b..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/index.js +++ /dev/null @@ -1,5 +0,0 @@ -if ('undefined' == typeof window) { - module.exports = require('./lib/debug'); -} else { - module.exports = require('./debug'); -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/lib/debug.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/lib/debug.js deleted file mode 100644 index 3b0a918..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/lib/debug.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Module dependencies. - */ - -var tty = require('tty'); - -/** - * Expose `debug()` as the module. - */ - -module.exports = debug; - -/** - * Enabled debuggers. - */ - -var names = [] - , skips = []; - -(process.env.DEBUG || '') - .split(/[\s,]+/) - .forEach(function(name){ - name = name.replace('*', '.*?'); - if (name[0] === '-') { - skips.push(new RegExp('^' + name.substr(1) + '$')); - } else { - names.push(new RegExp('^' + name + '$')); - } - }); - -/** - * Colors. - */ - -var colors = [6, 2, 3, 4, 5, 1]; - -/** - * Previous debug() call. - */ - -var prev = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Is stdout a TTY? Colored output is disabled when `true`. - */ - -var isatty = tty.isatty(2); - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function color() { - return colors[prevColor++ % colors.length]; -} - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -function humanize(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -} - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - function disabled(){} - disabled.enabled = false; - - var match = skips.some(function(re){ - return re.test(name); - }); - - if (match) return disabled; - - match = names.some(function(re){ - return re.test(name); - }); - - if (!match) return disabled; - var c = color(); - - function colored(fmt) { - fmt = coerce(fmt); - - var curr = new Date; - var ms = curr - (prev[name] || curr); - prev[name] = curr; - - fmt = ' \u001b[9' + c + 'm' + name + ' ' - + '\u001b[3' + c + 'm\u001b[90m' - + fmt + '\u001b[3' + c + 'm' - + ' +' + humanize(ms) + '\u001b[0m'; - - console.error.apply(this, arguments); - } - - function plain(fmt) { - fmt = coerce(fmt); - - fmt = new Date().toUTCString() - + ' ' + name + ' ' + fmt; - console.error.apply(this, arguments); - } - - colored.enabled = plain.enabled = true; - - return isatty || process.env.DEBUG_COLORS - ? colored - : plain; -} - -/** - * Coerce `val`. - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/package.json deleted file mode 100644 index 882a300..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/debug/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "debug", - "version": "0.7.4", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*" - }, - "main": "lib/debug.js", - "browser": "./debug.js", - "engines": { - "node": "*" - }, - "files": [ - "lib/debug.js", - "debug.js", - "index.js" - ], - "component": { - "scripts": { - "debug/index.js": "index.js", - "debug/debug.js": "debug.js" - } - }, - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "homepage": "https://github.com/visionmedia/debug", - "_id": "debug@0.7.4", - "dist": { - "shasum": "06e1ea8082c2cb14e39806e22e2f6f757f92af39", - "tarball": "http://registry.npmjs.org/debug/-/debug-0.7.4.tgz" - }, - "_from": "debug@0.7.4", - "_npmVersion": "1.3.13", - "_npmUser": { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - } - ], - "directories": {}, - "_shasum": "06e1ea8082c2cb14e39806e22e2f6f757f92af39", - "_resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/.npmignore deleted file mode 100644 index f09f630..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -examples -node_modules -test -npm-debug.log -coverage.html -.gitignore diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/.travis.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/.travis.yml deleted file mode 100644 index 04a6969..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "0.10" - - "0.8" - -notifications: - irc: "irc.freenode.org#socket.io" diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/History.md deleted file mode 100644 index 67b7f13..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/History.md +++ /dev/null @@ -1,395 +0,0 @@ - -1.4.3 / 2014-11-21 -================== - - * package: bump `ws` to fix fd leaks - * socket: flush the write buffer before closing the socket [nkzawa] - * polling: close the pending poll request when closing transport [nkzawa] - -1.4.2 / 2014-10-08 -================== - - * add iframe onload handling to jsonp tests [rase-] - -1.4.1 / 2014-10-03 -================== - - * socket: allow upgrades if the socket is still in closing state - * README: fix typo - -1.4.0 / 2014-09-03 -================== - - * readme: fix formatting for goals numbering - * server: ref fix by @nicokaiser - * server: fix ws memory leak (fixes #268) - * cache remote address in handshake since it might be lost later. - * correct git ref - * update client to commit with bumped parser - * package: bump parser - * npmignore: ignore `.gitignore` - * package: bump `debug` - * package: bump `engine.io-parser` for memleak fix - -1.3.1 / 2014-06-19 -================== - - * package: bump `engine.io-client` - -1.3.0 / 2014-06-13 -================== - - * update example to use v1.2.2 - * fixed newline parsing in jsonp - * make require('engine.io')() return a new Server instance [defunctzombie] - * add Server.attach method [defunctzombie] - * fix GH-211, set CORS headers when sending error message [mokesmokes] - -1.2.2 / 2014-05-30 -================== - - * package: bump `engine.io-parser` for binary utf8 fix - -1.2.1 / 2014-05-22 -================== - - * package: bump engine.io-client - -1.2.0 / 2014-05-18 -================== - - * removed flashsocket, moving to userland - -1.1.1 / 2014-05-14 -================== - - * test: reduce packet size - * package: bump parser - -1.1.0 / 2014-04-27 -================== - - * socket: removed unneeded `clearTimeout` (fixes #250) - * made the request verification process async - * package: bump `engine.io-parser` - * use _query instead of query, fixes compat with restify - * added a maximum buffer size to received data from polling - * fixing looping array via for in to normal loop - -1.0.5 / 2014-03-18 -================== - - * package: bump `engine.io-parser` and `engine.io-client` - -1.0.4 / 2014-03-14 -================== - - * package: bump `engine.io-client` - -1.0.3 / 2014-03-12 -================== - - * package: bump `engine.io-client` - -1.0.2 / 2014-03-12 -================== - - * bump engine.io-client - -1.0.1 / 2014-03-06 -================== - - * package: bump `engine.io-parser` - * transports: fix jshint warnings and style - -1.0.0 / 2014-03-06 -================== - - * polling-xhr: added `OPTIONS` support, fixes CORS - * close() properly when triggered in connection handler - * fix DDOS vector by setting up too many intervals - * binary support - -0.9.0 / 2014-02-09 -================== - - * Prevent errors with connections behind proxies without WS support - like Squid [nicklagrow, samaanghani, davidhcummings] - * Socket#request a simple property [mokesmokes] - * Changed `Socket`'s `upgrade` event to happen after upgrade [mokesmokes] - * Document `Socket#id` [mokesmokes] - -0.8.2 / 2014-01-18 -================== - - * package: bump `engine.io-client` - -0.8.1 / 2014-01-17 -================== - - * package: bump `engine.io-client` - * package: pin dev deps - * examples: fix port output - * fix latency example - -0.8.0 / 2014-01-05 -================== - - * package: bump `engine.io-client` to `0.8.0` - * test: fix syntax, remove globals - -0.7.14 / 2014-01-01 -=================== - - * package: bump `engine.io-client` to `0.7.14` - -0.7.13 / 2013-12-20 -=================== - - * package: bump `engine.io-client` - * transports: added support for XSS filters on IE [guille, 3rd-eden] - -0.7.12 / 2013-11-11 -=================== - - * package: bump `engine.io-client` - -0.7.11 / 2013-11-06 -=================== - - * package: bump engine.io-client - * fix GH-198 - -0.7.10 / 2013-10-28 -=================== - - * package: bump `engine.io-client` - * package: update "ws" to v0.4.31 - -0.7.9 / 2013-08-30 -================== - - * package: bump `engine.io-client` - -0.7.8 / 2013-08-30 -================== - - * package: bump `engine.io-client` - * package: bump ws - -0.7.7 / 2013-08-30 -================== - - * package: bump `engine.io-client` - -0.7.6 / 2013-08-30 -================== - - * package: bump engine.io-client - -0.7.5 / 2013-08-30 -================== - - * package: bump engine.io-client - -0.7.4 / 2013-08-25 -================== - - * package: bump `engine.io-client` - -0.7.3 / 2013-08-23 -================== - - * package: bump engine.io-client (noop) - * package: fix regresison in upgrade cause by ws update - -0.7.2 / 2013-08-23 -================== - - * package: bump `engine.io-client` for `WebSocket` browser fix - -0.7.1 / 2013-08-23 -================== - - * package: bump engine.io-client for ws fix - -0.7.0 / 2013-08-23 -================== - - * package: bump engine.io-client - * updated example - * inline merge - * added support node version 0.10 to .travis.yml - * fixed respond to flash policy request test. Closes #184 - * fixed upgrade with timeout test. Closes #185 - * engine.io: don't use __proto__, closes #170 - -0.6.3 / 2013-06-21 -================== - - * package: bumped `engine.io-client` to `0.6.3` - -0.6.2 / 2013-06-15 -================== - - * fix upgrade stalling edge case introduced with #174 fix - * remove unneeded client code related to iOS - * added test for `engine.io-client` `0.6.1` - -0.6.1 / 2013-06-06 -================== - - * package: bumped `engine.io-client` to `0.6.1` - -0.6.0 / 2013-05-31 -================== - - * socket: clear timer after sending one noop packet (fixes #174) - * clear all timers on socket close - * sending error on transport creation upon a bad request - * added test for client-side buffer cleanup - * changed flushComplete to flush - * ended support for node 0.6 - -0.5.0 / 2013-03-16 -================== - - * polling: implemented new parser - * test writeBuffer isn't cleared onError, removed 'closing' check in .flush() - * fixed bug89 and added tests: writeBuffer not flushed until nextTick - -0.4.3 / 2013-02-08 -================== - - * package: bumped `engine.io-client` to `0.4.3` - -0.4.2 / 2013-02-08 -================== - - * Only end upgrade socket connections if unhandled - * Fix websocket dependency - * Close socket if upgrade is received and socket.readyState != open - -0.4.1 / 2013-01-18 -================== - - * package: bumped versions - * Fixed bugs in previous send callback fix and updated test cases - * Added a test case which makes the code before the send callback fix fail - * socket: emit `data` event (synonym with `message`) - * socket: added `Socket#write` - * engine.io: cleanup - * engine.io: deprecated `resource` - * `npm docs engine.io` works now - -0.3.10 / 2012-12-03 -=================== - - * package: bumped `engine.io-client` with `close` fixes - * add packetCreate event [jxck] - * add packet event to socket [jxck] - * transport: remove `Connection` headers and let node handle it - * server: send validation failure reason to clients - * engine: invoking as a function causes attach - * socket: reset `writeBuffer` before send - -0.3.9 / 2012-10-23 -================== - - * package: bumped `engine.io-client` - -0.3.8 / 2012-10-23 -================== - - * package: bumped engine.io-client - * examples: added first example - -0.3.7 / 2012-10-21 -================== - - * package: bumped `engine.io-client` - -0.3.6 / 2012-10-21 -================== - - [skipped] - -0.3.5 / 2012-10-14 -================== - - * package: reverted last commit - we use the parser from the client - -0.3.4 / 2012-10-14 -================== - - * package: `engine.io-client` moved to `devDependencies` - * socket: added missing jsdoc - -0.3.3 / 2012-10-10 -================== - - * socket: fixed check interval clearing [joewalnes] - * transports: improved instrumentation - -0.3.2 / 2012-10-08 -================== - - * socket: improve check interval for upgrade - -0.3.1 / 2012-10-08 -================== - - * socket: faster upgrades (we perform a check immediately) - * server: don't assume sid is numeric - -0.3.0 / 2012-10-04 -================== - - * socket: `writeBuffer` now gets sliced, and is recoverable after `close` [afshinm] - * server: expect ping from client and send interval with handshake [cadorn] - * polling-jsonp: prevent client breakage with utf8 whitespace - * socket: fix `flush` and `drain` events - * socket: add `send` callback [afshinm] - * transport: avoid unhandled error events for stale transports - * README: documentation improvements [EugenDueck] - -0.2.2 / 2012-08-26 -================== - - * server: remove buffering for flash policy requests - * transport: avoid unhandled error events for stale transports (fixes #69) - * readme: documented `toString` behavior on `send` [EugenDueck] - -0.2.1 / 2012-08-13 -================== - - * polling-xhr: skip Keep-Alive when it's implied [EugenDueck] - * polling-jsonp: skip Keep-Alive when it's implied [EugenDueck] - * README: added plugins list with engine.io-conflation - * socket: added flush/drain events (fixes #56) - * server: avoid passing websocket to non-websocket transports (fixes #24) - -0.2.0 / 2012-08-06 -================== - - * Bumped client - * test: added closing connection test - * server: implemented stronger id generator with collision detection - -0.1.2 / 2012-08-02 -================== - - * Fixed a jsonp bug in Nokia mobile phones and potentially other UAs. - -0.1.1 / 2012-08-01 -================== - - * Fixed errors when a socket is closed while upgrade probe is happening. - * Improved WS error handling - * Replaced websocket.io with ws, now that it supports older drafts - * README fixes - -0.1.0 / 2012-07-03 -================== - - * Initial release. diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/Makefile deleted file mode 100644 index 5046ced..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/Makefile +++ /dev/null @@ -1,23 +0,0 @@ - -TESTS = test/*.js -BENCHMARKS = $(shell find bench -type f ! -name 'runner.js') -REPORTER = dot - -test: - @./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - --slow 500ms \ - --bail \ - --globals ___eio,document \ - $(TESTS) - -test-cov: lib-cov - EIO_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html - -lib-cov: - jscoverage --no-highlight lib lib-cov - -bench: - @node $(PROFILEFLAGS) bench/runner.js $(BENCHMARKS) - -.PHONY: test test-cov bench diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/README.md deleted file mode 100644 index 3ad198a..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/README.md +++ /dev/null @@ -1,517 +0,0 @@ - -# Engine.IO: the realtime engine - -[![Build Status](https://secure.travis-ci.org/Automattic/engine.io.png)](http://travis-ci.org/Automattic/engine.io) -[![NPM version](https://badge.fury.io/js/engine.io.png)](http://badge.fury.io/js/engine.io) - -`Engine.IO` is the implementation of transport-based -cross-browser/cross-device bi-directional communication layer for -[Socket.IO](http://github.com/learnboost/socket.io). - -## How to use - -### Server - -#### (A) Listening on a port - -```js -var engine = require('engine.io'); -var server = engine.listen(80); - -server.on('connection', function(socket){ - socket.send('utf 8 string'); - socket.send(new Buffer([0, 1, 2, 3, 4, 5])); // binary data -}); -``` - -#### (B) Intercepting requests for a http.Server - -```js -var engine = require('engine.io'); -var http = require('http').createServer().listen(3000); -var server = engine.attach(http); - -server.on('connection', function (socket) { - socket.on('message', function(data){ }); - socket.on('close', function(){ }); -}); -``` - -#### (C) Passing in requests - -```js -var engine = require('engine.io'); -var server = new engine.Server(); - -server.on('connection', function(socket){ - socket.send('hi'); -}); - -// … -httpServer.on('upgrade', function(req, socket, head){ - server.handleUpgrade(req, socket, head); -}); -httpServer.on('request', function(req, res){ - server.handleRequest(req, res); -}); -``` - -### Client - -```html - - -``` - -For more information on the client refer to the -[engine-client](http://github.com/learnboost/engine.io-client) repository. - -## What features does it have? - -- **Maximum reliability**. Connections are established even in the presence of: - - proxies and load balancers. - - personal firewall and antivirus software. - - for more information refer to **Goals** and **Architecture** sections -- **Minimal client size** aided by: - - lazy loading of flash transports. - - lack of redundant transports. -- **Scalable** - - load balancer friendly -- **Future proof** -- **100% Node.JS core style** - - No API sugar (left for higher level projects) - - Written in readable vanilla JavaScript - -## API - -### Server - -

    - -#### Top-level - -These are exposed by `require('engine.io')`: - -##### Events - -- `flush` - - Called when a socket buffer is being flushed. - - **Arguments** - - `Socket`: socket being flushed - - `Array`: write buffer -- `drain` - - Called when a socket buffer is drained - - **Arguments** - - `Socket`: socket being flushed - -##### Properties - -- `protocol` _(Number)_: protocol revision number -- `Server`: Server class constructor -- `Socket`: Socket class constructor -- `Transport` _(Function)_: transport constructor -- `transports` _(Object)_: map of available transports - -##### Methods - -- `()` - - Returns a new `Server` instance. If the first argument is an `http.Server` then the - new `Server` instance will be attached to it. Otherwise, the arguments are passed - directly to the `Server` constructor. - - **Parameters** - - `http.Server`: optional, server to attach to. - - `Object`: optional, options object (see `Server#constructor` api docs below) - - The following are identical ways to instantiate a server and then attach it. - ```js - var httpServer; // previously created with `http.createServer();` from node.js api. - - // create a server first, and then attach - var eioServer = require('engine.io').Server(); - eioServer.attach(httpServer); - - // or call the module as a function to get `Server` - var eioServer = require('engine.io')(); - eioServer.attach(httpServer); - - // immediately attach - var eioServer = require('engine.io')(httpServer); - ``` - -- `listen` - - Creates an `http.Server` which listens on the given port and attaches WS - to it. It returns `501 Not Implemented` for regular http requests. - - **Parameters** - - `Number`: port to listen on. - - `Object`: optional, options object - - `Function`: callback for `listen`. - - **Options** - - All options from `Server.attach` method, documented below. - - **Additionally** See Server `constructor` below for options you can pass for creating the new Server - - **Returns** `Server` -- `attach` - - Captures `upgrade` requests for a `http.Server`. In other words, makes - a regular http.Server WebSocket-compatible. - - **Parameters** - - `http.Server`: server to attach to. - - `Object`: optional, options object - - **Options** - - All options from `Server.attach` method, documented below. - - **Additionally** See Server `constructor` below for options you can pass for creating the new Server - - **Returns** `Server` a new Server instance. - -

    - -#### Server - -The main server/manager. _Inherits from EventEmitter_. - -##### Events - -- `connection` - - Fired when a new connection is established. - - **Arguments** - - `Socket`: a Socket object - -##### Properties - -**Important**: if you plan to use Engine.IO in a scalable way, please -keep in mind the properties below will only reflect the clients connected -to a single process. - -- `clients` _(Object)_: hash of connected clients by id. -- `clientsCount` _(Number)_: number of connected clients. - -##### Methods - -- **constructor** - - Initializes the server - - **Parameters** - - `Object`: optional, options object - - **Options** - - `pingTimeout` (`Number`): how many ms without a pong packet to - consider the connection closed (`60000`) - - `pingInterval` (`Number`): how many ms before sending a new ping - packet (`25000`) - - `maxHttpBufferSize` (`Number`): how many bytes or characters a message - can be when polling, before closing the session (to avoid DoS). Default - value is `10E7`. - - `allowRequest` (`Function`): A function that receives a given handshake - or upgrade request as its first parameter, and can decide whether to - continue or not. The second argument is a function that needs to be - called with the decided information: `fn(err, success)`, where - `success` is a boolean value where false means that the request is - rejected, and err is an error code. - - `transports` (` String`): transports to allow connections - to (`['polling', 'websocket']`) - - `allowUpgrades` (`Boolean`): whether to allow transport upgrades - (`true`) - - `cookie` (`String|Boolean`): name of the HTTP cookie that - contains the client sid to send as part of handshake response - headers. Set to `false` to not send one. (`io`) -- `close` - - Closes all clients - - **Returns** `Server` for chaining -- `handleRequest` - - Called internally when a `Engine` request is intercepted. - - **Parameters** - - `http.ServerRequest`: a node request object - - `http.ServerResponse`: a node response object - - **Returns** `Server` for chaining -- `handleUpgrade` - - Called internally when a `Engine` ws upgrade is intercepted. - - **Parameters** (same as `upgrade` event) - - `http.ServerRequest`: a node request object - - `net.Stream`: TCP socket for the request - - `Buffer`: legacy tail bytes - - **Returns** `Server` for chaining -- `attach` - - Attach this Server instance to an `http.Server` - - Captures `upgrade` requests for a `http.Server`. In other words, makes - a regular http.Server WebSocket-compatible. - - **Parameters** - - `http.Server`: server to attach to. - - `Object`: optional, options object - - **Options** - - `path` (`String`): name of the path to capture (`/engine.io`). - - `destroyUpgrade` (`Boolean`): destroy unhandled upgrade requests (`true`) - - `destroyUpgradeTimeout` (`Number`): milliseconds after which unhandled requests are ended (`1000`) - -

    - -#### Socket - -A representation of a client. _Inherits from EventEmitter_. - -##### Events - -- `close` - - Fired when the client is disconnected. - - **Arguments** - - `String`: reason for closing - - `Object`: description object (optional) -- `message` - - Fired when the client sends a message. - - **Arguments** - - `String` or `Buffer`: Unicode string or Buffer with binary contents -- `error` - - Fired when an error occurs. - - **Arguments** - - `Error`: error object -- `flush` - - Called when the write buffer is being flushed. - - **Arguments** - - `Array`: write buffer -- `drain` - - Called when the write buffer is drained -- `packet` - - Called when a socket received a packet (`message`, `ping`) - - **Arguments** - - `type`: packet type - - `data`: packet data (if type is message) -- `packetCreate` - - Called before a socket sends a packet (`message`, `pong`) - - **Arguments** - - `type`: packet type - - `data`: packet data (if type is message) - -##### Properties - -- `id` _(String)_: unique identifier -- `server` _(Server)_: engine parent reference -- `request` _(http.ServerRequest)_: request that originated the Socket -- `upgraded` _(Boolean)_: whether the transport has been upgraded -- `readyState` _(String)_: opening|open|closing|closed -- `transport` _(Transport)_: transport reference - -##### Methods - -- `send`: - - Sends a message, performing `message = toString(arguments[0])` unless - sending binary data, which is sent as is. - - **Parameters** - - `String` | `Buffer` | `ArrayBuffer` | `ArrayBufferView`: a string or any object implementing `toString()`, with outgoing data, or a Buffer or ArrayBuffer with binary data. Also any ArrayBufferView can be sent as is. - - `Function`: optional, a callback executed when the message gets flushed out by the transport - - **Returns** `Socket` for chaining -- `close` - - Disconnects the client - - **Returns** `Socket` for chaining - -### Client - -

    - -Exposed in the `eio` global namespace (in the browser), or by -`require('engine.io-client')` (in Node.JS). - -For the client API refer to the -[engine-client](http://github.com/learnboost/engine.io-client) repository. - -## Debug / logging - -Engine.IO is powered by [debug](http://github.com/visionmedia/debug). -In order to see all the debug output, run your app with the environment variable -`DEBUG` including the desired scope. - -To see the output from all of Engine.IO's debugging scopes you can use: - -``` -DEBUG=engine* node myapp -``` - -## Transports - -- `polling`: XHR / JSONP polling transport. -- `websocket`: WebSocket transport. - -## Plugins - -- [engine.io-conflation](https://github.com/EugenDueck/engine.io-conflation): Makes **conflation and aggregation** of messages straightforward. - -## Support - -The support channels for `engine.io` are the same as `socket.io`: - - irc.freenode.net **#socket.io** - - [Google Groups](http://groups.google.com/group/socket_io) - - [Website](http://socket.io) - -## Development - -To contribute patches, run tests or benchmarks, make sure to clone the -repository: - -``` -git clone git://github.com/LearnBoost/engine.io.git -``` - -Then: - -``` -cd engine.io -npm install -``` - -## Tests - -Tests run with `make test`. It runs the server tests that are aided by -the usage of `engine.io-client`. - -Make sure `npm install` is run first. - -## Goals - -The main goal of `Engine` is ensuring the most reliable realtime communication. -Unlike the previous Socket.IO core, it always establishes a long-polling -connection first, then tries to upgrade to better transports that are "tested" on -the side. - -During the lifetime of the Socket.IO projects, we've found countless drawbacks -to relying on `HTML5 WebSocket` or `Flash Socket` as the first connection -mechanisms. - -Both are clearly the _right way_ of establishing a bidirectional communication, -with HTML5 WebSocket being the way of the future. However, to answer most business -needs, alternative traditional HTTP 1.1 mechanisms are just as good as delivering -the same solution. - -WebSocket based connections have two fundamental benefits: - -1. **Better server performance** - - _A: Load balancers_
    - Load balancing a long polling connection poses a serious architectural nightmare - since requests can come from any number of open sockets by the user agent, but - they all need to be routed to the process and computer that owns the `Engine` - connection. This negatively impacts RAM and CPU usage. - - _B: Network traffic_
    - WebSocket is designed around the premise that each message frame has to be - surrounded by the least amount of data. In HTTP 1.1 transports, each message - frame is surrounded by HTTP headers and chunked encoding frames. If you try to - send the message _"Hello world"_ with xhr-polling, the message ultimately - becomes larger than if you were to send it with WebSocket. - - _C: Lightweight parser_
    - As an effect of **B**, the server has to do a lot more work to parse the network - data and figure out the message when traditional HTTP requests are used - (as in long polling). This means that another advantage of WebSocket is - less server CPU usage. - -2. **Better user experience** - - Due to the reasons stated in point **1**, the most important effect of being able - to establish a WebSocket connection is raw data transfer speed, which translates - in _some_ cases in better user experience. - - Applications with heavy realtime interaction (such as games) will benefit greatly, - whereas applications like realtime chat (Gmail/Facebook), newsfeeds (Facebook) or - timelines (Twitter) will have negligible user experience improvements. - -Having said this, attempting to establish a WebSocket connection directly so far has -proven problematic: - -1. **Proxies**
    - Many corporate proxies block WebSocket traffic. - -2. **Personal firewall and antivirus software**
    - As a result of our research, we've found that at least 3 personal security - applications block WebSocket traffic. - -3. **Cloud application platforms**
    - Platforms like Heroku or No.de have had trouble keeping up with the fast-paced - nature of the evolution of the WebSocket protocol. Applications therefore end up - inevitably using long polling, but the seamless installation experience of - Socket.IO we strive for (_"require() it and it just works"_) disappears. - -Some of these problems have solutions. In the case of proxies and personal programs, -however, the solutions many times involve upgrading software. Experience has shown -that relying on client software upgrades to deliver a business solution is -fruitless: the very existence of this project has to do with a fragmented panorama -of user agent distribution, with clients connecting with latest versions of the most -modern user agents (Chrome, Firefox and Safari), but others with versions as low as -IE 5.5. - -From the user perspective, an unsuccessful WebSocket connection can translate in -up to at least 10 seconds of waiting for the realtime application to begin -exchanging data. This **perceptively** hurts user experience. - -To summarize, **Engine** focuses on reliability and user experience first, marginal -potential UX improvements and increased server performance second. `Engine` is the -result of all the lessons learned with WebSocket in the wild. - -## Architecture - -The main premise of `Engine`, and the core of its existence, is the ability to -swap transports on the fly. A connection starts as xhr-polling, but it can -switch to WebSocket. - -The central problem this poses is: how do we switch transports without losing -messages? - -`Engine` only switches from polling to another transport in between polling -cycles. Since the server closes the connection after a certain timeout when -there's no activity, and the polling transport implementation buffers messages -in between connections, this ensures no message loss and optimal performance. - -Another benefit of this design is that we workaround almost all the limitations -of **Flash Socket**, such as slow connection times, increased file size (we can -safely lazy load it without hurting user experience), etc. - -## FAQ - -### Can I use engine without Socket.IO ? - -Absolutely. Although the recommended framework for building realtime applications -is Socket.IO, since it provides fundamental features for real-world applications -such as multiplexing, reconnection support, etc. - -`Engine` is to Socket.IO what Connect is to Express. An essential piece for building -realtime frameworks, but something you _probably_ won't be using for building -actual applications. - -### Does the server serve the client? - -No. The main reason is that `Engine` is meant to be bundled with frameworks. -Socket.IO includes `Engine`, therefore serving two clients is not necessary. If -you use Socket.IO, including - -```html - -``` - -In [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS ≥ v0.8.0](http://ringojs.org/): - -```js -var utf8 = require('utf8'); -``` - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('utf8.js'); -``` - -Using an AMD loader like [RequireJS](http://requirejs.org/): - -```js -require( - { - 'paths': { - 'utf8': 'path/to/utf8' - } - }, - ['utf8'], - function(utf8) { - console.log(utf8); - } -); -``` - -## API - -### `utf8.encode(string)` - -Encodes any given JavaScript string (`string`) as UTF-8, and returns the UTF-8-encoded version of the string. - -```js -// U+00A9 COPYRIGHT SIGN; see http://codepoints.net/U+00A9 -utf8.encode('\xA9'); -// → '\xC2\xA9' -// U+10001 LINEAR B SYLLABLE B038 E; see http://codepoints.net/U+10001 -utf8.encode('\uD800\uDC01'); -// → '\xF0\x90\x80\x81' -``` - -### `utf8.decode(byteString)` - -Encodes any given UTF-8-encoded string (`byteString`) as UTF-8, and returns the UTF-8-decoded version of the string. It throws an error when malformed UTF-8 is detected. - -```js -utf8.decode('\xC2\xA9'); -// → '\xA9' - -utf8.decode('\xF0\x90\x80\x81'); -// → '\uD800\uDC01' -// → U+10001 LINEAR B SYLLABLE B038 E -``` - -### `utf8.version` - -A string representing the semantic version number. - -## Support - -utf8.js has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4. - -## Unit tests & code coverage - -After cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. - -Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`. - -To generate [the code coverage report](http://rawgithub.com/mathiasbynens/utf8.js/master/coverage/utf8.js/utf8.js.html), use `grunt cover`. - -## FAQ - -### Why is the first release named v2.0.0? Haven’t you heard of [semantic versioning](http://semver.org/)? - -Long before utf8.js was created, the `utf8` module on npm was registered and used by another (slightly buggy) library. @ryanmcgrath was kind enough to give me access to the `utf8` package on npm when I told him about utf8.js. Since there has already been a v1.0.0 release of the old library, and to avoid breaking backwards compatibility with projects that rely on the `utf8` npm package, I decided the tag the first release of utf8.js as v2.0.0 and take it from there. - -## Author - -| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias "Follow @mathias on Twitter") | -|---| -| [Mathias Bynens](http://mathiasbynens.be/) | - -## License - -utf8.js is dual licensed under the [MIT](http://mths.be/mit) and [GPL](http://mths.be/gpl) licenses. diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/bower.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/bower.json deleted file mode 100644 index fe8fa72..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "utf8", - "version": "2.0.0", - "main": "utf8.js", - "ignore": [ - "coverage", - "tests", - ".*", - "component.json", - "Gruntfile.js", - "node_modules", - "package.json" - ] -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/component.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/component.json deleted file mode 100644 index 5165d4f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/component.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "utf8", - "version": "2.0.0", - "description": "A well-tested UTF-8 encoder/decoder written in JavaScript.", - "repo": "mathiasbynens/utf8.js", - "license": "MIT/GPL", - "scripts": [ - "utf8.js" - ], - "keywords": [ - "charset", - "encoding", - "unicode", - "utf8" - ] -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/index.html b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/index.html deleted file mode 100644 index 68f3574..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/index.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - Code coverage report for All files - - - - - - - -
    -

    Code coverage report for All files

    -

    - - Statements: 92.31% (120 / 130)      - - - Branches: 78.79% (52 / 66)      - - - Functions: 90% (9 / 10)      - - - Lines: 92.31% (120 / 130)      - -

    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    utf8.js/92.31%(120 / 130)78.79%(52 / 66)90%(9 / 10)92.31%(120 / 130)
    -
    -
    - - - - - - - - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.css b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.css deleted file mode 100644 index b317a7c..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.js deleted file mode 100644 index ef51e03..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/index.html b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/index.html deleted file mode 100644 index 926b3f6..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/index.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - Code coverage report for utf8.js/ - - - - - - - -
    -

    Code coverage report for utf8.js/

    -

    - - Statements: 92.31% (120 / 130)      - - - Branches: 78.79% (52 / 66)      - - - Functions: 90% (9 / 10)      - - - Lines: 92.31% (120 / 130)      - -

    -
    All files » utf8.js/
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    utf8.js92.31%(120 / 130)78.79%(52 / 66)90%(9 / 10)92.31%(120 / 130)
    -
    -
    - - - - - - - - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/utf8.js.html b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/utf8.js.html deleted file mode 100644 index 8923045..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/coverage/utf8.js/utf8.js.html +++ /dev/null @@ -1,1028 +0,0 @@ - - - - Code coverage report for utf8.js/utf8.js - - - - - - - -
    -

    Code coverage report for utf8.js/utf8.js

    -

    - - Statements: 92.31% (120 / 130)      - - - Branches: 78.79% (52 / 66)      - - - Functions: 90% (9 / 10)      - - - Lines: 92.31% (120 / 130)      - -

    -
    All files » utf8.js/ » utf8.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242  -1 -  -  -1 -  -  -1 -  -  -  -  -1 -1 -1 -  -  -  -  -1 -  -  -1 -52 -52 -52 -52 -52 -52 -128 -128 -  -8 -8 -5 -  -  -  -3 -3 -  -  -120 -  -  -52 -  -  -  -1 -24 -24 -24 -24 -24 -32 -32 -5 -5 -5 -  -32 -  -24 -  -  -  -  -  -1 -29 -  -  -1 -32 -5 -  -27 -27 -3 -  -24 -19 -19 -  -5 -5 -5 -5 -  -27 -27 -  -  -1 -24 -  -  -  -  -  -24 -24 -24 -24 -24 -32 -32 -  -24 -  -  -  -  -  -1 -60 -1 -  -  -59 -59 -  -59 -57 -  -  -  -2 -  -  -1 -60 -60 -60 -60 -60 -  -60 -  -  -  -60 -24 -  -  -  -36 -36 -  -  -36 -5 -  -  -  -31 -4 -3 -3 -3 -  -  -  -  -  -  -27 -20 -19 -19 -19 -19 -  -  -  -  -  -  -7 -6 -6 -5 -5 -  -5 -5 -  -  -  -1 -  -  -1 -1 -1 -1 -28 -28 -28 -28 -28 -28 -32 -  -24 -  -  -  -  -1 -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -1 -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  - 
    /*! http://mths.be/utf8js v2.0.0 by @mathias */
    -;(function(root) {
    - 
    -	// Detect free variables `exports`
    -	var freeExports = typeof exports == 'object' && exports;
    - 
    -	// Detect free variable `module`
    -	var freeModule = typeof module == 'object' && module &&
    -		module.exports == freeExports && module;
    - 
    -	// Detect free variable `global`, from Node.js or Browserified code,
    -	// and use it as `root`
    -	var freeGlobal = typeof global == 'object' && global;
    -	Eif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
    -		root = freeGlobal;
    -	}
    - 
    -	/*--------------------------------------------------------------------------*/
    - 
    -	var stringFromCharCode = String.fromCharCode;
    - 
    -	// Taken from http://mths.be/punycode
    -	function ucs2decode(string) {
    -		var output = [];
    -		var counter = 0;
    -		var length = string.length;
    -		var value;
    -		var extra;
    -		while (counter < length) {
    -			value = string.charCodeAt(counter++);
    -			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
    -				// high surrogate, and there is a next character
    -				extra = string.charCodeAt(counter++);
    -				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
    -					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
    -				} else {
    -					// unmatched surrogate; only append this code unit, in case the next
    -					// code unit is the high surrogate of a surrogate pair
    -					output.push(value);
    -					counter--;
    -				}
    -			} else {
    -				output.push(value);
    -			}
    -		}
    -		return output;
    -	}
    - 
    -	// Taken from http://mths.be/punycode
    -	function ucs2encode(array) {
    -		var length = array.length;
    -		var index = -1;
    -		var value;
    -		var output = '';
    -		while (++index < length) {
    -			value = array[index];
    -			if (value > 0xFFFF) {
    -				value -= 0x10000;
    -				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
    -				value = 0xDC00 | value & 0x3FF;
    -			}
    -			output += stringFromCharCode(value);
    -		}
    -		return output;
    -	}
    - 
    -	/*--------------------------------------------------------------------------*/
    - 
    -	// https://github.com/php/php-src/blob/master/ext/mbstring/oniguruma/enc/utf8.c
    -	function createByte(codePoint, shift) {
    -		return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
    -	}
    - 
    -	function encodeCodePoint(codePoint) {
    -		if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
    -			return stringFromCharCode(codePoint);
    -		}
    -		var symbol = '';
    -		if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
    -			symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
    -		}
    -		else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
    -			symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
    -			symbol += createByte(codePoint, 6);
    -		}
    -		else Eif ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
    -			symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
    -			symbol += createByte(codePoint, 12);
    -			symbol += createByte(codePoint, 6);
    -		}
    -		symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
    -		return symbol;
    -	}
    - 
    -	function utf8encode(string) {
    -		var codePoints = ucs2decode(string);
    - 
    -		// console.log(JSON.stringify(codePoints.map(function(x) {
    -		// 	return 'U+' + x.toString(16).toUpperCase();
    -		// })));
    - 
    -		var length = codePoints.length;
    -		var index = -1;
    -		var codePoint;
    -		var byteString = '';
    -		while (++index < length) {
    -			codePoint = codePoints[index];
    -			byteString += encodeCodePoint(codePoint);
    -		}
    -		return byteString;
    -	}
    - 
    -	/*--------------------------------------------------------------------------*/
    - 
    -	// https://github.com/php/php-src/blob/master/ext/json/utf8_decode.c
    -	function readContinuationByte() {
    -		if (byteIndex >= byteCount) {
    -			throw Error('Invalid byte index');
    -		}
    - 
    -		var continuationByte = byteArray[byteIndex] & 0xFF;
    -		byteIndex++;
    - 
    -		if ((continuationByte & 0xC0) == 0x80) {
    -			return continuationByte & 0x3F;
    -		}
    - 
    -		// If we end up here, it’s not a continuation byte
    -		throw Error('Invalid continuation byte');
    -	}
    - 
    -	function decodeSymbol() {
    -		var byte1;
    -		var byte2;
    -		var byte3;
    -		var byte4;
    -		var codePoint;
    - 
    -		Iif (byteIndex > byteCount) {
    -			throw Error('Invalid byte index');
    -		}
    - 
    -		if (byteIndex == byteCount) {
    -			return false;
    -		}
    - 
    -		// Read first byte
    -		byte1 = byteArray[byteIndex] & 0xFF;
    -		byteIndex++;
    - 
    -		// 1-byte sequence (no continuation bytes)
    -		if ((byte1 & 0x80) == 0) {
    -			return byte1;
    -		}
    - 
    -		// 2-byte sequence
    -		if ((byte1 & 0xE0) == 0xC0) {
    -			var byte2 = readContinuationByte();
    -			codePoint = ((byte1 & 0x1F) << 6) | byte2;
    -			Eif (codePoint >= 0x80) {
    -				return codePoint;
    -			} else {
    -				throw Error('Invalid continuation byte');
    -			}
    -		}
    - 
    -		// 3-byte sequence (may include unpaired surrogates)
    -		if ((byte1 & 0xF0) == 0xE0) {
    -			byte2 = readContinuationByte();
    -			byte3 = readContinuationByte();
    -			codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
    -			Eif (codePoint >= 0x0800) {
    -				return codePoint;
    -			} else {
    -				throw Error('Invalid continuation byte');
    -			}
    -		}
    - 
    -		// 4-byte sequence
    -		if ((byte1 & 0xF8) == 0xF0) {
    -			byte2 = readContinuationByte();
    -			byte3 = readContinuationByte();
    -			byte4 = readContinuationByte();
    -			codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) |
    -				(byte3 << 0x06) | byte4;
    -			Eif (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
    -				return codePoint;
    -			}
    -		}
    - 
    -		throw Error('Invalid UTF-8 detected');
    -	}
    - 
    -	var byteArray;
    -	var byteCount;
    -	var byteIndex;
    -	function utf8decode(byteString) {
    -		byteArray = ucs2decode(byteString);
    -		byteCount = byteArray.length;
    -		byteIndex = 0;
    -		var codePoints = [];
    -		var tmp;
    -		while ((tmp = decodeSymbol()) !== false) {
    -			codePoints.push(tmp);
    -		}
    -		return ucs2encode(codePoints);
    -	}
    - 
    -	/*--------------------------------------------------------------------------*/
    - 
    -	var utf8 = {
    -		'version': '2.0.0',
    -		'encode': utf8encode,
    -		'decode': utf8decode
    -	};
    - 
    -	// Some AMD build optimizers, like r.js, check for specific condition patterns
    -	// like the following:
    -	Iif (
    -		typeof define == 'function' &&
    -		typeof define.amd == 'object' &&
    -		define.amd
    -	) {
    -		define(function() {
    -			return utf8;
    -		});
    -	}	else Eif (freeExports && !freeExports.nodeType) {
    -		Eif (freeModule) { // in Node.js or RingoJS v0.8.0+
    -			freeModule.exports = utf8;
    -		} else { // in Narwhal or RingoJS v0.7.0-
    -			var object = {};
    -			var hasOwnProperty = object.hasOwnProperty;
    -			for (var key in utf8) {
    -				hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);
    -			}
    -		}
    -	} else { // in Rhino or a web browser
    -		root.utf8 = utf8;
    -	}
    - 
    -}(this));
    - 
    - -
    - - - - - - - - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/package.json deleted file mode 100644 index 0868533..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "utf8", - "version": "2.0.0", - "description": "A well-tested UTF-8 encoder/decoder written in JavaScript.", - "homepage": "http://mths.be/utf8js", - "main": "utf8.js", - "keywords": [ - "charset", - "encoding", - "unicode", - "utf8" - ], - "licenses": [ - { - "type": "MIT", - "url": "http://mths.be/mit" - }, - { - "type": "GPL", - "url": "http://mths.be/gpl" - } - ], - "author": { - "name": "Mathias Bynens", - "url": "http://mathiasbynens.be/" - }, - "repository": { - "type": "git", - "url": "https://github.com/mathiasbynens/utf8.js.git" - }, - "bugs": { - "url": "https://github.com/mathiasbynens/utf8.js/issues" - }, - "directories": { - "test": "tests" - }, - "scripts": { - "test": "node tests/tests.js" - }, - "dependencies": {}, - "devDependencies": { - "grunt": "~0.4.1", - "grunt-shell": "~0.2.2", - "istanbul": "~0.1.36", - "qunit-clib": "~1.3.0", - "qunitjs": "~1.11.0", - "requirejs": "~2.1.6" - }, - "readme": "# utf8.js [![Build status](https://travis-ci.org/mathiasbynens/utf8.js.png?branch=master)](https://travis-ci.org/mathiasbynens/utf8.js) [![Dependency status](https://gemnasium.com/mathiasbynens/utf8.js.png)](https://gemnasium.com/mathiasbynens/utf8.js)\n\n_utf8.js_ is a well-tested UTF-8 encoder/decoder written in JavaScript. Unlike many other JavaScript solutions, it is designed to be a _proper_ UTF-8 encoder/decoder: it can encode/decode any given Unicode code point, including astral symbols and unpaired surrogates.\n\nFeel free to fork if you see possible improvements!\n\n## Installation\n\nVia [npm](http://npmjs.org/):\n\n```bash\nnpm install utf8\n```\n\nVia [Bower](http://bower.io/):\n\n```bash\nbower install utf8\n```\n\nVia [Component](https://github.com/component/component):\n\n```bash\ncomponent install mathiasbynens/utf8.js\n```\n\nIn a browser:\n\n```html\n\n```\n\nIn [Narwhal](http://narwhaljs.org/), [Node.js](http://nodejs.org/), and [RingoJS ≥ v0.8.0](http://ringojs.org/):\n\n```js\nvar utf8 = require('utf8');\n```\n\nIn [Rhino](http://www.mozilla.org/rhino/):\n\n```js\nload('utf8.js');\n```\n\nUsing an AMD loader like [RequireJS](http://requirejs.org/):\n\n```js\nrequire(\n {\n 'paths': {\n 'utf8': 'path/to/utf8'\n }\n },\n ['utf8'],\n function(utf8) {\n console.log(utf8);\n }\n);\n```\n\n## API\n\n### `utf8.encode(string)`\n\nEncodes any given JavaScript string (`string`) as UTF-8, and returns the UTF-8-encoded version of the string.\n\n```js\n// U+00A9 COPYRIGHT SIGN; see http://codepoints.net/U+00A9\nutf8.encode('\\xA9');\n// → '\\xC2\\xA9'\n// U+10001 LINEAR B SYLLABLE B038 E; see http://codepoints.net/U+10001\nutf8.encode('\\uD800\\uDC01');\n// → '\\xF0\\x90\\x80\\x81'\n```\n\n### `utf8.decode(byteString)`\n\nEncodes any given UTF-8-encoded string (`byteString`) as UTF-8, and returns the UTF-8-decoded version of the string. It throws an error when malformed UTF-8 is detected.\n\n```js\nutf8.decode('\\xC2\\xA9');\n// → '\\xA9'\n\nutf8.decode('\\xF0\\x90\\x80\\x81');\n// → '\\uD800\\uDC01'\n// → U+10001 LINEAR B SYLLABLE B038 E\n```\n\n### `utf8.version`\n\nA string representing the semantic version number.\n\n## Support\n\nutf8.js has been tested in at least Chrome 27-29, Firefox 3-22, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0, and Rhino 1.7RC4.\n\n## Unit tests & code coverage\n\nAfter cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.\n\nOnce that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`.\n\nTo generate [the code coverage report](http://rawgithub.com/mathiasbynens/utf8.js/master/coverage/utf8.js/utf8.js.html), use `grunt cover`.\n\n## FAQ\n\n### Why is the first release named v2.0.0? Haven’t you heard of [semantic versioning](http://semver.org/)?\n\nLong before utf8.js was created, the `utf8` module on npm was registered and used by another (slightly buggy) library. @ryanmcgrath was kind enough to give me access to the `utf8` package on npm when I told him about utf8.js. Since there has already been a v1.0.0 release of the old library, and to avoid breaking backwards compatibility with projects that rely on the `utf8` npm package, I decided the tag the first release of utf8.js as v2.0.0 and take it from there.\n\n## Author\n\n| [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](http://twitter.com/mathias \"Follow @mathias on Twitter\") |\n|---|\n| [Mathias Bynens](http://mathiasbynens.be/) |\n\n## License\n\nutf8.js is dual licensed under the [MIT](http://mths.be/mit) and [GPL](http://mths.be/gpl) licenses.\n", - "readmeFilename": "README.md", - "_id": "utf8@2.0.0", - "dist": { - "shasum": "79ce59eced874809cab9a71fc7102c7d45d4118d", - "tarball": "http://registry.npmjs.org/utf8/-/utf8-2.0.0.tgz" - }, - "_from": "utf8@2.0.0", - "_npmVersion": "1.2.30", - "_npmUser": { - "name": "mathias", - "email": "mathias@qiwi.be" - }, - "maintainers": [ - { - "name": "ryanmcgrath", - "email": "ryan@venodesigns.net" - }, - { - "name": "mathias", - "email": "mathias@qiwi.be" - } - ], - "_shasum": "79ce59eced874809cab9a71fc7102c7d45d4118d", - "_resolved": "https://registry.npmjs.org/utf8/-/utf8-2.0.0.tgz" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py deleted file mode 100755 index 096b012..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python - -import re -import json - -# http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae -# http://stackoverflow.com/a/13436167/96656 -def unisymbol(codePoint): - if codePoint >= 0x0000 and codePoint <= 0xFFFF: - return unichr(codePoint) - elif codePoint >= 0x010000 and codePoint <= 0x10FFFF: - highSurrogate = int((codePoint - 0x10000) / 0x400) + 0xD800 - lowSurrogate = int((codePoint - 0x10000) % 0x400) + 0xDC00 - return unichr(highSurrogate) + unichr(lowSurrogate) - else: - return 'Error' - -def hexify(codePoint): - return 'U+' + hex(codePoint)[2:].upper().zfill(6) - -def writeFile(filename, contents): - print filename - with open(filename, 'w') as f: - f.write(contents.strip() + '\n') - -data = [] -for codePoint in range(0x000000, 0x10FFFF + 1): - symbol = unisymbol(codePoint) - # http://stackoverflow.com/a/17199950/96656 - bytes = symbol.encode('utf8').decode('latin1') - data.append({ - 'codePoint': codePoint, - 'decoded': symbol, - 'encoded': bytes - }); - -jsonData = json.dumps(data, sort_keys=False, indent=2, separators=(',', ': ')) -# Use tabs instead of double spaces for indentation -jsonData = jsonData.replace(' ', '\t') -# Escape hexadecimal digits in escape sequences -jsonData = re.sub( - r'\\u([a-fA-F0-9]{4})', - lambda match: r'\u{}'.format(match.group(1).upper()), - jsonData -) - -writeFile('data.json', jsonData) diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/index.html b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/index.html deleted file mode 100644 index 13cc04d..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - utf8.js test suite - - - -
    - - - - - - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/tests.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/tests.js deleted file mode 100644 index cb01e10..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/tests/tests.js +++ /dev/null @@ -1,242 +0,0 @@ -;(function(root) { - 'use strict'; - - /** Use a single `load` function */ - var load = typeof require == 'function' ? require : root.load; - - /** The unit testing framework */ - var QUnit = (function() { - var noop = Function.prototype; - return root.QUnit || ( - root.addEventListener || (root.addEventListener = noop), - root.setTimeout || (root.setTimeout = noop), - root.QUnit = load('../node_modules/qunitjs/qunit/qunit.js') || root.QUnit, - (load('../node_modules/qunit-clib/qunit-clib.js') || { 'runInContext': noop }).runInContext(root), - addEventListener === noop && delete root.addEventListener, - root.QUnit - ); - }()); - - /** The `utf8` object to test */ - var utf8 = root.utf8 || (root.utf8 = ( - utf8 = load('../utf8.js') || root.utf8, - utf8 = utf8.utf8 || utf8 - )); - - /*--------------------------------------------------------------------------*/ - - function forEach(array, fn) { - var index = -1; - var length = array.length; - while (++index < length) { - fn(array[index]); - } - } - - // Quick and dirty test to see if we’re in Node & need extended tests - var runExtendedTests = (function() { - try { - return process.argv[0] == 'node' && process.argv[2] == '--extended'; - } catch(error) { } - }()); - - var data = [ - // 1-byte - { - 'codePoint': 0x0000, - 'decoded': '\0', - 'encoded': '\0' - }, - { - 'codePoint': 0x005C, - 'decoded': '\x5C', - 'encoded': '\x5C' - }, - { - 'codePoint': 0x007F, - 'decoded': '\x7F', - 'encoded': '\x7F' - }, - - // 2-byte - { - 'codePoint': 0x0080, - 'decoded': '\x80', - 'encoded': '\xC2\x80' - }, - { - 'codePoint': 0x05CA, - 'decoded': '\u05CA', - 'encoded': '\xD7\x8A' - }, - { - 'codePoint': 0x07FF, - 'decoded': '\u07FF', - 'encoded': '\xDF\xBF', - }, - - // 3-byte - { - 'codePoint': 0x0800, - 'decoded': '\u0800', - 'encoded': '\xE0\xA0\x80', - }, - { - 'codePoint': 0x2C3C, - 'decoded': '\u2C3C', - 'encoded': '\xE2\xB0\xBC' - }, - { - 'codePoint': 0xFFFF, - 'decoded': '\uFFFF', - 'encoded': '\xEF\xBF\xBF' - }, - // unmatched surrogate halves - // high surrogates: 0xD800 to 0xDBFF - { - 'codePoint': 0xD800, - 'decoded': '\uD800', - 'encoded': '\xED\xA0\x80' - }, - { - 'description': 'High surrogate followed by another high surrogate', - 'decoded': '\uD800\uD800', - 'encoded': '\xED\xA0\x80\xED\xA0\x80' - }, - { - 'description': 'High surrogate followed by a symbol that is not a surrogate', - 'decoded': '\uD800A', - 'encoded': '\xED\xA0\x80A' - }, - { - 'description': 'Unmatched high surrogate, followed by a surrogate pair, followed by an unmatched high surrogate', - 'decoded': '\uD800\uD834\uDF06\uD800', - 'encoded': '\xED\xA0\x80\xF0\x9D\x8C\x86\xED\xA0\x80' - }, - { - 'codePoint': 0xD9AF, - 'decoded': '\uD9AF', - 'encoded': '\xED\xA6\xAF' - }, - { - 'codePoint': 0xDBFF, - 'decoded': '\uDBFF', - 'encoded': '\xED\xAF\xBF' - }, - // low surrogates: 0xDC00 to 0xDFFF - { - 'codePoint': 0xDC00, - 'decoded': '\uDC00', - 'encoded': '\xED\xB0\x80' - }, - { - 'description': 'Low surrogate followed by another low surrogate', - 'decoded': '\uDC00\uDC00', - 'encoded': '\xED\xB0\x80\xED\xB0\x80' - }, - { - 'description': 'Low surrogate followed by a symbol that is not a surrogate', - 'decoded': '\uDC00A', - 'encoded': '\xED\xB0\x80A' - }, - { - 'description': 'Unmatched low surrogate, followed by a surrogate pair, followed by an unmatched low surrogate', - 'decoded': '\uDC00\uD834\uDF06\uDC00', - 'encoded': '\xED\xB0\x80\xF0\x9D\x8C\x86\xED\xB0\x80' - }, - { - 'codePoint': 0xDEEE, - 'decoded': '\uDEEE', - 'encoded': '\xED\xBB\xAE' - }, - { - 'codePoint': 0xDFFF, - 'decoded': '\uDFFF', - 'encoded': '\xED\xBF\xBF' - }, - - // 4-byte - { - 'codePoint': 0x010000, - 'decoded': '\uD800\uDC00', - 'encoded': '\xF0\x90\x80\x80' - }, - { - 'codePoint': 0x01D306, - 'decoded': '\uD834\uDF06', - 'encoded': '\xF0\x9D\x8C\x86' - }, - { - 'codePoint': 0x10FFF, - 'decoded': '\uDBFF\uDFFF', - 'encoded': '\xF4\x8F\xBF\xBF' - } - ]; - - if (runExtendedTests) { - data = data.concat(require('./data.json')); - } - - // `throws` is a reserved word in ES3; alias it to avoid errors - var raises = QUnit.assert['throws']; - - // explicitly call `QUnit.module()` instead of `module()` - // in case we are in a CLI environment - QUnit.module('utf8.js'); - - test('encode/decode', function() { - forEach(data, function(object) { - var description = object.description || 'U+' + object.codePoint.toString(16).toUpperCase(); - ; - equal( - object.encoded, - utf8.encode(object.decoded), - 'Encoding: ' + description - ); - equal( - object.decoded, - utf8.decode(object.encoded), - 'Decoding: ' + description - ); - }); - - // Error handling - raises( - function() { - utf8.decode('\uFFFF'); - }, - Error, - 'Error: invalid UTF-8 detected' - ); - raises( - function() { - utf8.decode('\xE9\x00\x00'); - }, - Error, - 'Error: invalid continuation byte (4-byte sequence expected)' - ); - raises( - function() { - utf8.decode('\xC2\uFFFF'); - }, - Error, - 'Error: invalid continuation byte' - ); - raises( - function() { - utf8.decode('\xF0\x9D'); - }, - Error, - 'Error: invalid byte index' - ); - }); - - /*--------------------------------------------------------------------------*/ - - // configure QUnit and call `QUnit.start()` for - // Narwhal, Node.js, PhantomJS, Rhino, and RingoJS - if (!root.document || root.phantom) { - QUnit.config.noglobals = true; - QUnit.start(); - } -}(typeof global == 'object' && global || this)); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/utf8.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/utf8.js deleted file mode 100644 index 8f99bb1..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/utf8.js +++ /dev/null @@ -1,239 +0,0 @@ -/*! http://mths.be/utf8js v2.0.0 by @mathias */ -;(function(root) { - - // Detect free variables `exports` - var freeExports = typeof exports == 'object' && exports; - - // Detect free variable `module` - var freeModule = typeof module == 'object' && module && - module.exports == freeExports && module; - - // Detect free variable `global`, from Node.js or Browserified code, - // and use it as `root` - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - var stringFromCharCode = String.fromCharCode; - - // Taken from http://mths.be/punycode - function ucs2decode(string) { - var output = []; - var counter = 0; - var length = string.length; - var value; - var extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - // Taken from http://mths.be/punycode - function ucs2encode(array) { - var length = array.length; - var index = -1; - var value; - var output = ''; - while (++index < length) { - value = array[index]; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - } - return output; - } - - /*--------------------------------------------------------------------------*/ - - function createByte(codePoint, shift) { - return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80); - } - - function encodeCodePoint(codePoint) { - if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence - return stringFromCharCode(codePoint); - } - var symbol = ''; - if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence - symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0); - } - else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence - symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0); - symbol += createByte(codePoint, 6); - } - else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence - symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0); - symbol += createByte(codePoint, 12); - symbol += createByte(codePoint, 6); - } - symbol += stringFromCharCode((codePoint & 0x3F) | 0x80); - return symbol; - } - - function utf8encode(string) { - var codePoints = ucs2decode(string); - - // console.log(JSON.stringify(codePoints.map(function(x) { - // return 'U+' + x.toString(16).toUpperCase(); - // }))); - - var length = codePoints.length; - var index = -1; - var codePoint; - var byteString = ''; - while (++index < length) { - codePoint = codePoints[index]; - byteString += encodeCodePoint(codePoint); - } - return byteString; - } - - /*--------------------------------------------------------------------------*/ - - function readContinuationByte() { - if (byteIndex >= byteCount) { - throw Error('Invalid byte index'); - } - - var continuationByte = byteArray[byteIndex] & 0xFF; - byteIndex++; - - if ((continuationByte & 0xC0) == 0x80) { - return continuationByte & 0x3F; - } - - // If we end up here, it’s not a continuation byte - throw Error('Invalid continuation byte'); - } - - function decodeSymbol() { - var byte1; - var byte2; - var byte3; - var byte4; - var codePoint; - - if (byteIndex > byteCount) { - throw Error('Invalid byte index'); - } - - if (byteIndex == byteCount) { - return false; - } - - // Read first byte - byte1 = byteArray[byteIndex] & 0xFF; - byteIndex++; - - // 1-byte sequence (no continuation bytes) - if ((byte1 & 0x80) == 0) { - return byte1; - } - - // 2-byte sequence - if ((byte1 & 0xE0) == 0xC0) { - var byte2 = readContinuationByte(); - codePoint = ((byte1 & 0x1F) << 6) | byte2; - if (codePoint >= 0x80) { - return codePoint; - } else { - throw Error('Invalid continuation byte'); - } - } - - // 3-byte sequence (may include unpaired surrogates) - if ((byte1 & 0xF0) == 0xE0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3; - if (codePoint >= 0x0800) { - return codePoint; - } else { - throw Error('Invalid continuation byte'); - } - } - - // 4-byte sequence - if ((byte1 & 0xF8) == 0xF0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - byte4 = readContinuationByte(); - codePoint = ((byte1 & 0x0F) << 0x12) | (byte2 << 0x0C) | - (byte3 << 0x06) | byte4; - if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { - return codePoint; - } - } - - throw Error('Invalid UTF-8 detected'); - } - - var byteArray; - var byteCount; - var byteIndex; - function utf8decode(byteString) { - byteArray = ucs2decode(byteString); - byteCount = byteArray.length; - byteIndex = 0; - var codePoints = []; - var tmp; - while ((tmp = decodeSymbol()) !== false) { - codePoints.push(tmp); - } - return ucs2encode(codePoints); - } - - /*--------------------------------------------------------------------------*/ - - var utf8 = { - 'version': '2.0.0', - 'encode': utf8encode, - 'decode': utf8decode - }; - - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define(function() { - return utf8; - }); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = utf8; - } else { // in Narwhal or RingoJS v0.7.0- - var object = {}; - var hasOwnProperty = object.hasOwnProperty; - for (var key in utf8) { - hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); - } - } - } else { // in Rhino or a web browser - root.utf8 = utf8; - } - -}(this)); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/x.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/x.js deleted file mode 100644 index 2a23211..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/node_modules/utf8/x.js +++ /dev/null @@ -1,46 +0,0 @@ -var utf8 = require('./utf8.js'); -var stringEscape = require('string-escape'); - -utf8.encode('\xA9'); -// console.log( -// utf8.encode('\uD800\uDC01'), -// '\xF0\x90\x80\x81', -// utf8.encode('\uD800\uDC01') == '\xF0\x90\x80\x81' -// ); - -var obj = { - 'description': 'Low surrogate followed by another low surrogate', - // 'decoded': '\uDC00\uDC00', - // 'encoded': '\xED\xB0\x80\xED\xB0\x80' - 'decoded': '\xA9', - 'encoded': '\xED\xB0\x80' -}; - -// Encoding -actual = utf8.encode(obj.decoded); -expected = obj.encoded; - -if (actual != expected) { - console.log( - 'fail\n', - 'actual ', stringEscape(actual), '\n', - 'expected', stringEscape(expected) - ); -} else { - console.log('encoding successsssss') -} - - -// // Decoding -// actual = utf8.decode(obj.encoded); -// expected = obj.decoded; - -// if (actual != expected) { -// console.log( -// 'fail\n', -// 'actual ', actual, '\n', -// 'expected', expected -// ); -// } else { -// console.log('decoding successsssss') -// } \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/package.json deleted file mode 100644 index b1b3c87..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/engine.io-parser/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "engine.io-parser", - "description": "Parser for the client for the realtime Engine", - "version": "1.1.0", - "homepage": "https://github.com/LearnBoost/engine.io-protocol", - "devDependencies": { - "mocha": "*", - "expect.js": "*", - "zuul": "1.6.3" - }, - "dependencies": { - "base64-arraybuffer": "0.1.2", - "after": "0.8.1", - "arraybuffer.slice": "0.0.6", - "blob": "0.0.2", - "utf8": "2.0.0" - }, - "scripts": { - "test": "make test" - }, - "component": { - "scripts": { - "engine.io-parser/index.js": "lib/index.js", - "engine.io-parser/keys.js": "lib/keys.js" - } - }, - "repository": { - "type": "git", - "url": "git@github.com:LearnBoost/engine.io-parser.git" - }, - "browser": "./lib/browser.js", - "gitHead": "859338a4ae4cd43706559b3213e04554a3d71fe5", - "bugs": { - "url": "https://github.com/LearnBoost/engine.io-parser/issues" - }, - "_id": "engine.io-parser@1.1.0", - "_shasum": "39a2f7b1e8998fa1245fbc91e13504b8c92f3755", - "_from": "engine.io-parser@1.1.0", - "_npmVersion": "1.4.14", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "dist": { - "shasum": "39a2f7b1e8998fa1245fbc91e13504b8c92f3755", - "tarball": "http://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.1.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.npmignore deleted file mode 100644 index 1eba800..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -npm-debug.log -node_modules -.*.swp -.lock-* -build - -bench -doc -examples -test - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.travis.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.travis.yml deleted file mode 100644 index 9735866..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -npm_args: --ws:native -node_js: - - "0.8" - - "0.10" diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/History.md deleted file mode 100644 index 365a994..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/History.md +++ /dev/null @@ -1,322 +0,0 @@ -v0.5 - November 20th 2013 -===================== - -* Fixed a file descriptor leak. -* Removed wscat as cli client from ws and released as separate module (wscat) -* Fixed memory leak caused by EventEmitters. -* Protocol errors now return a 401 error instead of 404 which is more suitable. -* Code refactor to support strict mode. -* Updated dependencies to latest versions - -v0.4.31 - September 23th, 2013 -===================== - -* Component support - -v0.4.30 - August 30th, 2013 -===================== - -* BufferedAmount could be undefined, default to 0 [TooTallNate] -* Support protocols as second argument and options as third [TooTallNate] -* Proper browserify shim [mcollina] -* Broadcasting example in README [stefanocudini] - -v0.4.29 - August 23th, 2013 -===================== -* Small clean up of the Node 0.11 support by using NAN from the NPM registry [kkoopa] -* Support for custom `Agent`'s through the options. [gramakri] & [TooTallNate] -* Support for custom headers through the options [3rd-Eden] -* Added a `gypfile` flag to the package.json for compiled module discovery [wolfeidau] - -v0.4.28 - August 16th, 2013 -===================== -* Node 0.11 support. [kkoopa] -* Authorization headers are sent when basic auth is used in the url [jcrugzz] -* Origin header will now include the port number [Jason Plum] -* Race condition fixed where data was received before the readyState was updated. [saschagehlich] - -v0.4.27 - June 27th, 2013 -===================== -* Frames are no longer masked in `wscat`. [slaskis] -* Don't retrain reference to large slab buffers. [jmatthewsr-msi] -* Don't use Buffer.byteLength for ArrayBuffer's. [Anthony Pesch] -* Fix browser field in package.json. [shtylman] -* Client-side certificate support & documentation improvements. [Lukas Berns] -* WebSocket readyState's is added to the prototype for spec compatiblity. [BallBearing] -* Use Object.defineProperty. [arlolra] -* Autodetect ArrayBuffers as binary when sending. [BallBearing] -* Check instanceof Buffer for binary data. [arlolra] -* Emit the close event before destroying the internal socket. [3rd-Eden] -* Don't setup multiply timeouts for one connection. [AndreasMadsen] -* Allow support for binding to ethereal port. [wpreul] -* Fix broken terminate reference. [3rd-Eden] -* Misc node 0.10 test fixes and documentation improvements. [3rd-Eden] -* Ensure ssl options are propagated to request. [einaros] -* Add 'Host' and 'Origin' to request header. [Lars-Magnus Skog] -* Subprotocol support. [kanaka] -* Honor ArrayBufferView's byteOffset when sending. [Anthony Pesch] -* Added target attribute for events. [arlolra] - -v0.4.26 - Skipped -===================== - -v0.4.25 - December 17th, 2012 -===================== -* Removed install.js. [shtylman] -* Added browser field to package.json. [shtylman] -* Support overwriting host header. [Raynos] -* Emit 'listening' also with custom http server. [sebiq] - -v0.4.24 - December 6th, 2012 -===================== -* Yet another intermediate release, to not delay minor features any longer. -* Native support installation issues further circumvented. [einaros] - -v0.4.23 - November 19th, 2012 -===================== -* Service release - last before major upgrade. -* Changes default host from 127.0.0.1 to 0.0.0.0. [einaros] - -v0.4.22 - October 3rd, 2012 -===================== -* clear failsafe cleanup timeout once cleanup is called [AndreasMadsen] -* added w3c compatible CloseEvent for onclose / addEventListener("close", ...). [einaros] -* fix the sub protocol header handler [sonnyp] -* fix unhandled exception if socket closes and 'error' is emitted [jmatthewsr-ms] - -v0.4.21 - July 14th, 2012 -===================== -* Emit error if server reponds with anything other than status code 101. [einaros] -* Added 'headers' event to server. [rauchg] -* path.exists moved to fs.exists. [blakmatrix] - -v0.4.20 - June 26th, 2012 -===================== -* node v0.8.0 compatibility release. - -v0.4.19 - June 19th, 2012 -===================== -* Change sender to merge buffers for relatively small payloads, may improve perf in some cases [einaros] -* Avoid EventEmitter for Receiver classes. As above this may improve perf. [einaros] -* Renamed fallback files from the somewhat misleading '*Windows'. [einaros] - -v0.4.18 - June 14th 2012 -===================== -* Fixed incorrect md5 digest encoding in Hixie handshake [nicokaiser] -* Added example of use with Express 3 [einaros] -* Change installation procedure to not require --ws:native to build native extensions. They will now build if a compiler is available. [einaros] - -v0.4.17 - June 13th 2012 -===================== -* Improve error handling during connection handshaking [einaros] -* Ensure that errors are caught also after connection teardown [nicokaiser] -* Update 'mocha' version to 1.1.0. [einaros] -* Stop showing 'undefined' for some error logs. [tricknotes] -* Update 'should' version to 0.6.3 [tricknotes] - -v0.4.16 - June 1st 2012 -===================== -* Build fix for Windows. [einaros] - -v0.4.15 - May 20th 2012 -===================== -* Enable fauxe streaming for hixie tansport. [einaros] -* Allow hixie sender to deal with buffers. [einaros/pigne] -* Allow error code 1011. [einaros] -* Fix framing for empty packets (empty pings and pongs might break). [einaros] -* Improve error and close handling, to avoid connections lingering in CLOSING state. [einaros] - -v0.4.14 - Apr 30th 2012 -===================== -* use node-gyp instead of node-waf [TooTallNate] -* remove old windows compatibility makefile, and silently fall back to native modules [einaros] -* ensure connection status [nicokaiser] -* websocket client updated to use port 443 by default for wss:// connections [einaros] -* support unix sockets [kschzt] - -v0.4.13 - Apr 12th 2012 -===================== - -* circumvent node 0.6+ related memory leak caused by Object.defineProperty [nicokaiser] -* improved error handling, improving stability in massive load use cases [nicokaiser] - -v0.4.12 - Mar 30th 2012 -===================== - -* various memory leak / possible memory leak cleanups [einaros] -* api documentation [nicokaiser] -* add option to disable client tracking [nicokaiser] - -v0.4.11 - Mar 24th 2012 -===================== - -* node v0.7 compatibillity release -* gyp support [TooTallNate] -* commander dependency update [jwueller] -* loadbalancer support [nicokaiser] - -v0.4.10 - Mar 22th 2012 -===================== - -* Final hixie close frame fixes. [nicokaiser] - -v0.4.9 - Mar 21st 2012 -===================== - -* Various hixie bugfixes (such as proper close frame handling). [einaros] - -v0.4.8 - Feb 29th 2012 -===================== - -* Allow verifyClient to run asynchronously [karlsequin] -* Various bugfixes and cleanups. [einaros] - -v0.4.7 - Feb 21st 2012 -===================== - -* Exposed bytesReceived from websocket client object, which makes it possible to implement bandwidth sampling. [einaros] -* Updated browser based file upload example to include and output per websocket channel bandwidth sampling. [einaros] -* Changed build scripts to check which architecture is currently in use. Required after the node.js changes to have prebuilt packages target ia32 by default. [einaros] - -v0.4.6 - Feb 9th 2012 -===================== - -* Added browser based file upload example. [einaros] -* Added server-to-browser status push example. [einaros] -* Exposed pause() and resume() on WebSocket object, to enable client stream shaping. [einaros] - -v0.4.5 - Feb 7th 2012 -===================== - -* Corrected regression bug in handling of connections with the initial frame delivered across both http upgrade head and a standalone packet. This would lead to a race condition, which in some cases could cause message corruption. [einaros] - -v0.4.4 - Feb 6th 2012 -===================== - -* Pass original request object to verifyClient, for cookie or authentication verifications. [einaros] -* Implemented addEventListener and slightly improved the emulation API by adding a MessageEvent with a readonly data attribute. [aslakhellesoy] -* Rewrite parts of hybi receiver to avoid stack overflows for large amounts of packets bundled in the same buffer / packet. [einaros] - -v0.4.3 - Feb 4th 2012 -===================== - -* Prioritized update: Corrected issue which would cause sockets to stay open longer than necessary, and resource leakage because of this. [einaros] - -v0.4.2 - Feb 4th 2012 -===================== - -* Breaking change: WebSocketServer's verifyOrigin option has been renamed to verifyClient. [einaros] -* verifyClient now receives { origin: 'origin header', secure: true/false }, where 'secure' will be true for ssl connections. [einaros] -* Split benchmark, in preparation for more thorough case. [einaros] -* Introduced hixie-76 draft support for server, since Safari (iPhone / iPad / OS X) and Opera still aren't updated to use Hybi. [einaros] -* Expose 'supports' object from WebSocket, to indicate e.g. the underlying transport's support for binary data. [einaros] -* Test and code cleanups. [einaros] - -v0.4.1 - Jan 25th 2012 -===================== - -* Use readline in wscat [tricknotes] -* Refactor _state away, in favor of the new _readyState [tricknotes] -* travis-ci integration [einaros] -* Fixed race condition in testsuite, causing a few tests to fail (without actually indicating errors) on travis [einaros] -* Expose pong event [paddybyers] -* Enabled running of WebSocketServer in noServer-mode, meaning that upgrades are passed in manually. [einaros] -* Reworked connection procedure for WebSocketServer, and cleaned up tests. [einaros] - -v0.4.0 - Jan 2nd 2012 -===================== - -* Windows compatibility [einaros] -* Windows compatible test script [einaros] - -v0.3.9 - Jan 1st 2012 -====================== - -* Improved protocol framing performance [einaros] -* WSS support [kazuyukitanimura] -* WSS tests [einaros] -* readyState exposed [justinlatimer, tricknotes] -* url property exposed [justinlatimer] -* Removed old 'state' property [einaros] -* Test cleanups [einaros] - -v0.3.8 - Dec 27th 2011 -====================== - -* Made it possible to listen on specific paths, which is especially good to have for precreated http servers [einaros] -* Extensive WebSocket / WebSocketServer cleanup, including changing all internal properties to unconfigurable, unenumerable properties [einaros] -* Receiver modifications to ensure even better performance with fragmented sends [einaros] -* Fixed issue in sender.js, which would cause SlowBuffer instances (such as returned from the crypto library's randomBytes) to be copied (and thus be dead slow) [einaros] -* Removed redundant buffer copy in sender.js, which should improve server performance [einaros] - -v0.3.7 - Dec 25nd 2011 -====================== - -* Added a browser based API which uses EventEmitters internally [3rd-Eden] -* Expose request information from upgrade event for websocket server clients [mmalecki] - -v0.3.6 - Dec 19th 2011 -====================== - -* Added option to let WebSocket.Server use an already existing http server [mmalecki] -* Migrating various option structures to use options.js module [einaros] -* Added a few more tests, options and handshake verifications to ensure that faulty connections are dealt with [einaros] -* Code cleanups in Sender and Receiver, to ensure even faster parsing [einaros] - -v0.3.5 - Dec 13th 2011 -====================== - -* Optimized Sender.js, Receiver.js and bufferutil.cc: - * Apply loop-unrolling-like small block copies rather than use node.js Buffer#copy() (which is slow). - * Mask blocks of data using combination of 32bit xor and loop-unrolling, instead of single bytes. - * Keep pre-made send buffer for small transfers. -* Leak fixes and code cleanups. - -v0.3.3 - Dec 12th 2011 -====================== - -* Compile fix for Linux. -* Rewrote parts of WebSocket.js, to avoid try/catch and thus avoid optimizer bailouts. - -v0.3.2 - Dec 11th 2011 -====================== - -* Further performance updates, including the additions of a native BufferUtil module, which deals with several of the cpu intensive WebSocket operations. - -v0.3.1 - Dec 8th 2011 -====================== - -* Service release, fixing broken tests. - -v0.3.0 - Dec 8th 2011 -====================== - -* Node.js v0.4.x compatibility. -* Code cleanups and efficiency improvements. -* WebSocket server added, although this will still mainly be a client library. -* WebSocket server certified to pass the Autobahn test suite. -* Protocol improvements and corrections - such as handling (redundant) masks for empty fragments. -* 'wscat' command line utility added, which can act as either client or server. - -v0.2.6 - Dec 3rd 2011 -====================== - -* Renamed to 'ws'. Big woop, right -- but easy-websocket really just doesn't cut it anymore! - -v0.2.5 - Dec 3rd 2011 -====================== - - * Rewrote much of the WebSocket parser, to ensure high speed for highly fragmented messages. - * Added a BufferPool, as a start to more efficiently deal with allocations for WebSocket connections. More work to come, in that area. - * Updated the Autobahn report, at http://einaros.github.com/easy-websocket, with comparisons against WebSocket-Node 1.0.2 and Chrome 16. - -v0.2.0 - Nov 25th 2011 -====================== - - * Major rework to make sure all the Autobahn test cases pass. Also updated the internal tests to cover more corner cases. - -v0.1.2 - Nov 14th 2011 -====================== - - * Back and forth, back and forth: now settled on keeping the api (event names, methods) closer to the websocket browser api. This will stick now. - * Started keeping this history record. Better late than never, right? diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/Makefile deleted file mode 100644 index 00f19fa..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -ALL_TESTS = $(shell find test/ -name '*.test.js') -ALL_INTEGRATION = $(shell find test/ -name '*.integration.js') - -all: - node-gyp configure build - -clean: - node-gyp clean - -run-tests: - @./node_modules/.bin/mocha \ - -t 5000 \ - -s 2400 \ - $(TESTFLAGS) \ - $(TESTS) - -run-integrationtests: - @./node_modules/.bin/mocha \ - -t 5000 \ - -s 6000 \ - $(TESTFLAGS) \ - $(TESTS) - -test: - @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests - -integrationtest: - @$(MAKE) NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_PATH=lib TESTS="$(ALL_INTEGRATION)" run-integrationtests - -benchmark: - @node bench/sender.benchmark.js - @node bench/parser.benchmark.js - -autobahn: - @NODE_PATH=lib node test/autobahn.js - -autobahn-server: - @NODE_PATH=lib node test/autobahn-server.js - -.PHONY: test diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/README.md deleted file mode 100644 index e9706bf..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/README.md +++ /dev/null @@ -1,183 +0,0 @@ -# ws: a node.js websocket library - -[![Build Status](https://travis-ci.org/einaros/ws.svg?branch=master)](https://travis-ci.org/einaros/ws) - -`ws` is a simple to use WebSocket implementation, up-to-date against RFC-6455, -and [probably the fastest WebSocket library for node.js][archive]. - -Passes the quite extensive Autobahn test suite. See http://einaros.github.com/ws -for the full reports. - -## Protocol support - -* **Hixie draft 76** (Old and deprecated, but still in use by Safari and Opera. - Added to ws version 0.4.2, but server only. Can be disabled by setting the - `disableHixie` option to true.) -* **HyBi drafts 07-12** (Use the option `protocolVersion: 8`) -* **HyBi drafts 13-17** (Current default, alternatively option `protocolVersion: 13`) - -### Installing - -``` -npm install ---save ws -``` - -### Sending and receiving text data - -```js -var WebSocket = require('ws'); -var ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - ws.send('something'); -}); - -ws.on('message', function(data, flags) { - // flags.binary will be set if a binary data is received. - // flags.masked will be set if the data was masked. -}); -``` - -### Sending binary data - -```js -var WebSocket = require('ws'); -var ws = new WebSocket('ws://www.host.com/path'); - -ws.on('open', function open() { - var array = new Float32Array(5); - - for (var i = 0; i < array.length; ++i) { - array[i] = i / 2; - } - - ws.send(array, { binary: true, mask: true }); -}); -``` - -Setting `mask`, as done for the send options above, will cause the data to be -masked according to the WebSocket protocol. The same option applies for text -data. - -### Server example - -```js -var WebSocketServer = require('ws').Server - , wss = new WebSocketServer({ port: 8080 }); - -wss.on('connection', function connection(ws) { - ws.on('message', function incoming(message) { - console.log('received: %s', message); - }); - - ws.send('something'); -}); -``` - -### Server sending broadcast data - -```js -var WebSocketServer = require('ws').Server - , wss = new WebSocketServer({ port: 8080 }); - -wss.broadcast = function broadcast(data) { - for(var i in this.clients) { - this.clients[i].send(data); - } -}; -``` - -### Error handling best practices - -```js -// If the WebSocket is closed before the following send is attempted -ws.send('something'); - -// Errors (both immediate and async write errors) can be detected in an optional -// callback. The callback is also the only way of being notified that data has -// actually been sent. -ws.send('something', function ack(error) { - // if error is null, the send has been completed, - // otherwise the error object will indicate what failed. -}); - -// Immediate errors can also be handled with try/catch-blocks, but **note** that -// since sends are inherently asynchronous, socket write failures will *not* be -// captured when this technique is used. -try { ws.send('something'); } -catch (e) { /* handle error */ } -``` - -### echo.websocket.org demo - -```js -var WebSocket = require('ws'); -var ws = new WebSocket('ws://echo.websocket.org/', { - protocolVersion: 8, - origin: 'http://websocket.org' -}); - -ws.on('open', function open() { - console.log('connected'); - ws.send(Date.now().toString(), {mask: true}); -}); - -ws.on('close', function close() { - console.log('disconnected'); -}); - -ws.on('message', function message(data, flags) { - console.log('Roundtrip time: ' + (Date.now() - parseInt(data)) + 'ms', flags); - - setTimeout(function timeout() { - ws.send(Date.now().toString(), {mask: true}); - }, 500); -}); -``` - -### Other examples - -For a full example with a browser client communicating with a ws server, see the -examples folder. - -Note that the usage together with Express 3.0 is quite different from Express -2.x. The difference is expressed in the two different serverstats-examples. - -Otherwise, see the test cases. - -### Running the tests - -``` -make test -``` - -## API Docs - -See the doc/ directory for Node.js-like docs for the ws classes. - -## License - -(The MIT License) - -Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com> - -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 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. - -[archive]: http://web.archive.org/web/20130314230536/http://hobbycoding.posterous.com/the-fastest-websocket-module-for-nodejs diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/binding.gyp b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/binding.gyp deleted file mode 100644 index 600f9d1..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/binding.gyp +++ /dev/null @@ -1,16 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'validation', - 'include_dirs': ["> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_objc = CXX($(TOOLSET)) $@ -cmd_objc = $(CC.$(TOOLSET)) $(GYP_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< - -quiet_cmd_objcxx = CXX($(TOOLSET)) $@ -cmd_objcxx = $(CXX.$(TOOLSET)) $(GYP_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< - -# Commands for precompiled header files. -quiet_cmd_pch_c = CXX($(TOOLSET)) $@ -cmd_pch_c = $(CC.$(TOOLSET)) $(GYP_PCH_CFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< -quiet_cmd_pch_cc = CXX($(TOOLSET)) $@ -cmd_pch_cc = $(CC.$(TOOLSET)) $(GYP_PCH_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< -quiet_cmd_pch_m = CXX($(TOOLSET)) $@ -cmd_pch_m = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCFLAGS) $(DEPFLAGS) -c -o $@ $< -quiet_cmd_pch_mm = CXX($(TOOLSET)) $@ -cmd_pch_mm = $(CC.$(TOOLSET)) $(GYP_PCH_OBJCXXFLAGS) $(DEPFLAGS) -c -o $@ $< - -# gyp-mac-tool is written next to the root Makefile by gyp. -# Use $(4) for the command, since $(2) and $(3) are used as flag by do_cmd -# already. -quiet_cmd_mac_tool = MACTOOL $(4) $< -cmd_mac_tool = ./gyp-mac-tool $(4) $< "$@" - -quiet_cmd_mac_package_framework = PACKAGE FRAMEWORK $@ -cmd_mac_package_framework = ./gyp-mac-tool package-framework "$@" $(4) - -quiet_cmd_infoplist = INFOPLIST $@ -cmd_infoplist = $(CC.$(TOOLSET)) -E -P -Wno-trigraphs -x c $(INFOPLIST_DEFINES) "$<" -o "$@" - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = rm -rf "$@" && cp -af "$<" "$@" - -quiet_cmd_alink = LIBTOOL-STATIC $@ -cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) - -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -bundle $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ $(filter-out FORCE_DO_CMD, $^) $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 2,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.m FORCE_DO_CMD - @$(call do_cmd,objc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.mm FORCE_DO_CMD - @$(call do_cmd,objcxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.m FORCE_DO_CMD - @$(call do_cmd,objc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.mm FORCE_DO_CMD - @$(call do_cmd,objcxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.m FORCE_DO_CMD - @$(call do_cmd,objc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.mm FORCE_DO_CMD - @$(call do_cmd,objcxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,bufferutil.target.mk)))),) - include bufferutil.target.mk -endif -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,validation.target.mk)))),) - include validation.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/rubenmueller/Desktop/ld31/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/rubenmueller/.node-gyp/0.10.33/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/rubenmueller/.node-gyp/0.10.33" "-Dmodule_root_dir=/Users/rubenmueller/Desktop/ld31/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws" binding.gyp -Makefile: $(srcdir)/../../../../../../../../../../.node-gyp/0.10.33/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d deleted file mode 100644 index 70d0a06..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/bufferutil.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/bufferutil.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/bufferutil.node Release/obj.target/bufferutil/src/bufferutil.o -undefined dynamic_lookup diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d deleted file mode 100644 index bc2163c..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d +++ /dev/null @@ -1,25 +0,0 @@ -cmd_Release/obj.target/bufferutil/src/bufferutil.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/rubenmueller/.node-gyp/0.10.33/src -I/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include -I/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw -c -o Release/obj.target/bufferutil/src/bufferutil.o ../src/bufferutil.cc -Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8stdint.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-unix.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/ngx-queue.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-darwin.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node_object_wrap.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node_buffer.h \ - ../node_modules/nan/nan.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node_version.h -../src/bufferutil.cc: -/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8stdint.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-unix.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/ngx-queue.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-darwin.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node_object_wrap.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node_buffer.h: -../node_modules/nan/nan.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node_version.h: diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d deleted file mode 100644 index cb6ce91..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/obj.target/validation/src/validation.o.d +++ /dev/null @@ -1,25 +0,0 @@ -cmd_Release/obj.target/validation/src/validation.o := c++ '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/Users/rubenmueller/.node-gyp/0.10.33/src -I/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include -I/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include -I../node_modules/nan -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-rtti -fno-exceptions -fno-threadsafe-statics -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/validation/src/validation.o.d.raw -c -o Release/obj.target/validation/src/validation.o ../src/validation.cc -Release/obj.target/validation/src/validation.o: ../src/validation.cc \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8stdint.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-unix.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/ngx-queue.h \ - /Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-darwin.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node_object_wrap.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node_buffer.h \ - ../node_modules/nan/nan.h \ - /Users/rubenmueller/.node-gyp/0.10.33/src/node_version.h -../src/validation.cc: -/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include/v8stdint.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-unix.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/ngx-queue.h: -/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include/uv-private/uv-darwin.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node_object_wrap.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node_buffer.h: -../node_modules/nan/nan.h: -/Users/rubenmueller/.node-gyp/0.10.33/src/node_version.h: diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/validation.node.d b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/validation.node.d deleted file mode 100644 index 2f13adc..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/.deps/Release/validation.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/validation.node := ./gyp-mac-tool flock ./Release/linker.lock c++ -bundle -Wl,-search_paths_first -mmacosx-version-min=10.5 -arch x86_64 -L./Release -o Release/validation.node Release/obj.target/validation/src/validation.o -undefined dynamic_lookup diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/bufferutil.node b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/bufferutil.node deleted file mode 100755 index 2ebc598..0000000 Binary files a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/bufferutil.node and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/linker.lock b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/linker.lock deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o deleted file mode 100644 index 1efe888..0000000 Binary files a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/bufferutil/src/bufferutil.o and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/validation/src/validation.o b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/validation/src/validation.o deleted file mode 100644 index baaa6bb..0000000 Binary files a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/obj.target/validation/src/validation.o and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/validation.node b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/validation.node deleted file mode 100755 index f8604e1..0000000 Binary files a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/validation.node and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/binding.Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/binding.Makefile deleted file mode 100644 index 5d26a45..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/binding.Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# This file is generated by gyp; do not edit. - -export builddir_name ?= ./build/. -.PHONY: all -all: - $(MAKE) validation bufferutil diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/bufferutil.target.mk b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/bufferutil.target.mk deleted file mode 100644 index 4a8d749..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/bufferutil.target.mk +++ /dev/null @@ -1,156 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := bufferutil -DEFS_Debug := \ - '-D_DARWIN_USE_64_BIT_INODE=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -O0 \ - -gdwarf-2 \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -Wall \ - -Wendif-labels \ - -W \ - -Wno-unused-parameter - -# Flags passed to only C files. -CFLAGS_C_Debug := \ - -fno-strict-aliasing - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -fno-threadsafe-statics \ - -fno-strict-aliasing - -# Flags passed to only ObjC files. -CFLAGS_OBJC_Debug := - -# Flags passed to only ObjC++ files. -CFLAGS_OBJCC_Debug := - -INCS_Debug := \ - -I/Users/rubenmueller/.node-gyp/0.10.33/src \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -DEFS_Release := \ - '-D_DARWIN_USE_64_BIT_INODE=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -Os \ - -gdwarf-2 \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -Wall \ - -Wendif-labels \ - -W \ - -Wno-unused-parameter - -# Flags passed to only C files. -CFLAGS_C_Release := \ - -fno-strict-aliasing - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -fno-threadsafe-statics \ - -fno-strict-aliasing - -# Flags passed to only ObjC files. -CFLAGS_OBJC_Release := - -# Flags passed to only ObjC++ files. -CFLAGS_OBJCC_Release := - -INCS_Release := \ - -I/Users/rubenmueller/.node-gyp/0.10.33/src \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -OBJS := \ - $(obj).target/$(TARGET)/src/bufferutil.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) -$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) -$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -Wl,-search_paths_first \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -L$(builddir) - -LIBTOOLFLAGS_Debug := \ - -Wl,-search_paths_first - -LDFLAGS_Release := \ - -Wl,-search_paths_first \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -L$(builddir) - -LIBTOOLFLAGS_Release := \ - -Wl,-search_paths_first - -LIBS := \ - -undefined dynamic_lookup - -$(builddir)/bufferutil.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(builddir)/bufferutil.node: LIBS := $(LIBS) -$(builddir)/bufferutil.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) -$(builddir)/bufferutil.node: TOOLSET := $(TOOLSET) -$(builddir)/bufferutil.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(builddir)/bufferutil.node -# Add target alias -.PHONY: bufferutil -bufferutil: $(builddir)/bufferutil.node - -# Short alias for building this executable. -.PHONY: bufferutil.node -bufferutil.node: $(builddir)/bufferutil.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/bufferutil.node - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi deleted file mode 100644 index 9305000..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/config.gypi +++ /dev/null @@ -1,121 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "clang": 1, - "host_arch": "x64", - "node_install_npm": "true", - "node_prefix": "", - "node_shared_cares": "false", - "node_shared_http_parser": "false", - "node_shared_libuv": "false", - "node_shared_openssl": "false", - "node_shared_v8": "false", - "node_shared_zlib": "false", - "node_tag": "", - "node_unsafe_optimizations": 0, - "node_use_dtrace": "true", - "node_use_etw": "false", - "node_use_openssl": "true", - "node_use_perfctr": "false", - "openssl_no_asm": 0, - "python": "/usr/bin/python", - "target_arch": "x64", - "v8_enable_gdbjit": 0, - "v8_no_strict_aliasing": 1, - "v8_use_snapshot": "false", - "want_separate_host_toolset": 0, - "nodedir": "/Users/rubenmueller/.node-gyp/0.10.33", - "copy_dev_lib": "true", - "standalone_static_library": 1, - "save_dev": "", - "browser": "", - "viewer": "man", - "rollback": "true", - "usage": "", - "globalignorefile": "/usr/local/etc/npmignore", - "init_author_url": "", - "shell": "/bin/bash", - "parseable": "", - "shrinkwrap": "true", - "email": "", - "init_license": "ISC", - "cache_max": "Infinity", - "init_author_email": "", - "sign_git_tag": "", - "global_": "true", - "cert": "", - "git_tag_version": "true", - "local_address": "", - "long": "", - "registry": "https://registry.npmjs.org/", - "fetch_retries": "2", - "npat": "", - "key": "", - "message": "%s", - "versions": "", - "globalconfig": "/usr/local/etc/npmrc", - "always_auth": "", - "spin": "true", - "cache_lock_retries": "10", - "cafile": "", - "heading": "npm", - "fetch_retry_mintimeout": "10000", - "proprietary_attribs": "true", - "json": "", - "description": "true", - "engine_strict": "", - "https_proxy": "", - "init_module": "/Users/rubenmueller/.npm-init.js", - "userconfig": "/Users/rubenmueller/.npmrc", - "node_version": "0.10.33", - "user": "24561", - "editor": "vi", - "save": "", - "tag": "latest", - "global": "", - "optional": "true", - "username": "", - "bin_links": "true", - "force": "", - "searchopts": "", - "depth": "Infinity", - "rebuild_bundle": "true", - "searchsort": "name", - "unicode": "true", - "fetch_retry_maxtimeout": "60000", - "ca": "", - "save_prefix": "^", - "strict_ssl": "true", - "dev": "", - "fetch_retry_factor": "10", - "group": "20", - "save_exact": "", - "cache_lock_stale": "60000", - "version": "", - "cache_min": "10", - "cache": "/Users/rubenmueller/.npm", - "searchexclude": "", - "color": "true", - "save_optional": "", - "user_agent": "npm/1.4.28 node/v0.10.33 darwin x64", - "ignore_scripts": "", - "cache_lock_wait": "10000", - "production": "", - "save_bundle": "", - "umask": "18", - "git": "git", - "init_author_name": "", - "onload_script": "", - "tmp": "/var/folders/ft/_61kndhn14933kljlsvywx1m0000gn/T", - "unsafe_perm": "true", - "link": "", - "prefix": "/usr/local" - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/gyp-mac-tool b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/gyp-mac-tool deleted file mode 100755 index 7abfed5..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/gyp-mac-tool +++ /dev/null @@ -1,512 +0,0 @@ -#!/usr/bin/env python -# Generated by gyp. Do not edit. -# Copyright (c) 2012 Google Inc. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Utility functions to perform Xcode-style build steps. - -These functions are executed via gyp-mac-tool when using the Makefile generator. -""" - -import fcntl -import fnmatch -import glob -import json -import os -import plistlib -import re -import shutil -import string -import subprocess -import sys -import tempfile - - -def main(args): - executor = MacTool() - exit_code = executor.Dispatch(args) - if exit_code is not None: - sys.exit(exit_code) - - -class MacTool(object): - """This class performs all the Mac tooling steps. The methods can either be - executed directly, or dispatched from an argument list.""" - - def Dispatch(self, args): - """Dispatches a string command to a method.""" - if len(args) < 1: - raise Exception("Not enough arguments") - - method = "Exec%s" % self._CommandifyName(args[0]) - return getattr(self, method)(*args[1:]) - - def _CommandifyName(self, name_string): - """Transforms a tool name like copy-info-plist to CopyInfoPlist""" - return name_string.title().replace('-', '') - - def ExecCopyBundleResource(self, source, dest): - """Copies a resource file to the bundle/Resources directory, performing any - necessary compilation on each resource.""" - extension = os.path.splitext(source)[1].lower() - if os.path.isdir(source): - # Copy tree. - # TODO(thakis): This copies file attributes like mtime, while the - # single-file branch below doesn't. This should probably be changed to - # be consistent with the single-file branch. - if os.path.exists(dest): - shutil.rmtree(dest) - shutil.copytree(source, dest) - elif extension == '.xib': - return self._CopyXIBFile(source, dest) - elif extension == '.storyboard': - return self._CopyXIBFile(source, dest) - elif extension == '.strings': - self._CopyStringsFile(source, dest) - else: - shutil.copy(source, dest) - - def _CopyXIBFile(self, source, dest): - """Compiles a XIB file with ibtool into a binary plist in the bundle.""" - - # ibtool sometimes crashes with relative paths. See crbug.com/314728. - base = os.path.dirname(os.path.realpath(__file__)) - if os.path.relpath(source): - source = os.path.join(base, source) - if os.path.relpath(dest): - dest = os.path.join(base, dest) - - args = ['xcrun', 'ibtool', '--errors', '--warnings', '--notices', - '--output-format', 'human-readable-text', '--compile', dest, source] - ibtool_section_re = re.compile(r'/\*.*\*/') - ibtool_re = re.compile(r'.*note:.*is clipping its content') - ibtoolout = subprocess.Popen(args, stdout=subprocess.PIPE) - current_section_header = None - for line in ibtoolout.stdout: - if ibtool_section_re.match(line): - current_section_header = line - elif not ibtool_re.match(line): - if current_section_header: - sys.stdout.write(current_section_header) - current_section_header = None - sys.stdout.write(line) - return ibtoolout.returncode - - def _CopyStringsFile(self, source, dest): - """Copies a .strings file using iconv to reconvert the input into UTF-16.""" - input_code = self._DetectInputEncoding(source) or "UTF-8" - - # Xcode's CpyCopyStringsFile / builtin-copyStrings seems to call - # CFPropertyListCreateFromXMLData() behind the scenes; at least it prints - # CFPropertyListCreateFromXMLData(): Old-style plist parser: missing - # semicolon in dictionary. - # on invalid files. Do the same kind of validation. - import CoreFoundation - s = open(source, 'rb').read() - d = CoreFoundation.CFDataCreate(None, s, len(s)) - _, error = CoreFoundation.CFPropertyListCreateFromXMLData(None, d, 0, None) - if error: - return - - fp = open(dest, 'wb') - fp.write(s.decode(input_code).encode('UTF-16')) - fp.close() - - def _DetectInputEncoding(self, file_name): - """Reads the first few bytes from file_name and tries to guess the text - encoding. Returns None as a guess if it can't detect it.""" - fp = open(file_name, 'rb') - try: - header = fp.read(3) - except e: - fp.close() - return None - fp.close() - if header.startswith("\xFE\xFF"): - return "UTF-16" - elif header.startswith("\xFF\xFE"): - return "UTF-16" - elif header.startswith("\xEF\xBB\xBF"): - return "UTF-8" - else: - return None - - def ExecCopyInfoPlist(self, source, dest, *keys): - """Copies the |source| Info.plist to the destination directory |dest|.""" - # Read the source Info.plist into memory. - fd = open(source, 'r') - lines = fd.read() - fd.close() - - # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). - plist = plistlib.readPlistFromString(lines) - if keys: - plist = dict(plist.items() + json.loads(keys[0]).items()) - lines = plistlib.writePlistToString(plist) - - # Go through all the environment variables and replace them as variables in - # the file. - IDENT_RE = re.compile('[/\s]') - for key in os.environ: - if key.startswith('_'): - continue - evar = '${%s}' % key - evalue = os.environ[key] - lines = string.replace(lines, evar, evalue) - - # Xcode supports various suffices on environment variables, which are - # all undocumented. :rfc1034identifier is used in the standard project - # template these days, and :identifier was used earlier. They are used to - # convert non-url characters into things that look like valid urls -- - # except that the replacement character for :identifier, '_' isn't valid - # in a URL either -- oops, hence :rfc1034identifier was born. - evar = '${%s:identifier}' % key - evalue = IDENT_RE.sub('_', os.environ[key]) - lines = string.replace(lines, evar, evalue) - - evar = '${%s:rfc1034identifier}' % key - evalue = IDENT_RE.sub('-', os.environ[key]) - lines = string.replace(lines, evar, evalue) - - # Remove any keys with values that haven't been replaced. - lines = lines.split('\n') - for i in range(len(lines)): - if lines[i].strip().startswith("${"): - lines[i] = None - lines[i - 1] = None - lines = '\n'.join(filter(lambda x: x is not None, lines)) - - # Write out the file with variables replaced. - fd = open(dest, 'w') - fd.write(lines) - fd.close() - - # Now write out PkgInfo file now that the Info.plist file has been - # "compiled". - self._WritePkgInfo(dest) - - def _WritePkgInfo(self, info_plist): - """This writes the PkgInfo file from the data stored in Info.plist.""" - plist = plistlib.readPlist(info_plist) - if not plist: - return - - # Only create PkgInfo for executable types. - package_type = plist['CFBundlePackageType'] - if package_type != 'APPL': - return - - # The format of PkgInfo is eight characters, representing the bundle type - # and bundle signature, each four characters. If that is missing, four - # '?' characters are used instead. - signature_code = plist.get('CFBundleSignature', '????') - if len(signature_code) != 4: # Wrong length resets everything, too. - signature_code = '?' * 4 - - dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo') - fp = open(dest, 'w') - fp.write('%s%s' % (package_type, signature_code)) - fp.close() - - def ExecFlock(self, lockfile, *cmd_list): - """Emulates the most basic behavior of Linux's flock(1).""" - # Rely on exception handling to report errors. - fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666) - fcntl.flock(fd, fcntl.LOCK_EX) - return subprocess.call(cmd_list) - - def ExecFilterLibtool(self, *cmd_list): - """Calls libtool and filters out '/path/to/libtool: file: foo.o has no - symbols'.""" - libtool_re = re.compile(r'^.*libtool: file: .* has no symbols$') - libtoolout = subprocess.Popen(cmd_list, stderr=subprocess.PIPE) - _, err = libtoolout.communicate() - for line in err.splitlines(): - if not libtool_re.match(line): - print >>sys.stderr, line - return libtoolout.returncode - - def ExecPackageFramework(self, framework, version): - """Takes a path to Something.framework and the Current version of that and - sets up all the symlinks.""" - # Find the name of the binary based on the part before the ".framework". - binary = os.path.basename(framework).split('.')[0] - - CURRENT = 'Current' - RESOURCES = 'Resources' - VERSIONS = 'Versions' - - if not os.path.exists(os.path.join(framework, VERSIONS, version, binary)): - # Binary-less frameworks don't seem to contain symlinks (see e.g. - # chromium's out/Debug/org.chromium.Chromium.manifest/ bundle). - return - - # Move into the framework directory to set the symlinks correctly. - pwd = os.getcwd() - os.chdir(framework) - - # Set up the Current version. - self._Relink(version, os.path.join(VERSIONS, CURRENT)) - - # Set up the root symlinks. - self._Relink(os.path.join(VERSIONS, CURRENT, binary), binary) - self._Relink(os.path.join(VERSIONS, CURRENT, RESOURCES), RESOURCES) - - # Back to where we were before! - os.chdir(pwd) - - def _Relink(self, dest, link): - """Creates a symlink to |dest| named |link|. If |link| already exists, - it is overwritten.""" - if os.path.lexists(link): - os.remove(link) - os.symlink(dest, link) - - def ExecCodeSignBundle(self, key, resource_rules, entitlements, provisioning): - """Code sign a bundle. - - This function tries to code sign an iOS bundle, following the same - algorithm as Xcode: - 1. copy ResourceRules.plist from the user or the SDK into the bundle, - 2. pick the provisioning profile that best match the bundle identifier, - and copy it into the bundle as embedded.mobileprovision, - 3. copy Entitlements.plist from user or SDK next to the bundle, - 4. code sign the bundle. - """ - resource_rules_path = self._InstallResourceRules(resource_rules) - substitutions, overrides = self._InstallProvisioningProfile( - provisioning, self._GetCFBundleIdentifier()) - entitlements_path = self._InstallEntitlements( - entitlements, substitutions, overrides) - subprocess.check_call([ - 'codesign', '--force', '--sign', key, '--resource-rules', - resource_rules_path, '--entitlements', entitlements_path, - os.path.join( - os.environ['TARGET_BUILD_DIR'], - os.environ['FULL_PRODUCT_NAME'])]) - - def _InstallResourceRules(self, resource_rules): - """Installs ResourceRules.plist from user or SDK into the bundle. - - Args: - resource_rules: string, optional, path to the ResourceRules.plist file - to use, default to "${SDKROOT}/ResourceRules.plist" - - Returns: - Path to the copy of ResourceRules.plist into the bundle. - """ - source_path = resource_rules - target_path = os.path.join( - os.environ['BUILT_PRODUCTS_DIR'], - os.environ['CONTENTS_FOLDER_PATH'], - 'ResourceRules.plist') - if not source_path: - source_path = os.path.join( - os.environ['SDKROOT'], 'ResourceRules.plist') - shutil.copy2(source_path, target_path) - return target_path - - def _InstallProvisioningProfile(self, profile, bundle_identifier): - """Installs embedded.mobileprovision into the bundle. - - Args: - profile: string, optional, short name of the .mobileprovision file - to use, if empty or the file is missing, the best file installed - will be used - bundle_identifier: string, value of CFBundleIdentifier from Info.plist - - Returns: - A tuple containing two dictionary: variables substitutions and values - to overrides when generating the entitlements file. - """ - source_path, provisioning_data, team_id = self._FindProvisioningProfile( - profile, bundle_identifier) - target_path = os.path.join( - os.environ['BUILT_PRODUCTS_DIR'], - os.environ['CONTENTS_FOLDER_PATH'], - 'embedded.mobileprovision') - shutil.copy2(source_path, target_path) - substitutions = self._GetSubstitutions(bundle_identifier, team_id + '.') - return substitutions, provisioning_data['Entitlements'] - - def _FindProvisioningProfile(self, profile, bundle_identifier): - """Finds the .mobileprovision file to use for signing the bundle. - - Checks all the installed provisioning profiles (or if the user specified - the PROVISIONING_PROFILE variable, only consult it) and select the most - specific that correspond to the bundle identifier. - - Args: - profile: string, optional, short name of the .mobileprovision file - to use, if empty or the file is missing, the best file installed - will be used - bundle_identifier: string, value of CFBundleIdentifier from Info.plist - - Returns: - A tuple of the path to the selected provisioning profile, the data of - the embedded plist in the provisioning profile and the team identifier - to use for code signing. - - Raises: - SystemExit: if no .mobileprovision can be used to sign the bundle. - """ - profiles_dir = os.path.join( - os.environ['HOME'], 'Library', 'MobileDevice', 'Provisioning Profiles') - if not os.path.isdir(profiles_dir): - print >>sys.stderr, ( - 'cannot find mobile provisioning for %s' % bundle_identifier) - sys.exit(1) - provisioning_profiles = None - if profile: - profile_path = os.path.join(profiles_dir, profile + '.mobileprovision') - if os.path.exists(profile_path): - provisioning_profiles = [profile_path] - if not provisioning_profiles: - provisioning_profiles = glob.glob( - os.path.join(profiles_dir, '*.mobileprovision')) - valid_provisioning_profiles = {} - for profile_path in provisioning_profiles: - profile_data = self._LoadProvisioningProfile(profile_path) - app_id_pattern = profile_data.get( - 'Entitlements', {}).get('application-identifier', '') - for team_identifier in profile_data.get('TeamIdentifier', []): - app_id = '%s.%s' % (team_identifier, bundle_identifier) - if fnmatch.fnmatch(app_id, app_id_pattern): - valid_provisioning_profiles[app_id_pattern] = ( - profile_path, profile_data, team_identifier) - if not valid_provisioning_profiles: - print >>sys.stderr, ( - 'cannot find mobile provisioning for %s' % bundle_identifier) - sys.exit(1) - # If the user has multiple provisioning profiles installed that can be - # used for ${bundle_identifier}, pick the most specific one (ie. the - # provisioning profile whose pattern is the longest). - selected_key = max(valid_provisioning_profiles, key=lambda v: len(v)) - return valid_provisioning_profiles[selected_key] - - def _LoadProvisioningProfile(self, profile_path): - """Extracts the plist embedded in a provisioning profile. - - Args: - profile_path: string, path to the .mobileprovision file - - Returns: - Content of the plist embedded in the provisioning profile as a dictionary. - """ - with tempfile.NamedTemporaryFile() as temp: - subprocess.check_call([ - 'security', 'cms', '-D', '-i', profile_path, '-o', temp.name]) - return self._LoadPlistMaybeBinary(temp.name) - - def _LoadPlistMaybeBinary(self, plist_path): - """Loads into a memory a plist possibly encoded in binary format. - - This is a wrapper around plistlib.readPlist that tries to convert the - plist to the XML format if it can't be parsed (assuming that it is in - the binary format). - - Args: - plist_path: string, path to a plist file, in XML or binary format - - Returns: - Content of the plist as a dictionary. - """ - try: - # First, try to read the file using plistlib that only supports XML, - # and if an exception is raised, convert a temporary copy to XML and - # load that copy. - return plistlib.readPlist(plist_path) - except: - pass - with tempfile.NamedTemporaryFile() as temp: - shutil.copy2(plist_path, temp.name) - subprocess.check_call(['plutil', '-convert', 'xml1', temp.name]) - return plistlib.readPlist(temp.name) - - def _GetSubstitutions(self, bundle_identifier, app_identifier_prefix): - """Constructs a dictionary of variable substitutions for Entitlements.plist. - - Args: - bundle_identifier: string, value of CFBundleIdentifier from Info.plist - app_identifier_prefix: string, value for AppIdentifierPrefix - - Returns: - Dictionary of substitutions to apply when generating Entitlements.plist. - """ - return { - 'CFBundleIdentifier': bundle_identifier, - 'AppIdentifierPrefix': app_identifier_prefix, - } - - def _GetCFBundleIdentifier(self): - """Extracts CFBundleIdentifier value from Info.plist in the bundle. - - Returns: - Value of CFBundleIdentifier in the Info.plist located in the bundle. - """ - info_plist_path = os.path.join( - os.environ['TARGET_BUILD_DIR'], - os.environ['INFOPLIST_PATH']) - info_plist_data = self._LoadPlistMaybeBinary(info_plist_path) - return info_plist_data['CFBundleIdentifier'] - - def _InstallEntitlements(self, entitlements, substitutions, overrides): - """Generates and install the ${BundleName}.xcent entitlements file. - - Expands variables "$(variable)" pattern in the source entitlements file, - add extra entitlements defined in the .mobileprovision file and the copy - the generated plist to "${BundlePath}.xcent". - - Args: - entitlements: string, optional, path to the Entitlements.plist template - to use, defaults to "${SDKROOT}/Entitlements.plist" - substitutions: dictionary, variable substitutions - overrides: dictionary, values to add to the entitlements - - Returns: - Path to the generated entitlements file. - """ - source_path = entitlements - target_path = os.path.join( - os.environ['BUILT_PRODUCTS_DIR'], - os.environ['PRODUCT_NAME'] + '.xcent') - if not source_path: - source_path = os.path.join( - os.environ['SDKROOT'], - 'Entitlements.plist') - shutil.copy2(source_path, target_path) - data = self._LoadPlistMaybeBinary(target_path) - data = self._ExpandVariables(data, substitutions) - if overrides: - for key in overrides: - if key not in data: - data[key] = overrides[key] - plistlib.writePlist(data, target_path) - return target_path - - def _ExpandVariables(self, data, substitutions): - """Expands variables "$(variable)" in data. - - Args: - data: object, can be either string, list or dictionary - substitutions: dictionary, variable substitutions to perform - - Returns: - Copy of data where each references to "$(variable)" has been replaced - by the corresponding value found in substitutions, or left intact if - the key was not found. - """ - if isinstance(data, str): - for key, value in substitutions.iteritems(): - data = data.replace('$(%s)' % key, value) - return data - if isinstance(data, list): - return [self._ExpandVariables(v, substitutions) for v in data] - if isinstance(data, dict): - return dict((k, self._ExpandVariables(data[k], - substitutions)) for k in data) - return data - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:])) diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/validation.target.mk b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/validation.target.mk deleted file mode 100644 index 6441bdd..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/validation.target.mk +++ /dev/null @@ -1,156 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := validation -DEFS_Debug := \ - '-D_DARWIN_USE_64_BIT_INODE=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -O0 \ - -gdwarf-2 \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -Wall \ - -Wendif-labels \ - -W \ - -Wno-unused-parameter - -# Flags passed to only C files. -CFLAGS_C_Debug := \ - -fno-strict-aliasing - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -fno-threadsafe-statics \ - -fno-strict-aliasing - -# Flags passed to only ObjC files. -CFLAGS_OBJC_Debug := - -# Flags passed to only ObjC++ files. -CFLAGS_OBJCC_Debug := - -INCS_Debug := \ - -I/Users/rubenmueller/.node-gyp/0.10.33/src \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -DEFS_Release := \ - '-D_DARWIN_USE_64_BIT_INODE=1' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -Os \ - -gdwarf-2 \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -Wall \ - -Wendif-labels \ - -W \ - -Wno-unused-parameter - -# Flags passed to only C files. -CFLAGS_C_Release := \ - -fno-strict-aliasing - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -fno-threadsafe-statics \ - -fno-strict-aliasing - -# Flags passed to only ObjC files. -CFLAGS_OBJC_Release := - -# Flags passed to only ObjC++ files. -CFLAGS_OBJCC_Release := - -INCS_Release := \ - -I/Users/rubenmueller/.node-gyp/0.10.33/src \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/uv/include \ - -I/Users/rubenmueller/.node-gyp/0.10.33/deps/v8/include \ - -I$(srcdir)/node_modules/nan - -OBJS := \ - $(obj).target/$(TARGET)/src/validation.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) -$(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE)) -$(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -Wl,-search_paths_first \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -L$(builddir) - -LIBTOOLFLAGS_Debug := \ - -Wl,-search_paths_first - -LDFLAGS_Release := \ - -Wl,-search_paths_first \ - -mmacosx-version-min=10.5 \ - -arch x86_64 \ - -L$(builddir) - -LIBTOOLFLAGS_Release := \ - -Wl,-search_paths_first - -LIBS := \ - -undefined dynamic_lookup - -$(builddir)/validation.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(builddir)/validation.node: LIBS := $(LIBS) -$(builddir)/validation.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE)) -$(builddir)/validation.node: TOOLSET := $(TOOLSET) -$(builddir)/validation.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(builddir)/validation.node -# Add target alias -.PHONY: validation -validation: $(builddir)/validation.node - -# Short alias for building this executable. -.PHONY: validation.node -validation.node: $(builddir)/validation.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/validation.node - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/builderror.log b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/builderror.log deleted file mode 100644 index e1c128f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/builderror.log +++ /dev/null @@ -1,14 +0,0 @@ -../src/bufferutil.cc:32:17: warning: 'NanSymbol' is deprecated [-Wdeprecated-declarations] - target->Set(NanSymbol("BufferUtil"), t->GetFunction()); - ^ -../node_modules/nan/nan.h:1043:51: note: 'NanSymbol' has been explicitly marked deprecated here - NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( - ^ -1 warning generated. -../src/validation.cc:112:17: warning: 'NanSymbol' is deprecated [-Wdeprecated-declarations] - target->Set(NanSymbol("Validation"), t->GetFunction()); - ^ -../node_modules/nan/nan.h:1043:51: note: 'NanSymbol' has been explicitly marked deprecated here - NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( - ^ -1 warning generated. diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/index.js deleted file mode 100644 index a7e8644..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/index.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var WS = module.exports = require('./lib/WebSocket'); - -WS.Server = require('./lib/WebSocketServer'); -WS.Sender = require('./lib/Sender'); -WS.Receiver = require('./lib/Receiver'); - -/** - * Create a new WebSocket server. - * - * @param {Object} options Server options - * @param {Function} fn Optional connection listener. - * @returns {WS.Server} - * @api public - */ -WS.createServer = function createServer(options, fn) { - var server = new WS.Server(options); - - if (typeof fn === 'function') { - server.on('connection', fn); - } - - return server; -}; - -/** - * Create a new WebSocket connection. - * - * @param {String} address The URL/address we need to connect to. - * @param {Function} fn Open listener. - * @returns {WS} - * @api public - */ -WS.connect = WS.createConnection = function connect(address, fn) { - var client = new WS(address); - - if (typeof fn === 'function') { - client.on('open', fn); - } - - return client; -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferPool.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferPool.js deleted file mode 100644 index faf8637..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferPool.js +++ /dev/null @@ -1,59 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util'); - -function BufferPool(initialSize, growStrategy, shrinkStrategy) { - if (typeof initialSize === 'function') { - shrinkStrategy = growStrategy; - growStrategy = initialSize; - initialSize = 0; - } - else if (typeof initialSize === 'undefined') { - initialSize = 0; - } - this._growStrategy = (growStrategy || function(db, size) { - return db.used + size; - }).bind(null, this); - this._shrinkStrategy = (shrinkStrategy || function(db) { - return initialSize; - }).bind(null, this); - this._buffer = initialSize ? new Buffer(initialSize) : null; - this._offset = 0; - this._used = 0; - this._changeFactor = 0; - this.__defineGetter__('size', function(){ - return this._buffer == null ? 0 : this._buffer.length; - }); - this.__defineGetter__('used', function(){ - return this._used; - }); -} - -BufferPool.prototype.get = function(length) { - if (this._buffer == null || this._offset + length > this._buffer.length) { - var newBuf = new Buffer(this._growStrategy(length)); - this._buffer = newBuf; - this._offset = 0; - } - this._used += length; - var buf = this._buffer.slice(this._offset, this._offset + length); - this._offset += length; - return buf; -} - -BufferPool.prototype.reset = function(forceNewBuffer) { - var len = this._shrinkStrategy(); - if (len < this.size) this._changeFactor -= 1; - if (forceNewBuffer || this._changeFactor < -2) { - this._changeFactor = 0; - this._buffer = len ? new Buffer(len) : null; - } - this._offset = 0; - this._used = 0; -} - -module.exports = BufferPool; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.fallback.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.fallback.js deleted file mode 100644 index 508542c..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.fallback.js +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports.BufferUtil = { - merge: function(mergedBuffer, buffers) { - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - var buf = buffers[i]; - buf.copy(mergedBuffer, offset); - offset += buf.length; - } - }, - mask: function(source, mask, output, offset, length) { - var maskNum = mask.readUInt32LE(0, true); - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ source.readUInt32LE(i, true); - if (num < 0) num = 4294967296 + num; - output.writeUInt32LE(num, offset + i, true); - } - switch (length % 4) { - case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; - case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; - case 1: output[offset + i] = source[i] ^ mask[0]; - case 0:; - } - }, - unmask: function(data, mask) { - var maskNum = mask.readUInt32LE(0, true); - var length = data.length; - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ data.readUInt32LE(i, true); - if (num < 0) num = 4294967296 + num; - data.writeUInt32LE(num, i, true); - } - switch (length % 4) { - case 3: data[i + 2] = data[i + 2] ^ mask[2]; - case 2: data[i + 1] = data[i + 1] ^ mask[1]; - case 1: data[i] = data[i] ^ mask[0]; - case 0:; - } - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.js deleted file mode 100644 index 15d35b9..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/BufferUtil.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -try { - module.exports = require('../build/Release/bufferutil'); -} catch (e) { try { - module.exports = require('../build/default/bufferutil'); -} catch (e) { try { - module.exports = require('./BufferUtil.fallback'); -} catch (e) { - console.error('bufferutil.node seems to not have been built. Run npm install.'); - throw e; -}}} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/ErrorCodes.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/ErrorCodes.js deleted file mode 100644 index 55ebd52..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/ErrorCodes.js +++ /dev/null @@ -1,24 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports = { - isValidErrorCode: function(code) { - return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || - (code >= 3000 && code <= 4999); - }, - 1000: 'normal', - 1001: 'going away', - 1002: 'protocol error', - 1003: 'unsupported data', - 1004: 'reserved', - 1005: 'reserved for extensions', - 1006: 'reserved for extensions', - 1007: 'inconsistent or invalid data', - 1008: 'policy violation', - 1009: 'message too big', - 1010: 'extension handshake missing', - 1011: 'an unexpected condition prevented the request from being fulfilled', -}; \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.hixie.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.hixie.js deleted file mode 100644 index a8e41c4..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.hixie.js +++ /dev/null @@ -1,180 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util'); - -/** - * State constants - */ - -var EMPTY = 0 - , BODY = 1; -var BINARYLENGTH = 2 - , BINARYBODY = 3; - -/** - * Hixie Receiver implementation - */ - -function Receiver () { - this.state = EMPTY; - this.buffers = []; - this.messageEnd = -1; - this.spanLength = 0; - this.dead = false; - - this.onerror = function() {}; - this.ontext = function() {}; - this.onbinary = function() {}; - this.onclose = function() {}; - this.onping = function() {}; - this.onpong = function() {}; -} - -module.exports = Receiver; - -/** - * Add new data to the parser. - * - * @api public - */ - -Receiver.prototype.add = function(data) { - var self = this; - function doAdd() { - if (self.state === EMPTY) { - if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { - self.reset(); - self.onclose(); - return; - } - if (data[0] === 0x80) { - self.messageEnd = 0; - self.state = BINARYLENGTH; - data = data.slice(1); - } else { - - if (data[0] !== 0x00) { - self.error('payload must start with 0x00 byte', true); - return; - } - data = data.slice(1); - self.state = BODY; - - } - } - if (self.state === BINARYLENGTH) { - var i = 0; - while ((i < data.length) && (data[i] & 0x80)) { - self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); - ++i; - } - if (i < data.length) { - self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); - self.state = BINARYBODY; - ++i; - } - if (i > 0) - data = data.slice(i); - } - if (self.state === BINARYBODY) { - var dataleft = self.messageEnd - self.spanLength; - if (data.length >= dataleft) { - // consume the whole buffer to finish the frame - self.buffers.push(data); - self.spanLength += dataleft; - self.messageEnd = dataleft; - return self.parse(); - } - // frame's not done even if we consume it all - self.buffers.push(data); - self.spanLength += data.length; - return; - } - self.buffers.push(data); - if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { - self.spanLength += self.messageEnd; - return self.parse(); - } - else self.spanLength += data.length; - } - while(data) data = doAdd(); -}; - -/** - * Releases all resources used by the receiver. - * - * @api public - */ - -Receiver.prototype.cleanup = function() { - this.dead = true; - this.state = EMPTY; - this.buffers = []; -}; - -/** - * Process buffered data. - * - * @api public - */ - -Receiver.prototype.parse = function() { - var output = new Buffer(this.spanLength); - var outputIndex = 0; - for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { - var buffer = this.buffers[bi]; - buffer.copy(output, outputIndex); - outputIndex += buffer.length; - } - var lastBuffer = this.buffers[this.buffers.length - 1]; - if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); - if (this.state !== BODY) --this.messageEnd; - var tail = null; - if (this.messageEnd < lastBuffer.length - 1) { - tail = lastBuffer.slice(this.messageEnd + 1); - } - this.reset(); - this.ontext(output.toString('utf8')); - return tail; -}; - -/** - * Handles an error - * - * @api private - */ - -Receiver.prototype.error = function (reason, terminate) { - this.reset(); - this.onerror(reason, terminate); - return this; -}; - -/** - * Reset parser state - * - * @api private - */ - -Receiver.prototype.reset = function (reason) { - if (this.dead) return; - this.state = EMPTY; - this.buffers = []; - this.messageEnd = -1; - this.spanLength = 0; -}; - -/** - * Internal api - */ - -function bufferIndex(buffer, byte) { - for (var i = 0, l = buffer.length; i < l; ++i) { - if (buffer[i] === byte) return i; - } - return -1; -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js deleted file mode 100644 index 004cd32..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Receiver.js +++ /dev/null @@ -1,585 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util') - , Validation = require('./Validation').Validation - , ErrorCodes = require('./ErrorCodes') - , BufferPool = require('./BufferPool') - , bufferUtil = require('./BufferUtil').BufferUtil; - -/** - * HyBi Receiver implementation - */ - -function Receiver () { - // memory pool for fragmented messages - var fragmentedPoolPrevUsed = -1; - this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { - return db.used + length; - }, function(db) { - return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? - (fragmentedPoolPrevUsed + db.used) / 2 : - db.used; - }); - - // memory pool for unfragmented messages - var unfragmentedPoolPrevUsed = -1; - this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { - return db.used + length; - }, function(db) { - return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? - (unfragmentedPoolPrevUsed + db.used) / 2 : - db.used; - }); - - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0, - fragmentedOperation: false - }; - this.overflow = []; - this.headerBuffer = new Buffer(10); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.currentMessage = []; - this.expectHeader(2, this.processPacket); - this.dead = false; - - this.onerror = function() {}; - this.ontext = function() {}; - this.onbinary = function() {}; - this.onclose = function() {}; - this.onping = function() {}; - this.onpong = function() {}; -} - -module.exports = Receiver; - -/** - * Add new data to the parser. - * - * @api public - */ - -Receiver.prototype.add = function(data) { - var dataLength = data.length; - if (dataLength == 0) return; - if (this.expectBuffer == null) { - this.overflow.push(data); - return; - } - var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); - fastCopy(toRead, data, this.expectBuffer, this.expectOffset); - this.expectOffset += toRead; - if (toRead < dataLength) { - this.overflow.push(data.slice(toRead)); - } - while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { - var bufferForHandler = this.expectBuffer; - this.expectBuffer = null; - this.expectOffset = 0; - this.expectHandler.call(this, bufferForHandler); - } -}; - -/** - * Releases all resources used by the receiver. - * - * @api public - */ - -Receiver.prototype.cleanup = function() { - this.dead = true; - this.overflow = null; - this.headerBuffer = null; - this.expectBuffer = null; - this.expectHandler = null; - this.unfragmentedBufferPool = null; - this.fragmentedBufferPool = null; - this.state = null; - this.currentMessage = null; - this.onerror = null; - this.ontext = null; - this.onbinary = null; - this.onclose = null; - this.onping = null; - this.onpong = null; -}; - -/** - * Waits for a certain amount of header bytes to be available, then fires a callback. - * - * @api private - */ - -Receiver.prototype.expectHeader = function(length, handler) { - if (length == 0) { - handler(null); - return; - } - this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); - this.expectHandler = handler; - var toRead = length; - while (toRead > 0 && this.overflow.length > 0) { - var fromOverflow = this.overflow.pop(); - if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); - var read = Math.min(fromOverflow.length, toRead); - fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); - this.expectOffset += read; - toRead -= read; - } -}; - -/** - * Waits for a certain amount of data bytes to be available, then fires a callback. - * - * @api private - */ - -Receiver.prototype.expectData = function(length, handler) { - if (length == 0) { - handler(null); - return; - } - this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); - this.expectHandler = handler; - var toRead = length; - while (toRead > 0 && this.overflow.length > 0) { - var fromOverflow = this.overflow.pop(); - if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); - var read = Math.min(fromOverflow.length, toRead); - fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); - this.expectOffset += read; - toRead -= read; - } -}; - -/** - * Allocates memory from the buffer pool. - * - * @api private - */ - -Receiver.prototype.allocateFromPool = function(length, isFragmented) { - return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); -}; - -/** - * Start processing a new packet. - * - * @api private - */ - -Receiver.prototype.processPacket = function (data) { - if ((data[0] & 0x70) != 0) { - this.error('reserved fields must be empty', 1002); - return; - } - this.state.lastFragment = (data[0] & 0x80) == 0x80; - this.state.masked = (data[1] & 0x80) == 0x80; - var opcode = data[0] & 0xf; - if (opcode === 0) { - // continuation frame - this.state.fragmentedOperation = true; - this.state.opcode = this.state.activeFragmentedOperation; - if (!(this.state.opcode == 1 || this.state.opcode == 2)) { - this.error('continuation frame cannot follow current opcode', 1002); - return; - } - } - else { - if (opcode < 3 && this.state.activeFragmentedOperation != null) { - this.error('data frames after the initial data frame must have opcode 0', 1002); - return; - } - this.state.opcode = opcode; - if (this.state.lastFragment === false) { - this.state.fragmentedOperation = true; - this.state.activeFragmentedOperation = opcode; - } - else this.state.fragmentedOperation = false; - } - var handler = opcodes[this.state.opcode]; - if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); - else { - handler.start.call(this, data); - } -}; - -/** - * Endprocessing a packet. - * - * @api private - */ - -Receiver.prototype.endPacket = function() { - if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); - else if (this.state.lastFragment) this.fragmentedBufferPool.reset(false); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { - // end current fragmented operation - this.state.activeFragmentedOperation = null; - } - this.state.lastFragment = false; - this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; - this.state.masked = false; - this.expectHeader(2, this.processPacket); -}; - -/** - * Reset the parser state. - * - * @api private - */ - -Receiver.prototype.reset = function() { - if (this.dead) return; - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0, - fragmentedOperation: false - }; - this.fragmentedBufferPool.reset(true); - this.unfragmentedBufferPool.reset(true); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.overflow = []; - this.currentMessage = []; -}; - -/** - * Unmask received data. - * - * @api private - */ - -Receiver.prototype.unmask = function (mask, buf, binary) { - if (mask != null && buf != null) bufferUtil.unmask(buf, mask); - if (binary) return buf; - return buf != null ? buf.toString('utf8') : ''; -}; - -/** - * Concatenates a list of buffers. - * - * @api private - */ - -Receiver.prototype.concatBuffers = function(buffers) { - var length = 0; - for (var i = 0, l = buffers.length; i < l; ++i) length += buffers[i].length; - var mergedBuffer = new Buffer(length); - bufferUtil.merge(mergedBuffer, buffers); - return mergedBuffer; -}; - -/** - * Handles an error - * - * @api private - */ - -Receiver.prototype.error = function (reason, protocolErrorCode) { - this.reset(); - this.onerror(reason, protocolErrorCode); - return this; -}; - -/** - * Buffer utilities - */ - -function readUInt16BE(start) { - return (this[start]<<8) + - this[start+1]; -} - -function readUInt32BE(start) { - return (this[start]<<24) + - (this[start+1]<<16) + - (this[start+2]<<8) + - this[start+3]; -} - -function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { - switch (length) { - default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; - case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; - case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; - case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; - case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; - case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; - case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; - case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; - case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; - case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; - case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; - case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; - case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; - case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; - case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; - case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; - case 1: dstBuffer[dstOffset] = srcBuffer[0]; - } -} - -/** - * Opcode handlers - */ - -var opcodes = { - // text - '1': { - start: function(data) { - var self = this; - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['1'].getData.call(self, firstLength); - } - else if (firstLength == 126) { - self.expectHeader(2, function(data) { - opcodes['1'].getData.call(self, readUInt16BE.call(data, 0)); - }); - } - else if (firstLength == 127) { - self.expectHeader(8, function(data) { - if (readUInt32BE.call(data, 0) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported', 1008); - return; - } - opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); - }); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['1'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['1'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var packet = this.unmask(mask, data, true); - if (packet != null) this.currentMessage.push(packet); - if (this.state.lastFragment) { - var messageBuffer = this.concatBuffers(this.currentMessage); - if (!Validation.isValidUTF8(messageBuffer)) { - this.error('invalid utf8 sequence', 1007); - return; - } - this.ontext(messageBuffer.toString('utf8'), {masked: this.state.masked, buffer: messageBuffer}); - this.currentMessage = []; - } - this.endPacket(); - } - }, - // binary - '2': { - start: function(data) { - var self = this; - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['2'].getData.call(self, firstLength); - } - else if (firstLength == 126) { - self.expectHeader(2, function(data) { - opcodes['2'].getData.call(self, readUInt16BE.call(data, 0)); - }); - } - else if (firstLength == 127) { - self.expectHeader(8, function(data) { - if (readUInt32BE.call(data, 0) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported', 1008); - return; - } - opcodes['2'].getData.call(self, readUInt32BE.call(data, 4, true)); - }); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['2'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['2'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var packet = this.unmask(mask, data, true); - if (packet != null) this.currentMessage.push(packet); - if (this.state.lastFragment) { - var messageBuffer = this.concatBuffers(this.currentMessage); - this.onbinary(messageBuffer, {masked: this.state.masked, buffer: messageBuffer}); - this.currentMessage = []; - } - this.endPacket(); - } - }, - // close - '8': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented close is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['8'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['8'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['8'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var self = this; - data = self.unmask(mask, data, true); - if (data && data.length == 1) { - self.error('close packets with data must be at least two bytes long', 1002); - return; - } - var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; - if (!ErrorCodes.isValidErrorCode(code)) { - self.error('invalid error code', 1002); - return; - } - var message = ''; - if (data && data.length > 2) { - var messageBuffer = data.slice(2); - if (!Validation.isValidUTF8(messageBuffer)) { - self.error('invalid utf8 sequence', 1007); - return; - } - message = messageBuffer.toString('utf8'); - } - this.onclose(code, message, {masked: self.state.masked}); - this.reset(); - }, - }, - // ping - '9': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented ping is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['9'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['9'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['9'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - this.onping(this.unmask(mask, data, true), {masked: this.state.masked, binary: true}); - this.endPacket(); - } - }, - // pong - '10': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented pong is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['10'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (this.state.masked) { - this.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['10'].finish.call(self, mask, data); - }); - }); - } - else { - this.expectData(length, function(data) { - opcodes['10'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - this.onpong(this.unmask(mask, data, true), {masked: this.state.masked, binary: true}); - this.endPacket(); - } - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.hixie.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.hixie.js deleted file mode 100644 index fd2fd25..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.hixie.js +++ /dev/null @@ -1,120 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var events = require('events') - , util = require('util') - , EventEmitter = events.EventEmitter; - -/** - * Hixie Sender implementation - */ - -function Sender(socket) { - events.EventEmitter.call(this); - - this.socket = socket; - this.continuationFrame = false; - this.isClosed = false; -} - -module.exports = Sender; - -/** - * Inherits from EventEmitter. - */ - -util.inherits(Sender, events.EventEmitter); - -/** - * Frames and writes data. - * - * @api public - */ - -Sender.prototype.send = function(data, options, cb) { - if (this.isClosed) return; - - var isString = typeof data == 'string' - , length = isString ? Buffer.byteLength(data) : data.length - , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes - , writeStartMarker = this.continuationFrame == false - , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) - , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0)) - , offset = writeStartMarker ? 1 : 0; - - if (writeStartMarker) { - if (options && options.binary) { - buffer.write('\x80', 'binary'); - // assume length less than 2**14 bytes - if (lengthbytes > 1) - buffer.write(String.fromCharCode(128+length/128), offset++, 'binary'); - buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary'); - } else - buffer.write('\x00', 'binary'); - } - - if (isString) buffer.write(data, offset, 'utf8'); - else data.copy(buffer, offset, 0); - - if (writeEndMarker) { - if (options && options.binary) { - // sending binary, not writing end marker - } else - buffer.write('\xff', offset + length, 'binary'); - this.continuationFrame = false; - } - else this.continuationFrame = true; - - try { - this.socket.write(buffer, 'binary', cb); - } catch (e) { - this.error(e.toString()); - } -}; - -/** - * Sends a close instruction to the remote party. - * - * @api public - */ - -Sender.prototype.close = function(code, data, mask, cb) { - if (this.isClosed) return; - this.isClosed = true; - try { - if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); - this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); - } catch (e) { - this.error(e.toString()); - } -}; - -/** - * Sends a ping message to the remote party. Not available for hixie. - * - * @api public - */ - -Sender.prototype.ping = function(data, options) {}; - -/** - * Sends a pong message to the remote party. Not available for hixie. - * - * @api public - */ - -Sender.prototype.pong = function(data, options) {}; - -/** - * Handles an error - * - * @api private - */ - -Sender.prototype.error = function (reason) { - this.emit('error', reason); - return this; -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.js deleted file mode 100644 index 5ff4fd7..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Sender.js +++ /dev/null @@ -1,229 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var events = require('events') - , util = require('util') - , EventEmitter = events.EventEmitter - , ErrorCodes = require('./ErrorCodes') - , bufferUtil = require('./BufferUtil').BufferUtil; - -/** - * HyBi Sender implementation - */ - -function Sender(socket) { - events.EventEmitter.call(this); - - this._socket = socket; - this.firstFragment = true; -} - -/** - * Inherits from EventEmitter. - */ - -util.inherits(Sender, events.EventEmitter); - -/** - * Sends a close instruction to the remote party. - * - * @api public - */ - -Sender.prototype.close = function(code, data, mask) { - if (typeof code !== 'undefined') { - if (typeof code !== 'number' || - !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number'); - } - code = code || 1000; - var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0)); - writeUInt16BE.call(dataBuffer, code, 0); - if (dataBuffer.length > 2) dataBuffer.write(data, 2); - this.frameAndSend(0x8, dataBuffer, true, mask); -}; - -/** - * Sends a ping message to the remote party. - * - * @api public - */ - -Sender.prototype.ping = function(data, options) { - var mask = options && options.mask; - this.frameAndSend(0x9, data || '', true, mask); -}; - -/** - * Sends a pong message to the remote party. - * - * @api public - */ - -Sender.prototype.pong = function(data, options) { - var mask = options && options.mask; - this.frameAndSend(0xa, data || '', true, mask); -}; - -/** - * Sends text or binary data to the remote party. - * - * @api public - */ - -Sender.prototype.send = function(data, options, cb) { - var finalFragment = options && options.fin === false ? false : true; - var mask = options && options.mask; - var opcode = options && options.binary ? 2 : 1; - if (this.firstFragment === false) opcode = 0; - else this.firstFragment = false; - if (finalFragment) this.firstFragment = true - this.frameAndSend(opcode, data, finalFragment, mask, cb); -}; - -/** - * Frames and sends a piece of data according to the HyBi WebSocket protocol. - * - * @api private - */ - -Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, cb) { - var canModifyData = false; - - if (!data) { - try { - this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - return; - } - - if (!Buffer.isBuffer(data)) { - canModifyData = true; - if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) { - data = getArrayBuffer(data); - } else { - data = new Buffer(data); - } - } - - var dataLength = data.length - , dataOffset = maskData ? 6 : 2 - , secondByte = dataLength; - - if (dataLength >= 65536) { - dataOffset += 8; - secondByte = 127; - } - else if (dataLength > 125) { - dataOffset += 2; - secondByte = 126; - } - - var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData); - var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset; - var outputBuffer = new Buffer(totalLength); - outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode; - - switch (secondByte) { - case 126: - writeUInt16BE.call(outputBuffer, dataLength, 2); - break; - case 127: - writeUInt32BE.call(outputBuffer, 0, 2); - writeUInt32BE.call(outputBuffer, dataLength, 6); - } - - if (maskData) { - outputBuffer[1] = secondByte | 0x80; - var mask = this._randomMask || (this._randomMask = getRandomMask()); - outputBuffer[dataOffset - 4] = mask[0]; - outputBuffer[dataOffset - 3] = mask[1]; - outputBuffer[dataOffset - 2] = mask[2]; - outputBuffer[dataOffset - 1] = mask[3]; - if (mergeBuffers) { - bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength); - try { - this._socket.write(outputBuffer, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - else { - bufferUtil.mask(data, mask, data, 0, dataLength); - try { - this._socket.write(outputBuffer, 'binary'); - this._socket.write(data, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - } - else { - outputBuffer[1] = secondByte; - if (mergeBuffers) { - data.copy(outputBuffer, dataOffset); - try { - this._socket.write(outputBuffer, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - else { - try { - this._socket.write(outputBuffer, 'binary'); - this._socket.write(data, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - } -}; - -module.exports = Sender; - -function writeUInt16BE(value, offset) { - this[offset] = (value & 0xff00)>>8; - this[offset+1] = value & 0xff; -} - -function writeUInt32BE(value, offset) { - this[offset] = (value & 0xff000000)>>24; - this[offset+1] = (value & 0xff0000)>>16; - this[offset+2] = (value & 0xff00)>>8; - this[offset+3] = value & 0xff; -} - -function getArrayBuffer(data) { - // data is either an ArrayBuffer or ArrayBufferView. - var array = new Uint8Array(data.buffer || data) - , l = data.byteLength || data.length - , o = data.byteOffset || 0 - , buffer = new Buffer(l); - for (var i = 0; i < l; ++i) { - buffer[i] = array[o+i]; - } - return buffer; -} - -function getRandomMask() { - return new Buffer([ - ~~(Math.random() * 255), - ~~(Math.random() * 255), - ~~(Math.random() * 255), - ~~(Math.random() * 255) - ]); -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.fallback.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.fallback.js deleted file mode 100644 index 2c7c4fd..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.fallback.js +++ /dev/null @@ -1,12 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -module.exports.Validation = { - isValidUTF8: function(buffer) { - return true; - } -}; - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.js deleted file mode 100644 index 0f3109a..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/Validation.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -try { - module.exports = require('../build/Release/validation'); -} catch (e) { try { - module.exports = require('../build/default/validation'); -} catch (e) { try { - module.exports = require('./Validation.fallback'); -} catch (e) { - console.error('validation.node seems to not have been built. Run npm install.'); - throw e; -}}} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js deleted file mode 100644 index ff3f5d3..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocket.js +++ /dev/null @@ -1,879 +0,0 @@ -'use strict'; - -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var url = require('url') - , util = require('util') - , http = require('http') - , https = require('https') - , crypto = require('crypto') - , stream = require('stream') - , Ultron = require('ultron') - , Options = require('options') - , Sender = require('./Sender') - , Receiver = require('./Receiver') - , SenderHixie = require('./Sender.hixie') - , ReceiverHixie = require('./Receiver.hixie') - , EventEmitter = require('events').EventEmitter; - -/** - * Constants - */ - -// Default protocol version - -var protocolVersion = 13; - -// Close timeout - -var closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly - -/** - * WebSocket implementation - * - * @constructor - * @param {String} address Connection address. - * @param {String|Array} protocols WebSocket protocols. - * @param {Object} options Additional connection options. - * @api public - */ -function WebSocket(address, protocols, options) { - EventEmitter.call(this); - - if (protocols && !Array.isArray(protocols) && 'object' === typeof protocols) { - // accept the "options" Object as the 2nd argument - options = protocols; - protocols = null; - } - - if ('string' === typeof protocols) { - protocols = [ protocols ]; - } - - if (!Array.isArray(protocols)) { - protocols = []; - } - - // TODO: actually handle the `Sub-Protocols` part of the WebSocket client - - this._socket = null; - this._ultron = null; - this.bytesReceived = 0; - this.readyState = null; - this.supports = {}; - - if (Array.isArray(address)) { - initAsServerClient.apply(this, address.concat(options)); - } else { - initAsClient.apply(this, [address, protocols, options]); - } -} - -/** - * Inherits from EventEmitter. - */ -util.inherits(WebSocket, EventEmitter); - -/** - * Ready States - */ -["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function each(state, index) { - WebSocket.prototype[state] = WebSocket[state] = index; -}); - -/** - * Gracefully closes the connection, after sending a description message to the server - * - * @param {Object} data to be sent to the server - * @api public - */ -WebSocket.prototype.close = function close(code, data) { - if ( - this.readyState === WebSocket.CLOSING - || this.readyState === WebSocket.CLOSED - ) return; - - if (this.readyState === WebSocket.CONNECTING) { - this.readyState = WebSocket.CLOSED; - return; - } - - try { - this.readyState = WebSocket.CLOSING; - this._closeCode = code; - this._closeMessage = data; - var mask = !this._isServer; - this._sender.close(code, data, mask); - } catch (e) { - this.emit('error', e); - } finally { - this.terminate(); - } -}; - -/** - * Pause the client stream - * - * @api public - */ -WebSocket.prototype.pause = function pauser() { - if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); - - return this._socket.pause(); -}; - -/** - * Sends a ping - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open - * @api public - */ -WebSocket.prototype.ping = function ping(data, options, dontFailWhenClosed) { - if (this.readyState !== WebSocket.OPEN) { - if (dontFailWhenClosed === true) return; - throw new Error('not opened'); - } - - options = options || {}; - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - - this._sender.ping(data, options); -}; - -/** - * Sends a pong - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open - * @api public - */ -WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) { - if (this.readyState !== WebSocket.OPEN) { - if (dontFailWhenClosed === true) return; - throw new Error('not opened'); - } - - options = options || {}; - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - - this._sender.pong(data, options); -}; - -/** - * Resume the client stream - * - * @api public - */ -WebSocket.prototype.resume = function resume() { - if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); - - return this._socket.resume(); -}; - -/** - * Sends a piece of data - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {function} Optional callback which is executed after the send completes - * @api public - */ - -WebSocket.prototype.send = function send(data, options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (this.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else throw new Error('not opened'); - return; - } - - if (!data) data = ''; - if (this._queue) { - var self = this; - this._queue.push(function() { self.send(data, options, cb); }); - return; - } - - options = options || {}; - options.fin = true; - - if (typeof options.binary === 'undefined') { - options.binary = (data instanceof ArrayBuffer || data instanceof Buffer || - data instanceof Uint8Array || - data instanceof Uint16Array || - data instanceof Uint32Array || - data instanceof Int8Array || - data instanceof Int16Array || - data instanceof Int32Array || - data instanceof Float32Array || - data instanceof Float64Array); - } - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - - var readable = typeof stream.Readable === 'function' - ? stream.Readable - : stream.Stream; - - if (data instanceof readable) { - startQueue(this); - var self = this; - - sendStream(this, data, options, function send(error) { - process.nextTick(function tock() { - executeQueueSends(self); - }); - - if (typeof cb === 'function') cb(error); - }); - } else { - this._sender.send(data, options, cb); - } -}; - -/** - * Streams data through calls to a user supplied function - * - * @param {Object} Members - mask: boolean, binary: boolean - * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'. - * @api public - */ -WebSocket.prototype.stream = function stream(options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var self = this; - - if (typeof cb !== 'function') throw new Error('callback must be provided'); - - if (this.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else throw new Error('not opened'); - return; - } - - if (this._queue) { - this._queue.push(function () { self.stream(options, cb); }); - return; - } - - options = options || {}; - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - - startQueue(this); - - function send(data, final) { - try { - if (self.readyState !== WebSocket.OPEN) throw new Error('not opened'); - options.fin = final === true; - self._sender.send(data, options); - if (!final) process.nextTick(cb.bind(null, null, send)); - else executeQueueSends(self); - } catch (e) { - if (typeof cb === 'function') cb(e); - else { - delete self._queue; - self.emit('error', e); - } - } - } - - process.nextTick(cb.bind(null, null, send)); -}; - -/** - * Immediately shuts down the connection - * - * @api public - */ -WebSocket.prototype.terminate = function terminate() { - if (this.readyState === WebSocket.CLOSED) return; - - if (this._socket) { - // End the connection - try { this._socket.end(); } - catch (e) { - // Socket error during end() call, so just destroy it right now - cleanupWebsocketResources.call(this, true); - return; - } - - // Add a timeout to ensure that the connection is completely - // cleaned up within 30 seconds, even if the clean close procedure - // fails for whatever reason - this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout); - } else if (this.readyState === WebSocket.CONNECTING) { - cleanupWebsocketResources.call(this, true); - } -}; - -/** - * Expose bufferedAmount - * - * @api public - */ -Object.defineProperty(WebSocket.prototype, 'bufferedAmount', { - get: function get() { - var amount = 0; - if (this._socket) { - amount = this._socket.bufferSize || 0; - } - return amount; - } -}); - -/** - * Emulates the W3C Browser based WebSocket interface using function members. - * - * @see http://dev.w3.org/html5/websockets/#the-websocket-interface - * @api public - */ -['open', 'error', 'close', 'message'].forEach(function(method) { - Object.defineProperty(WebSocket.prototype, 'on' + method, { - /** - * Returns the current listener - * - * @returns {Mixed} the set function or undefined - * @api public - */ - get: function get() { - var listener = this.listeners(method)[0]; - return listener ? (listener._listener ? listener._listener : listener) : undefined; - }, - - /** - * Start listening for events - * - * @param {Function} listener the listener - * @returns {Mixed} the set function or undefined - * @api public - */ - set: function set(listener) { - this.removeAllListeners(method); - this.addEventListener(method, listener); - } - }); -}); - -/** - * Emulates the W3C Browser based WebSocket interface using addEventListener. - * - * @see https://developer.mozilla.org/en/DOM/element.addEventListener - * @see http://dev.w3.org/html5/websockets/#the-websocket-interface - * @api public - */ -WebSocket.prototype.addEventListener = function(method, listener) { - var target = this; - - function onMessage (data, flags) { - listener.call(target, new MessageEvent(data, flags.binary ? 'Binary' : 'Text', target)); - } - - function onClose (code, message) { - listener.call(target, new CloseEvent(code, message, target)); - } - - function onError (event) { - event.target = target; - listener.call(target, event); - } - - function onOpen () { - listener.call(target, new OpenEvent(target)); - } - - if (typeof listener === 'function') { - if (method === 'message') { - // store a reference so we can return the original function from the - // addEventListener hook - onMessage._listener = listener; - this.on(method, onMessage); - } else if (method === 'close') { - // store a reference so we can return the original function from the - // addEventListener hook - onClose._listener = listener; - this.on(method, onClose); - } else if (method === 'error') { - // store a reference so we can return the original function from the - // addEventListener hook - onError._listener = listener; - this.on(method, onError); - } else if (method === 'open') { - // store a reference so we can return the original function from the - // addEventListener hook - onOpen._listener = listener; - this.on(method, onOpen); - } else { - this.on(method, listener); - } - } -}; - -module.exports = WebSocket; - -/** - * W3C MessageEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @constructor - * @api private - */ -function MessageEvent(dataArg, typeArg, target) { - this.data = dataArg; - this.type = typeArg; - this.target = target; -} - -/** - * W3C CloseEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @constructor - * @api private - */ -function CloseEvent(code, reason, target) { - this.wasClean = (typeof code === 'undefined' || code === 1000); - this.code = code; - this.reason = reason; - this.target = target; -} - -/** - * W3C OpenEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @constructor - * @api private - */ -function OpenEvent(target) { - this.target = target; -} - -/** - * Entirely private apis, - * which may or may not be bound to a sepcific WebSocket instance. - */ -function initAsServerClient(req, socket, upgradeHead, options) { - options = new Options({ - protocolVersion: protocolVersion, - protocol: null - }).merge(options); - - // expose state properties - this.protocol = options.value.protocol; - this.protocolVersion = options.value.protocolVersion; - this.supports.binary = (this.protocolVersion !== 'hixie-76'); - this.upgradeReq = req; - this.readyState = WebSocket.CONNECTING; - this._isServer = true; - - // establish connection - if (options.value.protocolVersion === 'hixie-76') { - establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead); - } else { - establishConnection.call(this, Receiver, Sender, socket, upgradeHead); - } -} - -function initAsClient(address, protocols, options) { - options = new Options({ - origin: null, - protocolVersion: protocolVersion, - host: null, - headers: null, - protocol: null, - agent: null, - - // ssl-related options - pfx: null, - key: null, - passphrase: null, - cert: null, - ca: null, - ciphers: null, - rejectUnauthorized: null - }).merge(options); - - if (options.value.protocolVersion !== 8 && options.value.protocolVersion !== 13) { - throw new Error('unsupported protocol version'); - } - - // verify URL and establish http class - var serverUrl = url.parse(address); - var isUnixSocket = serverUrl.protocol === 'ws+unix:'; - if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url'); - var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:'; - var httpObj = isSecure ? https : http; - var port = serverUrl.port || (isSecure ? 443 : 80); - var auth = serverUrl.auth; - - // expose state properties - this._isServer = false; - this.url = address; - this.protocolVersion = options.value.protocolVersion; - this.supports.binary = (this.protocolVersion !== 'hixie-76'); - - // begin handshake - var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64'); - var shasum = crypto.createHash('sha1'); - shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); - var expectedServerKey = shasum.digest('base64'); - - var agent = options.value.agent; - - var headerHost = serverUrl.hostname; - // Append port number to Host and Origin header, only if specified in the url - // and non-default - if (serverUrl.port) { - if ((isSecure && (port !== 443)) || (!isSecure && (port !== 80))){ - headerHost = headerHost + ':' + port; - } - } - - var requestOptions = { - port: port, - host: serverUrl.hostname, - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Host': headerHost, - 'Origin': headerHost, - 'Sec-WebSocket-Version': options.value.protocolVersion, - 'Sec-WebSocket-Key': key - } - }; - - // If we have basic auth. - if (auth) { - requestOptions.headers.Authorization = 'Basic ' + new Buffer(auth).toString('base64'); - } - - if (options.value.protocol) { - requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol; - } - - if (options.value.host) { - requestOptions.headers.Host = options.value.host; - } - - if (options.value.headers) { - for (var header in options.value.headers) { - if (options.value.headers.hasOwnProperty(header)) { - requestOptions.headers[header] = options.value.headers[header]; - } - } - } - - if (options.isDefinedAndNonNull('pfx') - || options.isDefinedAndNonNull('key') - || options.isDefinedAndNonNull('passphrase') - || options.isDefinedAndNonNull('cert') - || options.isDefinedAndNonNull('ca') - || options.isDefinedAndNonNull('ciphers') - || options.isDefinedAndNonNull('rejectUnauthorized')) { - - if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx; - if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key; - if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase; - if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert; - if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca; - if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers; - if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized; - - if (!agent) { - // global agent ignores client side certificates - agent = new httpObj.Agent(requestOptions); - } - } - - requestOptions.path = serverUrl.path || '/'; - - if (agent) { - requestOptions.agent = agent; - } - - if (isUnixSocket) { - requestOptions.socketPath = serverUrl.pathname; - } - if (options.value.origin) { - if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin; - else requestOptions.headers.Origin = options.value.origin; - } - - var self = this; - var req = httpObj.request(requestOptions); - - req.on('error', function onerror(error) { - self.emit('error', error); - cleanupWebsocketResources.call(this, error); - }); - - req.once('response', function response(res) { - var error; - - if (!self.emit('unexpected-response', req, res)) { - error = new Error('unexpected server response (' + res.statusCode + ')'); - req.abort(); - self.emit('error', error); - } - - cleanupWebsocketResources.call(this, error); - }); - - req.once('upgrade', function upgrade(res, socket, upgradeHead) { - if (self.readyState === WebSocket.CLOSED) { - // client closed before server accepted connection - self.emit('close'); - self.removeAllListeners(); - socket.end(); - return; - } - - var serverKey = res.headers['sec-websocket-accept']; - if (typeof serverKey === 'undefined' || serverKey !== expectedServerKey) { - self.emit('error', 'invalid server key'); - self.removeAllListeners(); - socket.end(); - return; - } - - var serverProt = res.headers['sec-websocket-protocol']; - var protList = (options.value.protocol || "").split(/, */); - var protError = null; - - if (!options.value.protocol && serverProt) { - protError = 'server sent a subprotocol even though none requested'; - } else if (options.value.protocol && !serverProt) { - protError = 'server sent no subprotocol even though requested'; - } else if (serverProt && protList.indexOf(serverProt) === -1) { - protError = 'server responded with an invalid protocol'; - } - - if (protError) { - self.emit('error', protError); - self.removeAllListeners(); - socket.end(); - return; - } else if (serverProt) { - self.protocol = serverProt; - } - - establishConnection.call(self, Receiver, Sender, socket, upgradeHead); - - // perform cleanup on http resources - req.removeAllListeners(); - req = null; - agent = null; - }); - - req.end(); - this.readyState = WebSocket.CONNECTING; -} - -function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) { - var ultron = this._ultron = new Ultron(socket); - this._socket = socket; - - socket.setTimeout(0); - socket.setNoDelay(true); - var self = this; - this._receiver = new ReceiverClass(); - - // socket cleanup handlers - ultron.on('end', cleanupWebsocketResources.bind(this)); - ultron.on('close', cleanupWebsocketResources.bind(this)); - ultron.on('error', cleanupWebsocketResources.bind(this)); - - // ensure that the upgradeHead is added to the receiver - function firstHandler(data) { - if (self.readyState !== WebSocket.OPEN) return; - - if (upgradeHead && upgradeHead.length > 0) { - self.bytesReceived += upgradeHead.length; - var head = upgradeHead; - upgradeHead = null; - self._receiver.add(head); - } - - dataHandler = realHandler; - - if (data) { - self.bytesReceived += data.length; - self._receiver.add(data); - } - } - - // subsequent packets are pushed straight to the receiver - function realHandler(data) { - if (data) self.bytesReceived += data.length; - self._receiver.add(data); - } - - var dataHandler = firstHandler; - - // if data was passed along with the http upgrade, - // this will schedule a push of that on to the receiver. - // this has to be done on next tick, since the caller - // hasn't had a chance to set event handlers on this client - // object yet. - process.nextTick(firstHandler); - - // receiver event handlers - self._receiver.ontext = function ontext(data, flags) { - flags = flags || {}; - - self.emit('message', data, flags); - }; - - self._receiver.onbinary = function onbinary(data, flags) { - flags = flags || {}; - - flags.binary = true; - self.emit('message', data, flags); - }; - - self._receiver.onping = function onping(data, flags) { - flags = flags || {}; - - self.pong(data, { - mask: !self._isServer, - binary: flags.binary === true - }, true); - - self.emit('ping', data, flags); - }; - - self._receiver.onpong = function onpong(data, flags) { - self.emit('pong', data, flags || {}); - }; - - self._receiver.onclose = function onclose(code, data, flags) { - flags = flags || {}; - - self.close(code, data); - }; - - self._receiver.onerror = function onerror(reason, errorCode) { - // close the connection when the receiver reports a HyBi error code - self.close(typeof errorCode !== 'undefined' ? errorCode : 1002, ''); - self.emit('error', reason, errorCode); - }; - - // finalize the client - this._sender = new SenderClass(socket); - this._sender.on('error', function onerror(error) { - self.close(1002, ''); - self.emit('error', error); - }); - - this.readyState = WebSocket.OPEN; - this.emit('open'); - - ultron.on('data', dataHandler); -} - -function startQueue(instance) { - instance._queue = instance._queue || []; -} - -function executeQueueSends(instance) { - var queue = instance._queue; - if (typeof queue === 'undefined') return; - - delete instance._queue; - for (var i = 0, l = queue.length; i < l; ++i) { - queue[i](); - } -} - -function sendStream(instance, stream, options, cb) { - stream.on('data', function incoming(data) { - if (instance.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else { - delete instance._queue; - instance.emit('error', new Error('not opened')); - } - return; - } - - options.fin = false; - instance._sender.send(data, options); - }); - - stream.on('end', function end() { - if (instance.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else { - delete instance._queue; - instance.emit('error', new Error('not opened')); - } - return; - } - - options.fin = true; - instance._sender.send(null, options); - - if (typeof cb === 'function') cb(null); - }); -} - -function cleanupWebsocketResources(error) { - if (this.readyState === WebSocket.CLOSED) return; - - var emitClose = this.readyState !== WebSocket.CONNECTING; - this.readyState = WebSocket.CLOSED; - - clearTimeout(this._closeTimer); - this._closeTimer = null; - - if (emitClose) { - this.emit('close', this._closeCode || 1000, this._closeMessage || ''); - } - - if (this._socket) { - if (this._ultron) this._ultron.destroy(); - this._socket.on('error', function onerror() { - try { this.destroy(); } - catch (e) {} - }); - - try { - if (!error) this._socket.end(); - else this._socket.destroy(); - } catch (e) { /* Ignore termination errors */ } - - this._socket = null; - this._ultron = null; - } - - if (this._sender) { - this._sender.removeAllListeners(); - this._sender = null; - } - - if (this._receiver) { - this._receiver.cleanup(); - this._receiver = null; - } - - this.removeAllListeners(); - this.on('error', function onerror() {}); // catch all errors after this - delete this._queue; -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocketServer.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocketServer.js deleted file mode 100644 index 218048c..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/WebSocketServer.js +++ /dev/null @@ -1,467 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var util = require('util') - , events = require('events') - , http = require('http') - , crypto = require('crypto') - , Options = require('options') - , WebSocket = require('./WebSocket') - , tls = require('tls') - , url = require('url'); - -/** - * WebSocket Server implementation - */ - -function WebSocketServer(options, callback) { - events.EventEmitter.call(this); - - options = new Options({ - host: '0.0.0.0', - port: null, - server: null, - verifyClient: null, - handleProtocols: null, - path: null, - noServer: false, - disableHixie: false, - clientTracking: true - }).merge(options); - - if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) { - throw new TypeError('`port` or a `server` must be provided'); - } - - var self = this; - - if (options.isDefinedAndNonNull('port')) { - this._server = http.createServer(function (req, res) { - res.writeHead(200, {'Content-Type': 'text/plain'}); - res.end('Not implemented'); - }); - this._server.listen(options.value.port, options.value.host, callback); - this._closeServer = function() { if (self._server) self._server.close(); }; - } - else if (options.value.server) { - this._server = options.value.server; - if (options.value.path) { - // take note of the path, to avoid collisions when multiple websocket servers are - // listening on the same http server - if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) { - throw new Error('two instances of WebSocketServer cannot listen on the same http server path'); - } - if (typeof this._server._webSocketPaths !== 'object') { - this._server._webSocketPaths = {}; - } - this._server._webSocketPaths[options.value.path] = 1; - } - } - if (this._server) this._server.once('listening', function() { self.emit('listening'); }); - - if (typeof this._server != 'undefined') { - this._server.on('error', function(error) { - self.emit('error', error) - }); - this._server.on('upgrade', function(req, socket, upgradeHead) { - //copy upgradeHead to avoid retention of large slab buffers used in node core - var head = new Buffer(upgradeHead.length); - upgradeHead.copy(head); - - self.handleUpgrade(req, socket, head, function(client) { - self.emit('connection'+req.url, client); - self.emit('connection', client); - }); - }); - } - - this.options = options.value; - this.path = options.value.path; - this.clients = []; -} - -/** - * Inherits from EventEmitter. - */ - -util.inherits(WebSocketServer, events.EventEmitter); - -/** - * Immediately shuts down the connection. - * - * @api public - */ - -WebSocketServer.prototype.close = function() { - // terminate all associated clients - var error = null; - try { - for (var i = 0, l = this.clients.length; i < l; ++i) { - this.clients[i].terminate(); - } - } - catch (e) { - error = e; - } - - // remove path descriptor, if any - if (this.path && this._server._webSocketPaths) { - delete this._server._webSocketPaths[this.path]; - if (Object.keys(this._server._webSocketPaths).length == 0) { - delete this._server._webSocketPaths; - } - } - - // close the http server if it was internally created - try { - if (typeof this._closeServer !== 'undefined') { - this._closeServer(); - } - } - finally { - delete this._server; - } - if (error) throw error; -} - -/** - * Handle a HTTP Upgrade request. - * - * @api public - */ - -WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) { - // check for wrong path - if (this.options.path) { - var u = url.parse(req.url); - if (u && u.pathname !== this.options.path) return; - } - - if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments); - else handleHybiUpgrade.apply(this, arguments); -} - -module.exports = WebSocketServer; - -/** - * Entirely private apis, - * which may or may not be bound to a sepcific WebSocket instance. - */ - -function handleHybiUpgrade(req, socket, upgradeHead, cb) { - // handle premature socket errors - var errorHandler = function() { - try { socket.destroy(); } catch (e) {} - } - socket.on('error', errorHandler); - - // verify key presence - if (!req.headers['sec-websocket-key']) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - // verify version - var version = parseInt(req.headers['sec-websocket-version']); - if ([8, 13].indexOf(version) === -1) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - // verify protocol - var protocols = req.headers['sec-websocket-protocol']; - - // verify client - var origin = version < 13 ? - req.headers['sec-websocket-origin'] : - req.headers['origin']; - - // handler to call when the connection sequence completes - var self = this; - var completeHybiUpgrade2 = function(protocol) { - - // calc key - var key = req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - if (typeof protocol != 'undefined') { - headers.push('Sec-WebSocket-Protocol: ' + protocol); - } - - // allows external modification/inspection of handshake headers - self.emit('headers', headers); - - socket.setTimeout(0); - socket.setNoDelay(true); - try { - socket.write(headers.concat('', '').join('\r\n')); - } - catch (e) { - // if the upgrade write fails, shut the connection down hard - try { socket.destroy(); } catch (e) {} - return; - } - - var client = new WebSocket([req, socket, upgradeHead], { - protocolVersion: version, - protocol: protocol - }); - - if (self.options.clientTracking) { - self.clients.push(client); - client.on('close', function() { - var index = self.clients.indexOf(client); - if (index != -1) { - self.clients.splice(index, 1); - } - }); - } - - // signal upgrade complete - socket.removeListener('error', errorHandler); - cb(client); - } - - // optionally call external protocol selection handler before - // calling completeHybiUpgrade2 - var completeHybiUpgrade1 = function() { - // choose from the sub-protocols - if (typeof self.options.handleProtocols == 'function') { - var protList = (protocols || "").split(/, */); - var callbackCalled = false; - var res = self.options.handleProtocols(protList, function(result, protocol) { - callbackCalled = true; - if (!result) abortConnection(socket, 401, 'Unauthorized'); - else completeHybiUpgrade2(protocol); - }); - if (!callbackCalled) { - // the handleProtocols handler never called our callback - abortConnection(socket, 501, 'Could not process protocols'); - } - return; - } else { - if (typeof protocols !== 'undefined') { - completeHybiUpgrade2(protocols.split(/, */)[0]); - } - else { - completeHybiUpgrade2(); - } - } - } - - // optionally call external client verification handler - if (typeof this.options.verifyClient == 'function') { - var info = { - origin: origin, - secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', - req: req - }; - if (this.options.verifyClient.length == 2) { - this.options.verifyClient(info, function(result, code, name) { - if (typeof code === 'undefined') code = 401; - if (typeof name === 'undefined') name = http.STATUS_CODES[code]; - - if (!result) abortConnection(socket, code, name); - else completeHybiUpgrade1(); - }); - return; - } - else if (!this.options.verifyClient(info)) { - abortConnection(socket, 401, 'Unauthorized'); - return; - } - } - - completeHybiUpgrade1(); -} - -function handleHixieUpgrade(req, socket, upgradeHead, cb) { - // handle premature socket errors - var errorHandler = function() { - try { socket.destroy(); } catch (e) {} - } - socket.on('error', errorHandler); - - // bail if options prevent hixie - if (this.options.disableHixie) { - abortConnection(socket, 401, 'Hixie support disabled'); - return; - } - - // verify key presence - if (!req.headers['sec-websocket-key2']) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - var origin = req.headers['origin'] - , self = this; - - // setup handshake completion to run after client has been verified - var onClientVerified = function() { - var wshost; - if (!req.headers['x-forwarded-host']) - wshost = req.headers.host; - else - wshost = req.headers['x-forwarded-host']; - var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url - , protocol = req.headers['sec-websocket-protocol']; - - // handshake completion code to run once nonce has been successfully retrieved - var completeHandshake = function(nonce, rest) { - // calculate key - var k1 = req.headers['sec-websocket-key1'] - , k2 = req.headers['sec-websocket-key2'] - , md5 = crypto.createHash('md5'); - - [k1, k2].forEach(function (k) { - var n = parseInt(k.replace(/[^\d]/g, '')) - , spaces = k.replace(/[^ ]/g, '').length; - if (spaces === 0 || n % spaces !== 0){ - abortConnection(socket, 400, 'Bad Request'); - return; - } - n /= spaces; - md5.update(String.fromCharCode( - n >> 24 & 0xFF, - n >> 16 & 0xFF, - n >> 8 & 0xFF, - n & 0xFF)); - }); - md5.update(nonce.toString('binary')); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: WebSocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Location: ' + location - ]; - if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol); - if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin); - - socket.setTimeout(0); - socket.setNoDelay(true); - try { - // merge header and hash buffer - var headerBuffer = new Buffer(headers.concat('', '').join('\r\n')); - var hashBuffer = new Buffer(md5.digest('binary'), 'binary'); - var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length); - headerBuffer.copy(handshakeBuffer, 0); - hashBuffer.copy(handshakeBuffer, headerBuffer.length); - - // do a single write, which - upon success - causes a new client websocket to be setup - socket.write(handshakeBuffer, 'binary', function(err) { - if (err) return; // do not create client if an error happens - var client = new WebSocket([req, socket, rest], { - protocolVersion: 'hixie-76', - protocol: protocol - }); - if (self.options.clientTracking) { - self.clients.push(client); - client.on('close', function() { - var index = self.clients.indexOf(client); - if (index != -1) { - self.clients.splice(index, 1); - } - }); - } - - // signal upgrade complete - socket.removeListener('error', errorHandler); - cb(client); - }); - } - catch (e) { - try { socket.destroy(); } catch (e) {} - return; - } - } - - // retrieve nonce - var nonceLength = 8; - if (upgradeHead && upgradeHead.length >= nonceLength) { - var nonce = upgradeHead.slice(0, nonceLength); - var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null; - completeHandshake.call(self, nonce, rest); - } - else { - // nonce not present in upgradeHead, so we must wait for enough data - // data to arrive before continuing - var nonce = new Buffer(nonceLength); - upgradeHead.copy(nonce, 0); - var received = upgradeHead.length; - var rest = null; - var handler = function (data) { - var toRead = Math.min(data.length, nonceLength - received); - if (toRead === 0) return; - data.copy(nonce, received, 0, toRead); - received += toRead; - if (received == nonceLength) { - socket.removeListener('data', handler); - if (toRead < data.length) rest = data.slice(toRead); - completeHandshake.call(self, nonce, rest); - } - } - socket.on('data', handler); - } - } - - // verify client - if (typeof this.options.verifyClient == 'function') { - var info = { - origin: origin, - secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', - req: req - }; - if (this.options.verifyClient.length == 2) { - var self = this; - this.options.verifyClient(info, function(result, code, name) { - if (typeof code === 'undefined') code = 401; - if (typeof name === 'undefined') name = http.STATUS_CODES[code]; - - if (!result) abortConnection(socket, code, name); - else onClientVerified.apply(self); - }); - return; - } - else if (!this.options.verifyClient(info)) { - abortConnection(socket, 401, 'Unauthorized'); - return; - } - } - - // no client verification required - onClientVerified(); -} - -function abortConnection(socket, code, name) { - try { - var response = [ - 'HTTP/1.1 ' + code + ' ' + name, - 'Content-type: text/html' - ]; - socket.write(response.concat('', '').join('\r\n')); - } - catch (e) { /* ignore errors - we've aborted this connection */ } - finally { - // ensure that an early aborted connection is shut down completely - try { socket.destroy(); } catch (e) {} - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/browser.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/browser.js deleted file mode 100644 index 8d3a755..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib/browser.js +++ /dev/null @@ -1,43 +0,0 @@ - -/** - * Module dependencies. - */ - -var global = (function() { return this; })(); - -/** - * WebSocket constructor. - */ - -var WebSocket = global.WebSocket || global.MozWebSocket; - -/** - * Module exports. - */ - -module.exports = WebSocket ? ws : null; - -/** - * WebSocket constructor. - * - * The third `opts` options object gets ignored in web browsers, since it's - * non-standard, and throws a TypeError if passed to the constructor. - * See: https://github.com/einaros/ws/issues/227 - * - * @param {String} uri - * @param {Array} protocols (optional) - * @param {Object) opts (optional) - * @api public - */ - -function ws(uri, protocols, opts) { - var instance; - if (protocols) { - instance = new WebSocket(uri, protocols); - } else { - instance = new WebSocket(uri); - } - return instance; -} - -if (WebSocket) ws.prototype = WebSocket.prototype; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.dntrc b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.dntrc deleted file mode 100644 index 47971da..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.dntrc +++ /dev/null @@ -1,30 +0,0 @@ -## DNT config file -## see https://github.com/rvagg/dnt - -NODE_VERSIONS="\ - master \ - v0.11.13 \ - v0.10.30 \ - v0.10.29 \ - v0.10.28 \ - v0.10.26 \ - v0.10.25 \ - v0.10.24 \ - v0.10.23 \ - v0.10.22 \ - v0.10.21 \ - v0.10.20 \ - v0.10.19 \ - v0.8.28 \ - v0.8.27 \ - v0.8.26 \ - v0.8.24 \ -" -OUTPUT_PREFIX="nan-" -TEST_CMD=" \ - cd /dnt/ && \ - npm install && \ - node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ - node_modules/.bin/tap --gc test/js/*-test.js \ -" - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.nan.h.un~ b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.nan.h.un~ deleted file mode 100644 index f2214d3..0000000 Binary files a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/.nan.h.un~ and /dev/null differ diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/CHANGELOG.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/CHANGELOG.md deleted file mode 100644 index 4408f14..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/CHANGELOG.md +++ /dev/null @@ -1,216 +0,0 @@ -# NAN ChangeLog - -**Version 1.4.1: current Node unstable: 0.11.14, Node stable: 0.10.33** - -### 1.4.1 Nov 8 2014 - - Bugfix: Handle DEBUG definition correctly - - Bugfix: Accept int as Boolean - -### 1.4.0 Nov 1 2014 - - - Feature: Added NAN_GC_CALLBACK 6a5c245 - - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 - - Correctness: Added constness to references in NanHasInstance 02c61cd - - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 - - Windoze: Shut Visual Studio up when compiling 8d558c1 - - License: Switch to plain MIT from custom hacked MIT license 11de983 - - Build: Added test target to Makefile e232e46 - - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 - - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 - - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 - -### 1.3.0 Aug 2 2014 - - - Added NanNew(std::string) - - Added NanNew(std::string&) - - Added NanAsciiString helper class - - Added NanUtf8String helper class - - Added NanUcs2String helper class - - Deprecated NanRawString() - - Deprecated NanCString() - - Added NanGetIsolateData(v8::Isolate *isolate) - - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) - - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) - - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - -### 1.2.0 Jun 5 2014 - - - Add NanSetPrototypeTemplate - - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, - introduced _NanWeakCallbackDispatcher - - Removed -Wno-unused-local-typedefs from test builds - - Made test builds Windows compatible ('Sleep()') - -### 1.1.2 May 28 2014 - - - Release to fix more stuff-ups in 1.1.1 - -### 1.1.1 May 28 2014 - - - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 - -### 1.1.0 May 25 2014 - - - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead - - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), - (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, - v8::String::ExternalAsciiStringResource* - - Deprecate NanSymbol() - - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker - -### 1.0.0 May 4 2014 - - - Heavy API changes for V8 3.25 / Node 0.11.13 - - Use cpplint.py - - Removed NanInitPersistent - - Removed NanPersistentToLocal - - Removed NanFromV8String - - Removed NanMakeWeak - - Removed NanNewLocal - - Removed NAN_WEAK_CALLBACK_OBJECT - - Removed NAN_WEAK_CALLBACK_DATA - - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions - - Introduce NanUndefined, NanNull, NanTrue and NanFalse - - Introduce NanEscapableScope and NanEscapeScope - - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) - - Introduce NanMakeCallback for node::MakeCallback - - Introduce NanSetTemplate - - Introduce NanGetCurrentContext - - Introduce NanCompileScript and NanRunScript - - Introduce NanAdjustExternalMemory - - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback - - Introduce NanGetHeapStatistics - - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() - -### 0.8.0 Jan 9 2014 - - - NanDispose -> NanDisposePersistent, deprecate NanDispose - - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() - -### 0.7.1 Jan 9 2014 - - - Fixes to work against debug builds of Node - - Safer NanPersistentToLocal (avoid reinterpret_cast) - - Speed up common NanRawString case by only extracting flattened string when necessary - -### 0.7.0 Dec 17 2013 - - - New no-arg form of NanCallback() constructor. - - NanCallback#Call takes Handle rather than Local - - Removed deprecated NanCallback#Run method, use NanCallback#Call instead - - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS - - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() - - Introduce NanRawString() for char* (or appropriate void*) from v8::String - (replacement for NanFromV8String) - - Introduce NanCString() for null-terminated char* from v8::String - -### 0.6.0 Nov 21 2013 - - - Introduce NanNewLocal(v8::Handle value) for use in place of - v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 - -### 0.5.2 Nov 16 2013 - - - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public - -### 0.5.1 Nov 12 2013 - - - Use node::MakeCallback() instead of direct v8::Function::Call() - -### 0.5.0 Nov 11 2013 - - - Added @TooTallNate as collaborator - - New, much simpler, "include_dirs" for binding.gyp - - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros - -### 0.4.4 Nov 2 2013 - - - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ - -### 0.4.3 Nov 2 2013 - - - Include node_object_wrap.h, removed from node.h for Node 0.11.8. - -### 0.4.2 Nov 2 2013 - - - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for - Node 0.11.8 release. - -### 0.4.1 Sep 16 2013 - - - Added explicit `#include ` as it was removed from node.h for v0.11.8 - -### 0.4.0 Sep 2 2013 - - - Added NAN_INLINE and NAN_DEPRECATED and made use of them - - Added NanError, NanTypeError and NanRangeError - - Cleaned up code - -### 0.3.2 Aug 30 2013 - - - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent - in NanAsyncWorker - -### 0.3.1 Aug 20 2013 - - - fix "not all control paths return a value" compile warning on some platforms - -### 0.3.0 Aug 19 2013 - - - Made NAN work with NPM - - Lots of fixes to NanFromV8String, pulling in features from new Node core - - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API - - Added optional error number argument for NanThrowError() - - Added NanInitPersistent() - - Added NanReturnNull() and NanReturnEmptyString() - - Added NanLocker and NanUnlocker - - Added missing scopes - - Made sure to clear disposed Persistent handles - - Changed NanAsyncWorker to allocate error messages on the heap - - Changed NanThrowError(Local) to NanThrowError(Handle) - - Fixed leak in NanAsyncWorker when errmsg is used - -### 0.2.2 Aug 5 2013 - - - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() - -### 0.2.1 Aug 5 2013 - - - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for - NanFromV8String() - -### 0.2.0 Aug 5 2013 - - - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, - NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY - - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, - _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, - _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, - _NAN_PROPERTY_QUERY_ARGS - - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer - - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, - NAN_WEAK_CALLBACK_DATA, NanMakeWeak - - Renamed THROW_ERROR to _NAN_THROW_ERROR - - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) - - Added NanBufferUse(char*, uint32_t) - - Added NanNewContextHandle(v8::ExtensionConfiguration*, - v8::Handle, v8::Handle) - - Fixed broken NanCallback#GetFunction() - - Added optional encoding and size arguments to NanFromV8String() - - Added NanGetPointerSafe() and NanSetPointerSafe() - - Added initial test suite (to be expanded) - - Allow NanUInt32OptionValue to convert any Number object - -### 0.1.0 Jul 21 2013 - - - Added `NAN_GETTER`, `NAN_SETTER` - - Added `NanThrowError` with single Local argument - - Added `NanNewBufferHandle` with single uint32_t argument - - Added `NanHasInstance(Persistent&, Handle)` - - Added `Local NanCallback#GetFunction()` - - Added `NanCallback#Call(int, Local[])` - - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/LICENSE.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/LICENSE.md deleted file mode 100644 index 6821891..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2014 NAN contributors ------------------------------------ - -*NAN contributors listed at * - -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 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/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/appveyor.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/appveyor.yml deleted file mode 100644 index 657eed6..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -# http://www.appveyor.com/docs/appveyor-yml - -# Test against these versions of Node.js. -environment: - matrix: - - nodejs_version: "0.8" - - nodejs_version: "0.10" - - nodejs_version: "0.11" - -# Install scripts. (runs after repo cloning) -install: - # Get the latest stable version of Node 0.STABLE.latest - - npm install npm - - move node_modules npm - - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) - # Typical npm stuff. - - npm/.bin/npm install - - npm/.bin/npm run rebuild-tests - -# Post-install test scripts. -test_script: - # Output useful info for debugging. - - node --version - - npm --version - - cmd: npm test - -# Don't actually build. -build: off - -# Set build version format here instead of in the admin panel. -version: "{build}" - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/build/config.gypi b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/build/config.gypi deleted file mode 100644 index d6280e7..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/build/config.gypi +++ /dev/null @@ -1,43 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "clang": 0, - "gcc_version": 48, - "host_arch": "x64", - "node_install_npm": "true", - "node_prefix": "/usr", - "node_shared_cares": "false", - "node_shared_http_parser": "false", - "node_shared_libuv": "false", - "node_shared_openssl": "false", - "node_shared_v8": "false", - "node_shared_zlib": "false", - "node_tag": "", - "node_use_dtrace": "false", - "node_use_etw": "false", - "node_use_mdb": "false", - "node_use_openssl": "true", - "node_use_perfctr": "false", - "python": "/usr/bin/python", - "target_arch": "x64", - "uv_library": "static_library", - "uv_parent_path": "/deps/uv/", - "uv_use_dtrace": "false", - "v8_enable_gdbjit": 0, - "v8_enable_i18n_support": 0, - "v8_no_strict_aliasing": 1, - "v8_optimized_debug": 0, - "v8_random_seed": 0, - "v8_use_snapshot": "false", - "nodedir": "/home/kkoopa/.node-gyp/0.11.13", - "copy_dev_lib": "true", - "standalone_static_library": 1 - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/include_dirs.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/include_dirs.js deleted file mode 100644 index 4f1dfb4..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/include_dirs.js +++ /dev/null @@ -1 +0,0 @@ -console.log(require('path').relative('.', __dirname)); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h deleted file mode 100644 index e490339..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h +++ /dev/null @@ -1,2412 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2014 NAN contributors: - * - Rod Vagg - * - Benjamin Byholm - * - Trevor Norris - * - Nathan Rajlich - * - Brett Lawson - * - Ben Noordhuis - * - * MIT License - * - * Version 1.4.1: current Node unstable: 0.11.14, Node stable: 0.10.33 - * - * See https://github.com/rvagg/nan for the latest update to this file - **********************************************************************************/ - -#ifndef NAN_H_ -#define NAN_H_ - -#include -#include -#include -#include -#include -#include -#include -#if defined(_MSC_VER) -# pragma warning( disable : 4530 ) -#endif -#include - -#if defined(__GNUC__) && !(defined(DEBUG) && DEBUG) -# define NAN_INLINE inline __attribute__((always_inline)) -#elif defined(_MSC_VER) && !(defined(DEBUG) && DEBUG) -# define NAN_INLINE __forceinline -#else -# define NAN_INLINE inline -#endif - -#if defined(__GNUC__) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __declspec(deprecated) -#else -# define NAN_DEPRECATED -#endif - -// some generic helpers - -template NAN_INLINE bool NanSetPointerSafe( - T *var - , T val -) { - if (var) { - *var = val; - return true; - } else { - return false; - } -} - -template NAN_INLINE T NanGetPointerSafe( - T *var - , T fallback = reinterpret_cast(0) -) { - if (var) { - return *var; - } else { - return fallback; - } -} - -NAN_INLINE bool NanBooleanOptionValue( - v8::Local optionsObj - , v8::Handle opt, bool def -) { - if (def) { - return optionsObj.IsEmpty() - || !optionsObj->Has(opt) - || optionsObj->Get(opt)->BooleanValue(); - } else { - return !optionsObj.IsEmpty() - && optionsObj->Has(opt) - && optionsObj->Get(opt)->BooleanValue(); - } -} - -NAN_INLINE bool NanBooleanOptionValue( - v8::Local optionsObj - , v8::Handle opt -) { - return NanBooleanOptionValue(optionsObj, opt, false); -} - -NAN_INLINE uint32_t NanUInt32OptionValue( - v8::Local optionsObj - , v8::Handle opt - , uint32_t def -) { - return !optionsObj.IsEmpty() - && optionsObj->Has(opt) - && optionsObj->Get(opt)->IsNumber() - ? optionsObj->Get(opt)->Uint32Value() - : def; -} - -template -v8::Local NanNew(v8::Handle); - -template -NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { - return NanNew(val); -} - -template -NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { - return val; -} - -#if (NODE_MODULE_VERSION > 0x000B) -// Node 0.11+ (0.11.3 and below won't compile with these) - -# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo& -# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args -# define _NAN_METHOD_RETURN_TYPE void - -# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& -# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args -# define _NAN_GETTER_RETURN_TYPE void - -# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& -# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args -# define _NAN_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args -# define _NAN_PROPERTY_GETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_SETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args -# define _NAN_PROPERTY_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args -# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE void - -# define _NAN_PROPERTY_DELETER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_DELETER_ARGS \ - _NAN_PROPERTY_DELETER_ARGS_TYPE args -# define _NAN_PROPERTY_DELETER_RETURN_TYPE void - -# define _NAN_PROPERTY_QUERY_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args -# define _NAN_PROPERTY_QUERY_RETURN_TYPE void - -# define _NAN_INDEX_GETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args -# define _NAN_INDEX_GETTER_RETURN_TYPE void - -# define _NAN_INDEX_SETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args -# define _NAN_INDEX_SETTER_RETURN_TYPE void - -# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args -# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE void - -# define _NAN_INDEX_DELETER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args -# define _NAN_INDEX_DELETER_RETURN_TYPE void - -# define _NAN_INDEX_QUERY_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args -# define _NAN_INDEX_QUERY_RETURN_TYPE void - - typedef v8::FunctionCallback NanFunctionCallback; - - template - NAN_INLINE v8::Local NanNew() { - return T::New(v8::Isolate::GetCurrent()); - } - - template - NAN_INLINE v8::Local NanNew(P arg1) { - return T::New(v8::Isolate::GetCurrent(), arg1); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle receiver - , int argc - , v8::Handle argv[] = 0) { - return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); - } - - template - NAN_INLINE v8::Local NanNew( - NanFunctionCallback callback - , v8::Handle data = v8::Handle() - , v8::Handle signature = v8::Handle()) { - return T::New(v8::Isolate::GetCurrent(), callback, data, signature); - } - - template - NAN_INLINE v8::Local NanNew(v8::Handle arg1) { - return v8::Local::New(v8::Isolate::GetCurrent(), arg1); - } - - template - NAN_INLINE v8::Local NanNew(const v8::Persistent &arg1) { - return v8::Local::New(v8::Isolate::GetCurrent(), arg1); - } - - template - NAN_INLINE v8::Local NanNew(P arg1, int arg2) { - return T::New(v8::Isolate::GetCurrent(), arg1, arg2); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::Array::New(v8::Isolate::GetCurrent()); - } - - template<> - NAN_INLINE v8::Local NanNew(int length) { - return v8::Array::New(v8::Isolate::GetCurrent(), length); - } - - template<> - NAN_INLINE v8::Local NanNew(double time) { - return v8::Date::New(v8::Isolate::GetCurrent(), time).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(int time) { - return v8::Date::New(v8::Isolate::GetCurrent(), time).As(); - } - - typedef v8::UnboundScript NanUnboundScript; - typedef v8::Script NanBoundScript; - - template - NAN_INLINE v8::Local NanNew( - P s - , const v8::ScriptOrigin& origin - ) { - v8::ScriptCompiler::Source source(s, origin); - return v8::ScriptCompiler::CompileUnbound( - v8::Isolate::GetCurrent(), &source); - } - - template<> - NAN_INLINE v8::Local NanNew( - v8::Local s - ) { - v8::ScriptCompiler::Source source(s); - return v8::ScriptCompiler::CompileUnbound( - v8::Isolate::GetCurrent(), &source); - } - - template<> - NAN_INLINE v8::Local NanNew(bool value) { - return v8::BooleanObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Local value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Handle value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(double val) { - return v8::NumberObject::New( - v8::Isolate::GetCurrent(), val).As(); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Uint32::NewFromUnsigned( - v8::Isolate::GetCurrent(), val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Uint32::NewFromUnsigned( - v8::Isolate::GetCurrent(), val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Integer::NewFromUnsigned(v8::Isolate::GetCurrent(), val); - } - - template<> - NAN_INLINE v8::Local NanNew( - char *arg - , int length) { - return v8::String::NewFromUtf8( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew( - const char *arg - , int length) { - return v8::String::NewFromUtf8( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew(char *arg) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - const char *arg) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - uint8_t *arg - , int length) { - return v8::String::NewFromOneByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg - , int length) { - return v8::String::NewFromOneByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew(uint8_t *arg) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - uint16_t *arg - , int length) { - return v8::String::NewFromTwoByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint16_t *arg - , int length) { - return v8::String::NewFromTwoByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - template<> - NAN_INLINE v8::Local NanNew( - uint16_t *arg) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint16_t *arg) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - std::string arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::String::Empty(v8::Isolate::GetCurrent()); - } - - NAN_INLINE v8::Local NanNew(const char* arg, int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint8_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint16_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const std::string& arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - NAN_INLINE v8::Local NanNew(double val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(unsigned int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(bool val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalStringResource *resource) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), resource); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalAsciiStringResource *resource) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), resource); - } - -# define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent()) -# define NanEscapableScope() \ - v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()) - -# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) -# define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent()) -# define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent()) -# define NanReturnValue(value) return args.GetReturnValue().Set(value) -# define NanReturnUndefined() return -# define NanReturnHolder() NanReturnValue(args.Holder()) -# define NanReturnThis() NanReturnValue(args.This()) -# define NanReturnNull() return args.GetReturnValue().SetNull() -# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString() - -# define NanObjectWrapHandle(obj) obj->handle() - - NAN_INLINE v8::Local NanUndefined() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE v8::Local NanNull() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE v8::Local NanTrue() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE v8::Local NanFalse() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE int NanAdjustExternalMemory(int bc) { - return static_cast( - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , const char *name - , v8::Handle value) { - templ->Set(v8::Isolate::GetCurrent(), name, value); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - NAN_INLINE v8::Local NanGetCurrentContext() { - return v8::Isolate::GetCurrent()->GetCurrentContext(); - } - - NAN_INLINE void* NanGetInternalFieldPointer( - v8::Handle object - , int index) { - return object->GetAlignedPointerFromInternalField(index); - } - - NAN_INLINE void NanSetInternalFieldPointer( - v8::Handle object - , int index - , void* value) { - object->SetAlignedPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) - - NAN_INLINE void NanAddGCEpilogueCallback( - v8::Isolate::GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); - } - - NAN_INLINE void NanRemoveGCEpilogueCallback( - v8::Isolate::GCEpilogueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); - } - - NAN_INLINE void NanAddGCPrologueCallback( - v8::Isolate::GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); - } - - NAN_INLINE void NanRemoveGCPrologueCallback( - v8::Isolate::GCPrologueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); - } - - NAN_INLINE void NanGetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); - } - - NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( - const char* data, int length = -1) { - return NanNew(data, length); - } - - template - NAN_INLINE void NanAssignPersistent( - v8::Persistent& handle - , v8::Handle obj) { - handle.Reset(v8::Isolate::GetCurrent(), obj); - } - - template - NAN_INLINE void NanAssignPersistent( - v8::Persistent& handle - , const v8::Persistent& obj) { - handle.Reset(v8::Isolate::GetCurrent(), obj); - } - - template - class _NanWeakCallbackData; - - template - struct _NanWeakCallbackInfo { - typedef void (*Callback)(const _NanWeakCallbackData& data); - NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) - : parameter(param), callback(cb) { - NanAssignPersistent(persistent, handle); - } - - NAN_INLINE ~_NanWeakCallbackInfo() { - persistent.Reset(); - } - - P* const parameter; - Callback const callback; - v8::Persistent persistent; - }; - - template - class _NanWeakCallbackData { - public: - NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) - : info_(info) { } - - NAN_INLINE v8::Local GetValue() const { - return NanNew(info_->persistent); - } - - NAN_INLINE P* GetParameter() const { return info_->parameter; } - - NAN_INLINE bool IsNearDeath() const { - return info_->persistent.IsNearDeath(); - } - - NAN_INLINE void Revive() const; - - NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { - return info_; - } - - NAN_DEPRECATED NAN_INLINE void Dispose() const { - } - - private: - _NanWeakCallbackInfo* info_; - }; - - template - static void _NanWeakCallbackDispatcher( - const v8::WeakCallbackData > &data) { - _NanWeakCallbackInfo *info = data.GetParameter(); - _NanWeakCallbackData wcbd(info); - info->callback(wcbd); - if (wcbd.IsNearDeath()) { - delete wcbd.GetCallbackInfo(); - } - } - - template - NAN_INLINE void _NanWeakCallbackData::Revive() const { - info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher); - } - -template -NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( - v8::Handle handle - , P* parameter - , typename _NanWeakCallbackInfo::Callback callback) { - _NanWeakCallbackInfo *cbinfo = - new _NanWeakCallbackInfo(handle, parameter, callback); - cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher); - return cbinfo; -} - -# define NAN_WEAK_CALLBACK(name) \ - template \ - static void name(const _NanWeakCallbackData &data) - -# define _NAN_ERROR(fun, errmsg) fun(NanNew(errmsg)) - -# define _NAN_THROW_ERROR(fun, errmsg) \ - do { \ - NanScope(); \ - v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg)); \ - } while (0); - - NAN_INLINE v8::Local NanError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE void NanThrowError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE void NanThrowError(v8::Handle error) { - NanScope(); - v8::Isolate::GetCurrent()->ThrowException(error); - } - - NAN_INLINE v8::Local NanError( - const char *msg - , const int errorNumber - ) { - v8::Local err = v8::Exception::Error(NanNew(msg)); - v8::Local obj = err.As(); - obj->Set(NanNew("code"), NanNew(errorNumber)); - return err; - } - - NAN_INLINE void NanThrowError( - const char *msg - , const int errorNumber - ) { - NanThrowError(NanError(msg, errorNumber)); - } - - NAN_INLINE v8::Local NanTypeError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE void NanThrowTypeError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE v8::Local NanRangeError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::RangeError, errmsg); - } - - NAN_INLINE void NanThrowRangeError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); - } - - template NAN_INLINE void NanDisposePersistent( - v8::Persistent &handle - ) { - handle.Reset(); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - char *data - , size_t length - , node::smalloc::FreeCallback callback - , void *hint - ) { - return node::Buffer::New( - v8::Isolate::GetCurrent(), data, length, callback, hint); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - const char *data - , uint32_t size - ) { - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); - } - - NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { - return node::Buffer::New(v8::Isolate::GetCurrent(), size); - } - - NAN_INLINE v8::Local NanBufferUse( - char* data - , uint32_t size - ) { - return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); - } - - NAN_INLINE bool NanHasInstance( - const v8::Persistent& function_template - , v8::Handle value - ) { - return NanNew(function_template)->HasInstance(value); - } - - NAN_INLINE v8::Local NanNewContextHandle( - v8::ExtensionConfiguration* extensions = NULL - , v8::Handle tmpl = v8::Handle() - , v8::Handle obj = v8::Handle() - ) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return v8::Local::New( - isolate - , v8::Context::New(isolate, extensions, tmpl, obj) - ); - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::ScriptCompiler::Source source(s, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - ) { - v8::ScriptCompiler::Source source(s); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - NAN_INLINE v8::Local NanRunScript( - v8::Handle script - ) { - return script->BindToCurrentContext()->Run(); - } - - NAN_INLINE v8::Local NanRunScript( - v8::Handle script - ) { - return script->Run(); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle func - , int argc - , v8::Handle* argv) { - return NanNew(node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv)); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle symbol - , int argc - , v8::Handle* argv) { - return NanNew(node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv)); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , const char* method - , int argc - , v8::Handle* argv) { - return NanNew(node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv)); - } - - template - NAN_INLINE void NanSetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(0, data); - } - - template - NAN_INLINE T *NanGetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData(0)); - } - - class NanAsciiString { - public: - NAN_INLINE explicit NanAsciiString(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new char[size + 1]; - size = toStr->WriteOneByte(reinterpret_cast(buf)); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanAsciiString() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanAsciiString(const NanAsciiString&); - void operator=(const NanAsciiString&); - - char *buf; - int size; - }; - - class NanUtf8String { - public: - NAN_INLINE explicit NanUtf8String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Utf8Length(); - buf = new char[size + 1]; - toStr->WriteUtf8(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanUtf8String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUtf8String(const NanUtf8String&); - void operator=(const NanUtf8String&); - - char *buf; - int size; - }; - - class NanUcs2String { - public: - NAN_INLINE explicit NanUcs2String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new uint16_t[size + 1]; - toStr->Write(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE uint16_t* operator*() { return buf; } - NAN_INLINE const uint16_t* operator*() const { return buf; } - - NAN_INLINE ~NanUcs2String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUcs2String(const NanUcs2String&); - void operator=(const NanUcs2String&); - - uint16_t *buf; - int size; - }; - -#else -// Node 0.8 and 0.10 - -# define _NAN_METHOD_ARGS_TYPE const v8::Arguments& -# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args -# define _NAN_METHOD_RETURN_TYPE v8::Handle - -# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & -# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args -# define _NAN_GETTER_RETURN_TYPE v8::Handle - -# define _NAN_SETTER_ARGS_TYPE const v8::AccessorInfo & -# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args -# define _NAN_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_GETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args -# define _NAN_PROPERTY_GETTER_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_SETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args -# define _NAN_PROPERTY_SETTER_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args -# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_DELETER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_DELETER_ARGS _NAN_PROPERTY_DELETER_ARGS_TYPE args -# define _NAN_PROPERTY_DELETER_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_QUERY_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args -# define _NAN_PROPERTY_QUERY_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_GETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args -# define _NAN_INDEX_GETTER_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_SETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args -# define _NAN_INDEX_SETTER_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args -# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_DELETER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args -# define _NAN_INDEX_DELETER_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_QUERY_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args -# define _NAN_INDEX_QUERY_RETURN_TYPE v8::Handle - - typedef v8::InvocationCallback NanFunctionCallback; - - NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( - const char* data, int length = -1) { - return v8::String::NewSymbol(data, length); - } - - template - NAN_INLINE v8::Local NanNew() { - return T::New(); - } - - template - NAN_INLINE v8::Local NanNew(v8::Handle arg) { - return v8::Local::New(arg); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle receiver - , int argc - , v8::Handle argv[] = 0) { - return v8::Signature::New(receiver, argc, argv); - } - - template - NAN_INLINE v8::Local NanNew( - NanFunctionCallback callback - , v8::Handle data = v8::Handle() - , v8::Handle signature = v8::Handle()) { - return T::New(callback, data, signature); - } - - template - NAN_INLINE v8::Local NanNew(const v8::Persistent &arg) { - return v8::Local::New(arg); - } - - template - NAN_INLINE v8::Local NanNew(P arg) { - return _NanEnsureLocal(T::New(arg)); - } - - template - NAN_INLINE v8::Local NanNew(P arg, int length) { - return _NanEnsureLocal(T::New(arg, length)); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::Array::New(); - } - - template<> - NAN_INLINE v8::Local NanNew(int length) { - return v8::Array::New(length); - } - - template<> - NAN_INLINE v8::Local NanNew(double time) { - return v8::Date::New(time).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(int time) { - return v8::Date::New(time).As(); - } - - typedef v8::Script NanUnboundScript; - typedef v8::Script NanBoundScript; - - template - NAN_INLINE v8::Local NanNew( - P s - , const v8::ScriptOrigin& origin - ) { - return v8::Script::New(s, const_cast(&origin)); - } - - template<> - NAN_INLINE v8::Local NanNew( - v8::Local s - ) { - return v8::Script::New(s); - } - - template<> - NAN_INLINE v8::Local NanNew(bool value) { - return v8::BooleanObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Local value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Handle value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(double val) { - return v8::NumberObject::New(val).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Uint32::NewFromUnsigned(val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Uint32::NewFromUnsigned(val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Int32::New(val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Int32::New(val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Integer::NewFromUnsigned(val); - } - - template<> - NAN_INLINE v8::Local NanNew( - uint8_t *arg - , int length) { - int len = length; - if (len < 0) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - len = static_cast(temp); - } - uint16_t *warg = new uint16_t[len]; - for (int i = 0; i < len; i++) { - warg[i] = arg[i]; - } - v8::Local retval = v8::String::New(warg, len); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg - , int length) { - int len = length; - if (len < 0) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - len = static_cast(temp); - } - uint16_t *warg = new uint16_t[len]; - for (int i = 0; i < len; i++) { - warg[i] = arg[i]; - } - v8::Local retval = v8::String::New(warg, len); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew(uint8_t *arg) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - int length = static_cast(temp); - uint16_t *warg = new uint16_t[length]; - for (int i = 0; i < length; i++) { - warg[i] = arg[i]; - } - - v8::Local retval = v8::String::New(warg, length); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - int length = static_cast(temp); - uint16_t *warg = new uint16_t[length]; - for (int i = 0; i < length; i++) { - warg[i] = arg[i]; - } - v8::Local retval = v8::String::New(warg, length); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew( - std::string arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::String::Empty(); - } - - NAN_INLINE v8::Local NanNew(const char* arg, int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint8_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint16_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const std::string& arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - NAN_INLINE v8::Local NanNew(double val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(unsigned int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(bool val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalStringResource *resource) { - return v8::String::NewExternal(resource); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalAsciiStringResource *resource) { - return v8::String::NewExternal(resource); - } - -# define NanScope() v8::HandleScope scope -# define NanEscapableScope() v8::HandleScope scope -# define NanEscapeScope(val) scope.Close(val) -# define NanLocker() v8::Locker locker -# define NanUnlocker() v8::Unlocker unlocker -# define NanReturnValue(value) return scope.Close(value) -# define NanReturnHolder() NanReturnValue(args.Holder()) -# define NanReturnThis() NanReturnValue(args.This()) -# define NanReturnUndefined() return v8::Undefined() -# define NanReturnNull() return v8::Null() -# define NanReturnEmptyString() return v8::String::Empty() -# define NanObjectWrapHandle(obj) v8::Local::New(obj->handle_) - - NAN_INLINE v8::Local NanUndefined() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Undefined())); - } - - NAN_INLINE v8::Local NanNull() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Null())); - } - - NAN_INLINE v8::Local NanTrue() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::True())); - } - - NAN_INLINE v8::Local NanFalse() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::False())); - } - - NAN_INLINE int NanAdjustExternalMemory(int bc) { - return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , const char *name - , v8::Handle value) { - templ->Set(name, value); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - NAN_INLINE v8::Local NanGetCurrentContext() { - return v8::Context::GetCurrent(); - } - - NAN_INLINE void* NanGetInternalFieldPointer( - v8::Handle object - , int index) { - return object->GetPointerFromInternalField(index); - } - - NAN_INLINE void NanSetInternalFieldPointer( - v8::Handle object - , int index - , void* value) { - object->SetPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::GCType type, v8::GCCallbackFlags flags) - - NAN_INLINE void NanAddGCEpilogueCallback( - v8::GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCEpilogueCallback(callback, gc_type_filter); - } - NAN_INLINE void NanRemoveGCEpilogueCallback( - v8::GCEpilogueCallback callback) { - v8::V8::RemoveGCEpilogueCallback(callback); - } - NAN_INLINE void NanAddGCPrologueCallback( - v8::GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCPrologueCallback(callback, gc_type_filter); - } - NAN_INLINE void NanRemoveGCPrologueCallback( - v8::GCPrologueCallback callback) { - v8::V8::RemoveGCPrologueCallback(callback); - } - NAN_INLINE void NanGetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::V8::GetHeapStatistics(heap_statistics); - } - - template - NAN_INLINE void NanAssignPersistent( - v8::Persistent& handle - , v8::Handle obj) { - handle.Dispose(); - handle = v8::Persistent::New(obj); - } - - template - class _NanWeakCallbackData; - - template - struct _NanWeakCallbackInfo { - typedef void (*Callback)(const _NanWeakCallbackData &data); - NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) - : parameter(param) - , callback(cb) - , persistent(v8::Persistent::New(handle)) { } - - NAN_INLINE ~_NanWeakCallbackInfo() { - persistent.Dispose(); - persistent.Clear(); - } - - P* const parameter; - Callback const callback; - v8::Persistent persistent; - }; - - template - class _NanWeakCallbackData { - public: - NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) - : info_(info) { } - - NAN_INLINE v8::Local GetValue() const { - return NanNew(info_->persistent); - } - - NAN_INLINE P* GetParameter() const { return info_->parameter; } - - NAN_INLINE bool IsNearDeath() const { - return info_->persistent.IsNearDeath(); - } - - NAN_INLINE void Revive() const; - - NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { - return info_; - } - - NAN_DEPRECATED NAN_INLINE void Dispose() const { - } - - private: - _NanWeakCallbackInfo* info_; - }; - - template - static void _NanWeakPersistentDispatcher( - v8::Persistent object, void *data) { - _NanWeakCallbackInfo* info = - static_cast<_NanWeakCallbackInfo*>(data); - _NanWeakCallbackData wcbd(info); - info->callback(wcbd); - if (wcbd.IsNearDeath()) { - delete wcbd.GetCallbackInfo(); - } - } - - template - NAN_INLINE void _NanWeakCallbackData::Revive() const { - info_->persistent.MakeWeak( - info_ - , &_NanWeakPersistentDispatcher); - } - - template - NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( - v8::Handle handle - , P* parameter - , typename _NanWeakCallbackInfo::Callback callback) { - _NanWeakCallbackInfo *cbinfo = - new _NanWeakCallbackInfo(handle, parameter, callback); - cbinfo->persistent.MakeWeak( - cbinfo - , &_NanWeakPersistentDispatcher); - return cbinfo; - } - -# define NAN_WEAK_CALLBACK(name) \ - template \ - static void name(const _NanWeakCallbackData &data) - -# define _NAN_ERROR(fun, errmsg) \ - fun(v8::String::New(errmsg)) - -# define _NAN_THROW_ERROR(fun, errmsg) \ - do { \ - NanScope(); \ - return v8::Local::New( \ - v8::ThrowException(_NAN_ERROR(fun, errmsg))); \ - } while (0); - - NAN_INLINE v8::Local NanError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE v8::Local NanThrowError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE v8::Local NanThrowError( - v8::Handle error - ) { - NanScope(); - return v8::Local::New(v8::ThrowException(error)); - } - - NAN_INLINE v8::Local NanError( - const char *msg - , const int errorNumber - ) { - v8::Local err = v8::Exception::Error(v8::String::New(msg)); - v8::Local obj = err.As(); - obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); - return err; - } - - NAN_INLINE v8::Local NanThrowError( - const char *msg - , const int errorNumber - ) { - return NanThrowError(NanError(msg, errorNumber)); - } - - NAN_INLINE v8::Local NanTypeError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE v8::Local NanThrowTypeError( - const char* errmsg - ) { - _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE v8::Local NanRangeError( - const char* errmsg - ) { - return _NAN_ERROR(v8::Exception::RangeError, errmsg); - } - - NAN_INLINE v8::Local NanThrowRangeError( - const char* errmsg - ) { - _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); - } - - template - NAN_INLINE void NanDisposePersistent( - v8::Persistent &handle) { // NOLINT(runtime/references) - handle.Dispose(); - handle.Clear(); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - char *data - , size_t length - , node::Buffer::free_callback callback - , void *hint - ) { - return NanNew( - node::Buffer::New(data, length, callback, hint)->handle_); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - const char *data - , uint32_t size - ) { -#if NODE_MODULE_VERSION >= 0x000B - return NanNew(node::Buffer::New(data, size)->handle_); -#else - return NanNew( - node::Buffer::New(const_cast(data), size)->handle_); -#endif - } - - NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { - return NanNew(node::Buffer::New(size)->handle_); - } - - NAN_INLINE void FreeData(char *data, void *hint) { - delete[] data; - } - - NAN_INLINE v8::Local NanBufferUse( - char* data - , uint32_t size - ) { - return NanNew( - node::Buffer::New(data, size, FreeData, NULL)->handle_); - } - - NAN_INLINE bool NanHasInstance( - const v8::Persistent& function_template - , v8::Handle value - ) { - return function_template->HasInstance(value); - } - - NAN_INLINE v8::Local NanNewContextHandle( - v8::ExtensionConfiguration* extensions = NULL - , v8::Handle tmpl = v8::Handle() - , v8::Handle obj = v8::Handle() - ) { - v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); - v8::Local lctx = NanNew(ctx); - ctx.Dispose(); - return lctx; - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - return v8::Script::Compile(s, const_cast(&origin)); - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - ) { - return v8::Script::Compile(s); - } - - NAN_INLINE v8::Local NanRunScript(v8::Handle script) { - return script->Run(); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle func - , int argc - , v8::Handle* argv) { -# if NODE_VERSION_AT_LEAST(0, 8, 0) - return NanNew(node::MakeCallback(target, func, argc, argv)); -# else - v8::TryCatch try_catch; - v8::Local result = func->Call(target, argc, argv); - if (try_catch.HasCaught()) { - node::FatalException(try_catch); - } - return result; -# endif - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle symbol - , int argc - , v8::Handle* argv) { -# if NODE_VERSION_AT_LEAST(0, 8, 0) - return NanNew(node::MakeCallback(target, symbol, argc, argv)); -# else - v8::Local callback = target->Get(symbol).As(); - return NanMakeCallback(target, callback, argc, argv); -# endif - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , const char* method - , int argc - , v8::Handle* argv) { -# if NODE_VERSION_AT_LEAST(0, 8, 0) - return NanNew(node::MakeCallback(target, method, argc, argv)); -# else - return NanMakeCallback(target, NanNew(method), argc, argv); -# endif - } - - template - NAN_INLINE void NanSetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(data); - } - - template - NAN_INLINE T *NanGetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData()); - } - - class NanAsciiString { - public: - NAN_INLINE explicit NanAsciiString(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new char[size + 1]; - size = toStr->WriteAscii(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanAsciiString() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanAsciiString(const NanAsciiString&); - void operator=(const NanAsciiString&); - - char *buf; - int size; - }; - - class NanUtf8String { - public: - NAN_INLINE explicit NanUtf8String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Utf8Length(); - buf = new char[size + 1]; - toStr->WriteUtf8(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanUtf8String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUtf8String(const NanUtf8String&); - void operator=(const NanUtf8String&); - - char *buf; - int size; - }; - - class NanUcs2String { - public: - NAN_INLINE explicit NanUcs2String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new uint16_t[size + 1]; - toStr->Write(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE uint16_t* operator*() { return buf; } - NAN_INLINE const uint16_t* operator*() const { return buf; } - - NAN_INLINE ~NanUcs2String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUcs2String(const NanUcs2String&); - void operator=(const NanUcs2String&); - - uint16_t *buf; - int size; - }; - -#endif // NODE_MODULE_VERSION - -typedef void (*NanFreeCallback)(char *data, void *hint); - -#define NAN_METHOD(name) _NAN_METHOD_RETURN_TYPE name(_NAN_METHOD_ARGS) -#define NAN_GETTER(name) \ - _NAN_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_GETTER_ARGS) -#define NAN_SETTER(name) \ - _NAN_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , _NAN_SETTER_ARGS) -#define NAN_PROPERTY_GETTER(name) \ - _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_PROPERTY_GETTER_ARGS) -#define NAN_PROPERTY_SETTER(name) \ - _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , _NAN_PROPERTY_SETTER_ARGS) -#define NAN_PROPERTY_ENUMERATOR(name) \ - _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name(_NAN_PROPERTY_ENUMERATOR_ARGS) -#define NAN_PROPERTY_DELETER(name) \ - _NAN_PROPERTY_DELETER_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_PROPERTY_DELETER_ARGS) -#define NAN_PROPERTY_QUERY(name) \ - _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_PROPERTY_QUERY_ARGS) -# define NAN_INDEX_GETTER(name) \ - _NAN_INDEX_GETTER_RETURN_TYPE name(uint32_t index, _NAN_INDEX_GETTER_ARGS) -#define NAN_INDEX_SETTER(name) \ - _NAN_INDEX_SETTER_RETURN_TYPE name( \ - uint32_t index \ - , v8::Local value \ - , _NAN_INDEX_SETTER_ARGS) -#define NAN_INDEX_ENUMERATOR(name) \ - _NAN_INDEX_ENUMERATOR_RETURN_TYPE name(_NAN_INDEX_ENUMERATOR_ARGS) -#define NAN_INDEX_DELETER(name) \ - _NAN_INDEX_DELETER_RETURN_TYPE name( \ - uint32_t index \ - , _NAN_INDEX_DELETER_ARGS) -#define NAN_INDEX_QUERY(name) \ - _NAN_INDEX_QUERY_RETURN_TYPE name(uint32_t index, _NAN_INDEX_QUERY_ARGS) - -class NanCallback { - public: - NanCallback() { - NanScope(); - v8::Local obj = NanNew(); - NanAssignPersistent(handle, obj); - } - - explicit NanCallback(const v8::Handle &fn) { - NanScope(); - v8::Local obj = NanNew(); - NanAssignPersistent(handle, obj); - SetFunction(fn); - } - - ~NanCallback() { - if (handle.IsEmpty()) return; - NanDisposePersistent(handle); - } - - NAN_INLINE void SetFunction(const v8::Handle &fn) { - NanScope(); - NanNew(handle)->Set(kCallbackIndex, fn); - } - - NAN_INLINE v8::Local GetFunction() const { - NanEscapableScope(); - return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) - .As()); - } - - NAN_INLINE bool IsEmpty() const { - NanScope(); - return NanNew(handle)->Get(kCallbackIndex)->IsUndefined(); - } - - v8::Handle Call(int argc, v8::Handle argv[]) const { - NanEscapableScope(); -#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+ - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::Local callback = NanNew(handle)-> - Get(kCallbackIndex).As(); - return NanEscapeScope(node::MakeCallback( - isolate - , isolate->GetCurrentContext()->Global() - , callback - , argc - , argv - )); -#else -#if NODE_VERSION_AT_LEAST(0, 8, 0) - v8::Local callback = handle-> - Get(kCallbackIndex).As(); - return NanEscapeScope(node::MakeCallback( - v8::Context::GetCurrent()->Global() - , callback - , argc - , argv - )); -#else - v8::Local callback = handle-> - Get(kCallbackIndex).As(); - return NanEscapeScope(NanMakeCallback( - v8::Context::GetCurrent()->Global(), callback, argc, argv)); -#endif -#endif - } - - private: - v8::Persistent handle; - static const uint32_t kCallbackIndex = 0; -}; - -/* abstract */ class NanAsyncWorker { - public: - explicit NanAsyncWorker(NanCallback *callback_) - : callback(callback_), errmsg_(NULL) { - request.data = this; - - NanScope(); - v8::Local obj = NanNew(); - NanAssignPersistent(persistentHandle, obj); - } - - virtual ~NanAsyncWorker() { - NanScope(); - - if (!persistentHandle.IsEmpty()) - NanDisposePersistent(persistentHandle); - if (callback) - delete callback; - if (errmsg_) - delete[] errmsg_; - } - - virtual void WorkComplete() { - NanScope(); - - if (errmsg_ == NULL) - HandleOKCallback(); - else - HandleErrorCallback(); - delete callback; - callback = NULL; - } - - NAN_INLINE void SaveToPersistent( - const char *key, const v8::Local &obj) { - v8::Local handle = NanNew(persistentHandle); - handle->Set(NanNew(key), obj); - } - - v8::Local GetFromPersistent(const char *key) const { - NanEscapableScope(); - v8::Local handle = NanNew(persistentHandle); - return NanEscapeScope(handle->Get(NanNew(key)).As()); - } - - virtual void Execute() = 0; - - uv_work_t request; - - protected: - v8::Persistent persistentHandle; - NanCallback *callback; - - virtual void HandleOKCallback() { - callback->Call(0, NULL); - } - - virtual void HandleErrorCallback() { - NanScope(); - - v8::Local argv[] = { - v8::Exception::Error(NanNew(ErrorMessage())) - }; - callback->Call(1, argv); - } - - void SetErrorMessage(const char *msg) { - if (errmsg_) { - delete[] errmsg_; - } - - size_t size = strlen(msg) + 1; - errmsg_ = new char[size]; - memcpy(errmsg_, msg, size); - } - - const char* ErrorMessage() const { - return errmsg_; - } - - private: - char *errmsg_; -}; - -NAN_INLINE void NanAsyncExecute (uv_work_t* req) { - NanAsyncWorker *worker = static_cast(req->data); - worker->Execute(); -} - -NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) { - NanAsyncWorker* worker = static_cast(req->data); - worker->WorkComplete(); - delete worker; -} - -NAN_INLINE void NanAsyncQueueWorker (NanAsyncWorker* worker) { - uv_queue_work( - uv_default_loop() - , &worker->request - , NanAsyncExecute - , (uv_after_work_cb)NanAsyncExecuteComplete - ); -} - -//// Base 64 //// - -#define _nan_base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) - -// Doesn't check for padding at the end. Can be 1-2 bytes over. -NAN_INLINE size_t _nan_base64_decoded_size_fast(size_t size) { - size_t remainder = size % 4; - - size = (size / 4) * 3; - if (remainder) { - if (size == 0 && remainder == 1) { - // special case: 1-byte input cannot be decoded - size = 0; - } else { - // non-padded input, add 1 or 2 extra bytes - size += 1 + (remainder == 3); - } - } - - return size; -} - -template -NAN_INLINE size_t _nan_base64_decoded_size( - const T* src - , size_t size -) { - if (size == 0) - return 0; - - if (src[size - 1] == '=') - size--; - if (size > 0 && src[size - 1] == '=') - size--; - - return _nan_base64_decoded_size_fast(size); -} - -// supports regular and URL-safe base64 -static const int _nan_unbase64_table[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63 - , 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1 - , -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 - , 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63 - , -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 - , 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 -}; - -#define _nan_unbase64(x) _nan_unbase64_table[(uint8_t)(x)] - -template static size_t _nan_base64_decode( - char* buf - , size_t len - , const T* src - , const size_t srcLen -) { - char* dst = buf; - char* dstEnd = buf + len; - const T* srcEnd = src + srcLen; - - while (src < srcEnd && dst < dstEnd) { - ptrdiff_t remaining = srcEnd - src; - char a, b, c, d; - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining == 0 || *src == '=') break; - a = _nan_unbase64(*src++); - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining <= 1 || *src == '=') break; - b = _nan_unbase64(*src++); - - *dst++ = (a << 2) | ((b & 0x30) >> 4); - if (dst == dstEnd) break; - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining <= 2 || *src == '=') break; - c = _nan_unbase64(*src++); - - *dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2); - if (dst == dstEnd) break; - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining <= 3 || *src == '=') break; - d = _nan_unbase64(*src++); - - *dst++ = ((c & 0x03) << 6) | (d & 0x3F); - } - - return dst - buf; -} - -//// HEX //// - -template unsigned _nan_hex2bin(T c) { - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'A' && c <= 'F') return 10 + (c - 'A'); - if (c >= 'a' && c <= 'f') return 10 + (c - 'a'); - return static_cast(-1); -} - -template static size_t _nan_hex_decode( - char* buf - , size_t len - , const T* src - , const size_t srcLen -) { - size_t i; - for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) { - unsigned a = _nan_hex2bin(src[i * 2 + 0]); - unsigned b = _nan_hex2bin(src[i * 2 + 1]); - if (!~a || !~b) return i; - buf[i] = a * 16 + b; - } - - return i; -} - -static bool _NanGetExternalParts( - v8::Handle val - , const char** data - , size_t* len -) { - if (node::Buffer::HasInstance(val)) { - *data = node::Buffer::Data(val.As()); - *len = node::Buffer::Length(val.As()); - return true; - } - - assert(val->IsString()); - v8::Local str = NanNew(val.As()); - - if (str->IsExternalAscii()) { - const v8::String::ExternalAsciiStringResource* ext; - ext = str->GetExternalAsciiStringResource(); - *data = ext->data(); - *len = ext->length(); - return true; - - } else if (str->IsExternal()) { - const v8::String::ExternalStringResource* ext; - ext = str->GetExternalStringResource(); - *data = reinterpret_cast(ext->data()); - *len = ext->length(); - return true; - } - - return false; -} - -namespace Nan { - enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; -} - -/* NAN_DEPRECATED */ NAN_INLINE void* _NanRawString( - v8::Handle from - , enum Nan::Encoding encoding - , size_t *datalen - , void *buf - , size_t buflen - , int flags -) { - NanScope(); - - size_t sz_; - size_t term_len = !(flags & v8::String::NO_NULL_TERMINATION); - char *data = NULL; - size_t len; - bool is_extern = _NanGetExternalParts( - from - , const_cast(&data) - , &len); - - if (is_extern && !term_len) { - NanSetPointerSafe(datalen, len); - return data; - } - - v8::Local toStr = from->ToString(); - - char *to = static_cast(buf); - - switch (encoding) { - case Nan::ASCII: -#if NODE_MODULE_VERSION < 0x000C - sz_ = toStr->Length(); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len && "too small buffer"); - } - NanSetPointerSafe( - datalen - , toStr->WriteAscii(to, 0, static_cast(sz_ + term_len), flags)); - return to; -#endif - case Nan::BINARY: - case Nan::BUFFER: - sz_ = toStr->Length(); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len && "too small buffer"); - } -#if NODE_MODULE_VERSION < 0x000C - { - uint16_t* twobytebuf = new uint16_t[sz_ + term_len]; - - size_t somelen = toStr->Write(twobytebuf, 0, - static_cast(sz_ + term_len), flags); - - for (size_t i = 0; i < sz_ + term_len && i < somelen + term_len; i++) { - unsigned char *b = reinterpret_cast(&twobytebuf[i]); - to[i] = *b; - } - - NanSetPointerSafe(datalen, somelen); - - delete[] twobytebuf; - return to; - } -#else - NanSetPointerSafe( - datalen, - toStr->WriteOneByte( - reinterpret_cast(to) - , 0 - , static_cast(sz_ + term_len) - , flags)); - return to; -#endif - case Nan::UTF8: - sz_ = toStr->Utf8Length(); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len && "too small buffer"); - } - NanSetPointerSafe( - datalen - , toStr->WriteUtf8(to, static_cast(sz_ + term_len) - , NULL, flags) - - term_len); - return to; - case Nan::BASE64: - { - v8::String::Value value(toStr); - sz_ = _nan_base64_decoded_size(*value, value.length()); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len); - } - NanSetPointerSafe( - datalen - , _nan_base64_decode(to, sz_, *value, value.length())); - if (term_len) { - to[sz_] = '\0'; - } - return to; - } - case Nan::UCS2: - { - sz_ = toStr->Length(); - if (to == NULL) { - to = new char[(sz_ + term_len) * 2]; - } else { - assert(buflen >= (sz_ + term_len) * 2 && "too small buffer"); - } - - int bc = 2 * toStr->Write( - reinterpret_cast(to) - , 0 - , static_cast(sz_ + term_len) - , flags); - NanSetPointerSafe(datalen, bc); - return to; - } - case Nan::HEX: - { - v8::String::Value value(toStr); - sz_ = value.length(); - assert(!(sz_ & 1) && "bad hex data"); - if (to == NULL) { - to = new char[sz_ / 2 + term_len]; - } else { - assert(buflen >= sz_ / 2 + term_len && "too small buffer"); - } - NanSetPointerSafe( - datalen - , _nan_hex_decode(to, sz_ / 2, *value, value.length())); - } - if (term_len) { - to[sz_ / 2] = '\0'; - } - return to; - default: - assert(0 && "unknown encoding"); - } - return to; -} - -NAN_DEPRECATED NAN_INLINE void* NanRawString( - v8::Handle from - , enum Nan::Encoding encoding - , size_t *datalen - , void *buf - , size_t buflen - , int flags -) { - return _NanRawString(from, encoding, datalen, buf, buflen, flags); -} - - -NAN_DEPRECATED NAN_INLINE char* NanCString( - v8::Handle from - , size_t *datalen - , char *buf = NULL - , size_t buflen = 0 - , int flags = v8::String::NO_OPTIONS -) { - return static_cast( - _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags) - ); -} - -NAN_INLINE void NanSetPrototypeTemplate( - v8::Local templ - , const char *name - , v8::Handle value -) { - NanSetTemplate(templ->PrototypeTemplate(), name, value); -} - -NAN_INLINE void NanSetPrototypeTemplate( - v8::Local templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes -) { - NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes); -} - -NAN_INLINE void NanSetInstanceTemplate( - v8::Local templ - , const char *name - , v8::Handle value -) { - NanSetTemplate(templ->InstanceTemplate(), name, value); -} - -NAN_INLINE void NanSetInstanceTemplate( - v8::Local templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes -) { - NanSetTemplate(templ->InstanceTemplate(), name, value, attributes); -} - -#endif // NAN_H_ diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h.orig b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h.orig deleted file mode 100644 index cf29006..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/nan.h.orig +++ /dev/null @@ -1,2484 +0,0 @@ -/********************************************************************* - * NAN - Native Abstractions for Node.js - * - * Copyright (c) 2014 NAN contributors: - * - Rod Vagg - * - Benjamin Byholm - * - Trevor Norris - * - Nathan Rajlich - * - Brett Lawson - * - Ben Noordhuis - * - * MIT License - * - * Version 1.4.0: current Node unstable: 0.11.14, Node stable: 0.10.33 - * - * See https://github.com/rvagg/nan for the latest update to this file - **********************************************************************************/ - -#ifndef NAN_H_ -#define NAN_H_ - -#include -#include -#include -#include -#include -#include -#include -#if defined(_MSC_VER) -# pragma warning( disable : 4530 ) -#endif -#include - -#if defined(__GNUC__) && !(defined(DEBUG) && DEBUG) -# define NAN_INLINE inline __attribute__((always_inline)) -#elif defined(_MSC_VER) && !(defined(DEBUG) && DEBUG) -# define NAN_INLINE __forceinline -#else -# define NAN_INLINE inline -#endif - -#if defined(__GNUC__) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) && \ - !(defined(V8_DISABLE_DEPRECATIONS) && V8_DISABLE_DEPRECATIONS) -# define NAN_DEPRECATED __declspec(deprecated) -#else -# define NAN_DEPRECATED -#endif - -<<<<<<< HEAD -======= -#undef notset - - -#if (NODE_MODULE_VERSION < 12) -typedef v8::InvocationCallback NanFunctionCallback; -typedef v8::Script NanUnboundScript; -typedef v8::Script NanBoundScript; -#else -typedef v8::FunctionCallback NanFunctionCallback; -typedef v8::UnboundScript NanUnboundScript; -typedef v8::Script NanBoundScript; -#endif - -#define NAN_NEW_NAN_NEW - -#ifdef NAN_NEW_NAN_NEW -# include -#endif - ->>>>>>> agnat/feature/NanNew_redesign -// some generic helpers - -template NAN_INLINE bool NanSetPointerSafe( - T *var - , T val -) { - if (var) { - *var = val; - return true; - } else { - return false; - } -} - -template NAN_INLINE T NanGetPointerSafe( - T *var - , T fallback = reinterpret_cast(0) -) { - if (var) { - return *var; - } else { - return fallback; - } -} - -NAN_INLINE bool NanBooleanOptionValue( - v8::Local optionsObj - , v8::Handle opt, bool def -) { - if (def) { - return optionsObj.IsEmpty() - || !optionsObj->Has(opt) - || optionsObj->Get(opt)->BooleanValue(); - } else { - return !optionsObj.IsEmpty() - && optionsObj->Has(opt) - && optionsObj->Get(opt)->BooleanValue(); - } -} - -NAN_INLINE bool NanBooleanOptionValue( - v8::Local optionsObj - , v8::Handle opt -) { - return NanBooleanOptionValue(optionsObj, opt, false); -} - -NAN_INLINE uint32_t NanUInt32OptionValue( - v8::Local optionsObj - , v8::Handle opt - , uint32_t def -) { - return !optionsObj.IsEmpty() - && optionsObj->Has(opt) - && optionsObj->Get(opt)->IsNumber() - ? optionsObj->Get(opt)->Uint32Value() - : def; -} - -template -v8::Local NanNew(v8::Handle); - -template -NAN_INLINE v8::Local _NanEnsureLocal(v8::Handle val) { - return NanNew(val); -} - -template -NAN_INLINE v8::Local _NanEnsureLocal(v8::Local val) { - return val; -} - -#if (NODE_MODULE_VERSION > 0x000B) -// Node 0.11+ (0.11.3 and below won't compile with these) - -# define _NAN_METHOD_ARGS_TYPE const v8::FunctionCallbackInfo& -# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args -# define _NAN_METHOD_RETURN_TYPE void - -# define _NAN_GETTER_ARGS_TYPE const v8::PropertyCallbackInfo& -# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args -# define _NAN_GETTER_RETURN_TYPE void - -# define _NAN_SETTER_ARGS_TYPE const v8::PropertyCallbackInfo& -# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args -# define _NAN_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_GETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args -# define _NAN_PROPERTY_GETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_SETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args -# define _NAN_PROPERTY_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args -# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE void - -# define _NAN_PROPERTY_DELETER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_DELETER_ARGS \ - _NAN_PROPERTY_DELETER_ARGS_TYPE args -# define _NAN_PROPERTY_DELETER_RETURN_TYPE void - -# define _NAN_PROPERTY_QUERY_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args -# define _NAN_PROPERTY_QUERY_RETURN_TYPE void - -# define _NAN_INDEX_GETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args -# define _NAN_INDEX_GETTER_RETURN_TYPE void - -# define _NAN_INDEX_SETTER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args -# define _NAN_INDEX_SETTER_RETURN_TYPE void - -# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args -# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE void - -# define _NAN_INDEX_DELETER_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args -# define _NAN_INDEX_DELETER_RETURN_TYPE void - -# define _NAN_INDEX_QUERY_ARGS_TYPE \ - const v8::PropertyCallbackInfo& -# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args -# define _NAN_INDEX_QUERY_RETURN_TYPE void - -#ifndef NAN_NEW_NAN_NEW - template - NAN_INLINE v8::Local NanNew() { - return T::New(v8::Isolate::GetCurrent()); - } - - template - NAN_INLINE v8::Local NanNew(P arg1) { - return T::New(v8::Isolate::GetCurrent(), arg1); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle receiver - , int argc - , v8::Handle argv[] = 0) { - return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv); - } - - template - NAN_INLINE v8::Local NanNew( - NanFunctionCallback callback - , v8::Handle data = v8::Handle() - , v8::Handle signature = v8::Handle()) { - return T::New(v8::Isolate::GetCurrent(), callback, data, signature); - } - - template - NAN_INLINE v8::Local NanNew(v8::Handle arg1) { - return v8::Local::New(v8::Isolate::GetCurrent(), arg1); - } - - template - NAN_INLINE v8::Local NanNew(const v8::Persistent &arg1) { - return v8::Local::New(v8::Isolate::GetCurrent(), arg1); - } - - template - NAN_INLINE v8::Local NanNew(P arg1, int arg2) { - return T::New(v8::Isolate::GetCurrent(), arg1, arg2); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::Array::New(v8::Isolate::GetCurrent()); - } - - template<> - NAN_INLINE v8::Local NanNew(int length) { - return v8::Array::New(v8::Isolate::GetCurrent(), length); - } - - template<> - NAN_INLINE v8::Local NanNew(double time) { - return v8::Date::New(v8::Isolate::GetCurrent(), time).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(int time) { - return v8::Date::New(v8::Isolate::GetCurrent(), time).As(); - } - - template - NAN_INLINE v8::Local NanNew( - P s - , const v8::ScriptOrigin& origin - ) { - v8::ScriptCompiler::Source source(s, origin); - return v8::ScriptCompiler::CompileUnbound( - v8::Isolate::GetCurrent(), &source); - } - - template<> - NAN_INLINE v8::Local NanNew( - v8::Local s - ) { - v8::ScriptCompiler::Source source(s); - return v8::ScriptCompiler::CompileUnbound( - v8::Isolate::GetCurrent(), &source); - } - - template<> - NAN_INLINE v8::Local NanNew(bool value) { - return v8::BooleanObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Local value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Handle value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(double val) { - return v8::NumberObject::New( - v8::Isolate::GetCurrent(), val).As(); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Uint32::NewFromUnsigned( - v8::Isolate::GetCurrent(), val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Uint32::NewFromUnsigned( - v8::Isolate::GetCurrent(), val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Int32::New(v8::Isolate::GetCurrent(), val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Integer::NewFromUnsigned(v8::Isolate::GetCurrent(), val); - } - - template<> - NAN_INLINE v8::Local NanNew( - char *arg - , int length) { - return v8::String::NewFromUtf8( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew( - const char *arg - , int length) { - return v8::String::NewFromUtf8( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew(char *arg) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - const char *arg) { - return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - uint8_t *arg - , int length) { - return v8::String::NewFromOneByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg - , int length) { - return v8::String::NewFromOneByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew(uint8_t *arg) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg) { - return v8::String::NewFromOneByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - uint16_t *arg - , int length) { - return v8::String::NewFromTwoByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint16_t *arg - , int length) { - return v8::String::NewFromTwoByte( - v8::Isolate::GetCurrent() - , arg - , v8::String::kNormalString - , length); - } - template<> - NAN_INLINE v8::Local NanNew( - uint16_t *arg) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint16_t *arg) { - return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), arg); - } - - template<> - NAN_INLINE v8::Local NanNew( - std::string arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::String::Empty(v8::Isolate::GetCurrent()); - } - - NAN_INLINE v8::Local NanNew(const char* arg, int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint8_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint16_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const std::string& arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - NAN_INLINE v8::Local NanNew(double val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(unsigned int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(bool val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalStringResource *resource) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), resource); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalAsciiStringResource *resource) { - return v8::String::NewExternal(v8::Isolate::GetCurrent(), resource); - } -#endif - -# define NanScope() v8::HandleScope scope(v8::Isolate::GetCurrent()) -# define NanEscapableScope() \ - v8::EscapableHandleScope scope(v8::Isolate::GetCurrent()) - -# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val)) -# define NanLocker() v8::Locker locker(v8::Isolate::GetCurrent()) -# define NanUnlocker() v8::Unlocker unlocker(v8::Isolate::GetCurrent()) -# define NanReturnValue(value) return args.GetReturnValue().Set(value) -# define NanReturnUndefined() return -# define NanReturnHolder() NanReturnValue(args.Holder()) -# define NanReturnThis() NanReturnValue(args.This()) -# define NanReturnNull() return args.GetReturnValue().SetNull() -# define NanReturnEmptyString() return args.GetReturnValue().SetEmptyString() - -# define NanObjectWrapHandle(obj) obj->handle() - - NAN_INLINE v8::Local NanUndefined() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE v8::Local NanNull() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Null(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE v8::Local NanTrue() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE v8::Local NanFalse() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::False(v8::Isolate::GetCurrent()))); - } - - NAN_INLINE int NanAdjustExternalMemory(int bc) { - return static_cast( - v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(bc)); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , const char *name - , v8::Handle value) { - templ->Set(v8::Isolate::GetCurrent(), name, value); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - NAN_INLINE v8::Local NanGetCurrentContext() { - return v8::Isolate::GetCurrent()->GetCurrentContext(); - } - - NAN_INLINE void* NanGetInternalFieldPointer( - v8::Handle object - , int index) { - return object->GetAlignedPointerFromInternalField(index); - } - - NAN_INLINE void NanSetInternalFieldPointer( - v8::Handle object - , int index - , void* value) { - object->SetAlignedPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::Isolate *isolate, v8::GCType type, v8::GCCallbackFlags flags) - - NAN_INLINE void NanAddGCEpilogueCallback( - v8::Isolate::GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCEpilogueCallback(callback, gc_type_filter); - } - - NAN_INLINE void NanRemoveGCEpilogueCallback( - v8::Isolate::GCEpilogueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCEpilogueCallback(callback); - } - - NAN_INLINE void NanAddGCPrologueCallback( - v8::Isolate::GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::Isolate::GetCurrent()->AddGCPrologueCallback(callback, gc_type_filter); - } - - NAN_INLINE void NanRemoveGCPrologueCallback( - v8::Isolate::GCPrologueCallback callback) { - v8::Isolate::GetCurrent()->RemoveGCPrologueCallback(callback); - } - - NAN_INLINE void NanGetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::Isolate::GetCurrent()->GetHeapStatistics(heap_statistics); - } - - NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( - const char* data, int length = -1) { - return NanNew(data, length); - } - - template - NAN_INLINE void NanAssignPersistent( - v8::Persistent& handle - , v8::Handle obj) { - handle.Reset(v8::Isolate::GetCurrent(), obj); - } - - template - NAN_INLINE void NanAssignPersistent( - v8::Persistent& handle - , const v8::Persistent& obj) { - handle.Reset(v8::Isolate::GetCurrent(), obj); - } - - template - class _NanWeakCallbackData; - - template - struct _NanWeakCallbackInfo { - typedef void (*Callback)(const _NanWeakCallbackData& data); - NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) - : parameter(param), callback(cb) { - NanAssignPersistent(persistent, handle); - } - - NAN_INLINE ~_NanWeakCallbackInfo() { - persistent.Reset(); - } - - P* const parameter; - Callback const callback; - v8::Persistent persistent; - }; - - template - class _NanWeakCallbackData { - public: - NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) - : info_(info) { } - - NAN_INLINE v8::Local GetValue() const { - return NanNew(info_->persistent); - } - - NAN_INLINE P* GetParameter() const { return info_->parameter; } - - NAN_INLINE bool IsNearDeath() const { - return info_->persistent.IsNearDeath(); - } - - NAN_INLINE void Revive() const; - - NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { - return info_; - } - - NAN_DEPRECATED NAN_INLINE void Dispose() const { - } - - private: - _NanWeakCallbackInfo* info_; - }; - - template - static void _NanWeakCallbackDispatcher( - const v8::WeakCallbackData > &data) { - _NanWeakCallbackInfo *info = data.GetParameter(); - _NanWeakCallbackData wcbd(info); - info->callback(wcbd); - if (wcbd.IsNearDeath()) { - delete wcbd.GetCallbackInfo(); - } - } - - template - NAN_INLINE void _NanWeakCallbackData::Revive() const { - info_->persistent.SetWeak(info_, &_NanWeakCallbackDispatcher); - } - -template -NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( - v8::Handle handle - , P* parameter - , typename _NanWeakCallbackInfo::Callback callback) { - _NanWeakCallbackInfo *cbinfo = - new _NanWeakCallbackInfo(handle, parameter, callback); - cbinfo->persistent.SetWeak(cbinfo, &_NanWeakCallbackDispatcher); - return cbinfo; -} - -# define NAN_WEAK_CALLBACK(name) \ - template \ - static void name(const _NanWeakCallbackData &data) - -# define _NAN_ERROR(fun, errmsg) fun(NanNew(errmsg)) - -# define _NAN_THROW_ERROR(fun, errmsg) \ - do { \ - NanScope(); \ - v8::Isolate::GetCurrent()->ThrowException(_NAN_ERROR(fun, errmsg)); \ - } while (0); - - NAN_INLINE v8::Local NanError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE void NanThrowError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE void NanThrowError(v8::Handle error) { - NanScope(); - v8::Isolate::GetCurrent()->ThrowException(error); - } - - NAN_INLINE v8::Local NanError( - const char *msg - , const int errorNumber - ) { - v8::Local err = v8::Exception::Error(NanNew(msg)); - v8::Local obj = err.As(); - obj->Set(NanNew("code"), NanNew(errorNumber)); - return err; - } - - NAN_INLINE void NanThrowError( - const char *msg - , const int errorNumber - ) { - NanThrowError(NanError(msg, errorNumber)); - } - - NAN_INLINE v8::Local NanTypeError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE void NanThrowTypeError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE v8::Local NanRangeError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::RangeError, errmsg); - } - - NAN_INLINE void NanThrowRangeError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); - } - - template NAN_INLINE void NanDisposePersistent( - v8::Persistent &handle - ) { - handle.Reset(); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - char *data - , size_t length - , node::smalloc::FreeCallback callback - , void *hint - ) { - return node::Buffer::New( - v8::Isolate::GetCurrent(), data, length, callback, hint); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - const char *data - , uint32_t size - ) { - return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); - } - - NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { - return node::Buffer::New(v8::Isolate::GetCurrent(), size); - } - - NAN_INLINE v8::Local NanBufferUse( - char* data - , uint32_t size - ) { - return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); - } - - NAN_INLINE bool NanHasInstance( - const v8::Persistent& function_template - , v8::Handle value - ) { - return NanNew(function_template)->HasInstance(value); - } - - NAN_INLINE v8::Local NanNewContextHandle( - v8::ExtensionConfiguration* extensions = NULL - , v8::Handle tmpl = v8::Handle() - , v8::Handle obj = v8::Handle() - ) { - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - return v8::Local::New( - isolate - , v8::Context::New(isolate, extensions, tmpl, obj) - ); - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - v8::ScriptCompiler::Source source(s, origin); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - ) { - v8::ScriptCompiler::Source source(s); - return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &source); - } - - NAN_INLINE v8::Local NanRunScript( - v8::Handle script - ) { - return script->BindToCurrentContext()->Run(); - } - - NAN_INLINE v8::Local NanRunScript( - v8::Handle script - ) { - return script->Run(); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle func - , int argc - , v8::Handle* argv) { - return NanNew(node::MakeCallback( - v8::Isolate::GetCurrent(), target, func, argc, argv)); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle symbol - , int argc - , v8::Handle* argv) { - return NanNew(node::MakeCallback( - v8::Isolate::GetCurrent(), target, symbol, argc, argv)); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , const char* method - , int argc - , v8::Handle* argv) { - return NanNew(node::MakeCallback( - v8::Isolate::GetCurrent(), target, method, argc, argv)); - } - - template - NAN_INLINE void NanSetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(0, data); - } - - template - NAN_INLINE T *NanGetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData(0)); - } - - class NanAsciiString { - public: - NAN_INLINE explicit NanAsciiString(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new char[size + 1]; - size = toStr->WriteOneByte(reinterpret_cast(buf)); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanAsciiString() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanAsciiString(const NanAsciiString&); - void operator=(const NanAsciiString&); - - char *buf; - int size; - }; - - class NanUtf8String { - public: - NAN_INLINE explicit NanUtf8String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Utf8Length(); - buf = new char[size + 1]; - toStr->WriteUtf8(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanUtf8String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUtf8String(const NanUtf8String&); - void operator=(const NanUtf8String&); - - char *buf; - int size; - }; - - class NanUcs2String { - public: - NAN_INLINE explicit NanUcs2String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new uint16_t[size + 1]; - toStr->Write(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE uint16_t* operator*() { return buf; } - NAN_INLINE const uint16_t* operator*() const { return buf; } - - NAN_INLINE ~NanUcs2String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUcs2String(const NanUcs2String&); - void operator=(const NanUcs2String&); - - uint16_t *buf; - int size; - }; - -#else -// Node 0.8 and 0.10 - -# define _NAN_METHOD_ARGS_TYPE const v8::Arguments& -# define _NAN_METHOD_ARGS _NAN_METHOD_ARGS_TYPE args -# define _NAN_METHOD_RETURN_TYPE v8::Handle - -# define _NAN_GETTER_ARGS_TYPE const v8::AccessorInfo & -# define _NAN_GETTER_ARGS _NAN_GETTER_ARGS_TYPE args -# define _NAN_GETTER_RETURN_TYPE v8::Handle - -# define _NAN_SETTER_ARGS_TYPE const v8::AccessorInfo & -# define _NAN_SETTER_ARGS _NAN_SETTER_ARGS_TYPE args -# define _NAN_SETTER_RETURN_TYPE void - -# define _NAN_PROPERTY_GETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_GETTER_ARGS _NAN_PROPERTY_GETTER_ARGS_TYPE args -# define _NAN_PROPERTY_GETTER_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_SETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_SETTER_ARGS _NAN_PROPERTY_SETTER_ARGS_TYPE args -# define _NAN_PROPERTY_SETTER_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_ENUMERATOR_ARGS _NAN_PROPERTY_ENUMERATOR_ARGS_TYPE args -# define _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_DELETER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_DELETER_ARGS _NAN_PROPERTY_DELETER_ARGS_TYPE args -# define _NAN_PROPERTY_DELETER_RETURN_TYPE v8::Handle - -# define _NAN_PROPERTY_QUERY_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_PROPERTY_QUERY_ARGS _NAN_PROPERTY_QUERY_ARGS_TYPE args -# define _NAN_PROPERTY_QUERY_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_GETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_GETTER_ARGS _NAN_INDEX_GETTER_ARGS_TYPE args -# define _NAN_INDEX_GETTER_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_SETTER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_SETTER_ARGS _NAN_INDEX_SETTER_ARGS_TYPE args -# define _NAN_INDEX_SETTER_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_ENUMERATOR_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_ENUMERATOR_ARGS _NAN_INDEX_ENUMERATOR_ARGS_TYPE args -# define _NAN_INDEX_ENUMERATOR_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_DELETER_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_DELETER_ARGS _NAN_INDEX_DELETER_ARGS_TYPE args -# define _NAN_INDEX_DELETER_RETURN_TYPE v8::Handle - -# define _NAN_INDEX_QUERY_ARGS_TYPE const v8::AccessorInfo& -# define _NAN_INDEX_QUERY_ARGS _NAN_INDEX_QUERY_ARGS_TYPE args -# define _NAN_INDEX_QUERY_RETURN_TYPE v8::Handle - - NAN_DEPRECATED NAN_INLINE v8::Local NanSymbol( - const char* data, int length = -1) { - return v8::String::NewSymbol(data, length); - } - -#ifndef NAN_NEW_NAN_NEW - template - NAN_INLINE v8::Local NanNew() { - return T::New(); - } - - template - NAN_INLINE v8::Local NanNew(v8::Handle arg) { - return v8::Local::New(arg); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle receiver - , int argc - , v8::Handle argv[] = 0) { - return v8::Signature::New(receiver, argc, argv); - } - - template - NAN_INLINE v8::Local NanNew( - NanFunctionCallback callback - , v8::Handle data = v8::Handle() - , v8::Handle signature = v8::Handle()) { - return T::New(callback, data, signature); - } - - template - NAN_INLINE v8::Local NanNew(const v8::Persistent &arg) { - return v8::Local::New(arg); - } - - template - NAN_INLINE v8::Local NanNew(P arg) { - return _NanEnsureLocal(T::New(arg)); - } - - template - NAN_INLINE v8::Local NanNew(P arg, int length) { - return _NanEnsureLocal(T::New(arg, length)); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Handle pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template - NAN_INLINE v8::Local NanNew( - v8::Local pattern, v8::RegExp::Flags flags) { - return v8::RegExp::New(pattern, flags); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::Array::New(); - } - - template<> - NAN_INLINE v8::Local NanNew(int length) { - return v8::Array::New(length); - } - - template<> - NAN_INLINE v8::Local NanNew(double time) { - return v8::Date::New(time).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(int time) { - return v8::Date::New(time).As(); - } - -<<<<<<< HEAD - typedef v8::Script NanUnboundScript; - typedef v8::Script NanBoundScript; -======= - template<> - NAN_INLINE v8::Local NanNew(bool value) { - return v8::Local::New(v8::Boolean::New(value)); - } ->>>>>>> agnat/feature/NanNew_redesign - - template - NAN_INLINE v8::Local NanNew( - P s - , const v8::ScriptOrigin& origin - ) { - return v8::Script::New(s, const_cast(&origin)); - } - - template<> - NAN_INLINE v8::Local NanNew( - v8::Local s - ) { - return v8::Script::New(s); - } - - template<> - NAN_INLINE v8::Local NanNew(bool value) { - return v8::BooleanObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Local value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local - NanNew >( - v8::Handle value) { - return v8::StringObject::New(value).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(double val) { - return v8::NumberObject::New(val).As(); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Uint32::NewFromUnsigned(val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Uint32::NewFromUnsigned(val)->ToUint32(); - } - - template<> - NAN_INLINE v8::Local NanNew(int32_t val) { - return v8::Int32::New(val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Int32::New(val)->ToInt32(); - } - - template<> - NAN_INLINE v8::Local NanNew(uint32_t val) { - return v8::Integer::NewFromUnsigned(val); - } - - template<> - NAN_INLINE v8::Local NanNew( - uint8_t *arg - , int length) { - int len = length; - if (len < 0) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - len = static_cast(temp); - } - uint16_t *warg = new uint16_t[len]; - for (int i = 0; i < len; i++) { - warg[i] = arg[i]; - } - v8::Local retval = v8::String::New(warg, len); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg - , int length) { - int len = length; - if (len < 0) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - len = static_cast(temp); - } - uint16_t *warg = new uint16_t[len]; - for (int i = 0; i < len; i++) { - warg[i] = arg[i]; - } - v8::Local retval = v8::String::New(warg, len); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew(uint8_t *arg) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - int length = static_cast(temp); - uint16_t *warg = new uint16_t[length]; - for (int i = 0; i < length; i++) { - warg[i] = arg[i]; - } - - v8::Local retval = v8::String::New(warg, length); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew( - const uint8_t *arg) { - size_t temp = strlen(reinterpret_cast(arg)); - assert(temp <= INT_MAX && "too long string"); - int length = static_cast(temp); - uint16_t *warg = new uint16_t[length]; - for (int i = 0; i < length; i++) { - warg[i] = arg[i]; - } - v8::Local retval = v8::String::New(warg, length); - delete[] warg; - return retval; - } - - template<> - NAN_INLINE v8::Local NanNew( - std::string arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - template<> - NAN_INLINE v8::Local NanNew() { - return v8::String::Empty(); - } - - NAN_INLINE v8::Local NanNew(const char* arg, int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint8_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const uint16_t* arg - , int length = -1) { - return NanNew(arg, length); - } - - NAN_INLINE v8::Local NanNew( - const std::string& arg) { - return NanNew(arg.c_str(), static_cast(arg.size())); - } - - NAN_INLINE v8::Local NanNew(double val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(unsigned int val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew(bool val) { - return NanNew(val); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalStringResource *resource) { - return v8::String::NewExternal(resource); - } - - NAN_INLINE v8::Local NanNew( - v8::String::ExternalAsciiStringResource *resource) { - return v8::String::NewExternal(resource); - } - -#endif - -# define NanScope() v8::HandleScope scope -# define NanEscapableScope() v8::HandleScope scope -# define NanEscapeScope(val) scope.Close(val) -# define NanLocker() v8::Locker locker -# define NanUnlocker() v8::Unlocker unlocker -# define NanReturnValue(value) return scope.Close(value) -# define NanReturnHolder() NanReturnValue(args.Holder()) -# define NanReturnThis() NanReturnValue(args.This()) -# define NanReturnUndefined() return v8::Undefined() -# define NanReturnNull() return v8::Null() -# define NanReturnEmptyString() return v8::String::Empty() -# define NanObjectWrapHandle(obj) v8::Local::New(obj->handle_) - - NAN_INLINE v8::Local NanUndefined() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Undefined())); - } - - NAN_INLINE v8::Local NanNull() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::Null())); - } - - NAN_INLINE v8::Local NanTrue() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::True())); - } - - NAN_INLINE v8::Local NanFalse() { - NanEscapableScope(); - return NanEscapeScope(NanNew(v8::False())); - } - - NAN_INLINE int NanAdjustExternalMemory(int bc) { - return static_cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(bc)); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , const char *name - , v8::Handle value) { - templ->Set(name, value); - } - - NAN_INLINE void NanSetTemplate( - v8::Handle templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes) { - templ->Set(name, value, attributes); - } - - NAN_INLINE v8::Local NanGetCurrentContext() { - return v8::Context::GetCurrent(); - } - - NAN_INLINE void* NanGetInternalFieldPointer( - v8::Handle object - , int index) { - return object->GetPointerFromInternalField(index); - } - - NAN_INLINE void NanSetInternalFieldPointer( - v8::Handle object - , int index - , void* value) { - object->SetPointerInInternalField(index, value); - } - -# define NAN_GC_CALLBACK(name) \ - void name(v8::GCType type, v8::GCCallbackFlags flags) - - NAN_INLINE void NanAddGCEpilogueCallback( - v8::GCEpilogueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCEpilogueCallback(callback, gc_type_filter); - } - NAN_INLINE void NanRemoveGCEpilogueCallback( - v8::GCEpilogueCallback callback) { - v8::V8::RemoveGCEpilogueCallback(callback); - } - NAN_INLINE void NanAddGCPrologueCallback( - v8::GCPrologueCallback callback - , v8::GCType gc_type_filter = v8::kGCTypeAll) { - v8::V8::AddGCPrologueCallback(callback, gc_type_filter); - } - NAN_INLINE void NanRemoveGCPrologueCallback( - v8::GCPrologueCallback callback) { - v8::V8::RemoveGCPrologueCallback(callback); - } - NAN_INLINE void NanGetHeapStatistics( - v8::HeapStatistics *heap_statistics) { - v8::V8::GetHeapStatistics(heap_statistics); - } - - template - NAN_INLINE void NanAssignPersistent( - v8::Persistent& handle - , v8::Handle obj) { - handle.Dispose(); - handle = v8::Persistent::New(obj); - } - - template - class _NanWeakCallbackData; - - template - struct _NanWeakCallbackInfo { - typedef void (*Callback)(const _NanWeakCallbackData &data); - NAN_INLINE _NanWeakCallbackInfo(v8::Handle handle, P* param, Callback cb) - : parameter(param) - , callback(cb) - , persistent(v8::Persistent::New(handle)) { } - - NAN_INLINE ~_NanWeakCallbackInfo() { - persistent.Dispose(); - persistent.Clear(); - } - - P* const parameter; - Callback const callback; - v8::Persistent persistent; - }; - - template - class _NanWeakCallbackData { - public: - NAN_INLINE _NanWeakCallbackData(_NanWeakCallbackInfo *info) - : info_(info) { } - - NAN_INLINE v8::Local GetValue() const { - return NanNew(info_->persistent); - } - - NAN_INLINE P* GetParameter() const { return info_->parameter; } - - NAN_INLINE bool IsNearDeath() const { - return info_->persistent.IsNearDeath(); - } - - NAN_INLINE void Revive() const; - - NAN_INLINE _NanWeakCallbackInfo* GetCallbackInfo() const { - return info_; - } - - NAN_DEPRECATED NAN_INLINE void Dispose() const { - } - - private: - _NanWeakCallbackInfo* info_; - }; - - template - static void _NanWeakPersistentDispatcher( - v8::Persistent object, void *data) { - _NanWeakCallbackInfo* info = - static_cast<_NanWeakCallbackInfo*>(data); - _NanWeakCallbackData wcbd(info); - info->callback(wcbd); - if (wcbd.IsNearDeath()) { - delete wcbd.GetCallbackInfo(); - } - } - - template - NAN_INLINE void _NanWeakCallbackData::Revive() const { - info_->persistent.MakeWeak( - info_ - , &_NanWeakPersistentDispatcher); - } - - template - NAN_INLINE _NanWeakCallbackInfo* NanMakeWeakPersistent( - v8::Handle handle - , P* parameter - , typename _NanWeakCallbackInfo::Callback callback) { - _NanWeakCallbackInfo *cbinfo = - new _NanWeakCallbackInfo(handle, parameter, callback); - cbinfo->persistent.MakeWeak( - cbinfo - , &_NanWeakPersistentDispatcher); - return cbinfo; - } - -# define NAN_WEAK_CALLBACK(name) \ - template \ - static void name(const _NanWeakCallbackData &data) - -# define _NAN_ERROR(fun, errmsg) \ - fun(v8::String::New(errmsg)) - -# define _NAN_THROW_ERROR(fun, errmsg) \ - do { \ - NanScope(); \ - return v8::Local::New( \ - v8::ThrowException(_NAN_ERROR(fun, errmsg))); \ - } while (0); - - NAN_INLINE v8::Local NanError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE v8::Local NanThrowError(const char* errmsg) { - _NAN_THROW_ERROR(v8::Exception::Error, errmsg); - } - - NAN_INLINE v8::Local NanThrowError( - v8::Handle error - ) { - NanScope(); - return v8::Local::New(v8::ThrowException(error)); - } - - NAN_INLINE v8::Local NanError( - const char *msg - , const int errorNumber - ) { - v8::Local err = v8::Exception::Error(v8::String::New(msg)); - v8::Local obj = err.As(); - obj->Set(v8::String::New("code"), v8::Int32::New(errorNumber)); - return err; - } - - NAN_INLINE v8::Local NanThrowError( - const char *msg - , const int errorNumber - ) { - return NanThrowError(NanError(msg, errorNumber)); - } - - NAN_INLINE v8::Local NanTypeError(const char* errmsg) { - return _NAN_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE v8::Local NanThrowTypeError( - const char* errmsg - ) { - _NAN_THROW_ERROR(v8::Exception::TypeError, errmsg); - } - - NAN_INLINE v8::Local NanRangeError( - const char* errmsg - ) { - return _NAN_ERROR(v8::Exception::RangeError, errmsg); - } - - NAN_INLINE v8::Local NanThrowRangeError( - const char* errmsg - ) { - _NAN_THROW_ERROR(v8::Exception::RangeError, errmsg); - } - - template - NAN_INLINE void NanDisposePersistent( - v8::Persistent &handle) { // NOLINT(runtime/references) - handle.Dispose(); - handle.Clear(); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - char *data - , size_t length - , node::Buffer::free_callback callback - , void *hint - ) { - return NanNew( - node::Buffer::New(data, length, callback, hint)->handle_); - } - - NAN_INLINE v8::Local NanNewBufferHandle ( - const char *data - , uint32_t size - ) { -#if NODE_MODULE_VERSION >= 0x000B - return NanNew(node::Buffer::New(data, size)->handle_); -#else - return NanNew( - node::Buffer::New(const_cast(data), size)->handle_); -#endif - } - - NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) { - return NanNew(node::Buffer::New(size)->handle_); - } - - NAN_INLINE void FreeData(char *data, void *hint) { - delete[] data; - } - - NAN_INLINE v8::Local NanBufferUse( - char* data - , uint32_t size - ) { - return NanNew( - node::Buffer::New(data, size, FreeData, NULL)->handle_); - } - - NAN_INLINE bool NanHasInstance( - const v8::Persistent& function_template - , v8::Handle value - ) { - return function_template->HasInstance(value); - } - - NAN_INLINE v8::Local NanNewContextHandle( - v8::ExtensionConfiguration* extensions = NULL - , v8::Handle tmpl = v8::Handle() - , v8::Handle obj = v8::Handle() - ) { - v8::Persistent ctx = v8::Context::New(extensions, tmpl, obj); - v8::Local lctx = NanNew(ctx); - ctx.Dispose(); - return lctx; - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - , const v8::ScriptOrigin& origin - ) { - return v8::Script::Compile(s, const_cast(&origin)); - } - - NAN_INLINE v8::Local NanCompileScript( - v8::Local s - ) { - return v8::Script::Compile(s); - } - - NAN_INLINE v8::Local NanRunScript(v8::Handle script) { - return script->Run(); - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle func - , int argc - , v8::Handle* argv) { -# if NODE_VERSION_AT_LEAST(0, 8, 0) - return NanNew(node::MakeCallback(target, func, argc, argv)); -# else - v8::TryCatch try_catch; - v8::Local result = func->Call(target, argc, argv); - if (try_catch.HasCaught()) { - node::FatalException(try_catch); - } - return result; -# endif - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , v8::Handle symbol - , int argc - , v8::Handle* argv) { -# if NODE_VERSION_AT_LEAST(0, 8, 0) - return NanNew(node::MakeCallback(target, symbol, argc, argv)); -# else - v8::Local callback = target->Get(symbol).As(); - return NanMakeCallback(target, callback, argc, argv); -# endif - } - - NAN_INLINE v8::Local NanMakeCallback( - v8::Handle target - , const char* method - , int argc - , v8::Handle* argv) { -# if NODE_VERSION_AT_LEAST(0, 8, 0) - return NanNew(node::MakeCallback(target, method, argc, argv)); -# else - return NanMakeCallback(target, NanNew(method), argc, argv); -# endif - } - - template - NAN_INLINE void NanSetIsolateData( - v8::Isolate *isolate - , T *data - ) { - isolate->SetData(data); - } - - template - NAN_INLINE T *NanGetIsolateData( - v8::Isolate *isolate - ) { - return static_cast(isolate->GetData()); - } - - class NanAsciiString { - public: - NAN_INLINE explicit NanAsciiString(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new char[size + 1]; - size = toStr->WriteAscii(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanAsciiString() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanAsciiString(const NanAsciiString&); - void operator=(const NanAsciiString&); - - char *buf; - int size; - }; - - class NanUtf8String { - public: - NAN_INLINE explicit NanUtf8String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Utf8Length(); - buf = new char[size + 1]; - toStr->WriteUtf8(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE char* operator*() { return buf; } - NAN_INLINE const char* operator*() const { return buf; } - - NAN_INLINE ~NanUtf8String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUtf8String(const NanUtf8String&); - void operator=(const NanUtf8String&); - - char *buf; - int size; - }; - - class NanUcs2String { - public: - NAN_INLINE explicit NanUcs2String(v8::Handle from) { - v8::Local toStr = from->ToString(); - size = toStr->Length(); - buf = new uint16_t[size + 1]; - toStr->Write(buf); - } - - NAN_DEPRECATED NAN_INLINE int Size() const { - return size; - } - - NAN_INLINE int length() const { - return size; - } - - NAN_INLINE uint16_t* operator*() { return buf; } - NAN_INLINE const uint16_t* operator*() const { return buf; } - - NAN_INLINE ~NanUcs2String() { - delete[] buf; - } - - private: - // disallow copying and assigning - NanUcs2String(const NanUcs2String&); - void operator=(const NanUcs2String&); - - uint16_t *buf; - int size; - }; - -#endif // NODE_MODULE_VERSION - -typedef void (*NanFreeCallback)(char *data, void *hint); - -#define NAN_METHOD(name) _NAN_METHOD_RETURN_TYPE name(_NAN_METHOD_ARGS) -#define NAN_GETTER(name) \ - _NAN_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_GETTER_ARGS) -#define NAN_SETTER(name) \ - _NAN_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , _NAN_SETTER_ARGS) -#define NAN_PROPERTY_GETTER(name) \ - _NAN_PROPERTY_GETTER_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_PROPERTY_GETTER_ARGS) -#define NAN_PROPERTY_SETTER(name) \ - _NAN_PROPERTY_SETTER_RETURN_TYPE name( \ - v8::Local property \ - , v8::Local value \ - , _NAN_PROPERTY_SETTER_ARGS) -#define NAN_PROPERTY_ENUMERATOR(name) \ - _NAN_PROPERTY_ENUMERATOR_RETURN_TYPE name(_NAN_PROPERTY_ENUMERATOR_ARGS) -#define NAN_PROPERTY_DELETER(name) \ - _NAN_PROPERTY_DELETER_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_PROPERTY_DELETER_ARGS) -#define NAN_PROPERTY_QUERY(name) \ - _NAN_PROPERTY_QUERY_RETURN_TYPE name( \ - v8::Local property \ - , _NAN_PROPERTY_QUERY_ARGS) -# define NAN_INDEX_GETTER(name) \ - _NAN_INDEX_GETTER_RETURN_TYPE name(uint32_t index, _NAN_INDEX_GETTER_ARGS) -#define NAN_INDEX_SETTER(name) \ - _NAN_INDEX_SETTER_RETURN_TYPE name( \ - uint32_t index \ - , v8::Local value \ - , _NAN_INDEX_SETTER_ARGS) -#define NAN_INDEX_ENUMERATOR(name) \ - _NAN_INDEX_ENUMERATOR_RETURN_TYPE name(_NAN_INDEX_ENUMERATOR_ARGS) -#define NAN_INDEX_DELETER(name) \ - _NAN_INDEX_DELETER_RETURN_TYPE name( \ - uint32_t index \ - , _NAN_INDEX_DELETER_ARGS) -#define NAN_INDEX_QUERY(name) \ - _NAN_INDEX_QUERY_RETURN_TYPE name(uint32_t index, _NAN_INDEX_QUERY_ARGS) - -class NanCallback { - public: - NanCallback() { - NanScope(); - v8::Local obj = NanNew(); - NanAssignPersistent(handle, obj); - } - - explicit NanCallback(const v8::Handle &fn) { - NanScope(); - v8::Local obj = NanNew(); - NanAssignPersistent(handle, obj); - SetFunction(fn); - } - - ~NanCallback() { - if (handle.IsEmpty()) return; - NanDisposePersistent(handle); - } - - NAN_INLINE void SetFunction(const v8::Handle &fn) { - NanScope(); - NanNew(handle)->Set(kCallbackIndex, fn); - } - - NAN_INLINE v8::Local GetFunction() const { - NanEscapableScope(); - return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex) - .As()); - } - - NAN_INLINE bool IsEmpty() const { - NanScope(); - return NanNew(handle)->Get(kCallbackIndex)->IsUndefined(); - } - - v8::Handle Call(int argc, v8::Handle argv[]) const { - NanEscapableScope(); -#if (NODE_MODULE_VERSION > 0x000B) // 0.11.12+ - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::Local callback = NanNew(handle)-> - Get(kCallbackIndex).As(); - return NanEscapeScope(node::MakeCallback( - isolate - , isolate->GetCurrentContext()->Global() - , callback - , argc - , argv - )); -#else -#if NODE_VERSION_AT_LEAST(0, 8, 0) - v8::Local callback = handle-> - Get(kCallbackIndex).As(); - return NanEscapeScope(node::MakeCallback( - v8::Context::GetCurrent()->Global() - , callback - , argc - , argv - )); -#else - v8::Local callback = handle-> - Get(kCallbackIndex).As(); - return NanEscapeScope(NanMakeCallback( - v8::Context::GetCurrent()->Global(), callback, argc, argv)); -#endif -#endif - } - - private: - v8::Persistent handle; - static const uint32_t kCallbackIndex = 0; -}; - -/* abstract */ class NanAsyncWorker { - public: - explicit NanAsyncWorker(NanCallback *callback_) - : callback(callback_), errmsg_(NULL) { - request.data = this; - - NanScope(); - v8::Local obj = NanNew(); - NanAssignPersistent(persistentHandle, obj); - } - - virtual ~NanAsyncWorker() { - NanScope(); - - if (!persistentHandle.IsEmpty()) - NanDisposePersistent(persistentHandle); - if (callback) - delete callback; - if (errmsg_) - delete[] errmsg_; - } - - virtual void WorkComplete() { - NanScope(); - - if (errmsg_ == NULL) - HandleOKCallback(); - else - HandleErrorCallback(); - delete callback; - callback = NULL; - } - - NAN_INLINE void SaveToPersistent( - const char *key, const v8::Local &obj) { - v8::Local handle = NanNew(persistentHandle); - handle->Set(NanNew(key), obj); - } - - v8::Local GetFromPersistent(const char *key) const { - NanEscapableScope(); - v8::Local handle = NanNew(persistentHandle); - return NanEscapeScope(handle->Get(NanNew(key)).As()); - } - - virtual void Execute() = 0; - - uv_work_t request; - - protected: - v8::Persistent persistentHandle; - NanCallback *callback; - - virtual void HandleOKCallback() { - callback->Call(0, NULL); - } - - virtual void HandleErrorCallback() { - NanScope(); - - v8::Local argv[] = { - v8::Exception::Error(NanNew(ErrorMessage())) - }; - callback->Call(1, argv); - } - - void SetErrorMessage(const char *msg) { - if (errmsg_) { - delete[] errmsg_; - } - - size_t size = strlen(msg) + 1; - errmsg_ = new char[size]; - memcpy(errmsg_, msg, size); - } - - const char* ErrorMessage() const { - return errmsg_; - } - - private: - char *errmsg_; -}; - -NAN_INLINE void NanAsyncExecute (uv_work_t* req) { - NanAsyncWorker *worker = static_cast(req->data); - worker->Execute(); -} - -NAN_INLINE void NanAsyncExecuteComplete (uv_work_t* req) { - NanAsyncWorker* worker = static_cast(req->data); - worker->WorkComplete(); - delete worker; -} - -NAN_INLINE void NanAsyncQueueWorker (NanAsyncWorker* worker) { - uv_queue_work( - uv_default_loop() - , &worker->request - , NanAsyncExecute - , (uv_after_work_cb)NanAsyncExecuteComplete - ); -} - -//// Base 64 //// - -#define _nan_base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4) - -// Doesn't check for padding at the end. Can be 1-2 bytes over. -NAN_INLINE size_t _nan_base64_decoded_size_fast(size_t size) { - size_t remainder = size % 4; - - size = (size / 4) * 3; - if (remainder) { - if (size == 0 && remainder == 1) { - // special case: 1-byte input cannot be decoded - size = 0; - } else { - // non-padded input, add 1 or 2 extra bytes - size += 1 + (remainder == 3); - } - } - - return size; -} - -template -NAN_INLINE size_t _nan_base64_decoded_size( - const T* src - , size_t size -) { - if (size == 0) - return 0; - - if (src[size - 1] == '=') - size--; - if (size > 0 && src[size - 1] == '=') - size--; - - return _nan_base64_decoded_size_fast(size); -} - -// supports regular and URL-safe base64 -static const int _nan_unbase64_table[] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -2, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63 - , 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1 - , -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 - , 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63 - , -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 - , 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 - , -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 -}; - -#define _nan_unbase64(x) _nan_unbase64_table[(uint8_t)(x)] - -template static size_t _nan_base64_decode( - char* buf - , size_t len - , const T* src - , const size_t srcLen -) { - char* dst = buf; - char* dstEnd = buf + len; - const T* srcEnd = src + srcLen; - - while (src < srcEnd && dst < dstEnd) { - ptrdiff_t remaining = srcEnd - src; - char a, b, c, d; - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining == 0 || *src == '=') break; - a = _nan_unbase64(*src++); - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining <= 1 || *src == '=') break; - b = _nan_unbase64(*src++); - - *dst++ = (a << 2) | ((b & 0x30) >> 4); - if (dst == dstEnd) break; - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining <= 2 || *src == '=') break; - c = _nan_unbase64(*src++); - - *dst++ = ((b & 0x0F) << 4) | ((c & 0x3C) >> 2); - if (dst == dstEnd) break; - - while (_nan_unbase64(*src) < 0 && src < srcEnd) src++, remaining--; - if (remaining <= 3 || *src == '=') break; - d = _nan_unbase64(*src++); - - *dst++ = ((c & 0x03) << 6) | (d & 0x3F); - } - - return dst - buf; -} - -//// HEX //// - -template unsigned _nan_hex2bin(T c) { - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'A' && c <= 'F') return 10 + (c - 'A'); - if (c >= 'a' && c <= 'f') return 10 + (c - 'a'); - return static_cast(-1); -} - -template static size_t _nan_hex_decode( - char* buf - , size_t len - , const T* src - , const size_t srcLen -) { - size_t i; - for (i = 0; i < len && i * 2 + 1 < srcLen; ++i) { - unsigned a = _nan_hex2bin(src[i * 2 + 0]); - unsigned b = _nan_hex2bin(src[i * 2 + 1]); - if (!~a || !~b) return i; - buf[i] = a * 16 + b; - } - - return i; -} - -static bool _NanGetExternalParts( - v8::Handle val - , const char** data - , size_t* len -) { - if (node::Buffer::HasInstance(val)) { - *data = node::Buffer::Data(val.As()); - *len = node::Buffer::Length(val.As()); - return true; - } - - assert(val->IsString()); - v8::Local str = NanNew(val.As()); - - if (str->IsExternalAscii()) { - const v8::String::ExternalAsciiStringResource* ext; - ext = str->GetExternalAsciiStringResource(); - *data = ext->data(); - *len = ext->length(); - return true; - - } else if (str->IsExternal()) { - const v8::String::ExternalStringResource* ext; - ext = str->GetExternalStringResource(); - *data = reinterpret_cast(ext->data()); - *len = ext->length(); - return true; - } - - return false; -} - -namespace Nan { - enum Encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; -} - -/* NAN_DEPRECATED */ NAN_INLINE void* _NanRawString( - v8::Handle from - , enum Nan::Encoding encoding - , size_t *datalen - , void *buf - , size_t buflen - , int flags -) { - NanScope(); - - size_t sz_; - size_t term_len = !(flags & v8::String::NO_NULL_TERMINATION); - char *data = NULL; - size_t len; - bool is_extern = _NanGetExternalParts( - from - , const_cast(&data) - , &len); - - if (is_extern && !term_len) { - NanSetPointerSafe(datalen, len); - return data; - } - - v8::Local toStr = from->ToString(); - - char *to = static_cast(buf); - - switch (encoding) { - case Nan::ASCII: -#if NODE_MODULE_VERSION < 0x000C - sz_ = toStr->Length(); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len && "too small buffer"); - } - NanSetPointerSafe( - datalen - , toStr->WriteAscii(to, 0, static_cast(sz_ + term_len), flags)); - return to; -#endif - case Nan::BINARY: - case Nan::BUFFER: - sz_ = toStr->Length(); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len && "too small buffer"); - } -#if NODE_MODULE_VERSION < 0x000C - { - uint16_t* twobytebuf = new uint16_t[sz_ + term_len]; - - size_t somelen = toStr->Write(twobytebuf, 0, - static_cast(sz_ + term_len), flags); - - for (size_t i = 0; i < sz_ + term_len && i < somelen + term_len; i++) { - unsigned char *b = reinterpret_cast(&twobytebuf[i]); - to[i] = *b; - } - - NanSetPointerSafe(datalen, somelen); - - delete[] twobytebuf; - return to; - } -#else - NanSetPointerSafe( - datalen, - toStr->WriteOneByte( - reinterpret_cast(to) - , 0 - , static_cast(sz_ + term_len) - , flags)); - return to; -#endif - case Nan::UTF8: - sz_ = toStr->Utf8Length(); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len && "too small buffer"); - } - NanSetPointerSafe( - datalen - , toStr->WriteUtf8(to, static_cast(sz_ + term_len) - , NULL, flags) - - term_len); - return to; - case Nan::BASE64: - { - v8::String::Value value(toStr); - sz_ = _nan_base64_decoded_size(*value, value.length()); - if (to == NULL) { - to = new char[sz_ + term_len]; - } else { - assert(buflen >= sz_ + term_len); - } - NanSetPointerSafe( - datalen - , _nan_base64_decode(to, sz_, *value, value.length())); - if (term_len) { - to[sz_] = '\0'; - } - return to; - } - case Nan::UCS2: - { - sz_ = toStr->Length(); - if (to == NULL) { - to = new char[(sz_ + term_len) * 2]; - } else { - assert(buflen >= (sz_ + term_len) * 2 && "too small buffer"); - } - - int bc = 2 * toStr->Write( - reinterpret_cast(to) - , 0 - , static_cast(sz_ + term_len) - , flags); - NanSetPointerSafe(datalen, bc); - return to; - } - case Nan::HEX: - { - v8::String::Value value(toStr); - sz_ = value.length(); - assert(!(sz_ & 1) && "bad hex data"); - if (to == NULL) { - to = new char[sz_ / 2 + term_len]; - } else { - assert(buflen >= sz_ / 2 + term_len && "too small buffer"); - } - NanSetPointerSafe( - datalen - , _nan_hex_decode(to, sz_ / 2, *value, value.length())); - } - if (term_len) { - to[sz_ / 2] = '\0'; - } - return to; - default: - assert(0 && "unknown encoding"); - } - return to; -} - -NAN_DEPRECATED NAN_INLINE void* NanRawString( - v8::Handle from - , enum Nan::Encoding encoding - , size_t *datalen - , void *buf - , size_t buflen - , int flags -) { - return _NanRawString(from, encoding, datalen, buf, buflen, flags); -} - - -NAN_DEPRECATED NAN_INLINE char* NanCString( - v8::Handle from - , size_t *datalen - , char *buf = NULL - , size_t buflen = 0 - , int flags = v8::String::NO_OPTIONS -) { - return static_cast( - _NanRawString(from, Nan::UTF8, datalen, buf, buflen, flags) - ); -} - -NAN_INLINE void NanSetPrototypeTemplate( - v8::Local templ - , const char *name - , v8::Handle value -) { - NanSetTemplate(templ->PrototypeTemplate(), name, value); -} - -NAN_INLINE void NanSetPrototypeTemplate( - v8::Local templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes -) { - NanSetTemplate(templ->PrototypeTemplate(), name, value, attributes); -} - -NAN_INLINE void NanSetInstanceTemplate( - v8::Local templ - , const char *name - , v8::Handle value -) { - NanSetTemplate(templ->InstanceTemplate(), name, value); -} - -NAN_INLINE void NanSetInstanceTemplate( - v8::Local templ - , v8::Handle name - , v8::Handle value - , v8::PropertyAttribute attributes -) { - NanSetTemplate(templ->InstanceTemplate(), name, value, attributes); -} - -//=== Export ================================================================== - -inline -void -NanExport(v8::Handle target, const char * name, - NanFunctionCallback f) -{ - target->Set(NanNew(name), - NanNew(f)->GetFunction()); -} - -//=== Tap Reverse Binding ===================================================== - -struct NanTap { - NanTap(v8::Handle t) : t_() { - NanAssignPersistent(t_, t->ToObject()); - }; - ~NanTap() { NanDisposePersistent(t_); } // not sure if neccessary - - inline void plan(int i) { - v8::Handle arg = NanNew(i); - NanMakeCallback(NanNew(t_), "plan", 1, &arg); - } - - inline void ok(bool isOk, const char * msg = NULL) { - v8::Handle args[2]; - args[0] = NanNew(isOk); - if (msg) args[1] = NanNew(msg); - NanMakeCallback(NanNew(t_), "ok", msg ? 2 : 1, args); - } - -private: - - v8::Persistent t_; -}; - -#define NAN_STRINGIZE2(x) #x -#define NAN_STRINGIZE(x) NAN_STRINGIZE2(x) -#define NAN_TEST_EXPRESSION(expression) \ - ( expression ), __FILE__ ":" NAN_STRINGIZE(__LINE__) ": " #expression - -#define return_NanValue(v) NanReturnValue(v) -#define return_NanUndefined() NanReturnUndefined() -#define NAN_EXPORT(target, function) NanExport(target, #function, function) - -#endif // NAN_H_ diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/package.json deleted file mode 100644 index bec2019..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/nan/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "nan", - "version": "1.4.1", - "description": "Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility", - "main": "include_dirs.js", - "repository": { - "type": "git", - "url": "git://github.com/rvagg/nan.git" - }, - "scripts": { - "test": "tap --gc test/js/*-test.js", - "rebuild-tests": "node-gyp rebuild --directory test" - }, - "contributors": [ - { - "name": "Rod Vagg", - "email": "r@va.gg", - "url": "https://github.com/rvagg" - }, - { - "name": "Benjamin Byholm", - "email": "bbyholm@abo.fi", - "url": "https://github.com/kkoopa/" - }, - { - "name": "Trevor Norris", - "email": "trev.norris@gmail.com", - "url": "https://github.com/trevnorris" - }, - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "https://github.com/TooTallNate" - }, - { - "name": "Brett Lawson", - "email": "brett19@gmail.com", - "url": "https://github.com/brett19" - }, - { - "name": "Ben Noordhuis", - "email": "info@bnoordhuis.nl", - "url": "https://github.com/bnoordhuis" - } - ], - "devDependencies": { - "bindings": "~1.2.1", - "node-gyp": "~1.0.2", - "tap": "~0.4.13", - "xtend": "~4.0.0" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/rvagg/nan/issues" - }, - "homepage": "https://github.com/rvagg/nan", - "_id": "nan@1.4.1", - "_shasum": "0a2bb562c558b440005b1f7eb8b31ccbdb565d5f", - "_from": "nan@1.4.x", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "kkoopa", - "email": "bbyholm@abo.fi" - }, - "maintainers": [ - { - "name": "rvagg", - "email": "rod@vagg.org" - }, - { - "name": "kkoopa", - "email": "bbyholm@abo.fi" - } - ], - "dist": { - "shasum": "0a2bb562c558b440005b1f7eb8b31ccbdb565d5f", - "tarball": "http://registry.npmjs.org/nan/-/nan-1.4.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/nan/-/nan-1.4.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/.npmignore deleted file mode 100644 index 1b18fb3..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -npm-debug.log -node_modules -.*.swp -.lock-* -build/ - -test diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/Makefile deleted file mode 100644 index 7496b6f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -ALL_TESTS = $(shell find test/ -name '*.test.js') - -run-tests: - @./node_modules/.bin/mocha \ - -t 2000 \ - $(TESTFLAGS) \ - $(TESTS) - -test: - @$(MAKE) NODE_PATH=lib TESTS="$(ALL_TESTS)" run-tests - -.PHONY: test diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/README.md deleted file mode 100644 index 0dabc75..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# options.js # - -A very light-weight in-code option parsers for node.js. - -## Usage ## - -``` js -var Options = require("options"); - -// Create an Options object -function foo(options) { - var default_options = { - foo : "bar" - }; - - // Create an option object with default value - var opts = new Options(default_options); - - // Merge options - opts = opts.merge(options); - - // Reset to default value - opts.reset(); - - // Copy selected attributes out - var seled_att = opts.copy("foo"); - - // Read json options from a file. - opts.read("options.file"); // Sync - opts.read("options.file", function(err){ // Async - if(err){ // If error occurs - console.log("File error."); - }else{ - // No error - } - }); - - // Attributes defined or not - opts.isDefinedAndNonNull("foobar"); - opts.isDefined("foobar"); -} - -``` - - -## License ## - -(The MIT License) - -Copyright (c) 2012 Einar Otto Stangvik <einaros@gmail.com> - -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 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/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/lib/options.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/lib/options.js deleted file mode 100644 index 4fc45e9..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/lib/options.js +++ /dev/null @@ -1,86 +0,0 @@ -/*! - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -var fs = require('fs'); - -function Options(defaults) { - var internalValues = {}; - var values = this.value = {}; - Object.keys(defaults).forEach(function(key) { - internalValues[key] = defaults[key]; - Object.defineProperty(values, key, { - get: function() { return internalValues[key]; }, - configurable: false, - enumerable: true - }); - }); - this.reset = function() { - Object.keys(defaults).forEach(function(key) { - internalValues[key] = defaults[key]; - }); - return this; - }; - this.merge = function(options, required) { - options = options || {}; - if (Object.prototype.toString.call(required) === '[object Array]') { - var missing = []; - for (var i = 0, l = required.length; i < l; ++i) { - var key = required[i]; - if (!(key in options)) { - missing.push(key); - } - } - if (missing.length > 0) { - if (missing.length > 1) { - throw new Error('options ' + - missing.slice(0, missing.length - 1).join(', ') + ' and ' + - missing[missing.length - 1] + ' must be defined'); - } - else throw new Error('option ' + missing[0] + ' must be defined'); - } - } - Object.keys(options).forEach(function(key) { - if (key in internalValues) { - internalValues[key] = options[key]; - } - }); - return this; - }; - this.copy = function(keys) { - var obj = {}; - Object.keys(defaults).forEach(function(key) { - if (keys.indexOf(key) !== -1) { - obj[key] = values[key]; - } - }); - return obj; - }; - this.read = function(filename, cb) { - if (typeof cb == 'function') { - var self = this; - fs.readFile(filename, function(error, data) { - if (error) return cb(error); - var conf = JSON.parse(data); - self.merge(conf); - cb(); - }); - } - else { - var conf = JSON.parse(fs.readFileSync(filename)); - this.merge(conf); - } - return this; - }; - this.isDefined = function(key) { - return typeof values[key] != 'undefined'; - }; - this.isDefinedAndNonNull = function(key) { - return typeof values[key] != 'undefined' && values[key] !== null; - }; - Object.freeze(values); - Object.freeze(this); -} - -module.exports = Options; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/package.json deleted file mode 100644 index 7a62d8e..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/options/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "name": "options", - "description": "A very light-weight in-code option parsers for node.js.", - "version": "0.0.6", - "repository": { - "type": "git", - "url": "git://github.com/einaros/options.js.git" - }, - "main": "lib/options", - "scripts": { - "test": "make test" - }, - "engines": { - "node": ">=0.4.0" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "latest" - }, - "gitHead": "ff53d0a092c897cb95964232a96fe17da65c11af", - "bugs": { - "url": "https://github.com/einaros/options.js/issues" - }, - "homepage": "https://github.com/einaros/options.js", - "_id": "options@0.0.6", - "_shasum": "ec22d312806bb53e731773e7cdaefcf1c643128f", - "_from": "options@>=0.0.5", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "einaros", - "email": "einaros@gmail.com" - }, - "maintainers": [ - { - "name": "einaros", - "email": "einaros@gmail.com" - } - ], - "dist": { - "shasum": "ec22d312806bb53e731773e7cdaefcf1c643128f", - "tarball": "http://registry.npmjs.org/options/-/options-0.0.6.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/.npmignore deleted file mode 100644 index 66210a2..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -coverage -.tern-port diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/.travis.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/.travis.yml deleted file mode 100644 index a6e9741..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.11" -before_install: - - "npm install -g npm@1.4.x" -script: - - "npm run test-travis" -after_script: - - "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls" -notifications: - irc: - channels: - - "irc.freenode.org#unshift" - on_success: change - on_failure: change diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/README.md deleted file mode 100644 index 84fa3f2..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# Ultron - -[![Made by unshift](https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square)](http://unshift.io)[![Version npm](http://img.shields.io/npm/v/ultron.svg?style=flat-square)](http://browsenpm.org/package/ultron)[![Build Status](http://img.shields.io/travis/unshiftio/ultron/master.svg?style=flat-square)](https://travis-ci.org/unshiftio/ultron)[![Dependencies](https://img.shields.io/david/unshiftio/ultron.svg?style=flat-square)](https://david-dm.org/unshiftio/ultron)[![Coverage Status](http://img.shields.io/coveralls/unshiftio/ultron/master.svg?style=flat-square)](https://coveralls.io/r/unshiftio/ultron?branch=master)[![IRC channel](http://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square)](http://webchat.freenode.net/?channels=unshift) - -Ultron is a high-intelligence robot. It gathers intelligence so it can start -improving upon his rudimentary design. It will learn your event emitting -patterns and find ways to exterminate them. Allowing you to remove only the -event emitters that **you** assigned and not the ones that your users or -developers assigned. This can prevent race conditions, memory leaks and even file -descriptor leaks from ever happening as you won't remove clean up processes. - -## Installation - -The module is designed to be used in browsers using browserify and in Node.js. -You can install the module through the public npm registry by running the -following command in CLI: - -``` -npm install --save ultron -``` - -## Usage - -In all examples we assume that you've required the library as following: - -```js -'use strict'; - -var Ultron = require('ultron'); -``` - -Now that we've required the library we can construct our first `Ultron` instance. -The constructor requires one argument which should be the `EventEmitter` -instance that we need to operate upon. This can be the `EventEmitter` module -that ships with Node.js or `EventEmitter3` or anything else as long as it -follow the same API and internal structure as these 2. So with that in mind we -can create the instance: - -```js -// -// For the sake of this example we're going to construct an empty EventEmitter -// -var EventEmitter = require('events').EventEmitter; // or require('eventmitter3'); -var events = new EventEmitter(); - -var ultron = new Ultron(events); -``` - -You can now use the following API's from the Ultron instance: - -### Ultron.on - -Register a new event listener for the given event. It follows the exact same API -as `EventEmitter.on` but it will return itself instead of returning the -EventEmitter instance. If you are using EventEmitter3 it also supports the -context param: - -```js -ultron.on('event-name', handler, { custom: 'function context' }); -``` - -### Ultron.once - -Exactly the same as the [Ultron.on](#ultronon) but it only allows the execution -once. - -### Ultron.remove - -This is where all the magic happens and the safe removal starts. This function -accepts different argument styles: - -- No arguments, assume that all events need to be removed so it will work as - `removeAllListeners()` API. -- 1 argument, when it's a string it will be split on ` ` and `,` to create a - list of events that need to be cleared. -- Multiple arguments, we assume that they are all names of events that need to - be cleared. - -```js -ultron.remove('foo, bar baz'); // Removes foo, bar and baz. -ultron.remove('foo', 'bar', 'baz'); // Removes foo, bar and baz. -ultron.remove(); // Removes everything. -``` - -If you just want to remove a single event listener using a function reference -you can still use the EventEmitter's `removeListener(event, fn)` API: - -```js -function foo() {} - -ulton.on('foo', foo); -events.removeListener('foo', foo); -``` - -## License - -MIT diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/index.js deleted file mode 100644 index f0e8113..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/index.js +++ /dev/null @@ -1,125 +0,0 @@ -'use strict'; - -/** - * An auto incrementing id which we can use to create "unique" Ultron instances - * so we can track the event emitters that are added through the Ultron - * interface. - * - * @type {Number} - * @private - */ -var id = 0; - -/** - * Ultron is high-intelligence robot. It gathers intelligence so it can start improving - * upon his rudimentary design. It will learn from your EventEmitting patterns - * and exterminate them. - * - * @constructor - * @param {EventEmitter} ee EventEmitter instance we need to wrap. - * @api public - */ -function Ultron(ee) { - if (!(this instanceof Ultron)) return new Ultron(ee); - - this.id = id++; - this.ee = ee; -} - -/** - * Register a new EventListener for the given event. - * - * @param {String} event Name of the event. - * @param {Functon} fn Callback function. - * @param {Mixed} context The context of the function. - * @returns {Ultron} - * @api public - */ -Ultron.prototype.on = function on(event, fn, context) { - fn.__ultron = this.id; - this.ee.on(event, fn, context); - - return this; -}; -/** - * Add an EventListener that's only called once. - * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} context The context of the function. - * @returns {Ultron} - * @api public - */ -Ultron.prototype.once = function once(event, fn, context) { - fn.__ultron = this.id; - this.ee.once(event, fn, context); - - return this; -}; - -/** - * Remove the listeners we assigned for the given event. - * - * @returns {Ultron} - * @api public - */ -Ultron.prototype.remove = function remove() { - var args = arguments - , event; - - // - // When no event names are provided we assume that we need to clear all the - // events that were assigned through us. - // - if (args.length === 1 && 'string' === typeof args[0]) { - args = args[0].split(/[, ]+/); - } else if (!args.length) { - args = []; - - for (event in this.ee._events) { - if (this.ee._events.hasOwnProperty(event)) { - args.push(event); - } - } - } - - for (var i = 0; i < args.length; i++) { - var listeners = this.ee.listeners(args[i]); - - for (var j = 0; j < listeners.length; j++) { - event = listeners[j]; - - if (event.listener) { - if (event.listener.__ultron !== this.id) continue; - delete event.listener.__ultron; - } else { - if (event.__ultron !== this.id) continue; - delete event.__ultron; - } - - this.ee.removeListener(args[i], event); - } - } - - return this; -}; - -/** - * Destroy the Ultron instance, remove all listeners and release all references. - * - * @returns {Boolean} - * @api public - */ -Ultron.prototype.destroy = function destroy() { - if (!this.ee) return false; - - this.remove(); - this.ee = null; - - return true; -}; - -// -// Expose the module. -// -module.exports = Ultron; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/package.json deleted file mode 100644 index 0c85ad1..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "ultron", - "version": "1.0.1", - "description": "Ultron is high-intelligence robot. It gathers intel so it can start improving upon his rudimentary design", - "main": "index.js", - "scripts": { - "test": "mocha --reporter spec --ui bdd test.js", - "watch": "mocha --watch --reporter spec --ui bdd test.js", - "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter spec --ui bdd test.js", - "test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --ui bdd test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/unshiftio/ultron" - }, - "keywords": [ - "Ultron", - "robot", - "gather", - "intelligence", - "event", - "events", - "eventemitter", - "emitter", - "cleanup" - ], - "author": { - "name": "Arnout Kazemier" - }, - "license": "MIT", - "devDependencies": { - "assume": "0.0.x", - "eventemitter3": "0.1.x", - "istanbul": "0.3.x", - "mocha": "2.0.x", - "pre-commit": "0.0.x" - }, - "bugs": { - "url": "https://github.com/unshiftio/ultron/issues" - }, - "homepage": "https://github.com/unshiftio/ultron", - "gitHead": "1aae6f07661ebb69a60c466ef50b9798cfb7f631", - "_id": "ultron@1.0.1", - "_shasum": "c9d8d86c9cf2823028eb45629ab725897dd65dc5", - "_from": "ultron@1.0.x", - "_npmVersion": "1.4.28", - "_npmUser": { - "name": "V1", - "email": "info@3rd-Eden.com" - }, - "maintainers": [ - { - "name": "V1", - "email": "info@3rd-Eden.com" - }, - { - "name": "unshift", - "email": "npm@unshift.io" - } - ], - "dist": { - "shasum": "c9d8d86c9cf2823028eb45629ab725897dd65dc5", - "tarball": "http://registry.npmjs.org/ultron/-/ultron-1.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.1.tgz" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/test.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/test.js deleted file mode 100644 index 1fd4f1b..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/ultron/test.js +++ /dev/null @@ -1,327 +0,0 @@ -/* istanbul ignore next */ -describe('Ultron', function () { - 'use strict'; - - var EventEmitter = require('eventemitter3') - , EE = require('events').EventEmitter - , assume = require('assume') - , Ultron = require('./') - , ultron - , ee; - - beforeEach(function () { - ee = new EventEmitter(); - ultron = new Ultron(ee); - }); - - afterEach(function () { - ultron.destroy(); - ee.removeAllListeners(); - }); - - it('is exposed as a function', function () { - assume(Ultron).is.a('function'); - }); - - it('can be initialized without the new keyword', function () { - assume(Ultron(ee)).is.instanceOf(Ultron); - }); - - it('assigns a unique id to every instance', function () { - for (var i = 0; i < 100; i++) { - assume(ultron.id).does.not.equal((new Ultron()).id); - } - }); - - it('allows removal through the event emitter', function () { - function foo() {} - function bar() {} - - ultron.on('foo', foo); - ultron.once('foo', bar); - - assume(foo.__ultron).equals(ultron.id); - assume(bar.__ultron).equals(ultron.id); - assume(ee.listeners('foo').length).equals(2); - - ee.removeListener('foo', foo); - assume(ee.listeners('foo').length).equals(1); - - ee.removeListener('foo', bar); - assume(ee.listeners('foo').length).equals(0); - }); - - describe('#on', function () { - it('assigns a listener', function () { - assume(ee.listeners('foo').length).equals(0); - - function foo() {} - - ultron.on('foo', foo); - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('foo')[0]).equals(foo); - }); - - it('tags the assigned function', function () { - assume(ee.listeners('foo').length).equals(0); - - ultron.on('foo', function () {}); - assume(ee.listeners('foo')[0].__ultron).equals(ultron.id); - }); - - it('also passes in the context', function (next) { - var context = 1313; - - ultron.on('foo', function (a, b, c) { - assume(a).equals('a'); - assume(b).equals('b'); - assume(c).equals('c'); - - assume(this).equals(context); - - next(); - }, context); - - ee.emit('foo', 'a', 'b', 'c'); - }); - - it('works with regular eventemitters as well', function (next) { - var ee = new EE() - , ultron = new Ultron(ee); - - ultron.on('foo', function (a, b, c) { - assume(a).equals('a'); - assume(b).equals('b'); - assume(c).equals('c'); - - next(); - }); - - ee.emit('foo', 'a', 'b', 'c'); - }); - }); - - describe('#once', function () { - it('assigns a listener', function () { - assume(ee.listeners('foo').length).equals(0); - - function foo() {} - ultron.once('foo', foo); - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('foo')[0]).equals(foo); - }); - - it('tags the assigned function', function () { - assume(ee.listeners('foo').length).equals(0); - - ultron.once('foo', function () {}); - assume(ee.listeners('foo')[0].__ultron).equals(ultron.id); - }); - - it('also passes in the context', function (next) { - var context = 1313; - - ultron.once('foo', function (a, b, c) { - assume(a).equals('a'); - assume(b).equals('b'); - assume(c).equals('c'); - - assume(this).equals(context); - - next(); - }, context); - - ee.emit('foo', 'a', 'b', 'c'); - ee.emit('foo', 'a', 'b', 'c'); // Ensure that we don't double execute - }); - - it('works with regular eventemitters as well', function (next) { - var ee = new EE() - , ultron = new Ultron(ee); - - ultron.once('foo', function (a, b, c) { - assume(a).equals('a'); - assume(b).equals('b'); - assume(c).equals('c'); - - next(); - }); - - ee.emit('foo', 'a', 'b', 'c'); - ee.emit('foo', 'a', 'b', 'c'); // Ensure that we don't double execute - }); - }); - - describe('#remove', function () { - it('removes only our assigned `on` listeners', function () { - function foo() {} - function bar() {} - - ee.on('foo', foo); - ultron.on('foo', bar); - assume(ee.listeners('foo').length).equals(2); - - ultron.remove('foo'); - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('foo')[0]).equals(foo); - }); - - it('removes our private __ultron references', function () { - function once() {} - function on() {} - - assume('__ultron' in once).is.false(); - assume('__ultron' in on).is.false(); - - ultron.on('foo', on); - ultron.once('bar', once); - - assume('__ultron' in once).is.true(); - assume('__ultron' in on).is.true(); - - ultron.remove('foo, bar'); - - assume('__ultron' in once).is.false(); - assume('__ultron' in on).is.false(); - - ultron.destroy(); - - ee = new EE(); - ultron = new Ultron(ee); - - assume('__ultron' in once).is.false(); - assume('__ultron' in on).is.false(); - - ultron.on('foo', on); - ultron.once('bar', once); - - assume('__ultron' in once).is.true(); - assume('__ultron' in on).is.true(); - - ultron.remove('foo, bar'); - - assume('__ultron' in once).is.false(); - assume('__ultron' in on).is.false(); - }); - - it('removes only our assigned `once` listeners', function () { - function foo() {} - function bar() {} - - ee.once('foo', foo); - ultron.once('foo', bar); - assume(ee.listeners('foo').length).equals(2); - - ultron.remove('foo'); - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('foo')[0]).equals(foo); - }); - - it('removes only our assigned `once` listeners from regular EE', function () { - var ee = new EE() - , ultron = new Ultron(ee); - - function foo() {} - function bar() {} - - ee.once('foo', foo); - ultron.once('foo', bar); - assume(ee.listeners('foo').length).equals(2); - - ultron.remove('foo'); - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('foo')[0].listener).equals(foo); - }); - - it('removes all assigned events if called without args', function () { - function foo() {} - function bar() {} - - ultron.on('foo', foo); - ultron.on('bar', bar); - - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('bar').length).equals(1); - - ultron.remove(); - - assume(ee.listeners('foo').length).equals(0); - assume(ee.listeners('bar').length).equals(0); - }); - - it('removes multiple listeners based on args', function () { - function foo() {} - function bar() {} - function baz() {} - - ultron.on('foo', foo); - ultron.on('bar', bar); - ultron.on('baz', baz); - - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('bar').length).equals(1); - assume(ee.listeners('baz').length).equals(1); - - ultron.remove('foo', 'bar'); - - assume(ee.listeners('foo').length).equals(0); - assume(ee.listeners('bar').length).equals(0); - assume(ee.listeners('baz').length).equals(1); - }); - - it('removes multiple listeners if first arg is seperated string', function () { - function foo() {} - function bar() {} - function baz() {} - - ultron.on('foo', foo); - ultron.on('bar', bar); - ultron.on('baz', baz); - - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('bar').length).equals(1); - assume(ee.listeners('baz').length).equals(1); - - ultron.remove('foo, bar'); - - assume(ee.listeners('foo').length).equals(0); - assume(ee.listeners('bar').length).equals(0); - assume(ee.listeners('baz').length).equals(1); - }); - }); - - describe('#destroy', function () { - it('removes all listeners', function () { - function foo() {} - function bar() {} - function baz() {} - - ultron.on('foo', foo); - ultron.on('bar', bar); - ultron.on('baz', baz); - - assume(ee.listeners('foo').length).equals(1); - assume(ee.listeners('bar').length).equals(1); - assume(ee.listeners('baz').length).equals(1); - - ultron.destroy(); - - assume(ee.listeners('foo').length).equals(0); - assume(ee.listeners('bar').length).equals(0); - assume(ee.listeners('baz').length).equals(0); - }); - - it('removes the .ee reference', function () { - assume(ultron.ee).equals(ee); - ultron.destroy(); - assume(ultron.ee).equals(null); - }); - - it('returns booleans for state indication', function () { - assume(ultron.destroy()).is.true(); - assume(ultron.destroy()).is.false(); - assume(ultron.destroy()).is.false(); - assume(ultron.destroy()).is.false(); - }); - }); -}); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/package.json deleted file mode 100644 index cf6b0d3..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/package.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "author": { - "name": "Einar Otto Stangvik", - "email": "einaros@gmail.com", - "url": "http://2x.io" - }, - "name": "ws", - "description": "simple to use, blazing fast and thoroughly tested websocket client, server and console for node.js, up-to-date against RFC-6455", - "version": "0.5.0", - "license": "MIT", - "keywords": [ - "Hixie", - "HyBi", - "Push", - "RFC-6455", - "WebSocket", - "WebSockets", - "real-time" - ], - "repository": { - "type": "git", - "url": "git://github.com/einaros/ws.git" - }, - "scripts": { - "test": "make test", - "install": "(node-gyp rebuild 2> builderror.log) || (exit 0)" - }, - "dependencies": { - "nan": "1.4.x", - "options": ">=0.0.5", - "ultron": "1.0.x" - }, - "devDependencies": { - "ansi": "0.3.x", - "benchmark": "0.3.x", - "expect.js": "0.3.x", - "mocha": "2.0.x", - "should": "4.3.x", - "tinycolor": "0.0.x" - }, - "browser": "./lib/browser.js", - "component": { - "scripts": { - "ws/index.js": "./lib/browser.js" - } - }, - "gypfile": true, - "gitHead": "d242d2b8ddaa32f7f8a9c61abe74615767a91db4", - "bugs": { - "url": "https://github.com/einaros/ws/issues" - }, - "homepage": "https://github.com/einaros/ws", - "_id": "ws@0.5.0", - "_shasum": "b3980391dc4777d83974718aa361e808d86cf9ca", - "_from": "ws@0.5.0", - "_npmVersion": "1.4.28", - "_npmUser": { - "name": "V1", - "email": "info@3rd-Eden.com" - }, - "maintainers": [ - { - "name": "einaros", - "email": "einaros@gmail.com" - }, - { - "name": "V1", - "email": "info@3rd-Eden.com" - } - ], - "dist": { - "shasum": "b3980391dc4777d83974718aa361e808d86cf9ca", - "tarball": "http://registry.npmjs.org/ws/-/ws-0.5.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ws/-/ws-0.5.0.tgz" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/bufferutil.cc b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/bufferutil.cc deleted file mode 100644 index 7f99bd6..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/bufferutil.cc +++ /dev/null @@ -1,117 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "nan.h" - -using namespace v8; -using namespace node; - -class BufferUtil : public ObjectWrap -{ -public: - - static void Initialize(v8::Handle target) - { - NanScope(); - Local t = NanNew(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - NODE_SET_METHOD(t, "unmask", BufferUtil::Unmask); - NODE_SET_METHOD(t, "mask", BufferUtil::Mask); - NODE_SET_METHOD(t, "merge", BufferUtil::Merge); - target->Set(NanSymbol("BufferUtil"), t->GetFunction()); - } - -protected: - - static NAN_METHOD(New) - { - NanScope(); - BufferUtil* bufferUtil = new BufferUtil(); - bufferUtil->Wrap(args.This()); - NanReturnValue(args.This()); - } - - static NAN_METHOD(Merge) - { - NanScope(); - Local bufferObj = args[0]->ToObject(); - char* buffer = Buffer::Data(bufferObj); - Local array = Local::Cast(args[1]); - unsigned int arrayLength = array->Length(); - size_t offset = 0; - unsigned int i; - for (i = 0; i < arrayLength; ++i) { - Local src = array->Get(i)->ToObject(); - size_t length = Buffer::Length(src); - memcpy(buffer + offset, Buffer::Data(src), length); - offset += length; - } - NanReturnValue(NanTrue()); - } - - static NAN_METHOD(Unmask) - { - NanScope(); - Local buffer_obj = args[0]->ToObject(); - size_t length = Buffer::Length(buffer_obj); - Local mask_obj = args[1]->ToObject(); - unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); - unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); - size_t len32 = length / 4; - unsigned int i; - for (i = 0; i < len32; ++i) *(from + i) ^= *mask; - from += i; - switch (length % 4) { - case 3: *((unsigned char*)from+2) = *((unsigned char*)from+2) ^ ((unsigned char*)mask)[2]; - case 2: *((unsigned char*)from+1) = *((unsigned char*)from+1) ^ ((unsigned char*)mask)[1]; - case 1: *((unsigned char*)from ) = *((unsigned char*)from ) ^ ((unsigned char*)mask)[0]; - case 0:; - } - NanReturnValue(NanTrue()); - } - - static NAN_METHOD(Mask) - { - NanScope(); - Local buffer_obj = args[0]->ToObject(); - Local mask_obj = args[1]->ToObject(); - unsigned int *mask = (unsigned int*)Buffer::Data(mask_obj); - Local output_obj = args[2]->ToObject(); - unsigned int dataOffset = args[3]->Int32Value(); - unsigned int length = args[4]->Int32Value(); - unsigned int* to = (unsigned int*)(Buffer::Data(output_obj) + dataOffset); - unsigned int* from = (unsigned int*)Buffer::Data(buffer_obj); - unsigned int len32 = length / 4; - unsigned int i; - for (i = 0; i < len32; ++i) *(to + i) = *(from + i) ^ *mask; - to += i; - from += i; - switch (length % 4) { - case 3: *((unsigned char*)to+2) = *((unsigned char*)from+2) ^ *((unsigned char*)mask+2); - case 2: *((unsigned char*)to+1) = *((unsigned char*)from+1) ^ *((unsigned char*)mask+1); - case 1: *((unsigned char*)to ) = *((unsigned char*)from ) ^ *((unsigned char*)mask); - case 0:; - } - NanReturnValue(NanTrue()); - } -}; - -extern "C" void init (Handle target) -{ - NanScope(); - BufferUtil::Initialize(target); -} - -NODE_MODULE(bufferutil, init) - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/validation.cc b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/validation.cc deleted file mode 100644 index 0d9e242..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/src/validation.cc +++ /dev/null @@ -1,145 +0,0 @@ -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -#include -#include -#include -#include -#include -#include -#include -#include "nan.h" - -using namespace v8; -using namespace node; - -#define UNI_SUR_HIGH_START (uint32_t) 0xD800 -#define UNI_SUR_LOW_END (uint32_t) 0xDFFF -#define UNI_REPLACEMENT_CHAR (uint32_t) 0x0000FFFD -#define UNI_MAX_LEGAL_UTF32 (uint32_t) 0x0010FFFF - -static const uint8_t trailingBytesForUTF8[256] = { - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5 -}; - -static const uint32_t offsetsFromUTF8[6] = { - 0x00000000, 0x00003080, 0x000E2080, - 0x03C82080, 0xFA082080, 0x82082080 -}; - -static int isLegalUTF8(const uint8_t *source, const int length) -{ - uint8_t a; - const uint8_t *srcptr = source+length; - switch (length) { - default: return 0; - /* Everything else falls through when "true"... */ - /* RFC3629 makes 5 & 6 bytes UTF-8 illegal - case 6: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 5: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; */ - case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return 0; - case 2: if ((a = (*--srcptr)) > 0xBF) return 0; - switch (*source) { - /* no fall-through in this inner switch */ - case 0xE0: if (a < 0xA0) return 0; break; - case 0xED: if (a > 0x9F) return 0; break; - case 0xF0: if (a < 0x90) return 0; break; - case 0xF4: if (a > 0x8F) return 0; break; - default: if (a < 0x80) return 0; - } - - case 1: if (*source >= 0x80 && *source < 0xC2) return 0; - } - if (*source > 0xF4) return 0; - return 1; -} - -int is_valid_utf8 (size_t len, char *value) -{ - /* is the string valid UTF-8? */ - for (unsigned int i = 0; i < len; i++) { - uint32_t ch = 0; - uint8_t extrabytes = trailingBytesForUTF8[(uint8_t) value[i]]; - - if (extrabytes + i >= len) - return 0; - - if (isLegalUTF8 ((uint8_t *) (value + i), extrabytes + 1) == 0) return 0; - - switch (extrabytes) { - case 5 : ch += (uint8_t) value[i++]; ch <<= 6; - case 4 : ch += (uint8_t) value[i++]; ch <<= 6; - case 3 : ch += (uint8_t) value[i++]; ch <<= 6; - case 2 : ch += (uint8_t) value[i++]; ch <<= 6; - case 1 : ch += (uint8_t) value[i++]; ch <<= 6; - case 0 : ch += (uint8_t) value[i]; - } - - ch -= offsetsFromUTF8[extrabytes]; - - if (ch <= UNI_MAX_LEGAL_UTF32) { - if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) - return 0; - } else { - return 0; - } - } - - return 1; -} - -class Validation : public ObjectWrap -{ -public: - - static void Initialize(v8::Handle target) - { - NanScope(); - Local t = NanNew(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - NODE_SET_METHOD(t, "isValidUTF8", Validation::IsValidUTF8); - target->Set(NanSymbol("Validation"), t->GetFunction()); - } - -protected: - - static NAN_METHOD(New) - { - NanScope(); - Validation* validation = new Validation(); - validation->Wrap(args.This()); - NanReturnValue(args.This()); - } - - static NAN_METHOD(IsValidUTF8) - { - NanScope(); - if (!Buffer::HasInstance(args[0])) { - return NanThrowTypeError("First argument needs to be a buffer"); - } - Local buffer_obj = args[0]->ToObject(); - char *buffer_data = Buffer::Data(buffer_obj); - size_t buffer_length = Buffer::Length(buffer_obj); - NanReturnValue(is_valid_utf8(buffer_length, buffer_data) == 1 ? NanTrue() : NanFalse()); - } -}; - -extern "C" void init (Handle target) -{ - NanScope(); - Validation::Initialize(target); -} - -NODE_MODULE(validation, init) - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/README.md deleted file mode 100644 index 5b87ead..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# wscat - -WebSocket cat. - -## Installation - -This module needs to be installed globally so use the `-g` flag when installing: - -``` -npm install -g wscat -``` - -## Usage - -``` -$ wscat -c ws://echo.websocket.org -connected (press CTRL+C to quit) -> hi there -< hi there -> are you a happy parrot? -< are you a happy parrot? -``` - -## License - -MIT diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/bin/wscat b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/bin/wscat deleted file mode 100755 index 5ec8046..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/bin/wscat +++ /dev/null @@ -1,222 +0,0 @@ -#!/usr/bin/env node - -/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var program = require('commander') - , readline = require('readline') - , events = require('events') - , WebSocket = require('ws') - , util = require('util') - , fs = require('fs'); - -/** - * InputReader - processes console input. - */ -function Console() { - if (!(this instanceof Console)) return new Console(); - - this.stdin = process.stdin; - this.stdout = process.stdout; - - this.readlineInterface = readline.createInterface(this.stdin, this.stdout); - - var self = this; - - this.readlineInterface.on('line', function line(data) { - self.emit('line', data); - }).on('close', function close() { - self.emit('close'); - }); - - this._resetInput = function() { - self.clear(); - }; -} - -util.inherits(Console, events.EventEmitter); - -Console.Colors = { - Red: '\033[31m', - Green: '\033[32m', - Yellow: '\033[33m', - Blue: '\033[34m', - Default: '\033[39m' -}; - -Console.prototype.prompt = function prompt() { - this.readlineInterface.prompt(); -}; - -Console.prototype.print = function print(msg, color) { - this.clear(); - color = color || Console.Colors.Default; - this.stdout.write(color + msg + Console.Colors.Default + '\n'); - this.prompt(); -}; - -Console.prototype.clear = function clear() { - this.stdout.write('\033[2K\033[E'); -}; - -Console.prototype.pause = function pausing() { - this.stdin.on('keypress', this._resetInput); -}; - -Console.prototype.resume = function resume() { - this.stdin.removeListener('keypress', this._resetInput); -}; - -function appender(xs) { - xs = xs || []; - - return function (x) { - xs.push(x); - return xs; - }; -} - -function into(obj, kvals) { - kvals.forEach(function (kv) { - obj[kv[0]] = kv[1]; - }); - - return obj; -} - -function splitOnce(sep, str) { // sep can be either String or RegExp - var tokens = str.split(sep); - return [tokens[0], str.replace(sep, '').substr(tokens[0].length)]; -} - -/** - * The actual application - */ -var version = require('../package.json').version; - -program - .version(version) - .usage('[options] ') - .option('-l, --listen ', 'listen on port') - .option('-c, --connect ', 'connect to a websocket server') - .option('-p, --protocol ', 'optional protocol version') - .option('-o, --origin ', 'optional origin') - .option('--host ', 'optional host') - .option('-s, --subprotocol ', 'optional subprotocol') - .option('-n, --no-check', 'Do not check for unauthorized certificates') - .option('-H, --header ', 'Set an HTTP header. Repeat to set multiple. (--connect only)', appender(), []) - .option('--auth ', 'Add basic HTTP authentication header. (--connect only)') - .parse(process.argv); - -if (program.listen && program.connect) { - console.error('\033[33merror: use either --listen or --connect\033[39m'); - process.exit(-1); -} else if (program.listen) { - var wsConsole = new Console(); - wsConsole.pause(); - - var options = {}; - - if (program.protocol) options.protocolVersion = program.protocol; - if (program.origin) options.origin = program.origin; - if (program.subprotocol) options.protocol = program.subprotocol; - if (!program.check) options.rejectUnauthorized = program.check; - - var ws = null; - var wss = new WebSocket.Server({ port: program.listen }, function listening() { - wsConsole.print('listening on port ' + program.listen + ' (press CTRL+C to quit)', Console.Colors.Green); - wsConsole.clear(); - }); - - wsConsole.on('close', function close() { - try { ws.close(); } - catch (e) {} - - process.exit(0); - }); - - wsConsole.on('line', function line(data) { - if (ws) { - ws.send(data, { mask: false }); - wsConsole.prompt(); - } - }); - - wss.on('connection', function(newClient) { - if (ws) return newClient.terminate(); - - ws = newClient; - wsConsole.resume(); - wsConsole.prompt(); - wsConsole.print('client connected', Console.Colors.Green); - - ws.on('close', function close() { - wsConsole.print('disconnected', Console.Colors.Green); - wsConsole.clear(); - wsConsole.pause(); - ws = null; - }).on('error', function error(code, description) { - wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow); - }).on('message', function message(data, flags) { - wsConsole.print('< ' + data, Console.Colors.Blue); - }); - }).on('error', function servererrror(error) { - wsConsole.print('error: ' + error.toString(), Console.Colors.Yellow); - process.exit(-1); - }); -} else if (program.connect) { - var wsConsole = new Console(); - var options = {}; - - if (program.protocol) options.protocolVersion = program.protocol; - if (program.origin) options.origin = program.origin; - if (program.subprotocol) options.protocol = program.subprotocol; - if (program.host) options.host = program.host; - if (!program.check) options.rejectUnauthorized = program.check; - - var headers = into({}, (program.header || []).map(function split(s) { - return splitOnce(':', s); - })); - - if (program.auth) { - headers.Authorization = 'Basic '+ new Buffer(program.auth).toString('base64'); - } - - options.headers = headers; - var ws = new WebSocket(program.connect, options); - - ws.on('open', function open() { - wsConsole.print('connected (press CTRL+C to quit)', Console.Colors.Green); - wsConsole.on('line', function line(data) { - ws.send(data, { mask: true }); - wsConsole.prompt(); - }); - }).on('close', function close() { - wsConsole.print('disconnected', Console.Colors.Green); - wsConsole.clear(); - process.exit(); - }).on('error', function error(code, description) { - wsConsole.print('error: ' + code + (description ? ' ' + description : ''), Console.Colors.Yellow); - process.exit(-1); - }).on('message', function message(data, flags) { - wsConsole.print('< ' + data, Console.Colors.Blue); - }); - - wsConsole.on('close', function close() { - if (!ws) return; - - try { ws.close(); } - catch(e) {} - - process.exit(); - }); -} else { - program.help(); -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/package.json deleted file mode 100644 index d275562..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/node_modules/ws/wscat/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "wscat", - "version": "1.0.0", - "description": "WebSocket cat", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "https://github.com/einaros/ws/tree/master/wscat" - }, - "keywords": [ - "wscat", - "websocket", - "cat" - ], - "author": "Arnout Kazemier, Einar Otto Stangvik", - "license": "MIT", - "dependencies": { - "commander": "2.5.x", - "tinycolor": "0.0.x", - "ws": "0.4.x" - }, - "bin": { - "wscat": "./bin/wscat" - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/package.json deleted file mode 100644 index a1cc32a..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "engine.io", - "version": "1.4.3", - "description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server", - "main": "./lib/engine.io", - "author": { - "name": "Guillermo Rauch", - "email": "guillermo@learnboost.com" - }, - "homepage": "https://github.com/LearnBoost/engine.io", - "repository": { - "type": "git", - "url": "git@github.com:LearnBoost/engine.io.git" - }, - "contributors": [ - { - "name": "Eugen Dueck", - "url": "https://github.com/EugenDueck" - }, - { - "name": "Afshin Mehrabani", - "url": "https://github.com/afshinm" - }, - { - "name": "Christoph Dorn", - "url": "https://github.com/cadorn" - }, - { - "name": "Mark Mokryn", - "email": "mokesmokes@gmail.com" - } - ], - "dependencies": { - "debug": "1.0.3", - "ws": "0.5.0", - "engine.io-parser": "1.1.0", - "base64id": "0.1.0" - }, - "devDependencies": { - "mocha": "1.12.0", - "expect.js": "0.2.0", - "superagent": "0.15.4", - "engine.io-client": "1.4.3", - "s": "0.1.1" - }, - "scripts": { - "test": "make test" - }, - "gitHead": "d95ba537f806400d0729a2f387ac9152f46687ff", - "bugs": { - "url": "https://github.com/LearnBoost/engine.io/issues" - }, - "_id": "engine.io@1.4.3", - "_shasum": "0ac97dad713e8ca821c1f18ab037bf088555c3a6", - "_from": "engine.io@1.4.3", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "dist": { - "shasum": "0ac97dad713e8ca821c1f18ab037bf088555c3a6", - "tarball": "http://registry.npmjs.org/engine.io/-/engine.io-1.4.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.4.3.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/.npmignore deleted file mode 100644 index a72b52e..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/.npmignore +++ /dev/null @@ -1,15 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -npm-debug.log -node_modules diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/LICENSE b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/LICENSE deleted file mode 100644 index e6603cd..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Kevin Roark - -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 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/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/Makefile deleted file mode 100644 index 1d90629..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/Makefile +++ /dev/null @@ -1,3 +0,0 @@ - -test: - @./node_modules/.bin/mocha test.js diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/README.md deleted file mode 100644 index 76a0035..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/README.md +++ /dev/null @@ -1,4 +0,0 @@ -has-binarydata.js -================= - -Simple module to test if an object contains binary data diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/fixtures/big.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/fixtures/big.json deleted file mode 100644 index 3172879..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/fixtures/big.json +++ /dev/null @@ -1 +0,0 @@ -{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":{"k":"cool"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/gen.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/gen.js deleted file mode 100644 index 40e4ce4..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/gen.js +++ /dev/null @@ -1,17 +0,0 @@ -var ob = {}; - -var max = 5230; // just before call stack breaks -var count = 0; - -function g(o) { - if (count++ < max) { - o.k = {}; - g(o.k); - } - else { - o.k = 'cool'; - } -} - -g(ob); -console.log(JSON.stringify(ob)); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/index.js deleted file mode 100644 index eaea571..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/index.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Module requirements. - */ - -var isArray = require('isarray'); - -/** - * Module exports. - */ - -module.exports = hasBinary; - -/** - * Checks for binary data. - * - * Right now only Buffer and ArrayBuffer are supported.. - * - * @param {Object} anything - * @api public - */ - -function hasBinary(data) { - - function _hasBinary(obj) { - if (!obj) return false; - - if ( (global.Buffer && Buffer.isBuffer(obj)) || - (global.ArrayBuffer && obj instanceof ArrayBuffer) || - (global.Blob && obj instanceof Blob) || - (global.File && obj instanceof File) - ) { - return true; - } - - if (isArray(obj)) { - for (var i = 0; i < obj.length; i++) { - if (_hasBinary(obj[i])) { - return true; - } - } - } else if (obj && 'object' == typeof obj) { - if (obj.toJSON) { - obj = obj.toJSON(); - } - - for (var key in obj) { - if (obj.hasOwnProperty(key) && _hasBinary(obj[key])) { - return true; - } - } - } - - return false; - } - - return _hasBinary(data); -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/README.md deleted file mode 100644 index 052a62b..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/README.md +++ /dev/null @@ -1,54 +0,0 @@ - -# isarray - -`Array#isArray` for older browsers. - -## Usage - -```js -var isArray = require('isarray'); - -console.log(isArray([])); // => true -console.log(isArray({})); // => false -``` - -## Installation - -With [npm](http://npmjs.org) do - -```bash -$ npm install isarray -``` - -Then bundle for the browser with -[browserify](https://github.com/substack/browserify). - -With [component](http://component.io) do - -```bash -$ component install juliangruber/isarray -``` - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -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 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/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/build/build.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/build/build.js deleted file mode 100644 index ec58596..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/build/build.js +++ /dev/null @@ -1,209 +0,0 @@ - -/** - * Require the given path. - * - * @param {String} path - * @return {Object} exports - * @api public - */ - -function require(path, parent, orig) { - var resolved = require.resolve(path); - - // lookup failed - if (null == resolved) { - orig = orig || path; - parent = parent || 'root'; - var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); - err.path = orig; - err.parent = parent; - err.require = true; - throw err; - } - - var module = require.modules[resolved]; - - // perform real require() - // by invoking the module's - // registered function - if (!module.exports) { - module.exports = {}; - module.client = module.component = true; - module.call(this, module.exports, require.relative(resolved), module); - } - - return module.exports; -} - -/** - * Registered modules. - */ - -require.modules = {}; - -/** - * Registered aliases. - */ - -require.aliases = {}; - -/** - * Resolve `path`. - * - * Lookup: - * - * - PATH/index.js - * - PATH.js - * - PATH - * - * @param {String} path - * @return {String} path or null - * @api private - */ - -require.resolve = function(path) { - if (path.charAt(0) === '/') path = path.slice(1); - var index = path + '/index.js'; - - var paths = [ - path, - path + '.js', - path + '.json', - path + '/index.js', - path + '/index.json' - ]; - - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; - if (require.modules.hasOwnProperty(path)) return path; - } - - if (require.aliases.hasOwnProperty(index)) { - return require.aliases[index]; - } -}; - -/** - * Normalize `path` relative to the current path. - * - * @param {String} curr - * @param {String} path - * @return {String} - * @api private - */ - -require.normalize = function(curr, path) { - var segs = []; - - if ('.' != path.charAt(0)) return path; - - curr = curr.split('/'); - path = path.split('/'); - - for (var i = 0; i < path.length; ++i) { - if ('..' == path[i]) { - curr.pop(); - } else if ('.' != path[i] && '' != path[i]) { - segs.push(path[i]); - } - } - - return curr.concat(segs).join('/'); -}; - -/** - * Register module at `path` with callback `definition`. - * - * @param {String} path - * @param {Function} definition - * @api private - */ - -require.register = function(path, definition) { - require.modules[path] = definition; -}; - -/** - * Alias a module definition. - * - * @param {String} from - * @param {String} to - * @api private - */ - -require.alias = function(from, to) { - if (!require.modules.hasOwnProperty(from)) { - throw new Error('Failed to alias "' + from + '", it does not exist'); - } - require.aliases[to] = from; -}; - -/** - * Return a require function relative to the `parent` path. - * - * @param {String} parent - * @return {Function} - * @api private - */ - -require.relative = function(parent) { - var p = require.normalize(parent, '..'); - - /** - * lastIndexOf helper. - */ - - function lastIndexOf(arr, obj) { - var i = arr.length; - while (i--) { - if (arr[i] === obj) return i; - } - return -1; - } - - /** - * The relative require() itself. - */ - - function localRequire(path) { - var resolved = localRequire.resolve(path); - return require(resolved, parent, path); - } - - /** - * Resolve relative to the parent. - */ - - localRequire.resolve = function(path) { - var c = path.charAt(0); - if ('/' == c) return path.slice(1); - if ('.' == c) return require.normalize(p, path); - - // resolve deps by returning - // the dep in the nearest "deps" - // directory - var segs = parent.split('/'); - var i = lastIndexOf(segs, 'deps') + 1; - if (!i) i = 0; - path = segs.slice(0, i + 1).join('/') + '/deps/' + path; - return path; - }; - - /** - * Check if module is defined at `path`. - */ - - localRequire.exists = function(path) { - return require.modules.hasOwnProperty(localRequire.resolve(path)); - }; - - return localRequire; -}; -require.register("isarray/index.js", function(exports, require, module){ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - -}); -require.alias("isarray/index.js", "isarray/index.js"); - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/component.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/component.json deleted file mode 100644 index 9e31b68..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name" : "isarray", - "description" : "Array#isArray for older browsers", - "version" : "0.0.1", - "repository" : "juliangruber/isarray", - "homepage": "https://github.com/juliangruber/isarray", - "main" : "index.js", - "scripts" : [ - "index.js" - ], - "dependencies" : {}, - "keywords": ["browser","isarray","array"], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/index.js deleted file mode 100644 index 5f5ad45..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/package.json deleted file mode 100644 index fc7904b..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/node_modules/isarray/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "isarray", - "description": "Array#isArray for older browsers", - "version": "0.0.1", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/isarray.git" - }, - "homepage": "https://github.com/juliangruber/isarray", - "main": "index.js", - "scripts": { - "test": "tap test/*.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "*" - }, - "keywords": [ - "browser", - "isarray", - "array" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", - "readmeFilename": "README.md", - "_id": "isarray@0.0.1", - "dist": { - "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "_from": "isarray@0.0.1", - "_npmVersion": "1.2.18", - "_npmUser": { - "name": "juliangruber", - "email": "julian@juliangruber.com" - }, - "maintainers": [ - { - "name": "juliangruber", - "email": "julian@juliangruber.com" - } - ], - "directories": {}, - "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/package.json deleted file mode 100644 index 041c846..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "has-binary-data", - "version": "0.1.3", - "description": "A function that takes anything in javascript and returns true if its argument contains binary data.", - "dependencies": { - "isarray": "0.0.1" - }, - "devDependencies": { - "better-assert": "1.0.0", - "mocha": "1.17.1" - }, - "author": { - "name": "Kevin Roark" - }, - "license": "ISC", - "_id": "has-binary-data@0.1.3", - "dist": { - "shasum": "8ebb18388b57f19a5231275a16fc18d51f379aae", - "tarball": "http://registry.npmjs.org/has-binary-data/-/has-binary-data-0.1.3.tgz" - }, - "_from": "has-binary-data@0.1.3", - "_npmVersion": "1.3.24", - "_npmUser": { - "name": "porkfat", - "email": "ker2143@columbia.edu" - }, - "maintainers": [ - { - "name": "porkfat", - "email": "ker2143@columbia.edu" - } - ], - "directories": {}, - "_shasum": "8ebb18388b57f19a5231275a16fc18d51f379aae", - "_resolved": "https://registry.npmjs.org/has-binary-data/-/has-binary-data-0.1.3.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/test.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/test.js deleted file mode 100644 index 5320d4f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/has-binary-data/test.js +++ /dev/null @@ -1,108 +0,0 @@ - -var hasBinary = require('./'); -var assert = require('better-assert'); -var fs = require('fs'); - -var start = new Date(); - -describe('has-binarydata', function(){ - - it('should work with buffer', function(){ - assert(hasBinary(fs.readFileSync('./test.js'))); - }); - - it('should work with an array that does not contain binary', function() { - var arr = [1, 'cool', 2]; - assert(!hasBinary(arr)); - }); - - it('should work with an array that contains a buffer', function() { - var arr = [1, new Buffer('asdfasdf', 'utf8'), 2]; - assert(hasBinary(arr)); - }); - - it('should work with an object that does not contain binary', function() { - var ob = {a: 'a', b: [], c: 1234}; - assert(!hasBinary(ob)); - }); - - it('should work with an object that contains a buffer', function() { - var ob = {a: 'a', b: new Buffer('abc'), c: 1234}; - assert(hasBinary(ob)); - }); - - it('should work with null', function() { - assert(!hasBinary(null)); - }); - - it('should work with undefined', function() { - assert(!hasBinary(undefined)); - }); - - it('should work with a complex object that contains undefined and no binary', function() { - var ob = { - x: ['a', 'b', 123], - y: undefined, - z: {a: 'x', b: 'y', c: 3, d: null}, - w: [] - }; - assert(!hasBinary(ob)); - }); - - it('should work with a complex object that contains undefined and binary', function() { - var ob = { - x: ['a', 'b', 123], - y: undefined, - z: {a: 'x', b: 'y', c: 3, d: null}, - w: [], - bin: new Buffer('xxx') - }; - assert(hasBinary(ob)); - }); - - it('should handle a very large json object with no binary', function(done) { - this.timeout(); - fs.readFile(__dirname + '/fixtures/big.json', function(err, data) { - if (err) { - console.log(err); - assert(false); - } - data = JSON.parse(data); - assert(!hasBinary(data)); - done(); - }); - }); - - it('should handle a very large json object with binary', function(done) { - this.timeout(); - fs.readFile(__dirname + '/fixtures/big.json', function(err, data) { - if (err) { - console.log(err); - assert(false); - } - var ob = JSON.parse(data); - ob.bin = {bin: {bin: {bin: new Buffer('abc')}}}; - assert(hasBinary(ob)); - done(); - }); - }); - - if (global.ArrayBuffer) { - it('should work with an ArrayBuffer', function() { - assert(hasBinary(new ArrayBuffer())); - }); - } - - if (global.Blob) { - it('should work with a Blob', function() { - assert(hasBinary(new Blob())); - }); - } - - it('should print the test time', function() { - var end = new Date(); - var diff = end - start; - console.log('\ntest time: ' + diff + ' ms'); - }); - -}); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/History.md deleted file mode 100644 index 1234b9f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/History.md +++ /dev/null @@ -1,25 +0,0 @@ - -0.3.1 / 2014-10-27 -================== - - * bump parser version - * fix room autopruning - * add autoprunning of empty rooms - * rooms are now created as objects - * added the repository field. - * updated the debug dependency. - -0.3.0 / 2014-05-30 -================== - - * bump `socket.io-parser` for binary ack fix - -0.2.0 / 2014-03-14 -================== - - * upgraded faster parser - -0.1.0 / 2014-03-07 -================== - - * initial commit diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/Readme.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/Readme.md deleted file mode 100644 index bcef653..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/Readme.md +++ /dev/null @@ -1,16 +0,0 @@ - -# socket.io-adapter - -Default socket.io in-memory adapter class. - -## How to use - -This module is not intended for end-user usage, but can be used as an -interface to inheirt from from other adapters you might want to build. - -As an example of an adapter that builds on top of this, please take a look -at [socket.io-redis](https://github.com/learnboost/socket.io-redis). - -## License - -MIT diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/index.js deleted file mode 100644 index 58b84c9..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/index.js +++ /dev/null @@ -1,144 +0,0 @@ - -/** - * Module dependencies. - */ - -var keys = require('object-keys'); -var Emitter = require('events').EventEmitter; -var parser = require('socket.io-parser'); - -/** - * Module exports. - */ - -module.exports = Adapter; - -/** - * Memory adapter constructor. - * - * @param {Namespace} nsp - * @api public - */ - -function Adapter(nsp){ - this.nsp = nsp; - this.rooms = {}; - this.sids = {}; - this.encoder = new parser.Encoder(); -} - -/** - * Inherits from `EventEmitter`. - */ - -Adapter.prototype.__proto__ = Emitter.prototype; - -/** - * Adds a socket from a room. - * - * @param {String} socket id - * @param {String} room name - * @param {Function} callback - * @api public - */ - -Adapter.prototype.add = function(id, room, fn){ - this.sids[id] = this.sids[id] || {}; - this.sids[id][room] = true; - this.rooms[room] = this.rooms[room] || {}; - this.rooms[room][id] = true; - if (fn) process.nextTick(fn.bind(null, null)); -}; - -/** - * Removes a socket from a room. - * - * @param {String} socket id - * @param {String} room name - * @param {Function} callback - * @api public - */ - -Adapter.prototype.del = function(id, room, fn){ - this.sids[id] = this.sids[id] || {}; - this.rooms[room] = this.rooms[room] || {}; - delete this.sids[id][room]; - delete this.rooms[room][id]; - if (this.rooms.hasOwnProperty(room) && !keys(this.rooms[room]).length) { - delete this.rooms[room]; - } - - if (fn) process.nextTick(fn.bind(null, null)); -}; - -/** - * Removes a socket from all rooms it's joined. - * - * @param {String} socket id - * @api public - */ - -Adapter.prototype.delAll = function(id, fn){ - var rooms = this.sids[id]; - if (rooms) { - for (var room in rooms) { - if (rooms.hasOwnProperty(room)) { - delete this.rooms[room][id]; - } - - if (this.rooms.hasOwnProperty(room) && !keys(this.rooms[room]).length) { - delete this.rooms[room]; - } - } - } - delete this.sids[id]; -}; - -/** - * Broadcasts a packet. - * - * Options: - * - `flags` {Object} flags for this packet - * - `except` {Array} sids that should be excluded - * - `rooms` {Array} list of rooms to broadcast to - * - * @param {Object} packet object - * @api public - */ - -Adapter.prototype.broadcast = function(packet, opts){ - var rooms = opts.rooms || []; - var except = opts.except || []; - var flags = opts.flags || {}; - var ids = {}; - var self = this; - var socket; - - packet.nsp = this.nsp.name; - this.encoder.encode(packet, function(encodedPackets) { - if (rooms.length) { - for (var i = 0; i < rooms.length; i++) { - var room = self.rooms[rooms[i]]; - if (!room) continue; - for (var id in room) { - if (room.hasOwnProperty(id)) { - if (ids[id] || ~except.indexOf(id)) continue; - socket = self.nsp.connected[id]; - if (socket) { - socket.packet(encodedPackets, true, flags.volatile); - ids[id] = true; - } - } - } - } - } else { - for (var id in self.sids) { - if (self.sids.hasOwnProperty(id)) { - if (~except.indexOf(id)) continue; - socket = self.nsp.connected[id]; - if (socket) socket.packet(encodedPackets, true, flags.volatile); - } - } - } - }); -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/.jshintrc b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/.jshintrc deleted file mode 100644 index 299877f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "laxbreak": true -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/.npmignore deleted file mode 100644 index 7e6163d..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -support -test -examples -example -*.sock -dist diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/History.md deleted file mode 100644 index 42139a8..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/History.md +++ /dev/null @@ -1,126 +0,0 @@ - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/Makefile deleted file mode 100644 index b0bde6e..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 -THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) - -# BIN directory -BIN := $(THIS_DIR)/node_modules/.bin - -# applications -NODE ?= $(shell which node) -NPM ?= $(NODE) $(shell which npm) -BROWSERIFY ?= $(NODE) $(BIN)/browserify - -all: dist/debug.js - -install: node_modules - -clean: - @rm -rf node_modules dist - -dist: - @mkdir -p $@ - -dist/debug.js: node_modules browser.js debug.js dist - @$(BROWSERIFY) \ - --standalone debug \ - . > $@ - -node_modules: package.json - @NODE_ENV= $(NPM) install - @touch node_modules - -.PHONY: all install clean diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/Readme.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/Readme.md deleted file mode 100644 index e3607db..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/Readme.md +++ /dev/null @@ -1,153 +0,0 @@ -# debug - - tiny node.js debugging utility modelled after node core's debugging technique. - -## Installation - -```bash -$ npm install debug -``` - -## Usage - - With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. - -Example _app.js_: - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example _worker.js_: - -```js -var debug = require('debug')('worker'); - -setInterval(function(){ - debug('doing some work'); -}, 1000); -``` - - The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: - - ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) - - ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - -#### Web Inspector Colors - - Colors are also enabled on "Web Inspectors" that understand the `%c` formatting - option. These are WebKit web inspectors, and the Firebug plugin for Firefox. - Colored output looks something like: - - ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) - -### stderr vs stdout - -You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: - -Example _stderr.js_: - -```js -var debug = require('../'); -var log = debug('app:log'); - -// by default console.log is used -log('goes to stdout!'); - -var error = debug('app:error'); -// set this namespace to log via console.error -error.log = console.error.bind(console); // don't forget to bind to console! -error('goes to stderr'); -log('still goes to stdout!'); - -// set all output to go via console.warn -// overrides all per-namespace log settings -debug.log = console.warn.bind(console); -log('now goes to stderr via console.warn'); -error('still goes to stderr, but via console.warn now'); -``` - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - -## License - -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> - -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 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/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/browser.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/browser.js deleted file mode 100644 index 41d957c..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/browser.js +++ /dev/null @@ -1,144 +0,0 @@ - -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors and the Firebug - * extension (*not* the built-in Firefox web inpector) are - * known to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? '%c ' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args - - var c = 'color: ' + this.color; - args = [args[0], c, ''].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // This hackery is required for IE8, - // where the `console.log` function doesn't have 'apply' - return 'object' == typeof console - && 'function' == typeof console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - localStorage.removeItem('debug'); - } else { - localStorage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = localStorage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/component.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/component.json deleted file mode 100644 index dfb0311..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "debug", - "repo": "visionmedia/debug", - "description": "small debugging utility", - "version": "1.0.2", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "guille/ms.js": "0.6.1" - } -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/debug.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/debug.js deleted file mode 100644 index c514fb7..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/debug.js +++ /dev/null @@ -1,197 +0,0 @@ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = debug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - -exports.formatters = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function debug(namespace) { - - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; - - // define the `enabled` version - function enabled() { - - var self = enabled; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = exports.log || enabled.log || console.log.bind(console); - logFn.apply(self, args); - } - enabled.enabled = true; - - var fn = exports.enabled(namespace) ? enabled : disabled; - - fn.namespace = namespace; - - return fn; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace('*', '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node.js deleted file mode 100644 index c94f7d1..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node.js +++ /dev/null @@ -1,129 +0,0 @@ - -/** - * Module dependencies. - */ - -var tty = require('tty'); -var util = require('util'); - -/** - * This is the Node.js implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; - -/** - * Colors. - */ - -exports.colors = [6, 2, 3, 4, 5, 1]; - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); - if (0 === debugColors.length) { - return tty.isatty(1); - } else { - return '0' !== debugColors - && 'no' !== debugColors - && 'false' !== debugColors - && 'disabled' !== debugColors; - } -} - -/** - * Map %o to `util.inspect()`, since Node doesn't do that out of the box. - */ - -var inspect = (4 === util.inspect.length ? - // node <= 0.8.x - function (v, colors) { - return util.inspect(v, void 0, void 0, colors); - } : - // node > 0.8.x - function (v, colors) { - return util.inspect(v, { colors: colors }); - } -); - -exports.formatters.o = function(v) { - return inspect(v, this.useColors) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - var name = this.namespace; - - if (useColors) { - var c = this.color; - - args[0] = ' \u001b[9' + c + 'm' + name + ' ' - + '\u001b[0m' - + args[0] + '\u001b[3' + c + 'm' - + ' +' + exports.humanize(this.diff) + '\u001b[0m'; - } else { - args[0] = new Date().toUTCString() - + ' ' + name + ' ' + args[0]; - } - return args; -} - -/** - * Invokes `console.log()` with the specified arguments. - */ - -function log() { - return console.log.apply(console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/.npmignore deleted file mode 100644 index d1aa0ce..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -test -History.md -Makefile -component.json diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/README.md deleted file mode 100644 index d4ab12a..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# ms.js: miliseconds conversion utility - -```js -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5s') // 5000 -ms('100') // 100 -``` - -```js -ms(60000) // "1m" -ms(2 * 60000) // "2m" -ms(ms('10 hours')) // "10h" -``` - -```js -ms(60000, { long: true }) // "1 minute" -ms(2 * 60000, { long: true }) // "2 minutes" -ms(ms('10 hours', { long: true })) // "10 hours" -``` - -- Node/Browser compatible. Published as `ms` in NPM. -- If a number is supplied to `ms`, a string with a unit is returned. -- If a string that contains the number is supplied, it returns it as -a number (e.g: it returns `100` for `'100'`). -- If you pass a string with a number and a valid unit, the number of -equivalent ms is returned. - -## License - -MIT \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/index.js deleted file mode 100644 index c5847f8..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/index.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 's': - return n * s; - case 'ms': - return n; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/package.json deleted file mode 100644 index 9ad9189..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/node_modules/ms/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "ms", - "version": "0.6.2", - "description": "Tiny ms conversion utility", - "repository": { - "type": "git", - "url": "git://github.com/guille/ms.js.git" - }, - "main": "./index", - "devDependencies": { - "mocha": "*", - "expect.js": "*", - "serve": "*" - }, - "component": { - "scripts": { - "ms/index.js": "index.js" - } - }, - "bugs": { - "url": "https://github.com/guille/ms.js/issues" - }, - "_id": "ms@0.6.2", - "dist": { - "shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.6.2.tgz" - }, - "_from": "ms@0.6.2", - "_npmVersion": "1.2.30", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "directories": {}, - "_shasum": "d89c2124c6fdc1353d65a8b77bf1aac4b193708c", - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.6.2.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/guille/ms.js", - "scripts": {} -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/package.json deleted file mode 100644 index 14cc898..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/debug/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "debug", - "version": "1.0.2", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/debug.git" - }, - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "contributors": [ - { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io" - } - ], - "dependencies": { - "ms": "0.6.2" - }, - "devDependencies": { - "browserify": "4.1.6", - "mocha": "*" - }, - "main": "./node.js", - "browser": "./browser.js", - "component": { - "scripts": { - "debug/index.js": "browser.js", - "debug/debug.js": "debug.js" - } - }, - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "homepage": "https://github.com/visionmedia/debug", - "_id": "debug@1.0.2", - "_shasum": "3849591c10cce648476c3c7c2e2e3416db5963c4", - "_from": "debug@1.0.2", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "dist": { - "shasum": "3849591c10cce648476c3c7c2e2e3416db5963c4", - "tarball": "http://registry.npmjs.org/debug/-/debug-1.0.2.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.2.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.jscs.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.jscs.json deleted file mode 100644 index 97ab933..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.jscs.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], - - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], - - "disallowSpaceAfterKeywords": [], - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": "allButReserved", - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "requireSpaceAfterPrefixUnaryOperators": [], - - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforePostfixUnaryOperators": [], - - "disallowSpaceBeforeBinaryOperators": [], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "disallowSpaceAfterBinaryOperators": [], - - "disallowImplicitTypeConversion": ["binary", "string"], - - "disallowKeywords": ["with", "eval"], - - "validateLineBreaks": "LF", - - "requireKeywordsOnNewLine": [], - "disallowKeywordsOnNewLine": ["else"], - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "excludeFiles": ["node_modules/**", "vendor/**"], - - "disallowMultipleLineStrings": true, - - "additionalRules": [] -} - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.npmignore deleted file mode 100644 index a777a81..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -test/* - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.travis.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.travis.yml deleted file mode 100644 index 912080a..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: node_js -node_js: - - "0.11" - - "0.10" - - "0.9" - - "0.8" - - "0.6" - - "0.4" -before_install: - - '[ "${TRAVIS_NODE_VERSION}" == "0.6" ] || npm install -g npm@~1.4.6' -matrix: - fast_finish: true - allow_failures: - - node_js: "0.11" - - node_js: "0.9" - - node_js: "0.6" - - node_js: "0.4" - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/CHANGELOG.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/CHANGELOG.md deleted file mode 100644 index 187a954..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/CHANGELOG.md +++ /dev/null @@ -1,151 +0,0 @@ -1.0.0 / 2014-08-26 -================= - * v1.0.0 - -0.6.1 / 2014-08-25 -================= - * v0.6.1 - * Updating dependencies (tape, covert, is) - * Update badges in readme - * Use separate var statements - -0.6.0 / 2014-04-23 -================= - * v0.6.0 - * Updating dependencies (tape, covert) - * Make sure boxed primitives, and arguments objects, work properly in ES3 browsers - * Improve test matrix: test all node versions, but only latest two stables are a failure - * Remove internal foreach shim. - -0.5.1 / 2014-03-09 -================= - * 0.5.1 - * Updating dependencies (tape, covert, is) - * Removing forEach from the module (but keeping it in tests) - -0.5.0 / 2014-01-30 -================= - * 0.5.0 - * Explicitly returning the shim, instead of returning native Object.keys when present - * Adding a changelog. - * Cleaning up IIFE wrapping - * Testing on node 0.4 through 0.11 - -0.4.0 / 2013-08-14 -================== - - * v0.4.0 - * In Chrome 4-10 and Safari 4, typeof (new RegExp) === 'function' - * If it's a string, make sure to use charAt instead of brackets. - * Only use Function#call if necessary. - * Making sure the context tests actually run. - * Better function detection - * Adding the android browser - * Fixing testling files - * Updating tape - * Removing the "is" dependency. - * Making an isArguments shim. - * Adding a local forEach shim and tests. - * Updating paths. - * Moving the shim test. - * v0.3.0 - -0.3.0 / 2013-05-18 -================== - - * README tweak. - * Fixing constructor enum issue. Fixes [#5](https://github.com/ljharb/object-keys/issues/5). - * Adding a test for [#5](https://github.com/ljharb/object-keys/issues/5) - * Updating readme. - * Updating dependencies. - * Giving credit to lodash. - * Make sure that a prototype's constructor property is not enumerable. Fixes [#3](https://github.com/ljharb/object-keys/issues/3). - * Adding additional tests to handle arguments objects, and to skip "prototype" in functions. Fixes [#2](https://github.com/ljharb/object-keys/issues/2). - * Fixing a typo on this test for [#3](https://github.com/ljharb/object-keys/issues/3). - * Adding node 0.10 to travis. - * Adding an IE < 9 test per [#3](https://github.com/ljharb/object-keys/issues/3) - * Adding an iOS 5 mobile Safari test per [#2](https://github.com/ljharb/object-keys/issues/2) - * Moving "indexof" and "is" to be dev dependencies. - * Making sure the shim works with functions. - * Flattening the tests. - -0.2.0 / 2013-05-10 -================== - - * v0.2.0 - * Object.keys should work with arrays. - -0.1.8 / 2013-05-10 -================== - - * v0.1.8 - * Upgrading dependencies. - * Using a simpler check. - * Fixing a bug in hasDontEnumBug browsers. - * Using the newest tape! - * Fixing this error test. - * "undefined" is probably a reserved word in ES3. - * Better test message. - -0.1.7 / 2013-04-17 -================== - - * Upgrading "is" once more. - * The key "null" is breaking some browsers. - -0.1.6 / 2013-04-17 -================== - - * v0.1.6 - * Upgrading "is" - -0.1.5 / 2013-04-14 -================== - - * Bumping version. - * Adding more testling browsers. - * Updating "is" - -0.1.4 / 2013-04-08 -================== - - * Using "is" instead of "is-extended". - -0.1.3 / 2013-04-07 -================== - - * Using "foreach" instead of my own shim. - * Removing "tap"; I'll just wait for "tape" to fix its node 0.10 bug. - -0.1.2 / 2013-04-03 -================== - - * Adding dependency status; moving links to an index at the bottom. - * Upgrading is-extended; version 0.1.2 - * Adding an npm version badge. - -0.1.1 / 2013-04-01 -================== - - * Adding Travis CI. - * Bumping the version. - * Adding indexOf since IE sucks. - * Adding a forEach shim since older browsers don't have Array#forEach. - * Upgrading tape - 0.3.2 uses Array#map - * Using explicit end instead of plan. - * Can't test with Array.isArray in older browsers. - * Using is-extended. - * Fixing testling files. - * JSHint/JSLint-ing. - * Removing an unused object. - * Using strict mode. - -0.1.0 / 2013-03-30 -================== - - * Changing the exports should have meant a higher version bump. - * Oops, fixing the repo URL. - * Adding more tests. - * 0.0.2 - * Merge branch 'export_one_thing'; closes [#1](https://github.com/ljharb/object-keys/issues/1) - * Move shim export to a separate file. diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/LICENSE b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/LICENSE deleted file mode 100644 index 28553fd..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (C) 2013 Jordan Harband - -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 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. \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/README.md deleted file mode 100644 index c9b152b..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/README.md +++ /dev/null @@ -1,76 +0,0 @@ -#object-keys [![Version Badge][2]][1] - -[![Build Status][3]][4] -[![dependency status][5]][6] -[![dev dependency status][7]][8] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][13]][1] - -[![browser support][9]][10] - -An Object.keys shim. Invoke its "shim" method to shim Object.keys if it is unavailable. - -Most common usage: -```js -var keys = Object.keys || require('object-keys'); -``` - -## Example - -```js -var keys = require('object-keys'); -var assert = require('assert'); -var obj = { - a: true, - b: true, - c: true -}; - -assert.deepEqual(keys(obj), ['a', 'b', 'c']); -``` - -```js -var keys = require('object-keys'); -var assert = require('assert'); -/* when Object.keys is not present */ -delete Object.keys; -var shimmedKeys = keys.shim(); -assert.equal(shimmedKeys, keys); -assert.deepEqual(Object.keys(obj), keys(obj)); -``` - -```js -var keys = require('object-keys'); -var assert = require('assert'); -/* when Object.keys is present */ -var shimmedKeys = keys.shim(); -assert.equal(shimmedKeys, Object.keys); -assert.deepEqual(Object.keys(obj), keys(obj)); -``` - -## Source -Implementation taken directly from [es5-shim][11], with modifications, including from [lodash][12]. - -## Tests -Simply clone the repo, `npm install`, and run `npm test` - -[1]: https://npmjs.org/package/object-keys -[2]: http://vb.teelaun.ch/ljharb/object-keys.svg -[3]: https://travis-ci.org/ljharb/object-keys.svg -[4]: https://travis-ci.org/ljharb/object-keys -[5]: https://david-dm.org/ljharb/object-keys.svg -[6]: https://david-dm.org/ljharb/object-keys -[7]: https://david-dm.org/ljharb/object-keys/dev-status.svg -[8]: https://david-dm.org/ljharb/object-keys#info=devDependencies -[9]: https://ci.testling.com/ljharb/object-keys.png -[10]: https://ci.testling.com/ljharb/object-keys -[11]: https://github.com/es-shims/es5-shim/blob/master/es5-shim.js#L542-589 -[12]: https://github.com/bestiejs/lodash -[13]: https://nodei.co/npm/object-keys.png?downloads=true&stars=true -[license-image]: http://img.shields.io/npm/l/object-keys.svg -[license-url]: LICENSE -[downloads-image]: http://img.shields.io/npm/dm/object-keys.svg -[downloads-url]: http://npm-stat.com/charts.html?package=object-keys - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/index.js deleted file mode 100644 index 1abe1ad..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/index.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; - -// modified from https://github.com/es-shims/es5-shim -var has = Object.prototype.hasOwnProperty; -var toString = Object.prototype.toString; -var isArgs = require('./isArguments'); -var hasDontEnumBug = !({'toString': null}).propertyIsEnumerable('toString'); -var hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'); -var dontEnums = [ - "toString", - "toLocaleString", - "valueOf", - "hasOwnProperty", - "isPrototypeOf", - "propertyIsEnumerable", - "constructor" -]; - -var keysShim = function keys(object) { - var isObject = object !== null && typeof object === 'object'; - var isFunction = toString.call(object) === '[object Function]'; - var isArguments = isArgs(object); - var isString = isObject && toString.call(object) === '[object String]'; - var theKeys = []; - - if (!isObject && !isFunction && !isArguments) { - throw new TypeError("Object.keys called on a non-object"); - } - - var skipProto = hasProtoEnumBug && isFunction; - if (isString && object.length > 0 && !has.call(object, 0)) { - for (var i = 0; i < object.length; ++i) { - theKeys.push(String(i)); - } - } - - if (isArguments && object.length > 0) { - for (var j = 0; j < object.length; ++j) { - theKeys.push(String(j)); - } - } else { - for (var name in object) { - if (!(skipProto && name === 'prototype') && has.call(object, name)) { - theKeys.push(String(name)); - } - } - } - - if (hasDontEnumBug) { - var ctor = object.constructor; - var skipConstructor = ctor && ctor.prototype === object; - - for (var j = 0; j < dontEnums.length; ++j) { - if (!(skipConstructor && dontEnums[j] === 'constructor') && has.call(object, dontEnums[j])) { - theKeys.push(dontEnums[j]); - } - } - } - return theKeys; -}; - -keysShim.shim = function shimObjectKeys() { - if (!Object.keys) { - Object.keys = keysShim; - } - return Object.keys || keysShim; -}; - -module.exports = keysShim; - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/isArguments.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/isArguments.js deleted file mode 100644 index e17d7fc..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/isArguments.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -var toString = Object.prototype.toString; - -module.exports = function isArguments(value) { - var str = toString.call(value); - var isArguments = str === '[object Arguments]'; - if (!isArguments) { - isArguments = str !== '[object Array]' - && value !== null - && typeof value === 'object' - && typeof value.length === 'number' - && value.length >= 0 - && toString.call(value.callee) === '[object Function]'; - } - return isArguments; -}; - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/package.json deleted file mode 100644 index 3194200..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/node_modules/object-keys/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "object-keys", - "version": "1.0.1", - "author": { - "name": "Jordan Harband" - }, - "description": "An Object.keys replacement, in case Object.keys is not available. From https://github.com/es-shims/es5-shim", - "license": "MIT", - "main": "index.js", - "scripts": { - "test": "npm run lint && node test/index.js", - "coverage": "covert test/*.js", - "coverage-quiet": "covert test/*.js --quiet", - "lint": "jscs test/*.js *.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/ljharb/object-keys.git" - }, - "keywords": [ - "Object.keys", - "keys", - "ES5", - "shim" - ], - "dependencies": {}, - "devDependencies": { - "foreach": "~2.0.4", - "is": "~2.0.1", - "tape": "~2.14.0", - "indexof": "~0.0.1", - "covert": "~1.0.0", - "jscs": "~1.6.1" - }, - "testling": { - "files": "test/index.js", - "browsers": [ - "iexplore/6.0..latest", - "firefox/3.0..6.0", - "firefox/15.0..latest", - "firefox/nightly", - "chrome/4.0..10.0", - "chrome/20.0..latest", - "chrome/canary", - "opera/10.0..latest", - "opera/next", - "safari/4.0..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2" - ] - }, - "engines": { - "node": ">= 0.4" - }, - "gitHead": "2ecbaaa0405c2f03e8b669ccf4b70376318a8f8b", - "bugs": { - "url": "https://github.com/ljharb/object-keys/issues" - }, - "homepage": "https://github.com/ljharb/object-keys", - "_id": "object-keys@1.0.1", - "_shasum": "55802e85842c26bbb5ebbc157abf3be302569ba8", - "_from": "object-keys@1.0.1", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "ljharb", - "email": "ljharb@gmail.com" - }, - "maintainers": [ - { - "name": "ljharb", - "email": "ljharb@gmail.com" - } - ], - "dist": { - "shasum": "55802e85842c26bbb5ebbc157abf3be302569ba8", - "tarball": "http://registry.npmjs.org/object-keys/-/object-keys-1.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/package.json deleted file mode 100644 index 4eae1bd..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-adapter/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "socket.io-adapter", - "version": "0.3.1", - "repository": { - "type": "git", - "url": "git://github.com/Automattic/socket.io-adapter.git" - }, - "description": "Default socket.io in-memory adapter class.", - "dependencies": { - "debug": "1.0.2", - "socket.io-parser": "2.2.2", - "object-keys": "1.0.1" - }, - "gitHead": "c22e10f6351e99b2673216898106590d9e290305", - "bugs": { - "url": "https://github.com/Automattic/socket.io-adapter/issues" - }, - "homepage": "https://github.com/Automattic/socket.io-adapter", - "_id": "socket.io-adapter@0.3.1", - "scripts": {}, - "_shasum": "df81f970b4df6493902d93e519c7b72755c3a958", - "_from": "socket.io-adapter@0.3.1", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "dist": { - "shasum": "df81f970b4df6493902d93e519c7b72755c3a958", - "tarball": "http://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.3.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.3.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/History.md deleted file mode 100644 index dbb33cd..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/History.md +++ /dev/null @@ -1,351 +0,0 @@ - -1.2.1 / 2014-11-21 -================== - - * package: bump `engine.io-client` - * README: fixes to prevent duplicate events [nkzawa] - * fix reconnection after reconnecting manually [nkzawa] - * make ACK callbacks idempotent [thexeos] - * package: bump `uglify-js` - -1.2.0 / 2014-10-27 -================== - - * bump `engine.io-client`. - * set `readyState` before engine.io close event - * fix reconnection after reconnecting manually - * enable to stop reconnecting - * downloads badge - * support no schema relative url - * enable to reconnect manually - -1.1.0 / 2014-09-04 -================== - - * socket: fix in `has-binary` - * package: bump `socket.io-parser` - * package: bump `engine.io-client` - * further increase test timeout. - * double to singly quotes in tests. - * extend timeout and remember to close everything in each test case - * fix travis - * add travis + zuul matrix - * use svg instead of png to get better image quality in readme - * make CI build faster - * removed unnecessary code from try block. Only decode packet is needed. - * package: bump `browserify` - * package: bump `engine.io-client` - * fix autoConnect option - * npmignore: ignore `.gitignore` - * package: update `browserify` - * don't fire an extra reconnect when we're not reconnecting - after a failed initial connect attempt - * package: bump `socket.io-parser` for `component-emitter` dep fix - * updated tests to reflect `autoConnect` option - * add `autoConnect` option to wait with connecting - -1.0.6 / 2014-06-19 -================== - - * test fixes on internet explorer - * fixes for duplicate event propagation from manager instance [Rase-] - -1.0.5 / 2014-06-16 -================== - - * package: bump `engine.io-client` for better deps and smaller build - * handle io.connect(null, opts) correctly [audreyt] - * url: fix incorrect ports in certain connections [holic] - * manager: propagate all reconnection events to sockets [Rase-] - * index: added BC for `force new connection` - * socket: fix event buffering while in disconnected state [kevin-roark] - * package: stop using tarballs in dependencies [reid] - * manager: relay `connect_error` and `connect_timeout` to sockets - -1.0.4 / 2014-06-02 -================== - - * update build - -1.0.3 / 2014-05-31 -================== - - * package; bump `socket.io-parser` for binary ACK fix - * package: bump `engine.io-client` for binary UTF8 fix - -1.0.2 / 2014-05-28 -================== - - * package: bump `socket.io-parser` for windows fix - -1.0.1 / 2014-05-28 -================== - - * override npm tag - -1.0.0 / 2014-05-28 -================== - - * stable release - -1.0.0-pre5 / 2014-05-22 -======================= - - * package: bump `engine.io-client` for parser fixes - -1.0.0-pre4 / 2014-05-19 -======================= - - * build - -1.0.0-pre3 / 2014-05-17 -======================= - - * package: bump parser - * package: bump engine.io-client - -1.0.0-pre2 / 2014-04-27 -======================= - - * package: bump `engine.io-client` - * package: bump `zuul` - * allows user-level query string parameters to be in socket.request - * package: bump `socket.io-parser` - * package: bump `engine.io-client` for android fix - * tidy up .gitignore - -1.0.0-pre / 2014-03-14 -====================== - - * implemented `engine.io-client` - * implemented `socket.io-parser` - * implemented `json3` to avoid env pollution - * implemented `debug` - * added binary support - * added `browserify` support - -0.9.11 / 2012-11-02 -=================== - - * Enable use of 'xhr' transport in Node.js - * Fix the problem with disconnecting xhr-polling users - * Add should to devDependencies - * Prefer XmlHttpRequest if CORS is available - * Make client compatible with AMD loaders. - -0.9.10 / 2012-08-10 -=================== - - * fix removeAllListeners to behave as expected. - * set withCredentials to true only if xdomain. - * socket: disable disconnect on unload by default. - -0.9.9 / 2012-08-01 -================== - - * socket: fixed disconnect xhr url and made it actually sync - * *: bump xmlhttprequest dep - -0.9.8 / 2012-07-24 -================== - - * Fixed build. - -0.9.7 / 2012-07-24 -================== - - * iOS websocket crash fix. - * Fixed potential `open` collision. - * Fixed disconnectSync. - -0.9.6 / 2012-04-17 -================== - - * Don't position the jsonp form off the screen (android fix). - -0.9.5 / 2012-04-05 -================== - - * Bumped version. - -0.9.4 / 2012-04-01 -================== - - * Fixes polling loop upon reconnect advice (fixes #438). - -0.9.3 / 2012-03-28 -================== - - * Fix XHR.check, which was throwing an error transparently and causing non-IE browsers to fall back to JSONP [mikito] - * Fixed forced disconnect on window close [zzzaaa] - -0.9.2 / 2012-03-13 -================== - - * Transport order set by "options" [zzzaaa] - -0.9.1-1 / 2012-03-02 -==================== - - * Fixed active-x-obfuscator NPM dependency. - -0.9.1 / 2012-03-02 -================== - - * Misc corrections. - * Added warning within Firefox about webworker test in test runner. - * Update ws dependency [einaros] - * Implemented client side heartbeat checks. [felixge] - * Improved Firewall support with ActiveX obfuscation. [felixge] - * Fixed error handling during connection process. [Outsideris] - -0.9.0 / 2012-02-26 -================== - - * Added DS_Store to gitignore. - * Updated depedencies. - * Bumped uglify - * Tweaking code so it doesn't throw an exception when used inside a WebWorker in Firefox - * Do not rely on Array.prototype.indexOf as it breaks with pages that use the Prototype.js library. - * Windows support landed - * Use @einaros ws module instead of the old crap one - * Fix for broken closeTimeout and 'IE + xhr' goes into infinite loop on disconnection - * Disabled reconnection on error if reconnect option is set to false - * Set withCredentials to true before xhr to fix authentication - * Clears the timeout from reconnection attempt when there is a successful or failed reconnection. - This fixes the issue of setTimeout's carrying over from previous reconnection - and changing (skipping) values of self.reconnectionDelay in the newer reconnection. - * Removed decoding of parameters when chunking the query string. - This was used later on to construct the url to post to the socket.io server - for connection and if we're adding custom parameters of our own to this url - (for example for OAuth authentication) they were being sent decoded, which is wrong. - -0.8.7 / 2011-11-05 -================== - - * Bumped client - -0.8.6 / 2011-10-27 -================== - - * Added WebWorker support. - * Fixed swfobject and web_socket.js to not assume window. - * Fixed CORS detection for webworker. - * Fix `defer` for webkit in a webworker. - * Fixed io.util.request to not rely on window. - * FIxed; use global instead of window and dont rely on document. - * Fixed; JSON-P handshake if CORS is not available. - * Made underlying Transport disconnection trigger immediate socket.io disconnect. - * Fixed warning when compressing with Google Closure Compiler. - * Fixed builder's uglify utf-8 support. - * Added workaround for loading indicator in FF jsonp-polling. [3rd-Eden] - * Fixed host discovery lookup. [holic] - * Fixed close timeout when disconnected/reconnecting. [jscharlach] - * Fixed jsonp-polling feature detection. - * Fixed jsonp-polling client POSTing of \n. - * Fixed test runner on IE6/7 - -0.8.5 / 2011-10-07 -================== - - * Bumped client - -0.8.4 / 2011-09-06 -================== - - * Corrected build - -0.8.3 / 2011-09-03 -================== - - * Fixed `\n` parsing for non-JSON packets. - * Fixed; make Socket.IO XHTML doctype compatible (fixes #460 from server) - * Fixed support for Node.JS running `socket.io-client`. - * Updated repository name in `package.json`. - * Added support for different policy file ports without having to port - forward 843 on the server side [3rd-Eden] - -0.8.2 / 2011-08-29 -================== - - * Fixed flashsocket detection. - -0.8.1 / 2011-08-29 -================== - - * Bump version. - -0.8.0 / 2011-08-28 -================== - - * Added MozWebSocket support (hybi-10 doesn't require API changes) [einaros]. - -0.7.11 / 2011-08-27 -=================== - - * Corrected previous release (missing build). - -0.7.10 / 2011-08-27 -=================== - - * Fix for failing fallback in websockets - -0.7.9 / 2011-08-12 -================== - - * Added check on `Socket#onConnect` to prevent double `connect` events on the main manager. - * Fixed socket namespace connect test. Remove broken alternative namespace connect test. - * Removed test handler for removed test. - * Bumped version to match `socket.io` server. - -0.7.5 / 2011-08-08 -================== - - * Added querystring support for `connect` [3rd-Eden] - * Added partial Node.JS transports support [3rd-Eden, josephg] - * Fixed builder test. - * Changed `util.inherit` to replicate Object.create / __proto__. - * Changed and cleaned up some acceptance tests. - * Fixed race condition with a test that could not be run multiple times. - * Added test for encoding a payload. - * Added the ability to override the transport to use in acceptance test [3rd-Eden] - * Fixed multiple connect packets [DanielBaulig] - * Fixed jsonp-polling over-buffering [3rd-Eden] - * Fixed ascii preservation in minified socket.io client [3rd-Eden] - * Fixed socket.io in situations where the page is not served through utf8. - * Fixed namespaces not reconnecting after disconnect [3rd-Eden] - * Fixed default port for secure connections. - -0.7.4 / 2011-07-12 -================== - - * Added `SocketNamespace#of` shortcut. [3rd-Eden] - * Fixed a IE payload decoding bug. [3rd-Eden] - * Honor document protocol, unless overriden. [dvv] - * Fixed new builder dependencies. [3rd-Eden] - -0.7.3 / 2011-06-30 -================== - - * Fixed; acks don't depend on arity. They're automatic for `.send` and - callback based for `.emit`. [dvv] - * Added support for sub-sockets authorization. [3rd-Eden] - * Added BC support for `new io.connect`. [fat] - * Fixed double `connect` events. [3rd-Eden] - * Fixed reconnection with jsonp-polling maintaining old sessionid. [franck34] - -0.7.2 / 2011-06-22 -================== - - * Added `noop` message type. - -0.7.1 / 2011-06-21 -================== - - * Bumped socket.io dependency version for acceptance tests. - -0.7.0 / 2011-06-21 -================== - - * http://socket.io/announcement.html - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/LICENSE b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/LICENSE deleted file mode 100644 index 9338df1..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Guillermo Rauch - - -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 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. \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/README.md deleted file mode 100644 index a94c27d..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/README.md +++ /dev/null @@ -1,164 +0,0 @@ - -# socket.io-client - -[![Build Status](https://secure.travis-ci.org/Automattic/socket.io-client.svg)](http://travis-ci.org/Automattic/socket.io-client) -[![NPM version](https://badge.fury.io/js/socket.io-client.svg)](http://badge.fury.io/js/socket.io-client) -![Downloads](http://img.shields.io/npm/dm/socket.io-client.svg) - -## How to use - -A standalone build of `socket.io-client` is exposed automatically by the -socket.io server as `/socket.io/socket.io.js`. Alternatively you can -serve the file `socket.io.js` found at the root of this repository. - -```html - - -``` - -Socket.IO is compatible with [browserify](http://browserify.org/). - -### Node.JS (server-side usage) - - Add `socket.io-client` to your `package.json` and then: - - ```js - var socket = require('socket.io-client')('http://localhost'); - socket.on('connect', function(){}); - socket.on('event', function(data){}); - socket.on('disconnect', function(){}); - ``` - -## API - -### IO(url:String, opts:Object):Socket - - Exposed as the `io` namespace in the standalone build, or the result - of calling `require('socket.io-client')`. - - When called, it creates a new `Manager` for the given URL, and attempts - to reuse an existing `Manager` for subsequent calls, unless the - `multiplex` option is passed with `false`. - - The rest of the options are passed to the `Manager` constructor (see below - for details). - - A `Socket` instance is returned for the namespace specified by the - pathname in the URL, defaulting to `/`. For example, if the `url` is - `http://localhost/users`, a transport connection will be established to - `http://localhost` and a Socket.IO connection will be established to - `/users`. - -### IO#protocol - - Socket.io protocol revision number this client works with. - -### IO#Socket - - Reference to the `Socket` constructor. - -### IO#Manager - - Reference to the `Manager` constructor. - -### IO#Emitter - - Reference to the `Emitter` constructor. - -### Manager(url:String, opts:Object) - - A `Manager` represents a connection to a given Socket.IO server. One or - more `Socket` instances are associated with the manager. The manager - can be accessed through the `io` property of each `Socket` instance. - - The `opts` are also passed to `engine.io` upon initialization of the - underlying `Socket`. - - Options: - - `reconnection` whether to reconnect automatically (`true`) - - `reconnectionDelay` how long to wait before attempting a new - reconnection (`1000`) - - `reconnectionDelayMax` maximum amount of time to wait between - reconnections (`5000`). Each attempt increases the reconnection by - the amount specified by `reconnectionDelay`. - - `timeout` connection timeout before a `connect_error` - and `connect_timeout` events are emitted (`20000`) - - `autoConnect` by setting this false, you have to call `manager.open` - whenever you decide it's appropriate - -#### Events - - - `connect`. Fired upon a successful connection. - - `connect_error`. Fired upon a connection error. - Parameters: - - `Object` error object - - `connect_timeout`. Fired upon a connection timeout. - - `reconnect`. Fired upon a successful reconnection. - Parameters: - - `Number` reconnection attempt number - - `reconnect_attempt`. Fired upon an attempt to reconnect. - - `reconnecting`. Fired upon an attempt to reconnect. - Parameters: - - `Number` reconnection attempt number - - `reconnect_error`. Fired upon a reconnection attempt error. - Parameters: - - `Object` error object - - `reconnect_failed`. Fired when couldn't reconnect within `reconnectionAttempts` - -The events above are also emitted on the individual sockets that -reconnect that depend on this `Manager`. - -### Manager#reconnection(v:Boolean):Manager - - Sets the `reconnection` option, or returns it if no parameters - are passed. - -### Manager#reconnectionAttempts(v:Boolean):Manager - - Sets the `reconnectionAttempts` option, or returns it if no parameters - are passed. - -### Manager#reconnectionDelay(v:Boolean):Manager - - Sets the `reconectionDelay` option, or returns it if no parameters - are passed. - -### Manager#reconnectionDelayMax(v:Boolean):Manager - - Sets the `reconectionDelayMax` option, or returns it if no parameters - are passed. - -### Manager#timeout(v:Boolean):Manager - - Sets the `timeout` option, or returns it if no parameters - are passed. - -### Socket - -#### Events - - - `connect`. Fired upon a connection including a successful reconnection. - - `error`. Fired upon a connection error - Parameters: - - `Object` error data - - `disconnect`. Fired upon a disconnection. - - `reconnect`. Fired upon a successful reconnection. - Parameters: - - `Number` reconnection attempt number - - `reconnect_attempt`. Fired upon an attempt to reconnect. - - `reconnecting`. Fired upon an attempt to reconnect. - Parameters: - - `Number` reconnection attempt number - - `reconnect_error`. Fired upon a reconnection attempt error. - Parameters: - - `Object` error object - - `reconnect_failed`. Fired when couldn't reconnect within `reconnectionAttempts` - -## License - -[MIT](/LICENSE) diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/index.js deleted file mode 100644 index 887727f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/'); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/index.js deleted file mode 100644 index 17d81f1..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/index.js +++ /dev/null @@ -1,87 +0,0 @@ - -/** - * Module dependencies. - */ - -var url = require('./url'); -var parser = require('socket.io-parser'); -var Manager = require('./manager'); -var debug = require('debug')('socket.io-client'); - -/** - * Module exports. - */ - -module.exports = exports = lookup; - -/** - * Managers cache. - */ - -var cache = exports.managers = {}; - -/** - * Looks up an existing `Manager` for multiplexing. - * If the user summons: - * - * `io('http://localhost/a');` - * `io('http://localhost/b');` - * - * We reuse the existing instance based on same scheme/port/host, - * and we initialize sockets for each namespace. - * - * @api public - */ - -function lookup(uri, opts) { - if (typeof uri == 'object') { - opts = uri; - uri = undefined; - } - - opts = opts || {}; - - var parsed = url(uri); - var source = parsed.source; - var id = parsed.id; - var io; - - if (opts.forceNew || opts['force new connection'] || false === opts.multiplex) { - debug('ignoring socket cache for %s', source); - io = Manager(source, opts); - } else { - if (!cache[id]) { - debug('new io instance for %s', source); - cache[id] = Manager(source, opts); - } - io = cache[id]; - } - - return io.socket(parsed.path); -} - -/** - * Protocol version. - * - * @api public - */ - -exports.protocol = parser.protocol; - -/** - * `connect`. - * - * @param {String} uri - * @api public - */ - -exports.connect = lookup; - -/** - * Expose constructors for standalone build. - * - * @api public - */ - -exports.Manager = require('./manager'); -exports.Socket = require('./socket'); diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/manager.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/manager.js deleted file mode 100644 index f2ab2a2..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/manager.js +++ /dev/null @@ -1,473 +0,0 @@ - -/** - * Module dependencies. - */ - -var url = require('./url'); -var eio = require('engine.io-client'); -var Socket = require('./socket'); -var Emitter = require('component-emitter'); -var parser = require('socket.io-parser'); -var on = require('./on'); -var bind = require('component-bind'); -var object = require('object-component'); -var debug = require('debug')('socket.io-client:manager'); -var indexOf = require('indexof'); - -/** - * Module exports - */ - -module.exports = Manager; - -/** - * `Manager` constructor. - * - * @param {String} engine instance or engine uri/opts - * @param {Object} options - * @api public - */ - -function Manager(uri, opts){ - if (!(this instanceof Manager)) return new Manager(uri, opts); - if (uri && ('object' == typeof uri)) { - opts = uri; - uri = undefined; - } - opts = opts || {}; - - opts.path = opts.path || '/socket.io'; - this.nsps = {}; - this.subs = []; - this.opts = opts; - this.reconnection(opts.reconnection !== false); - this.reconnectionAttempts(opts.reconnectionAttempts || Infinity); - this.reconnectionDelay(opts.reconnectionDelay || 1000); - this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000); - this.timeout(null == opts.timeout ? 20000 : opts.timeout); - this.readyState = 'closed'; - this.uri = uri; - this.connected = []; - this.attempts = 0; - this.encoding = false; - this.packetBuffer = []; - this.encoder = new parser.Encoder(); - this.decoder = new parser.Decoder(); - this.autoConnect = opts.autoConnect !== false; - if (this.autoConnect) this.open(); -} - -/** - * Propagate given event to sockets and emit on `this` - * - * @api private - */ - -Manager.prototype.emitAll = function() { - this.emit.apply(this, arguments); - for (var nsp in this.nsps) { - this.nsps[nsp].emit.apply(this.nsps[nsp], arguments); - } -}; - -/** - * Mix in `Emitter`. - */ - -Emitter(Manager.prototype); - -/** - * Sets the `reconnection` config. - * - * @param {Boolean} true/false if it should automatically reconnect - * @return {Manager} self or value - * @api public - */ - -Manager.prototype.reconnection = function(v){ - if (!arguments.length) return this._reconnection; - this._reconnection = !!v; - return this; -}; - -/** - * Sets the reconnection attempts config. - * - * @param {Number} max reconnection attempts before giving up - * @return {Manager} self or value - * @api public - */ - -Manager.prototype.reconnectionAttempts = function(v){ - if (!arguments.length) return this._reconnectionAttempts; - this._reconnectionAttempts = v; - return this; -}; - -/** - * Sets the delay between reconnections. - * - * @param {Number} delay - * @return {Manager} self or value - * @api public - */ - -Manager.prototype.reconnectionDelay = function(v){ - if (!arguments.length) return this._reconnectionDelay; - this._reconnectionDelay = v; - return this; -}; - -/** - * Sets the maximum delay between reconnections. - * - * @param {Number} delay - * @return {Manager} self or value - * @api public - */ - -Manager.prototype.reconnectionDelayMax = function(v){ - if (!arguments.length) return this._reconnectionDelayMax; - this._reconnectionDelayMax = v; - return this; -}; - -/** - * Sets the connection timeout. `false` to disable - * - * @return {Manager} self or value - * @api public - */ - -Manager.prototype.timeout = function(v){ - if (!arguments.length) return this._timeout; - this._timeout = v; - return this; -}; - -/** - * Starts trying to reconnect if reconnection is enabled and we have not - * started reconnecting yet - * - * @api private - */ - -Manager.prototype.maybeReconnectOnOpen = function() { - // Only try to reconnect if it's the first time we're connecting - if (!this.openReconnect && !this.reconnecting && this._reconnection && this.attempts === 0) { - // keeps reconnection from firing twice for the same reconnection loop - this.openReconnect = true; - this.reconnect(); - } -}; - - -/** - * Sets the current transport `socket`. - * - * @param {Function} optional, callback - * @return {Manager} self - * @api public - */ - -Manager.prototype.open = -Manager.prototype.connect = function(fn){ - debug('readyState %s', this.readyState); - if (~this.readyState.indexOf('open')) return this; - - debug('opening %s', this.uri); - this.engine = eio(this.uri, this.opts); - var socket = this.engine; - var self = this; - this.readyState = 'opening'; - this.skipReconnect = false; - - // emit `open` - var openSub = on(socket, 'open', function() { - self.onopen(); - fn && fn(); - }); - - // emit `connect_error` - var errorSub = on(socket, 'error', function(data){ - debug('connect_error'); - self.cleanup(); - self.readyState = 'closed'; - self.emitAll('connect_error', data); - if (fn) { - var err = new Error('Connection error'); - err.data = data; - fn(err); - } - - self.maybeReconnectOnOpen(); - }); - - // emit `connect_timeout` - if (false !== this._timeout) { - var timeout = this._timeout; - debug('connect attempt will timeout after %d', timeout); - - // set timer - var timer = setTimeout(function(){ - debug('connect attempt timed out after %d', timeout); - openSub.destroy(); - socket.close(); - socket.emit('error', 'timeout'); - self.emitAll('connect_timeout', timeout); - }, timeout); - - this.subs.push({ - destroy: function(){ - clearTimeout(timer); - } - }); - } - - this.subs.push(openSub); - this.subs.push(errorSub); - - return this; -}; - -/** - * Called upon transport open. - * - * @api private - */ - -Manager.prototype.onopen = function(){ - debug('open'); - - // clear old subs - this.cleanup(); - - // mark as open - this.readyState = 'open'; - this.emit('open'); - - // add new subs - var socket = this.engine; - this.subs.push(on(socket, 'data', bind(this, 'ondata'))); - this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded'))); - this.subs.push(on(socket, 'error', bind(this, 'onerror'))); - this.subs.push(on(socket, 'close', bind(this, 'onclose'))); -}; - -/** - * Called with data. - * - * @api private - */ - -Manager.prototype.ondata = function(data){ - this.decoder.add(data); -}; - -/** - * Called when parser fully decodes a packet. - * - * @api private - */ - -Manager.prototype.ondecoded = function(packet) { - this.emit('packet', packet); -}; - -/** - * Called upon socket error. - * - * @api private - */ - -Manager.prototype.onerror = function(err){ - debug('error', err); - this.emitAll('error', err); -}; - -/** - * Creates a new socket for the given `nsp`. - * - * @return {Socket} - * @api public - */ - -Manager.prototype.socket = function(nsp){ - var socket = this.nsps[nsp]; - if (!socket) { - socket = new Socket(this, nsp); - this.nsps[nsp] = socket; - var self = this; - socket.on('connect', function(){ - if (!~indexOf(self.connected, socket)) { - self.connected.push(socket); - } - }); - } - return socket; -}; - -/** - * Called upon a socket close. - * - * @param {Socket} socket - */ - -Manager.prototype.destroy = function(socket){ - var index = indexOf(this.connected, socket); - if (~index) this.connected.splice(index, 1); - if (this.connected.length) return; - - this.close(); -}; - -/** - * Writes a packet. - * - * @param {Object} packet - * @api private - */ - -Manager.prototype.packet = function(packet){ - debug('writing packet %j', packet); - var self = this; - - if (!self.encoding) { - // encode, then write to engine with result - self.encoding = true; - this.encoder.encode(packet, function(encodedPackets) { - for (var i = 0; i < encodedPackets.length; i++) { - self.engine.write(encodedPackets[i]); - } - self.encoding = false; - self.processPacketQueue(); - }); - } else { // add packet to the queue - self.packetBuffer.push(packet); - } -}; - -/** - * If packet buffer is non-empty, begins encoding the - * next packet in line. - * - * @api private - */ - -Manager.prototype.processPacketQueue = function() { - if (this.packetBuffer.length > 0 && !this.encoding) { - var pack = this.packetBuffer.shift(); - this.packet(pack); - } -}; - -/** - * Clean up transport subscriptions and packet buffer. - * - * @api private - */ - -Manager.prototype.cleanup = function(){ - var sub; - while (sub = this.subs.shift()) sub.destroy(); - - this.packetBuffer = []; - this.encoding = false; - - this.decoder.destroy(); -}; - -/** - * Close the current socket. - * - * @api private - */ - -Manager.prototype.close = -Manager.prototype.disconnect = function(){ - this.skipReconnect = true; - this.readyState = 'closed'; - this.engine && this.engine.close(); -}; - -/** - * Called upon engine close. - * - * @api private - */ - -Manager.prototype.onclose = function(reason){ - debug('close'); - this.cleanup(); - this.readyState = 'closed'; - this.emit('close', reason); - if (this._reconnection && !this.skipReconnect) { - this.reconnect(); - } -}; - -/** - * Attempt a reconnection. - * - * @api private - */ - -Manager.prototype.reconnect = function(){ - if (this.reconnecting || this.skipReconnect) return this; - - var self = this; - this.attempts++; - - if (this.attempts > this._reconnectionAttempts) { - debug('reconnect failed'); - this.emitAll('reconnect_failed'); - this.reconnecting = false; - } else { - var delay = this.attempts * this.reconnectionDelay(); - delay = Math.min(delay, this.reconnectionDelayMax()); - debug('will wait %dms before reconnect attempt', delay); - - this.reconnecting = true; - var timer = setTimeout(function(){ - if (self.skipReconnect) return; - - debug('attempting reconnect'); - self.emitAll('reconnect_attempt', self.attempts); - self.emitAll('reconnecting', self.attempts); - - // check again for the case socket closed in above events - if (self.skipReconnect) return; - - self.open(function(err){ - if (err) { - debug('reconnect attempt error'); - self.reconnecting = false; - self.reconnect(); - self.emitAll('reconnect_error', err.data); - } else { - debug('reconnect success'); - self.onreconnect(); - } - }); - }, delay); - - this.subs.push({ - destroy: function(){ - clearTimeout(timer); - } - }); - } -}; - -/** - * Called upon successful reconnect. - * - * @api private - */ - -Manager.prototype.onreconnect = function(){ - var attempt = this.attempts; - this.attempts = 0; - this.reconnecting = false; - this.emitAll('reconnect', attempt); -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/on.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/on.js deleted file mode 100644 index 6be286d..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/on.js +++ /dev/null @@ -1,24 +0,0 @@ - -/** - * Module exports. - */ - -module.exports = on; - -/** - * Helper for subscriptions. - * - * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter` - * @param {String} event name - * @param {Function} callback - * @api public - */ - -function on(obj, ev, fn) { - obj.on(ev, fn); - return { - destroy: function(){ - obj.removeListener(ev, fn); - } - }; -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/socket.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/socket.js deleted file mode 100644 index 7b06825..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/socket.js +++ /dev/null @@ -1,384 +0,0 @@ - -/** - * Module dependencies. - */ - -var parser = require('socket.io-parser'); -var Emitter = require('component-emitter'); -var toArray = require('to-array'); -var on = require('./on'); -var bind = require('component-bind'); -var debug = require('debug')('socket.io-client:socket'); -var hasBin = require('has-binary'); - -/** - * Module exports. - */ - -module.exports = exports = Socket; - -/** - * Internal events (blacklisted). - * These events can't be emitted by the user. - * - * @api private - */ - -var events = { - connect: 1, - connect_error: 1, - connect_timeout: 1, - disconnect: 1, - error: 1, - reconnect: 1, - reconnect_attempt: 1, - reconnect_failed: 1, - reconnect_error: 1, - reconnecting: 1 -}; - -/** - * Shortcut to `Emitter#emit`. - */ - -var emit = Emitter.prototype.emit; - -/** - * `Socket` constructor. - * - * @api public - */ - -function Socket(io, nsp){ - this.io = io; - this.nsp = nsp; - this.json = this; // compat - this.ids = 0; - this.acks = {}; - if (this.io.autoConnect) this.open(); - this.receiveBuffer = []; - this.sendBuffer = []; - this.connected = false; - this.disconnected = true; -} - -/** - * Mix in `Emitter`. - */ - -Emitter(Socket.prototype); - -/** - * Subscribe to open, close and packet events - * - * @api private - */ - -Socket.prototype.subEvents = function() { - if (this.subs) return; - - var io = this.io; - this.subs = [ - on(io, 'open', bind(this, 'onopen')), - on(io, 'packet', bind(this, 'onpacket')), - on(io, 'close', bind(this, 'onclose')) - ]; -}; - -/** - * "Opens" the socket. - * - * @api public - */ - -Socket.prototype.open = -Socket.prototype.connect = function(){ - if (this.connected) return this; - - this.subEvents(); - this.io.open(); // ensure open - if ('open' == this.io.readyState) this.onopen(); - return this; -}; - -/** - * Sends a `message` event. - * - * @return {Socket} self - * @api public - */ - -Socket.prototype.send = function(){ - var args = toArray(arguments); - args.unshift('message'); - this.emit.apply(this, args); - return this; -}; - -/** - * Override `emit`. - * If the event is in `events`, it's emitted normally. - * - * @param {String} event name - * @return {Socket} self - * @api public - */ - -Socket.prototype.emit = function(ev){ - if (events.hasOwnProperty(ev)) { - emit.apply(this, arguments); - return this; - } - - var args = toArray(arguments); - var parserType = parser.EVENT; // default - if (hasBin(args)) { parserType = parser.BINARY_EVENT; } // binary - var packet = { type: parserType, data: args }; - - // event ack callback - if ('function' == typeof args[args.length - 1]) { - debug('emitting packet with ack id %d', this.ids); - this.acks[this.ids] = args.pop(); - packet.id = this.ids++; - } - - if (this.connected) { - this.packet(packet); - } else { - this.sendBuffer.push(packet); - } - - return this; -}; - -/** - * Sends a packet. - * - * @param {Object} packet - * @api private - */ - -Socket.prototype.packet = function(packet){ - packet.nsp = this.nsp; - this.io.packet(packet); -}; - -/** - * Called upon engine `open`. - * - * @api private - */ - -Socket.prototype.onopen = function(){ - debug('transport is open - connecting'); - - // write connect packet if necessary - if ('/' != this.nsp) { - this.packet({ type: parser.CONNECT }); - } -}; - -/** - * Called upon engine `close`. - * - * @param {String} reason - * @api private - */ - -Socket.prototype.onclose = function(reason){ - debug('close (%s)', reason); - this.connected = false; - this.disconnected = true; - this.emit('disconnect', reason); -}; - -/** - * Called with socket packet. - * - * @param {Object} packet - * @api private - */ - -Socket.prototype.onpacket = function(packet){ - if (packet.nsp != this.nsp) return; - - switch (packet.type) { - case parser.CONNECT: - this.onconnect(); - break; - - case parser.EVENT: - this.onevent(packet); - break; - - case parser.BINARY_EVENT: - this.onevent(packet); - break; - - case parser.ACK: - this.onack(packet); - break; - - case parser.BINARY_ACK: - this.onack(packet); - break; - - case parser.DISCONNECT: - this.ondisconnect(); - break; - - case parser.ERROR: - this.emit('error', packet.data); - break; - } -}; - -/** - * Called upon a server event. - * - * @param {Object} packet - * @api private - */ - -Socket.prototype.onevent = function(packet){ - var args = packet.data || []; - debug('emitting event %j', args); - - if (null != packet.id) { - debug('attaching ack callback to event'); - args.push(this.ack(packet.id)); - } - - if (this.connected) { - emit.apply(this, args); - } else { - this.receiveBuffer.push(args); - } -}; - -/** - * Produces an ack callback to emit with an event. - * - * @api private - */ - -Socket.prototype.ack = function(id){ - var self = this; - var sent = false; - return function(){ - // prevent double callbacks - if (sent) return; - sent = true; - var args = toArray(arguments); - debug('sending ack %j', args); - - var type = hasBin(args) ? parser.BINARY_ACK : parser.ACK; - self.packet({ - type: type, - id: id, - data: args - }); - }; -}; - -/** - * Called upon a server acknowlegement. - * - * @param {Object} packet - * @api private - */ - -Socket.prototype.onack = function(packet){ - debug('calling ack %s with %j', packet.id, packet.data); - var fn = this.acks[packet.id]; - fn.apply(this, packet.data); - delete this.acks[packet.id]; -}; - -/** - * Called upon server connect. - * - * @api private - */ - -Socket.prototype.onconnect = function(){ - this.connected = true; - this.disconnected = false; - this.emit('connect'); - this.emitBuffered(); -}; - -/** - * Emit buffered events (received and emitted). - * - * @api private - */ - -Socket.prototype.emitBuffered = function(){ - var i; - for (i = 0; i < this.receiveBuffer.length; i++) { - emit.apply(this, this.receiveBuffer[i]); - } - this.receiveBuffer = []; - - for (i = 0; i < this.sendBuffer.length; i++) { - this.packet(this.sendBuffer[i]); - } - this.sendBuffer = []; -}; - -/** - * Called upon server disconnect. - * - * @api private - */ - -Socket.prototype.ondisconnect = function(){ - debug('server disconnect (%s)', this.nsp); - this.destroy(); - this.onclose('io server disconnect'); -}; - -/** - * Called upon forced client/server side disconnections, - * this method ensures the manager stops tracking us and - * that reconnections don't get triggered for this. - * - * @api private. - */ - -Socket.prototype.destroy = function(){ - if (this.subs) { - // clean subscriptions to avoid reconnections - for (var i = 0; i < this.subs.length; i++) { - this.subs[i].destroy(); - } - this.subs = null; - } - - this.io.destroy(this); -}; - -/** - * Disconnects the socket manually. - * - * @return {Socket} self - * @api public - */ - -Socket.prototype.close = -Socket.prototype.disconnect = function(){ - if (this.connected) { - debug('performing disconnect (%s)', this.nsp); - this.packet({ type: parser.DISCONNECT }); - } - - // remove socket from pool - this.destroy(); - - if (this.connected) { - // fire events - this.onclose('io client disconnect'); - } - return this; -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/url.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/url.js deleted file mode 100644 index d119067..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/lib/url.js +++ /dev/null @@ -1,73 +0,0 @@ - -/** - * Module dependencies. - */ - -var parseuri = require('parseuri'); -var debug = require('debug')('socket.io-client:url'); - -/** - * Module exports. - */ - -module.exports = url; - -/** - * URL parser. - * - * @param {String} url - * @param {Object} An object meant to mimic window.location. - * Defaults to window.location. - * @api public - */ - -function url(uri, loc){ - var obj = uri; - - // default to window.location - var loc = loc || global.location; - if (null == uri) uri = loc.protocol + '//' + loc.hostname; - - // relative path support - if ('string' == typeof uri) { - if ('/' == uri.charAt(0)) { - if ('/' == uri.charAt(1)) { - uri = loc.protocol + uri; - } else { - uri = loc.hostname + uri; - } - } - - if (!/^(https?|wss?):\/\//.test(uri)) { - debug('protocol-less url %s', uri); - if ('undefined' != typeof loc) { - uri = loc.protocol + '//' + uri; - } else { - uri = 'https://' + uri; - } - } - - // parse - debug('parse %s', uri); - obj = parseuri(uri); - } - - // make sure we treat `localhost:80` and `localhost` equally - if (!obj.port) { - if (/^(http|ws)$/.test(obj.protocol)) { - obj.port = '80'; - } - else if (/^(http|ws)s$/.test(obj.protocol)) { - obj.port = '443'; - } - } - - obj.path = obj.path || '/'; - - // define unique id - obj.id = obj.protocol + '://' + obj.host + ':' + obj.port; - // define href - obj.href = obj.protocol + '://' + obj.host + (loc && loc.port == obj.port ? '' : (':' + obj.port)); - - return obj; -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/History.md deleted file mode 100644 index 2795fdb..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/History.md +++ /dev/null @@ -1,13 +0,0 @@ - -1.0.0 / 2014-05-27 -================== - - * index: use slice ref (#7, @viatropos) - * package: rename package to "component-bind" - * package: add "repository" field (#6, @repoify) - * package: add "component" section - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Makefile deleted file mode 100644 index 4e9c8d3..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Readme.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Readme.md deleted file mode 100644 index 6a8febc..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/Readme.md +++ /dev/null @@ -1,64 +0,0 @@ -# bind - - Function binding utility. - -## Installation - -``` -$ component install component/bind -``` - -## API - - - [bind(obj, fn)](#bindobj-fn) - - [bind(obj, fn, ...)](#bindobj-fn-) - - [bind(obj, name)](#bindobj-name) - - - -### bind(obj, fn) -should bind the function to the given object. - -```js -var tobi = { name: 'tobi' }; - -function name() { - return this.name; -} - -var fn = bind(tobi, name); -fn().should.equal('tobi'); -``` - - -### bind(obj, fn, ...) -should curry the remaining arguments. - -```js -function add(a, b) { - return a + b; -} - -bind(null, add)(1, 2).should.equal(3); -bind(null, add, 1)(2).should.equal(3); -bind(null, add, 1, 2)().should.equal(3); -``` - - -### bind(obj, name) -should bind the method of the given name. - -```js -var tobi = { name: 'tobi' }; - -tobi.getName = function() { - return this.name; -}; - -var fn = bind(tobi, 'getName'); -fn().should.equal('tobi'); -``` - -## License - - MIT \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/component.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/component.json deleted file mode 100644 index 4e1e93f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/component.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "bind", - "version": "1.0.0", - "description": "function binding utility", - "keywords": [ - "bind", - "utility" - ], - "dependencies": {}, - "scripts": [ - "index.js" - ] -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/index.js deleted file mode 100644 index 4eeb2c0..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Slice reference. - */ - -var slice = [].slice; - -/** - * Bind `obj` to `fn`. - * - * @param {Object} obj - * @param {Function|String} fn or string - * @return {Function} - * @api public - */ - -module.exports = function(obj, fn){ - if ('string' == typeof fn) fn = obj[fn]; - if ('function' != typeof fn) throw new Error('bind() requires a function'); - var args = slice.call(arguments, 2); - return function(){ - return fn.apply(obj, args.concat(slice.call(arguments))); - } -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/package.json deleted file mode 100644 index f4b41c8..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-bind/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "component-bind", - "version": "1.0.0", - "description": "function binding utility", - "keywords": [ - "bind", - "utility" - ], - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "component": { - "scripts": { - "bind/index.js": "index.js" - } - }, - "repository": { - "type": "git", - "url": "https://github.com/component/bind.git" - }, - "bugs": { - "url": "https://github.com/component/bind/issues" - }, - "homepage": "https://github.com/component/bind", - "_id": "component-bind@1.0.0", - "_shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", - "_from": "component-bind@1.0.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "dist": { - "shasum": "00c608ab7dcd93897c0009651b1d3a8e1e73bbd1", - "tarball": "http://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.npmignore deleted file mode 100644 index f05b1f2..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -test diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.travis.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.travis.yml deleted file mode 100644 index 8750e3b..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -node_js: -- "0.8" -- "0.10" -language: node_js \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/History.md deleted file mode 100644 index b898ca6..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/History.md +++ /dev/null @@ -1,52 +0,0 @@ - -1.1.2 / 2014-02-10 -================== - - * package: rename to "component-emitter" - * package: update "main" and "component" fields - * Add license to Readme (same format as the other components) - * created .npmignore - * travis stuff - -1.1.1 / 2013-12-01 -================== - - * fix .once adding .on to the listener - * docs: Emitter#off() - * component: add `.repo` prop - -1.1.0 / 2013-10-20 -================== - - * add `.addEventListener()` and `.removeEventListener()` aliases - -1.0.1 / 2013-06-27 -================== - - * add support for legacy ie - -1.0.0 / 2013-02-26 -================== - - * add `.off()` support for removing all listeners - -0.0.6 / 2012-10-08 -================== - - * add `this._callbacks` initialization to prevent funky gotcha - -0.0.5 / 2012-09-07 -================== - - * fix `Emitter.call(this)` usage - -0.0.3 / 2012-07-11 -================== - - * add `.listeners()` - * rename `.has()` to `.hasListeners()` - -0.0.2 / 2012-06-28 -================== - - * fix `.off()` with `.once()`-registered callbacks diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Makefile deleted file mode 100644 index 4e9c8d3..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Makefile +++ /dev/null @@ -1,7 +0,0 @@ - -test: - @./node_modules/.bin/mocha \ - --require should \ - --reporter spec - -.PHONY: test \ No newline at end of file diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Readme.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Readme.md deleted file mode 100644 index 0f3f9b9..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/Readme.md +++ /dev/null @@ -1,74 +0,0 @@ -# Emitter [![Build Status](https://travis-ci.org/component/emitter.png)](https://travis-ci.org/component/emitter) - - Event emitter component. - -## Installation - -``` -$ component install component/emitter -``` - -## API - -### Emitter(obj) - - The `Emitter` may also be used as a mixin. For example - a "plain" object may become an emitter, or you may - extend an existing prototype. - - As an `Emitter` instance: - -```js -var Emitter = require('emitter'); -var emitter = new Emitter; -emitter.emit('something'); -``` - - As a mixin: - -```js -var Emitter = require('emitter'); -var user = { name: 'tobi' }; -Emitter(user); - -user.emit('im a user'); -``` - - As a prototype mixin: - -```js -var Emitter = require('emitter'); -Emitter(User.prototype); -``` - -### Emitter#on(event, fn) - - Register an `event` handler `fn`. - -### Emitter#once(event, fn) - - Register a single-shot `event` handler `fn`, - removed immediately after it is invoked the - first time. - -### Emitter#off(event, fn) - - * Pass `event` and `fn` to remove a listener. - * Pass `event` to remove all listeners on that event. - * Pass nothing to remove all listeners on all events. - -### Emitter#emit(event, ...) - - Emit an `event` with variable option args. - -### Emitter#listeners(event) - - Return an array of callbacks, or an empty array. - -### Emitter#hasListeners(event) - - Check if this emitter has `event` handlers. - -## License - -MIT diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/bower.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/bower.json deleted file mode 100644 index c618d41..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/bower.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "emitter", - "description": "Event emitter", - "keywords": [ - "emitter", - "events" - ], - "version": "1.1.2", - "license": "MIT", - "main": "index.js", - "homepage": "https://github.com/component/emitter", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "Makefile", - "package.json", - "component.json" - ] -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/component.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/component.json deleted file mode 100644 index 68ba0b1..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/component.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "emitter", - "repo": "component/emitter", - "description": "Event emitter", - "keywords": [ - "emitter", - "events" - ], - "version": "1.1.2", - "scripts": [ - "index.js" - ], - "license": "MIT" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/index.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/index.js deleted file mode 100644 index ad71163..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/index.js +++ /dev/null @@ -1,164 +0,0 @@ - -/** - * Expose `Emitter`. - */ - -module.exports = Emitter; - -/** - * Initialize a new `Emitter`. - * - * @api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); -}; - -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} - -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.on = -Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks[event] = this._callbacks[event] || []) - .push(fn); - return this; -}; - -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.once = function(event, fn){ - var self = this; - this._callbacks = this._callbacks || {}; - - function on() { - self.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; -}; - -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = -Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks[event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks[event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; -}; - -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks[event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; -}; - -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks[event] || []; -}; - -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/package.json b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/package.json deleted file mode 100644 index 9295f1e..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/component-emitter/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "component-emitter", - "description": "Event emitter", - "version": "1.1.2", - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "component": { - "scripts": { - "emitter/index.js": "index.js" - } - }, - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/component/emitter.git" - }, - "scripts": { - "test": "make test" - }, - "bugs": { - "url": "https://github.com/component/emitter/issues" - }, - "homepage": "https://github.com/component/emitter", - "_id": "component-emitter@1.1.2", - "dist": { - "shasum": "296594f2753daa63996d2af08d15a95116c9aec3", - "tarball": "http://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz" - }, - "_from": "component-emitter@1.1.2", - "_npmVersion": "1.3.24", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "directories": {}, - "_shasum": "296594f2753daa63996d2af08d15a95116c9aec3", - "_resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.npmignore b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.npmignore deleted file mode 100644 index 3957910..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -support/ -test diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.travis.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.travis.yml deleted file mode 100644 index cae1c0f..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: node_js -node_js: - - "0.10" -notifications: - irc: "irc.freenode.org#socket.io" -env: - global: - - secure: v76/Y3hGIGsANoFAW0US3X8cuDFY7g8stMFrwGUxiQnm4HN3j83w+FfoZay0mESKhNIpqk4nCJQwMCd1gJnLL7ybjGOt5LeEuQVlLDXkRVrXSViy2XwAW+mLj7H/++/LTHWo/Ma6pOa1YC2o4SbSsiK1NdhdAK5ZGluonPBIG18= - - secure: P2zFTMeI9duoPBXhAZZLddqeJS+dUI27Q02tTdr+AjvUkr8f7Zga57SZxP6Jbn8bxUPI3ZQzAm1KMsyUo4IAegXLJ4j9VCF6ab65NkE1k8UH99kXXS30Ha27NS1aQafCbaOTxxQfqQHmnjt2HJtvk04nqCEDhoZCdDUZNVSGCOc= -matrix: - include: - - node_js: '0.10' - env: BROWSER_NAME=chrome BROWSER_VERSION=latest - - node_js: '0.10' - env: BROWSER_NAME=safari BROWSER_VERSION=latest - - node_js: '0.10' - env: BROWSER_NAME=ie BROWSER_VERSION=6 - - node_js: '0.10' - env: BROWSER_NAME=ie BROWSER_VERSION=7 - - node_js: '0.10' - env: BROWSER_NAME=ie BROWSER_VERSION=8 - - node_js: '0.10' - env: BROWSER_NAME=ie BROWSER_VERSION=9 - - node_js: '0.10' - env: BROWSER_NAME=ie BROWSER_VERSION=10 BROWSER_PLATFORM="Windows 2012" - - node_js: '0.10' - env: BROWSER_NAME=ie BROWSER_VERSION=latest BROWSER_PLATFORM="Windows 2012" - - node_js: '0.10' - env: BROWSER_NAME=iphone BROWSER_VERSION=4.3 - - node_js: '0.10' - env: BROWSER_NAME=iphone BROWSER_VERSION=5.1 - - node_js: '0.10' - env: BROWSER_NAME=iphone BROWSER_VERSION=6.1 - - node_js: '0.10' - env: BROWSER_NAME=iphone BROWSER_VERSION=7.1 - - node_js: '0.10' - env: BROWSER_NAME=android BROWSER_VERSION=4.0 - - node_js: '0.10' - env: BROWSER_NAME=android BROWSER_VERSION=4.1 - - node_js: '0.10' - env: BROWSER_NAME=android BROWSER_VERSION=4.2 - - node_js: '0.10' - env: BROWSER_NAME=android BROWSER_VERSION=4.3 - - node_js: '0.10' - env: BROWSER_NAME=android BROWSER_VERSION=4.4 diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.zuul.yml b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.zuul.yml deleted file mode 100644 index 5337ec7..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/.zuul.yml +++ /dev/null @@ -1,20 +0,0 @@ -ui: mocha-bdd -server: ./test/support/server.js -browsers: - - name: chrome - version: 29..latest -# Firefox disabled for now because it can cause infinite wait loops when -# running any tests -# - name: firefox -# version: latest - - name: safari - version: latest - - name: ie - version: 10 - platform: Windows 2012 - - name: ie - version: [6..9, latest] - - name: iphone - version: oldest..latest - - name: android - version: oldest..latest diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/History.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/History.md deleted file mode 100644 index a0e1604..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/History.md +++ /dev/null @@ -1,454 +0,0 @@ - -1.4.3 / 2014-11-21 -================== - - * support: make the build system work with the latest browserify - * test: remove test with partial browser support - * Fixed calls to addEventListener in old browsers - -1.4.2 / 2014-10-27 -================== - - * remove invalid value for strict mode - * IE10 should prefer using XHR2 over XDR because it's safer - * fixed transport close deferring logic [nkzawa] - * wait for buffer to be drained before closing [nkzawa] - -1.4.1 / 2014-10-03 -================== - - * Fixed "jsonp polling iframe removal error" - * Move ws upgrade needing connection tests to a block checking browser support. - * check `readyState` in `sendPacket` and close on `upgradeError` too - * defer close while upgrading a transport - -1.4.0 / 2014-09-03 -================== - - * add matrix support for travis runs. - * add `enablesXDR` option to turn on `XDomainRequest` - * package: bump `browserify` - * package: bump `engine.io-parser` - * style and close socket after assert - * add support for `jsonp` option to turn it off - -1.3.1 / 2014-06-19 -================== - - * transport: catch utf8 decode errors - -1.3.0 / 2014-06-13 -================== - - * smaller inherits utility - * fix a test for ws - * upgrade emitter dep to not rely on tarball - -1.2.2 / 2014-05-30 -================== - - * package: bump `engine.io-parser` for binary utf8 fix - -1.2.1 / 2014-05-22 -================== - - * build - -1.2.0 / 2014-05-18 -================== - - * removed flashsocket, moving to userland - * new build - -1.1.1 / 2014-05-14 -================== - - * jsonp-polling: fixed newline double escaping - * package: bump parser - * remove legacy Socket#onopen call - * added tests for multibyte strings - -1.1.0 / 2014-04-27 -================== - - * bump zuul version - * renamed removeAllListeners to cleanup - * use inherits package instead of inherit - * removed all references to util.js - * fix if statement in FlashWS.ready method - * polling-jsonp: prevent spurious errors from being emitted when the window is unloaded - * polling-xhr: fix a comment and remove unneeded `document` reference - * enforce cache busting for all user agents - * JSONP and test fixes for fails in IE - * package: bump `engine.io-parser` - * polling-xhr: abort the request when the window is unloaded - -1.0.5 / 2014-03-18 -================== - - * package: bump `engine.io-parser` for android binary fix - -1.0.4 / 2014-03-14 -================== - - * no base64 encoding for no reason when using websockets - -1.0.3 / 2014-03-12 -================== - - * fix browserify - -1.0.2 / 2014-03-12 -================== - - * bump `engine.io-parser` - * made `parseJSON` and `parseURI` from `util` their own modules [gkoren] - * clean up tests - * clean up browserify - -1.0.1 / 2014-03-06 -================== - - * package: bump `engine.io-parser` - -1.0.0 / 2014-03-06 -================== - - * run browserify without shims - * emit socket upgrade event after upgrade done - * better feature detection for XHR2 - * added `rememberUpgrade` option - * binary support - -0.9.0 / 2014-02-09 -================== - - * Fix simple `host:port` URLs and IPV6 [bmalehorn] - * Fix XHR cleanup method [poohlty] - * Match semantics of `close` event with `WebSocket`. If an error occurs - and `open` hadn't fired before, we still emit `close` as per - WebSocket spec [mokesmokes]. - * Removed SPEC (now in `engine.io-protocol` repository) - * Remove `Socket#open` docs (private API) [mokesmokes] - -0.8.2 / 2014-01-18 -================== - - * polling-xhr: avoid catching user-thrown errors - * util: remove unused `hasCORS` - * polling: remove deferring for faster startup (fixes #174) - * engine now works perfectly on workers - -0.8.1 / 2014-01-17 -================== - - * package: bump debug to fix `localStorage` issue (fixes #213) - * remove duplicate xmlhttprequest code - * add iphone automated testing - * bump zuul to 1.3.0 to improve tests performance - * use invalid ip address for incorrect connection test - * Fix GH-224, remove sockets array - -0.8.0 / 2014-01-05 -================== - - * socket: emit upgrade errors as `upgradeError` instead of `error` - -0.7.14 / 2014-01-01 -=================== - - * test: increase timeouts for network tests - * test: whitelist globals - * test: improve socket closing test - * polling: improve url timestamp for ie11 and allow force disabling - * polling-xhr: handle errors for xhr creation (fixes `access denied` issues) - * polling-xhr: style - * socket: more instrumentation for transport creation - * socket: allow explicit `false` for `timestampRequests` - * socket: accept `null` as first argument - * Makefile: cleanup - * .travis: deprecate 0.6 - -0.7.13 / 2013-12-20 -=================== - - * use `jsonp` in favor of `XDomainRequest` to preserve `Cookie` - headers in all situations [3rd-eden] (fixes #217) - * run zuul tests after node tests [defunctzombie] - * add zuul support for easier browser testing [defunctzombie] - -0.7.12 / 2013-11-11 -=================== - - * engine.io: updated build to fix WebSocket constructor issue - * package: move browserify into devDeps - -0.7.11 / 2013-11-06 -=================== - - * AMD support - * Makefile: build now smaller thanks to browserify - * add browserify support - -0.7.10 / 2013-10-28 -=================== - - * fixed issue which prevented IE9 and under to pass Cookies to server during handshake - * package: update "ws" to v0.4.31 - * fixed - there is no host property only hostname - * fixed - flash socket creation - * fixed - emit errors thrown by xhr.send() - -0.7.9 / 2013-08-30 -================== - - * websocket: pass `undefined` as the WebSocket "protocols" - -0.7.8 / 2013-08-30 -================== - - * package: update "ws" - -0.7.7 / 2013-08-30 -================== - - * package: bump ws to 0.4.30 - * websocket: no more env sniffing, just require `ws` [TooTallNate] - * websocket: remove the "bufferedAmount" checking logic [TooTallNate] - -0.7.6 / 2013-08-30 -================== - - * package: revert ws to avoid upgrade fail now - -0.7.5 / 2013-08-30 -================== - - * package: bump ws to 0.4.30 - -0.7.4 / 2013-08-25 -================== - - * package: rolling back to `ws` `0.4.25` due to disconnection bug - -0.7.3 / 2013-08-23 -================== - - * noop bump - -0.7.2 / 2013-08-23 -================== - - * transports: fix WebSocket transport in the web browser (again) - -0.7.1 / 2013-08-23 -================== - - * transports: fix WebSocket transport in the web browser - * package: upgrade "ws" to v0.4.29 - -0.7.0 / 2013-08-23 -================== - - * socket: add `agent` option - * package: point "xmlhttprequest" to our LearnBoost fork for agent support - * package: specify a newer version of "ws" that includes `agent` support - * util: use "component/has-cors" - * transport: fix whitespace - * util: use "component/global" - * package: Add repository field to readme - * socket: Don't lose packets writen during upgrade after a re-open - * socket: use a consistent "debug" name for socket.js - * package: Update emitter dep to 1.0.1 for old IE support - -0.6.3 / 2013-06-21 -================== - - * fix check readyState in polling transport (Naoyuki Kanezawa) - * use http url in npm dependencies for emitter (Eric Schoffstall) - -0.6.2 / 2013-06-15 -================== - - * transports: improve polling orderly close (fixes #164) - * socket: ignore further transport communication upon `onClose` - * socket: added missing `socket#onerror` support - * socket: don't call `socket#onclose` if previous state was not `open` - * transports: fix iOS5 crash issue - * Makefile: extra precaution when building to avoid 0.6.0 build problem - -0.6.1 / 2013-06-06 -================== - - * engine.io: fixed build - -0.6.0 / 2013-05-31 -================== - - * does not emit close on incorrect socket connection - * use indexof component for ie8 and below - * improved x-domain handling - * introduce public `ping` api - * added drain event - * fix `flush` and `flushComplete` events - * fixed `drain` bug splicing with upgrading - * add support for callbacks with socket.send() - -0.5.0 / 2013-03-16 -================== - - * socket: implement qs support for `string` - * added query.EIO to take protocol version from parser - * use istanbul for code coverage - * integrated engine.io-protocol 0.3.0 - * updated ws - * fixed JSONPPolling iframe removal error - * changed error message to match xhr error message on jsonp transport script tag - * Added onerror handler for script tag in jsonp transport - * remove uid qs - * Added missing colon in payload. Thanks @lsm - -0.4.3 / 2013-02-08 -================== - - * package: removed unusued `parser.js` - -0.4.2 / 2013-02-08 -================== - - * polling-jsonp: fix ie6 JSONP on SSL - * close also if socket.readyState is on "opening" - * parser.js: removed the file package.json: added the engine.io-parser dependency everything else: switched to engine.io-parser - * fix "TypeError: Object # has no method 'global'" - * client now ignores unsupported upgrades - -0.4.1 / 2013-01-18 -================== - - * do not shadow global XMLHttpRequest - * socket: added `data` event (as synonym to `message`) - * socket: remove `resource` and fix `path` - * socket: fixed access to `opts` - * test: fixed transports tests - * socket: constructor can accept uri/opts simultaneously - * SPEC: simplified: removed resource from SPEC - * socket: proper `host`/`hostname` support - * socket: ensure `onclose` idempotency - * socket: added `onerror` instrumentation - * socket: fix style - * use window to detect platform and fix global reference - * *: fix references to `global` (fixes #79) - -0.4.0 / 2012-12-09 -================== - - * *: now based on `component(1)` - * *: module now exports `Socket` - * socket: export constructors, utils and `protocol` - * *: implemented `emitter` component - * *: removed browserbuild and preprocessor instructions - -0.3.10 / 2012-12-03 -=================== - - * socket: fix closing the socket in an `open` listener [mmastrac] - * socket: perform ping interval/timer cleanup [mmastrac] - * fix SPEC (packages -> packets) [jxck] - * socket: handle probe's transport errors [indutny] - -0.3.9 / 2012-10-23 -================== - - * socket: fix `hostname` instead of `host` - * socket: avoid duplicate `port` defaults - -0.3.8 / 2012-10-23 -================== - - * socket: introduce introspection hooks - * socket: introduced `host` and `port` `location` defaults - * flashsocket: obfuscate activex (fixes #31) - * README: documented reconnect (closes #45) - * socket: unset `id` upon close - * socket: clear transport listeners upon force close - -0.3.7 / 2012-10-21 -================== - - * fix `version` [quackingduck] - * ping timeout gets reset upon any packet received [indutny] - * timeout fixes [cadorn, indutny] - * transport: fix xdomain detection in absence of location.port (GH-38) - * socket: fix passing `false` as secure getting overridden - * socket: default `secure` to `true` for SSL-served pages - * socket: fix default port for SSL when `secure` is not supplied - -0.3.6 / 2012-10-16 -================== - - * socket: reset timeout on any incoming data [indutny] - -0.3.5 / 2012-10-14 -================== - - * new build - -0.3.4 / 2012-10-14 -================== - - * package: fix `component` exports - -0.3.3 / 2012-10-10 -================== - - * socket: fix `secure` default value discovery [quackingduck] - -0.3.2 / 2012-10-08 -================== - - * Bump - -0.3.1 / 2012-10-08 -================== - - * socket: added `write` alias for `send` - * package: added `component` - -0.3.0 / 2012-09-04 -================== - - * IE's XDomainRequest cannot do requests that go from HTTPS to HTTP or HTTP to HTTPS [mixu] - * Switch to client-initiated ping, and set interval in handshake [cadorn] - -0.2.2 / 2012-08-26 -================== - - * polling-jsonp: allow unneeded global leak (fixes #41) - * polling-jsonp: allow for multiple eio's in the same page - -0.2.1 / 2012-08-13 -================== - - * Bump - -0.2.0 / 2012-08-06 -================== - - * polling: introduced `poll` and `pollComplete` (formerly `poll`) events - -0.1.2 / 2012-08-02 -================== - - * Bump - -0.1.1 / 2012-08-01 -================== - - * Added options for request timestamping - * Made timestamp query param customizable - * Added automatic timestamping for Android - -0.1.0 / 2012-07-03 -================== - - * Initial release. diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/Makefile b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/Makefile deleted file mode 100644 index 203b4b5..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/Makefile +++ /dev/null @@ -1,37 +0,0 @@ - -REPORTER = dot - -build: engine.io.js - -engine.io.js: lib/*.js lib/transports/*.js package.json - @./support/browserify.sh > engine.io.js - -test: - @if [ "x$(BROWSER_NAME)" = "x" ]; then make test-node; else make test-zuul; fi - -test-node: - @./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - test/index.js - -test-zuul: - @if [ "x$(BROWSER_PLATFORM)" = "x" ]; then \ - ./node_modules/zuul/bin/zuul \ - --browser-name $(BROWSER_NAME) \ - --browser-version $(BROWSER_VERSION) \ - test/index.js; \ - else \ - ./node_modules/zuul/bin/zuul \ - --browser-name $(BROWSER_NAME) \ - --browser-version $(BROWSER_VERSION) \ - --browser-platform "$(BROWSER_PLATFORM)" \ - test/index.js; \ - fi - -test-cov: - @./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- \ - --require ./test/common \ - --reporter $(REPORTER) \ - $(TESTS) - -.PHONY: test build diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/README.md b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/README.md deleted file mode 100644 index e2b2caf..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/README.md +++ /dev/null @@ -1,243 +0,0 @@ - -# Engine.IO client - -[![Build Status](https://secure.travis-ci.org/Automattic/engine.io-client.png)](http://travis-ci.org/Automattic/engine.io-client) -[![NPM version](https://badge.fury.io/js/engine.io-client.png)](http://badge.fury.io/js/engine.io-client) - -This is the client for [Engine.IO](http://github.com/automattic/engine.io), -the implementation of transport-based cross-browser/cross-device -bi-directional communication layer for [Socket.IO](http://github.com/automattic/socket.io). - -## How to use - -### Standalone - -You can find an `engine.io.js` file in this repository, which is a -standalone build you can use as follows: - -```html - - -``` - -### With browserify - -Engine.IO is a commonjs module, which means you can include it by using -`require` on the browser and package using [browserify](http://browserify.org/): - -1. install the client package - - ```bash - $ npm install engine.io-client - ``` - -1. write your app code - - ```js - var socket = require('engine.io-client')('ws://localhost'); - socket.on('open', function(){ - socket.on('message', function(data){}); - socket.on('close', function(){}); - }); - ``` - -1. build your app bundle - - ```bash - $ browserify app.js > bundle.js - ``` - -1. include on your page - - ```html - - ``` - -### Sending and receiving binary - -```html - - -``` - -### Node.JS - -Add `engine.io-client` to your `package.json` and then: - -```js -var socket = require('engine.io-client')('ws://localhost'); -socket.on('open', function(){ - socket.on('message', function(data){}); - socket.on('close', function(){}); -}); -``` - -## Features - -- Lightweight -- Runs on browser and node.js seamlessly -- Transports are independent of `Engine` - - Easy to debug - - Easy to unit test -- Runs inside HTML5 WebWorker -- Can send and receive binary data - - Receives as ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer - in Node - - When XHR2 or WebSockets are used, binary is emitted directly. Otherwise - binary is encoded into base64 strings, and decoded when binary types are - supported. - - With browsers that don't support ArrayBuffer, an object { base64: true, - data: dataAsBase64String } is emitted on the `message` event. - -## API - -### Socket - -The client class. Mixes in [Emitter](http://github.com/component/emitter). -Exposed as `eio` in the browser standalone build. - -#### Properties - -- `protocol` _(Number)_: protocol revision number -- `binaryType` _(String)_ : can be set to 'arraybuffer' or 'blob' in browsers, - and `buffer` or `arraybuffer` in Node. Blob is only used in browser if it's - supported. - -#### Events - -- `open` - - Fired upon successful connection. -- `message` - - Fired when data is received from the server. - - **Arguments** - - `String` | `ArrayBuffer`: utf-8 encoded data or ArrayBuffer containing - binary data -- `close` - - Fired upon disconnection. In compliance with the WebSocket API spec, this event may be - fired even if the `open` event does not occur (i.e. due to connection error or `close()`). -- `error` - - Fired when an error occurs. -- `flush` - - Fired upon completing a buffer flush -- `drain` - - Fired after `drain` event of transport if writeBuffer is empty -- `upgradeError` - - Fired if an error occurs with a transport we're trying to upgrade to. -- `upgrade` - - Fired upon upgrade success, after the new transport is set - -#### Methods - -- **constructor** - - Initializes the client - - **Parameters** - - `String` uri - - `Object`: optional, options object - - **Options** - - `agent` (`http.Agent`): `http.Agent` to use, defaults to `false` (NodeJS only) - - `upgrade` (`Boolean`): defaults to true, whether the client should try - to upgrade the transport from long-polling to something better. - - `forceJSONP` (`Boolean`): forces JSONP for polling transport. - - `jsonp` (`Boolean`): determines whether to use JSONP when - necessary for polling. If disabled (by settings to false) an error will - be emitted (saying "No transports available") if no other transports - are available. If another transport is available for opening a - connection (e.g. WebSocket) that transport - will be used instead. - - `forceBase64` (`Boolean`): forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary. - - `enablesXDR` (`Boolean`): enables XDomainRequest for IE8 to avoid loading bar flashing with click sound. default to `false` because XDomainRequest has a flaw of not sending cookie. - - `timestampRequests` (`Boolean`): whether to add the timestamp with - each transport request. Note: this is ignored if the browser is - IE or Android, in which case requests are always stamped (`false`) - - `timestampParam` (`String`): timestamp parameter (`t`) - - `policyPort` (`Number`): port the policy server listens on (`843`) - - `path` (`String`): path to connect to, default is `/engine.io` - - `transports` (`Array`): a list of transports to try (in order). - Defaults to `['polling', 'websocket']`. `Engine` - always attempts to connect directly with the first one, provided the - feature detection test for it passes. - - `rememberUpgrade` (`Boolean`): defaults to false. - If true and if the previous websocket connection to the server succeeded, - the connection attempt will bypass the normal upgrade process and will initially - try websocket. A connection attempt following a transport error will use the - normal upgrade process. It is recommended you turn this on only when using - SSL/TLS connections, or if you know that your network does not block websockets. -- `send` - - Sends a message to the server - - **Parameters** - - `String` | `ArrayBuffer` | `ArrayBufferView` | `Blob`: data to send - - `Function`: optional, callback upon `drain` -- `close` - - Disconnects the client. - -### Transport - -The transport class. Private. _Inherits from EventEmitter_. - -#### Events - -- `poll`: emitted by polling transports upon starting a new request -- `pollComplete`: emitted by polling transports upon completing a request -- `drain`: emitted by polling transports upon a buffer drain - -## Tests - -`engine.io-client` is used to test -[engine](http://github.com/automattic/engine.io). Running the `engine.io` -test suite ensures the client works and vice-versa. - -Browser tests are run using [zuul](https://github.com/defunctzombie/zuul). You can -run the tests locally using the following command. - -``` -./node_modules/.bin/zuul --local 8080 -- test/index.js -``` - -Additionally, `engine.io-client` has a standalone test suite you can run -with `make test` which will run node.js and browser tests. You must have zuul setup with -a saucelabs account. - -## Support - -The support channels for `engine.io-client` are the same as `socket.io`: - - irc.freenode.net **#socket.io** - - [Google Groups](http://groups.google.com/group/socket_io) - - [Website](http://socket.io) - -## Development - -To contribute patches, run tests or benchmarks, make sure to clone the -repository: - -```bash -git clone git://github.com/automattic/engine.io-client.git -``` - -Then: - -```bash -cd engine.io-client -npm install -``` - -See the `Tests` section above for how to run tests before submitting any patches. - -## License - -MIT - Copyright (c) 2014 Automattic, Inc. - diff --git a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js b/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js deleted file mode 100644 index b6c9df2..0000000 --- a/node_modules/browser-sync/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/engine.io.js +++ /dev/null @@ -1,3872 +0,0 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.eio=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o